@insure-os/client 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-sizes.json +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=()=>{globalThis.insureOSDebug};var t,n,r,i,o,s,a,c,l,u,d,h,f,m={},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)&&!E.P++||o!=n.debounceRendering)&&((o=n.debounceRendering)||s)(E)}function E(){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),R(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,j(c,r,l),r.v!=s&&$(r)));E.P=0}function C(e,t,n,r,i,o,s,a,c,l,u){var d,h,f,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._=I(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)),W(a,a));return r}(n,t,S,c,$),d=0;d<$;d++)null!=(f=n.i[d])&&(h=-1==f._?m:S[f._]||m,f._=d,w=R(e,f,h,i,o,s,a,c,l,u),g=f.v,f.ref&&h.ref!=f.ref&&(h.ref&&L(h.ref,null,f),u.push(f.ref,f.k||g,f)),null==v&&null!=g&&(v=g),(b=!!(4&f.C))||h.i===f.i?c=T(f,c,e,b):"function"==typeof f.type&&void 0!==w?c=w:g&&(c=g.nextSibling),f.C&=-7);return n.v=v,c}function T(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=T(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 I(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 M(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 P(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||M(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||M(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 D(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 R(e,t,r,i,o,s,a,c,l,u){var d,h,f,m,p,g,b,x,N,$,_,E,T,I,M,P,D,R=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 R)try{if(x=t.props,N="prototype"in R&&R.prototype.render,$=(d=R.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 R(x,_):(t.k=h=new S(x,_),h.constructor=R,h.render=q),$&&$.sub(h),h.props=x,h.state||(h.state={}),h.context=_,h.O=i,f=h.I=!0,h.A=[],h.L=[]),N&&null==h.W&&(h.W=h.state),N&&null!=R.getDerivedStateFromProps&&(h.W==h.state&&(h.W=v({},h.W)),v(h.W,R.getDerivedStateFromProps(x,h.W))),m=h.props,p=h.state,h.N=t,f)N&&null==R.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),N&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(N&&null==R.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,_),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.W,_)||t.N==r.N){for(t.N!=r.N&&(h.props=x,h.state=h.W,h.I=!1),t.v=r.v,t.i=r.i,t.i.some(function(e){e&&(e.m=t)}),E=0;E<h.L.length;E++)h.A.push(h.L[E]);h.L=[],h.A.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.W,_),N&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=_,h.props=x,h.R=e,h.v=!1,T=n.P,I=0,N){for(h.state=h.W,h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),M=0;M<h.L.length;M++)h.A.push(h.L[M]);h.L=[]}else do{h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),h.state=h.W}while(h.I&&++I<25);h.state=h.W,null!=h.getChildContext&&(i=v(v({},i),h.getChildContext())),N&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),P=d,null!=d&&d.type===k&&null==d.key&&(P=z(d.props.children)),c=C(e,y(P)?P:[P],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(D=s.length;D--;)w(s[D]);O(t)}else t.v=r.v,t.i=r.i,e.then||O(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 O(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(O)}function j(e,t,r){for(var i=0;i<r.length;i++)L(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 z(e){return"object"!=typeof e||null==e||e.p&&e.p>0?e:y(e)?e.map(z):v({},e)}function A(e,r,i,o,s,a,c,l,u){var d,h,f,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||m,!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)f=g;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;P(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||P(e,d,g,x[d],s);if(h)l||f&&(h.H==f.H||h.H==e.innerHTML)||(e.innerHTML=h.H),r.i=[];else if(f&&(e.innerHTML=""),C("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])&&P(e,d,v,x[d],s),d="checked",null!=b&&b!=e[d]&&P(e,d,b,x[d],s))}return e}function L(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 W(e,t,r){var i,o;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||L(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&W(i[o],t,r||"function"!=typeof e.type);r||w(e.v),e.k=e.m=e.v=void 0}function q(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.W&&this.W!=this.state?this.W:this.W=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.N&&(t&&this.L.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},E.P=0,c=/(PointerCapture)$|Capture$/i,l=0,u=D(!1),d=D(!0),h=0,exports.ErrorType=void 0,(f=exports.ErrorType||(exports.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",f.API_ERROR="API_ERROR",f.VALIDATION_ERROR="VALIDATION_ERROR",f.STORAGE_ERROR="STORAGE_ERROR",f.TIMEOUT_ERROR="TIMEOUT_ERROR",f.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class 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 B{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 H{constructor(e){this.config=e,this.retryStrategy=new B(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(exports.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new F(exports.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}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"})}initiatePayment(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${t.code}/initiate`,method:"POST",body:e})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${t.code}/status/${e}`,method:"GET"})}createPaymentLink(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links`,method:"POST",body:e})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}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(exports.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);if(429===t.status)return new F(exports.ErrorType.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(exports.ErrorType.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(exports.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.error.details):new F(exports.ErrorType.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(exports.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,t.status)}if(400===t.status)try{const e=i;return e.errors?new F(exports.ErrorType.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.errors):new F(exports.ErrorType.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,t.status)}catch(e){return new F(exports.ErrorType.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(exports.ErrorType.API_ERROR,e,!1,t.status)}return new F(exports.ErrorType.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 fd}).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 U{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 Z{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class G{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}G.KEY_PREFIX="insure_os_",G.SEPARATOR="_";class Y{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||Y.DEFAULT_EXPIRATION_MS,namespace:t.namespace||Y.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(e),r=G.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=G.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return G.generateKey(this.config.namespace,e)}}Y.DEFAULT_EXPIRATION_MS=864e5,Y.DEFAULT_NAMESPACE="quote_intent";class J{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class V{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function Q(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)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);return 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}`})),r}function X(e,t){var n,r;const i=[];for(const r of e.fields){const e=r.code||r.id,o=t[e],s=Q(r,o);if(i.push(...s),"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===o||"true"===o)||"no"===r.boolean_config.show_details_on&&(!1===o||"false"===o))){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,t=i.find(t=>t.field===e);if(t)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)&&i.push({field:e,message:`${r.label} is required`})}}return{isValid:0===i.length,errors:i}}function K(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class ee{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:K(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 te{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 ne{constructor(e){this.httpClient=e}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function re(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 fd}).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 ie(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 ie(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:se(e),title:oe(e),message:n||t.message,retryable:ce(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:se(e),title:oe(e),message:n||l,retryable:ce(e,0),timestamp:a,trackingId:c}}function ie(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=ce(t,n);return{id:e,type:t,severity:s,statusCode:n,title:oe(t,n),message:i||ae(t,n,r),details:r,retryable:a,timestamp:o}}function oe(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Service Unavailable";if(t>=500)return"Server Error";if(t>=400)return"Validation Error"}switch(e){case"initialization":return"Initialization Error";case"calculation":return"Calculation Error";case"network":return"Network Error";case"validation":return"Validation Error";case"maintenance":return"Maintenance Mode";default:return"Unexpected Error"}}function se(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ae(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 ce(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 le(e){return"maintenance"===e.type||503===e.statusCode}function ue(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 de=null;function he(e){de=e}function fe(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 me(e){var t,n;if(!(null==de?void 0:de.isEnabled()))return;const r={...fe(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};de.push(r)}function pe(e,t,n,r){var i,o;if(!(null==de?void 0:de.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={...fe(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};de.push(c)}function ge(e,t){if(!(null==de?void 0:de.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={...fe(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};de.push(l)}function ye(e,t,n,r,i){if(!(null==de?void 0:de.isEnabled()))return;const o={...fe(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};de.push(o)}function ve(e,t){if(!(null==de?void 0:de.isEnabled()))return;const n=t.referrals||[],r={...fe(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};de.push(r)}function we(e,t,n,r){if(!(null==de?void 0:de.isEnabled()))return;const i={...fe(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};de.push(i)}function be(e,t,n,r,i,o){if(!(null==de?void 0:de.isEnabled()))return;const s={...fe(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};de.push(s)}function xe(e,t,n,r,i,o){if(!(null==de?void 0:de.isEnabled()))return;const s={...fe(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};de.push(s)}class ke{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 ee(t,i,n),this.autoSaveManager=new V(this.config,this.saveFormData.bind(this)),this.navigationManager=new te(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ne(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){this.autoSaveManager.startTyping(),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(e){this.isUserTyping()||(this.formData=e,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=re("validation",t);this.addGeneralError(e),this.notify()}}throw e}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(e){return this.navigationManager.canNavigateToPage(e)}navigateToPage(e){return this.navigationManager.navigateToPage(e)}async navigateToNextPage(){var e,t;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(t=null===(e=this.quoteIntent.form_definition)||void 0===e?void 0:e.pages[n-1])||void 0===t?void 0:t.title;pe(this.quoteIntent,n,r,i)}return n}navigateToPreviousPage(){return this.navigationManager.navigateToPrevious()}getPageCompletionStatus(){return this.navigationManager.getCompletionStatus()}getFormProgress(){return this.formData}getFormDefinition(){return this.quoteIntent.form_definition}getTotalPages(){return this.navigationManager.getTotalPages()}getCurrentPageIndex(){return this.formData.current_page}isAutoSavePaused(){return this.autoSaveManager.status.isPaused}isUserTyping(){return this.autoSaveManager.status.isUserTyping}getIsCalculating(){return this.isCalculating}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=X(t,this.formData.page_data[t.id]||{});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=Q(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 Ss});e.pages.forEach(e=>{const r=this.formData.page_data[e.id]||{},i={};e.fields.forEach(e=>{const t=e.code||e.id,o=r[t];let s=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});s="show"===e.visibility.action?t.matched:!t.matched}s&&void 0!==o&&(i[t]=o)}),t.page_data[e.id]=i});const r=this.processRatingFactorMappings(t),i={...t,page_data:{...t.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){e();const t=this.getFormDefinition(),n=[];for(const r of t.pages){const t=X(r,this.formData.page_data[r.id]||{});e(r.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?ge(this.quoteIntent,e):"referral"===e.outcome_type&&ve(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()}}notify(){this.subscribers.forEach(e=>e(this))}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&&we(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 Se{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 Ne{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Se(this.httpClient,n)}}var $e=0;function _e(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:--$e,_:-1,C:0,V:o,X: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 Ee,Ce,Te,Ie,Me=0,Pe=[],De=n,Re=De.p,Oe=De.P,je=De.diffed,ze=De.k,Ae=De.unmount,Le=De.m;function We(e,t){De.A&&De.A(Ce,e,Me||t),Me=0;var n=Ce.K||(Ce.K={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function qe(e){return Me=1,function(e,t){var n=We(Ee++,2);if(n.t=e,!n.k&&(n.m=[Qe(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=Ce,!Ce.te)){var r=function(e,t,r){if(!n.k.K)return!0;var o=n.k.K.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};Ce.te=!0;var i=Ce.shouldComponentUpdate,o=Ce.componentWillUpdate;Ce.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)},Ce.shouldComponentUpdate=r}return n.ee||n.m}(Qe,e)}function Fe(e,t){var n=We(Ee++,3);!De.W&&Ve(n.K,t)&&(n.m=e,n.u=t,Ce.K.A.push(n))}function Be(e){return Me=5,He(function(){return{current:e}},[])}function He(e,t){var n=We(Ee++,7);return Ve(n.K,t)&&(n.m=e(),n.K=t,n.A=e),n.m}function Ue(){for(var e;e=Pe.shift();)if(e.R&&e.K)try{e.K.A.forEach(Ye),e.K.A.forEach(Je),e.K.A=[]}catch(t){e.K.A=[],De.v(t,e.N)}}De.p=function(e){Ce=null,Re&&Re(e)},De.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Le&&Le(e,t)},De.P=function(e){Oe&&Oe(e),Ee=0;var t=(Ce=e.k).K;t&&(Te===Ce?(t.A=[],Ce.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(Ye),t.A.forEach(Je),t.A=[],Ee=0)),Te=Ce},De.diffed=function(e){je&&je(e);var t=e.k;t&&t.K&&(t.K.A.length&&(1!==Pe.push(t)&&Ie===De.requestAnimationFrame||((Ie=De.requestAnimationFrame)||Ge)(Ue)),t.K.m.forEach(function(e){e.u&&(e.K=e.u),e.u=void 0})),Te=Ce=null},De.k=function(e,t){t.some(function(e){try{e.A.forEach(Ye),e.A=e.A.filter(function(e){return!e.m||Je(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],De.v(n,e.N)}}),ze&&ze(e,t)},De.unmount=function(e){Ae&&Ae(e);var t,n=e.k;n&&n.K&&(n.K.m.forEach(function(e){try{Ye(e)}catch(e){t=e}}),n.K=void 0,t&&De.v(t,n.N))};var Ze="function"==typeof requestAnimationFrame;function Ge(e){var t,n=function(){clearTimeout(r),Ze&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ze&&(t=requestAnimationFrame(n))}function Ye(e){var t=Ce,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ce=t}function Je(e){var t=Ce;e.k=e.m(),Ce=t}function Ve(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Qe(e,t){return"function"==typeof t?t(e):t}const Xe="insure-os";let Ke=!1;const et=new Map,tt={[`--${Xe}-radius`]:"0.75rem",[`--${Xe}-radius-sm`]:"0.5rem",[`--${Xe}-radius-lg`]:"1rem",[`--${Xe}-background`]:"oklch(0.955 0 0)",[`--${Xe}-foreground`]:"oklch(0.145 0 0)",[`--${Xe}-card`]:"oklch(1 0 0)",[`--${Xe}-card-foreground`]:"oklch(0.145 0 0)",[`--${Xe}-popover`]:"oklch(1 0 0)",[`--${Xe}-popover-foreground`]:"oklch(0.145 0 0)",[`--${Xe}-primary`]:"oklch(0.205 0 0)",[`--${Xe}-primary-foreground`]:"oklch(0.985 0 0)",[`--${Xe}-secondary`]:"oklch(0.97 0 0)",[`--${Xe}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${Xe}-muted`]:"oklch(0.97 0 0)",[`--${Xe}-muted-foreground`]:"oklch(0.556 0 0)",[`--${Xe}-accent`]:"oklch(0.97 0 0)",[`--${Xe}-accent-foreground`]:"oklch(0.205 0 0)",[`--${Xe}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${Xe}-border`]:"oklch(0.9 0 0)",[`--${Xe}-input`]:"oklch(0.9 0 0)",[`--${Xe}-ring`]:"oklch(0.708 0 0)",[`--${Xe}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${Xe}-font-size-large`]:"18px",[`--${Xe}-font-size-small`]:"14px",[`--${Xe}-font-size`]:"16px",[`--${Xe}-border-width`]:"1px",[`--${Xe}-transition-duration`]:"200ms",[`--${Xe}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${Xe}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${Xe}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${Xe}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${Xe}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${Xe}-spacing-sm`]:"0.75rem",[`--${Xe}-spacing`]:"1rem",[`--${Xe}-spacing-md`]:"1.5rem",[`--${Xe}-spacing-lg`]:"2rem",[`--${Xe}-spacing-xl`]:"3rem"},nt={colors:{background:`var(--${Xe}-background)`,foreground:`var(--${Xe}-foreground)`,card:`var(--${Xe}-card)`,popover:`var(--${Xe}-popover)`,popoverForeground:`var(--${Xe}-popover-foreground)`,primary:`var(--${Xe}-primary)`,primaryForeground:`var(--${Xe}-primary-foreground)`,secondary:`var(--${Xe}-secondary)`,muted:`var(--${Xe}-muted)`,mutedForeground:`var(--${Xe}-muted-foreground)`,accent:`var(--${Xe}-accent)`,accentForeground:`var(--${Xe}-accent-foreground)`,destructive:`var(--${Xe}-destructive)`,border:`var(--${Xe}-border)`,input:`var(--${Xe}-input)`,ring:`var(--${Xe}-ring)`},fontSize:{small:`var(--${Xe}-font-size-small)`,default:`var(--${Xe}-font-size)`,large:`var(--${Xe}-font-size-large)`},radius:{small:`var(--${Xe}-radius-sm)`,default:`var(--${Xe}-radius)`,large:`var(--${Xe}-radius-lg)`},shadow:{sm:`var(--${Xe}-shadow-sm)`,md:`var(--${Xe}-shadow-md)`},spacing:{sm:`var(--${Xe}-spacing-sm)`,md:`var(--${Xe}-spacing-md)`,lg:`var(--${Xe}-spacing-lg)`,xl:`var(--${Xe}-spacing-xl)`},fontFamily:`var(--${Xe}-font-family)`,borderWidth:`var(--${Xe}-border-width)`,transition:`var(--${Xe}-transition-duration) var(--${Xe}-transition-timing-function)`},rt=new Set;function it(e){if(!document.getElementById(`${Xe}-styles`)){const e=document.createElement("style");e.id=`${Xe}-styles`,document.head.appendChild(e)}document.getElementById(`${Xe}-styles`).textContent+=e+"\n"}function ot(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 st(){Ke||(it(`:root {\n${Object.entries(tt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),Ke=!0)}const at={name:e=>`${Xe}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){st();const r=ot(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=et.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return rt.has(a)||(it(`.${c} { ${r} }`),rt.add(a)),et.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${Xe}-${e}`;return rt.has(`keyframes-${e}`)||(it(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${ot(t)} }`).join("\n")}\n}`),rt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;it(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${Xe}-${e} { ${ot(t)} }`).join("\n")}\n}`),rt.add(n)},pseudoElement(e,t,n){const r=`${Xe}-${e}`,i=`${e}-${t}`;return rt.has(i)||(it(`.${r}${t} { ${ot(n)} }`),rt.add(i)),r}};var ct=Object.freeze({__proto__:null,baseVariables:tt,styles:at,theme:nt,updateBaseVariables:function(t){e(),Object.assign(tt,t);const n=document.getElementById(`${Xe}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(tt).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 st()}});function lt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var ut,dt={exports:{}};function ht(){return ut||(ut=1,e=dt,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}()),dt.exports;var e}var ft=lt(ht());function mt({size:e="small"}){const t=at.create("spinner-small",{width:"16px",height:"16px"}),n=at.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return at.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),_e("div",{className:at.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:_e("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:ft(r),children:_e("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function pt({className:e,children:t,size:n="md"}){const r={sm:nt.spacing.sm,md:nt.spacing.md,lg:nt.spacing.lg,xl:nt.spacing.xl},i=at.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?nt.spacing.lg:"lg"===n?nt.spacing.md:r[n]},"(max-width: 480px)":{padding:nt.spacing.sm}});return _e("div",{className:ft(i,e),children:t})}const gt=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 yt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o}){return _e(gt.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function vt(){const e=function(e){var t=Ce.context[e.k],n=We(Ee++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ce)),t.props.value):e.m}(gt);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function wt(e){const t=vt(),{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]=qe(()=>e(n));return Fe(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class bt extends Error{}class xt extends bt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class kt extends bt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class St extends bt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Nt extends bt{}class $t extends bt{constructor(e){super(`Invalid unit ${e}`)}}class _t extends bt{}class Et extends bt{constructor(){super("Zone is an abstract class")}}const Ct="numeric",Tt="short",It="long",Mt={year:Ct,month:Ct,day:Ct},Pt={year:Ct,month:Tt,day:Ct},Dt={year:Ct,month:Tt,day:Ct,weekday:Tt},Rt={year:Ct,month:It,day:Ct},Ot={year:Ct,month:It,day:Ct,weekday:It},jt={hour:Ct,minute:Ct},zt={hour:Ct,minute:Ct,second:Ct},At={hour:Ct,minute:Ct,second:Ct,timeZoneName:Tt},Lt={hour:Ct,minute:Ct,second:Ct,timeZoneName:It},Wt={hour:Ct,minute:Ct,hourCycle:"h23"},qt={hour:Ct,minute:Ct,second:Ct,hourCycle:"h23"},Ft={hour:Ct,minute:Ct,second:Ct,hourCycle:"h23",timeZoneName:Tt},Bt={hour:Ct,minute:Ct,second:Ct,hourCycle:"h23",timeZoneName:It},Ht={year:Ct,month:Ct,day:Ct,hour:Ct,minute:Ct},Ut={year:Ct,month:Ct,day:Ct,hour:Ct,minute:Ct,second:Ct},Zt={year:Ct,month:Tt,day:Ct,hour:Ct,minute:Ct},Gt={year:Ct,month:Tt,day:Ct,hour:Ct,minute:Ct,second:Ct},Yt={year:Ct,month:Tt,day:Ct,weekday:Tt,hour:Ct,minute:Ct},Jt={year:Ct,month:It,day:Ct,hour:Ct,minute:Ct,timeZoneName:Tt},Vt={year:Ct,month:It,day:Ct,hour:Ct,minute:Ct,second:Ct,timeZoneName:Tt},Qt={year:Ct,month:It,day:Ct,weekday:It,hour:Ct,minute:Ct,timeZoneName:It},Xt={year:Ct,month:It,day:Ct,weekday:It,hour:Ct,minute:Ct,second:Ct,timeZoneName:It};class Kt{get type(){throw new Et}get name(){throw new Et}get ianaName(){return this.name}get isUniversal(){throw new Et}offsetName(e,t){throw new Et}formatOffset(e,t){throw new Et}offset(e){throw new Et}equals(e){throw new Et}get isValid(){throw new Et}}let en=null;class tn extends Kt{static get instance(){return null===en&&(en=new tn),en}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return kr(e,t,n)}formatOffset(e,t){return _r(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const nn=new Map,rn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},on=new Map;class sn extends Kt{static create(e){let t=on.get(e);return void 0===t&&on.set(e,t=new sn(e)),t}static resetCache(){on.clear(),nn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=sn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return kr(e,t,n,this.name)}formatOffset(e,t){return _r(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=function(e){let t=nn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),nn.set(e,t)),t}(this.name);let[r,i,o,s,a,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=rn[t];"era"===t?r[o]=i:tr(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,(vr({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 an={};const cn=new Map;function ln(e,t={}){const n=JSON.stringify([e,t]);let r=cn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),cn.set(n,r)),r}const un=new Map,dn=new Map;let hn=null;const fn=new Map;function mn(e){let t=fn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),fn.set(e,t)),t}const pn=new Map;function gn(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class yn{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=un.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),un.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 ur(this.floor?Math.floor(e):mr(e,3),this.padTo)}}class vn{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&&sn.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=ln(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class wn{constructor(e,t,n){this.opts={style:"long",...n},!t&&ir()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=dn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),dn.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 bn={firstDay:1,minimalDays:4,weekend:[6,7]};class xn{static fromOpts(e){return xn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||Ln.defaultLocale,s=o||(i?"en-US":hn||(hn=(new Intl.DateTimeFormat).resolvedOptions().locale,hn)),a=t||Ln.defaultNumberingSystem,c=n||Ln.defaultOutputCalendar,l=cr(r)||Ln.defaultWeekSettings;return new xn(s,a,c,l,o)}static resetCache(){hn=null,cn.clear(),un.clear(),dn.clear(),fn.clear(),pn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return xn.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=ln(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=ln(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"===mn(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?xn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,cr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return gn(this,e,Mr,()=>{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=Ro.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return gn(this,e,Or,()=>{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=Ro.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return gn(this,void 0,()=>jr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ro.utc(2016,11,13,9),Ro.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return gn(this,e,Wr,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ro.utc(-40,1,1),Ro.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 yn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new vn(e,this.intl,t)}relFormatter(e={}){return new wn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=an[n];return r||(r=new Intl.ListFormat(e,t),an[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||mn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:or()?function(e){let t=pn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...bn,...t}),pn.set(e,t)}return t}(this.locale):bn}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 kn=null;class Sn extends Kt{static get utcInstance(){return null===kn&&(kn=new Sn(0)),kn}static instance(e){return 0===e?Sn.utcInstance:new Sn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Sn(Sr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${_r(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${_r(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return _r(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 Nn extends Kt{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 $n(e,t){if(tr(e)||null===e)return t;if(e instanceof Kt)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?tn.instance:"utc"===n||"gmt"===n?Sn.utcInstance:Sn.parseSpecifier(n)||sn.create(e)}return nr(e)?Sn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Nn(e)}const _n={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},En={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]},Cn=_n.hanidec.replace(/[\[|\]]/g,"").split(""),Tn=new Map;function In({numberingSystem:e},t=""){const n=e||"latn";let r=Tn.get(n);void 0===r&&(r=new Map,Tn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${_n[n]}${t}`),r.set(t,i)),i}let Mn,Pn=()=>Date.now(),Dn="system",Rn=null,On=null,jn=null,zn=60,An=null;class Ln{static get now(){return Pn}static set now(e){Pn=e}static set defaultZone(e){Dn=e}static get defaultZone(){return $n(Dn,tn.instance)}static get defaultLocale(){return Rn}static set defaultLocale(e){Rn=e}static get defaultNumberingSystem(){return On}static set defaultNumberingSystem(e){On=e}static get defaultOutputCalendar(){return jn}static set defaultOutputCalendar(e){jn=e}static get defaultWeekSettings(){return An}static set defaultWeekSettings(e){An=cr(e)}static get twoDigitCutoffYear(){return zn}static set twoDigitCutoffYear(e){zn=e%100}static get throwOnInvalid(){return Mn}static set throwOnInvalid(e){Mn=e}static resetCaches(){xn.resetCache(),sn.resetCache(),Ro.resetCache(),Tn.clear()}}class Wn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const qn=[0,31,59,90,120,151,181,212,243,273,304,334],Fn=[0,31,60,91,121,152,182,213,244,274,305,335];function Bn(e,t){return new Wn("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Hn(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 Un(e,t,n){return n+(pr(e)?Fn:qn)[t-1]}function Zn(e,t){const n=pr(e)?Fn:qn,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function Gn(e,t){return(e-t+7)%7+1}function Yn(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=Un(r,i,o),a=Gn(Hn(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=br(c,t,n)):l>br(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Er(e)}}function Jn(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=Gn(Hn(r,1,t),n),a=gr(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=gr(c)):l>a?(c=r+1,l-=gr(r)):c=r;const{month:u,day:d}=Zn(c,l);return{year:c,month:u,day:d,...Er(e)}}function Vn(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:Un(t,n,r),...Er(e)}}function Qn(e){const{year:t,ordinal:n}=e,{month:r,day:i}=Zn(t,n);return{year:t,month:r,day:i,...Er(e)}}function Xn(e,t){if(!tr(e.localWeekday)||!tr(e.localWeekNumber)||!tr(e.localWeekYear)){if(!tr(e.weekday)||!tr(e.weekNumber)||!tr(e.weekYear))throw new Nt("Cannot mix locale-based week fields with ISO-based week fields");return tr(e.localWeekday)||(e.weekday=e.localWeekday),tr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),tr(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 Kn(e){const t=rr(e.year),n=lr(e.month,1,12),r=lr(e.day,1,yr(e.year,e.month));return t?n?!r&&Bn("day",e.day):Bn("month",e.month):Bn("year",e.year)}function er(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=lr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=lr(n,0,59),a=lr(r,0,59),c=lr(i,0,999);return o?s?a?!c&&Bn("millisecond",i):Bn("second",r):Bn("minute",n):Bn("hour",t)}function tr(e){return void 0===e}function nr(e){return"number"==typeof e}function rr(e){return"number"==typeof e&&e%1==0}function ir(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function or(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function sr(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 ar(e,t){return{}.hasOwnProperty.call(e,t)}function cr(e){if(null==e)return null;if("object"!=typeof e)throw new _t("Week settings must be an object");if(!lr(e.firstDay,1,7)||!lr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!lr(e,1,7)))throw new _t("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function lr(e,t,n){return rr(e)&&e>=t&&e<=n}function ur(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function dr(e){return tr(e)||null===e||""===e?void 0:parseInt(e,10)}function hr(e){return tr(e)||null===e||""===e?void 0:parseFloat(e)}function fr(e){if(!tr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function mr(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 pr(e){return e%4==0&&(e%100!=0||e%400==0)}function gr(e){return pr(e)?366:365}function yr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?pr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function vr(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function wr(e,t,n){return-Gn(Hn(e,1,t),n)+t-1}function br(e,t=4,n=1){const r=wr(e,t,n),i=wr(e+1,t,n);return(gr(e)-r+i)/7}function xr(e){return e>99?e:e>Ln.twoDigitCutoffYear?1900+e:2e3+e}function kr(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 Sr(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 Nr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new _t(`Invalid unit value ${e}`);return t}function $r(e,t){const n={};for(const r in e)if(ar(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Nr(i)}return n}function _r(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}${ur(n,2)}:${ur(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${ur(n,2)}${ur(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Er(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Cr=["January","February","March","April","May","June","July","August","September","October","November","December"],Tr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ir=["J","F","M","A","M","J","J","A","S","O","N","D"];function Mr(e){switch(e){case"narrow":return[...Ir];case"short":return[...Tr];case"long":return[...Cr];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 Pr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Dr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Rr=["M","T","W","T","F","S","S"];function Or(e){switch(e){case"narrow":return[...Rr];case"short":return[...Dr];case"long":return[...Pr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const jr=["AM","PM"],zr=["Before Christ","Anno Domini"],Ar=["BC","AD"],Lr=["B","A"];function Wr(e){switch(e){case"narrow":return[...Lr];case"short":return[...Ar];case"long":return[...zr];default:return null}}function qr(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Fr={D:Mt,DD:Pt,DDD:Rt,DDDD:Ot,t:jt,tt:zt,ttt:At,tttt:Lt,T:Wt,TT:qt,TTT:Ft,TTTT:Bt,f:Ht,ff:Zt,fff:Jt,ffff:Qt,F:Ut,FF:Gt,FFF:Vt,FFFF:Xt};class Br{static create(e,t={}){return new Br(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 Fr[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 ur(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 Mr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Or(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=Br.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return Wr(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return qr(Br.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 jr[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=Br.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 qr(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 Hr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ur(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function Zr(...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 Gr(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 Yr(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=dr(t[n+i]);return[r,null,n+i]}}const Jr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Vr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Qr=RegExp(`${Vr.source}(?:${Jr.source}?(?:\\[(${Hr.source})\\])?)?`),Xr=RegExp(`(?:[Tt]${Qr.source})?`),Kr=Yr("weekYear","weekNumber","weekDay"),ei=Yr("year","ordinal"),ti=RegExp(`${Vr.source} ?(?:${Jr.source}|(${Hr.source}))?`),ni=RegExp(`(?: ${ti.source})?`);function ri(e,t,n){const r=e[t];return tr(r)?n:dr(r)}function ii(e,t){return[{hours:ri(e,t,0),minutes:ri(e,t+1,0),seconds:ri(e,t+2,0),milliseconds:fr(e[t+3])},null,t+4]}function oi(e,t){const n=!e[t]&&!e[t+1],r=Sr(e[t+1],e[t+2]);return[{},n?null:Sn.instance(r),t+3]}function si(e,t){return[{},e[t]?sn.create(e[t]):null,t+1]}const ai=RegExp(`^T?${Vr.source}$`),ci=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function li(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(hr(n)),months:h(hr(r)),weeks:h(hr(i)),days:h(hr(o)),hours:h(hr(s)),minutes:h(hr(a)),seconds:h(hr(c),"-0"===c),milliseconds:h(fr(l),d)}]}const ui={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function di(e,t,n,r,i,o,s){const a={year:2===t.length?xr(dr(t)):dr(t),month:Tr.indexOf(n)+1,day:dr(r),hour:dr(i),minute:dr(o)};return s&&(a.second=dr(s)),e&&(a.weekday=e.length>3?Pr.indexOf(e)+1:Dr.indexOf(e)+1),a}const hi=/^(?:(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 fi(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=di(t,i,r,n,o,s,a);let f;return f=c?ui[c]:l?0:Sr(u,d),[h,new Sn(f)]}const mi=/^(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$/,pi=/^(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$/,gi=/^(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 yi(e){const[,t,n,r,i,o,s,a]=e;return[di(t,i,r,n,o,s,a),Sn.utcInstance]}function vi(e){const[,t,n,r,i,o,s,a]=e;return[di(t,a,n,r,i,o,s),Sn.utcInstance]}const wi=Ur(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xr),bi=Ur(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Xr),xi=Ur(/(\d{4})-?(\d{3})/,Xr),ki=Ur(Qr),Si=Zr(function(e,t){return[{year:ri(e,t),month:ri(e,t+1,1),day:ri(e,t+2,1)},null,t+3]},ii,oi,si),Ni=Zr(Kr,ii,oi,si),$i=Zr(ei,ii,oi,si),_i=Zr(ii,oi,si),Ei=Zr(ii),Ci=Ur(/(\d{4})-(\d\d)-(\d\d)/,ni),Ti=Ur(ti),Ii=Zr(ii,oi,si),Mi="Invalid Duration",Pi={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}},Di={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},...Pi},Ri={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},...Pi},Oi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ji=Oi.slice(0).reverse();function zi(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 qi(r)}function Ai(e,t){let n=t.milliseconds??0;for(const r of ji.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Li(e,t){const n=Ai(e,t)<0?-1:1;Oi.reduceRight((r,i)=>{if(tr(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),Oi.reduce((n,r)=>{if(tr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Wi(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class qi{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Ri:Di;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||xn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return qi.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new _t("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new qi({values:$r(e,qi.normalizeUnit),loc:xn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(nr(e))return qi.fromMillis(e);if(qi.isDuration(e))return e;if("object"==typeof e)return qi.fromObject(e);throw new _t(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return Gr(e,[ci,li])}(e);return n?qi.fromObject(n,t):qi.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return Gr(e,[ai,Ei])}(e);return n?qi.fromObject(n,t):qi.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new _t("need to specify a reason the Duration is invalid");const n=e instanceof Wn?e:new Wn(e,t);if(Ln.throwOnInvalid)throw new St(n);return new qi({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 $t(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?Br.create(this.loc,n).formatDurationFromString(this,e):Mi}toHuman(e={}){if(!this.isValid)return Mi;const t=!1!==e.showZeros,n=Oi.map(n=>{const r=this.values[n];return tr(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+=mr(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},Ro.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?Ai(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=qi.fromDurationLike(e),n={};for(const e of Oi)(ar(t.values,e)||ar(this.values,e))&&(n[e]=t.get(e)+this.get(e));return zi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=qi.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]=Nr(e(this.values[n],n));return zi(this,{values:t},!0)}get(e){return this[qi.normalizeUnit(e)]}set(e){return this.isValid?zi(this,{values:{...this.values,...$r(e,qi.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return zi(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 Li(this.matrix,e),zi(this,{values:e},!0)}rescale(){return this.isValid?zi(this,{values:Wi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>qi.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Oi)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;nr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else nr(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 Li(this.matrix,t),zi(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 zi(this,{values:e},!0)}removeZeros(){return this.isValid?zi(this,{values:Wi(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 Oi)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Fi="Invalid Interval";class Bi{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 _t("need to specify a reason the Interval is invalid");const n=e instanceof Wn?e:new Wn(e,t);if(Ln.throwOnInvalid)throw new kt(n);return new Bi({invalid:n})}static fromDateTimes(e,t){const n=Oo(e),r=Oo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?Bi.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:Bi.invalid("missing or invalid end"):Bi.invalid("missing or invalid start")}(n,r);return null==i?new Bi({start:n,end:r}):i}static after(e,t){const n=qi.fromDurationLike(t),r=Oo(e);return Bi.fromDateTimes(r,r.plus(n))}static before(e,t){const n=qi.fromDurationLike(t),r=Oo(e);return Bi.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=Ro.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Ro.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return Bi.fromDateTimes(e,o);if(i){const n=qi.fromISO(r,t);if(n.isValid)return Bi.after(e,n)}else if(s){const e=qi.fromISO(n,t);if(e.isValid)return Bi.before(o,e)}}return Bi.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?Bi.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Oo).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(Bi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=qi.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(Bi.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:Bi.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 Bi.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(Bi.fromDateTimes(t,e.time)),t=null);return Bi.merge(r)}difference(...e){return Bi.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Fi}[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=Mt,t={}){return this.isValid?Br.create(this.s.loc.clone(t),e).formatInterval(this):Fi}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Fi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Fi}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Fi}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Fi}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):qi.invalid(this.invalidReason)}mapEndpoints(e){return Bi.fromDateTimes(e(this.s),e(this.e))}}class Hi{static hasDST(e=Ln.defaultZone){const t=Ro.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return sn.isValidZone(e)}static normalizeZone(e){return $n(e,Ln.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||xn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||xn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||xn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return xn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return xn.create(t,null,"gregory").eras(e)}static features(){return{relative:ir(),localeWeek:or()}}}function Ui(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(qi.fromMillis(r).as("days"))}function Zi(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(_n.hanidec))t+=Cn.indexOf(e[n]);else for(const e in En){const[n,i]=En[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const Gi=`[ ${String.fromCharCode(160)}]`,Yi=new RegExp(Gi,"g");function Ji(e){return e.replace(/\./g,"\\.?").replace(Yi,Gi)}function Vi(e){return e.replace(/\./g,"").replace(Yi," ").toLowerCase()}function Qi(e,t){return null===e?null:{regex:RegExp(e.map(Ji).join("|")),deser:([n])=>e.findIndex(e=>Vi(n)===Vi(e))+t}}function Xi(e,t){return{regex:e,deser:([,e,t])=>Sr(e,t),groups:t}}function Ki(e){return{regex:e,deser:([e])=>e}}const eo={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 to=null;function no(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=oo(Br.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class ro{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=no(Br.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=In(t),r=In(t,"{2}"),i=In(t,"{3}"),o=In(t,"{4}"),s=In(t,"{6}"),a=In(t,"{1,2}"),c=In(t,"{1,3}"),l=In(t,"{1,6}"),u=In(t,"{1,9}"),d=In(t,"{2,4}"),h=In(t,"{4,6}"),f=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return f(m);switch(m.val){case"G":return Qi(t.eras("short"),0);case"GG":return Qi(t.eras("long"),0);case"y":return Zi(l);case"yy":case"kk":return Zi(d,xr);case"yyyy":case"kkkk":return Zi(o);case"yyyyy":return Zi(h);case"yyyyyy":return Zi(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Zi(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Zi(r);case"MMM":return Qi(t.months("short",!0),1);case"MMMM":return Qi(t.months("long",!0),1);case"LLL":return Qi(t.months("short",!1),1);case"LLLL":return Qi(t.months("long",!1),1);case"o":case"S":return Zi(c);case"ooo":case"SSS":return Zi(i);case"u":return Ki(u);case"uu":return Ki(a);case"uuu":case"E":case"c":return Zi(n);case"a":return Qi(t.meridiems(),0);case"EEE":return Qi(t.weekdays("short",!1),1);case"EEEE":return Qi(t.weekdays("long",!1),1);case"ccc":return Qi(t.weekdays("short",!0),1);case"cccc":return Qi(t.weekdays("long",!0),1);case"Z":case"ZZ":return Xi(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Xi(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Ki(/[a-z_+-/]{1,256}?/i);case" ":return Ki(/[^\S\n\r]/);default:return f(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(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(ar(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;tr(e.z)||(n=sn.create(e.z)),tr(e.Z)||(n||(n=new Sn(e.Z)),t=e.Z),tr(e.q)||(e.M=3*(e.q-1)+1),tr(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),tr(e.u)||(e.S=fr(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(ar(n,"a")&&ar(n,"H"))throw new Nt("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 io(e,t,n){return new ro(e,n).explainFromTokens(t)}function oo(e,t){if(!e)return null;const n=Br.create(t,e).dtFormatter((to||(to=Ro.fromMillis(1555555555555)),to)),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=eo[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const so="Invalid DateTime",ao=864e13;function co(e){return new Wn("unsupported zone",`the zone "${e.name}" is not supported`)}function lo(e){return null===e.weekData&&(e.weekData=Yn(e.c)),e.weekData}function uo(e){return null===e.localWeekData&&(e.localWeekData=Yn(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function ho(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Ro({...n,...t,old:n})}function fo(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 mo(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 po(e,t,n){return fo(vr(e),t,n)}function go(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,yr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=qi.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=vr(o);let[c,l]=fo(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function yo(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=Ro.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Ro.invalid(new Wn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function vo(e,t,n=!0){return e.isValid?Br.create(xn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function wo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=ur(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=ur(e.c.month),"month"===n)return i;i+="-"}else if(i+=ur(e.c.month),"month"===n)return i;return i+=ur(e.c.day),i}function bo(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+=ur(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=ur(e.c.minute),"minute"===s)break;a&&(c+=":",c+=ur(e.c.second))}else{if(c+=ur(e.c.minute),"minute"===s)break;a&&(c+=ur(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=ur(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=ur(Math.trunc(-e.o/60)),c+=":",c+=ur(Math.trunc(-e.o%60))):(c+="+",c+=ur(Math.trunc(e.o/60)),c+=":",c+=ur(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const xo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ko={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},So={ordinal:1,hour:0,minute:0,second:0,millisecond:0},No=["year","month","day","hour","minute","second","millisecond"],$o=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],_o=["year","ordinal","hour","minute","second","millisecond"];function Eo(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 $t(e);return t}function Co(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Eo(e)}}function To(e,t){const n=$n(t.zone,Ln.defaultZone);if(!n.isValid)return Ro.invalid(co(n));const r=xn.fromObject(t);let i,o;if(tr(e.year))i=Ln.now();else{for(const t of No)tr(e[t])&&(e[t]=xo[t]);const t=Kn(e)||er(e);if(t)return Ro.invalid(t);const r=function(e){if(void 0===Po&&(Po=Ln.now()),"iana"!==e.type)return e.offset(Po);const t=e.name;let n=Do.get(t);return void 0===n&&(n=e.offset(Po),Do.set(t,n)),n}(n);[i,o]=po(e,r,n)}return new Ro({ts:i,zone:n,loc:r,o:o})}function Io(e,t,n){const r=!!tr(n.round)||n.round,i=tr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=mr(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 Mo(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 Po;const Do=new Map;class Ro{constructor(e){const t=e.zone||Ln.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Wn("invalid input"):null)||(t.isValid?null:co(t));this.ts=tr(e.ts)?Ln.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=nr(e.o)&&!e.old?e.o:t.offset(this.ts);r=mo(this.ts,o),n=Number.isNaN(r.year)?new Wn("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||xn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Ro({})}static local(){const[e,t]=Mo(arguments),[n,r,i,o,s,a,c]=t;return To({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Mo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=Sn.utcInstance,To({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 Ro.invalid("invalid input");const r=$n(t.zone,Ln.defaultZone);return r.isValid?new Ro({ts:n,zone:r,loc:xn.fromObject(t)}):Ro.invalid(co(r))}static fromMillis(e,t={}){if(nr(e))return e<-ao||e>ao?Ro.invalid("Timestamp out of range"):new Ro({ts:e,zone:$n(t.zone,Ln.defaultZone),loc:xn.fromObject(t)});throw new _t(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(nr(e))return new Ro({ts:1e3*e,zone:$n(t.zone,Ln.defaultZone),loc:xn.fromObject(t)});throw new _t("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=$n(t.zone,Ln.defaultZone);if(!n.isValid)return Ro.invalid(co(n));const r=xn.fromObject(t),i=$r(e,Co),{minDaysInFirstWeek:o,startOfWeek:s}=Xn(i,r),a=Ln.now(),c=tr(t.specificOffset)?n.offset(a):t.specificOffset,l=!tr(i.ordinal),u=!tr(i.year),d=!tr(i.month)||!tr(i.day),h=u||d,f=i.weekYear||i.weekNumber;if((h||l)&&f)throw new Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new Nt("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=mo(a,c);m?(p=$o,g=ko,y=Yn(y,o,s)):l?(p=_o,g=So,y=Vn(y)):(p=No,g=xo);let v=!1;for(const e of p)tr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=m?function(e,t=4,n=1){const r=rr(e.weekYear),i=lr(e.weekNumber,1,br(e.weekYear,t,n)),o=lr(e.weekday,1,7);return r?i?!o&&Bn("weekday",e.weekday):Bn("week",e.weekNumber):Bn("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=rr(e.year),n=lr(e.ordinal,1,gr(e.year));return t?!n&&Bn("ordinal",e.ordinal):Bn("year",e.year)}(i):Kn(i),b=w||er(i);if(b)return Ro.invalid(b);const x=m?Jn(i,o,s):l?Qn(i):i,[k,S]=po(x,c,n),N=new Ro({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?Ro.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:Ro.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return Gr(e,[wi,Si],[bi,Ni],[xi,$i],[ki,_i])}(e);return yo(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return Gr(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[hi,fi])}(e);return yo(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return Gr(e,[mi,yi],[pi,yi],[gi,vi])}(e);return yo(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(tr(e)||tr(t))throw new _t("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=io(e,t,n);return[r,i,o,s]}(o,e,t);return l?Ro.invalid(l):yo(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return Ro.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return Gr(e,[Ci,Si],[Ti,Ii])}(e);return yo(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new _t("need to specify a reason the DateTime is invalid");const n=e instanceof Wn?e:new Wn(e,t);if(Ln.throwOnInvalid)throw new xt(n);return new Ro({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=oo(e,xn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return no(Br.parseFormat(e),xn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Po=void 0,Do.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?lo(this).weekYear:NaN}get weekNumber(){return this.isValid?lo(this).weekNumber:NaN}get weekday(){return this.isValid?lo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?uo(this).weekday:NaN}get localWeekNumber(){return this.isValid?uo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?uo(this).weekYear:NaN}get ordinal(){return this.isValid?Vn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Hi.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Hi.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Hi.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Hi.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=vr(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=mo(a,o),u=mo(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[ho(this,{ts:a}),ho(this,{ts:c})]:[this]}get isInLeapYear(){return pr(this.year)}get daysInMonth(){return yr(this.year,this.month)}get daysInYear(){return this.isValid?gr(this.year):NaN}get weeksInWeekYear(){return this.isValid?br(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?br(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=Br.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Sn.instance(e),t)}toLocal(){return this.setZone(Ln.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=$n(e,Ln.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]=po(n,t,e)}return ho(this,{ts:r,zone:e})}return Ro.invalid(co(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return ho(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=$r(e,Co),{minDaysInFirstWeek:n,startOfWeek:r}=Xn(t,this.loc),i=!tr(t.weekYear)||!tr(t.weekNumber)||!tr(t.weekday),o=!tr(t.ordinal),s=!tr(t.year),a=!tr(t.month)||!tr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Nt("Can't mix ordinal dates with month/day");let u;i?u=Jn({...Yn(this.c,n,r),...t},n,r):tr(t.ordinal)?(u={...this.toObject(),...t},tr(t.day)&&(u.day=Math.min(yr(u.year,u.month),u.day))):u=Qn({...Vn(this.c),...t});const[d,h]=po(u,this.o,this.zone);return ho(this,{ts:d,o:h})}plus(e){return this.isValid?ho(this,go(this,qi.fromDurationLike(e))):this}minus(e){return this.isValid?ho(this,go(this,qi.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=qi.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?Br.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):so}toLocaleString(e=Mt,t={}){return this.isValid?Br.create(this.loc.clone(t),e).formatDateTime(this):so}toLocaleParts(e={}){return this.isValid?Br.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===e;let a=wo(this,s,o=Eo(o));return No.indexOf(o)>=3&&(a+="T"),a+=bo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?wo(this,"extended"===e,Eo(t)):null}toISOWeekDate(){return vo(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=Eo(s),(r&&No.indexOf(s)>=3?"T":"")+bo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return vo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return vo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?wo(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(n&&(r+=" "),t?r+="z":e&&(r+="ZZ")),vo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():so}[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 qi.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(qi.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=Ui(e,t);return(n-n%7)/7}],["days",Ui]],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=qi.fromObject(o,r);return l.length>0?qi.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(Ro.now(),e,t)}until(e){return this.isValid?Bi.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||Ro.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),Io(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Io(e.base||Ro.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Ro.isDateTime))throw new _t("min requires all arguments be DateTimes");return sr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Ro.isDateTime))throw new _t("max requires all arguments be DateTimes");return sr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return io(xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Ro.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=xn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new ro(i,e)}static fromFormatParser(e,t,n={}){if(tr(e)||tr(t))throw new _t("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new _t(`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?Ro.invalid(l):yo(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Mt}static get DATE_MED(){return Pt}static get DATE_MED_WITH_WEEKDAY(){return Dt}static get DATE_FULL(){return Rt}static get DATE_HUGE(){return Ot}static get TIME_SIMPLE(){return jt}static get TIME_WITH_SECONDS(){return zt}static get TIME_WITH_SHORT_OFFSET(){return At}static get TIME_WITH_LONG_OFFSET(){return Lt}static get TIME_24_SIMPLE(){return Wt}static get TIME_24_WITH_SECONDS(){return qt}static get TIME_24_WITH_SHORT_OFFSET(){return Ft}static get TIME_24_WITH_LONG_OFFSET(){return Bt}static get DATETIME_SHORT(){return Ht}static get DATETIME_SHORT_WITH_SECONDS(){return Ut}static get DATETIME_MED(){return Zt}static get DATETIME_MED_WITH_SECONDS(){return Gt}static get DATETIME_MED_WITH_WEEKDAY(){return Yt}static get DATETIME_FULL(){return Jt}static get DATETIME_FULL_WITH_SECONDS(){return Vt}static get DATETIME_HUGE(){return Qt}static get DATETIME_HUGE_WITH_SECONDS(){return Xt}}function Oo(e){if(Ro.isDateTime(e))return e;if(e&&e.valueOf&&nr(e.valueOf()))return Ro.fromJSDate(e);if(e&&"object"==typeof e)return Ro.fromObject(e);throw new _t(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function jo({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return _e("div",{className:at.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:nt.colors.accent}),children:_e("div",{className:at.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&_e("div",{className:at.create("page-heading-wrapper",{width:"100%",marginBottom:nt.spacing.lg}),children:_e(pt,{children:_e("div",{className:at.create("page-heading-container",{backgroundColor:nt.colors.primary,color:nt.colors.primaryForeground,borderRadius:nt.radius.large,padding:`${nt.spacing.lg} ${nt.spacing.xl}`,boxShadow:nt.shadow.md}),children:_e("div",{className:at.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:nt.spacing.lg}),children:_e("div",{className:at.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[_e("h1",{className:at.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:nt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&_e("p",{className:at.create("page-template-description",{margin:"0",marginTop:nt.spacing.sm,fontSize:nt.fontSize.small,lineHeight:"1.5",color:nt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function zo({className:e,children:t}){const n=at.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return _e("div",{className:ft(n,e),children:t})}function Ao({message:e}){return _e(jo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e(zo,{className:at.name("loading-container"),children:_e(mt,{size:"large"})})})})}function Lo({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:nt.colors.primary,color:nt.colors.primaryForeground,boxShadow:nt.shadow.sm},outline:{border:`${nt.borderWidth} solid ${nt.colors.primary}`,backgroundColor:nt.colors.card,color:nt.colors.primary,boxShadow:nt.shadow.sm}},l=at.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:nt.radius.default,cursor:"pointer",fontSize:nt.fontSize.default,fontWeight:"500",transition:nt.transition,fontFamily:nt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});at.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),at.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:nt.shadow.md}),at.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:nt.shadow.sm});const u=at.create(`button-${e}`,{...c[e]});return _e("button",{type:t,className:ft(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&_e(mt,{size:"small"}),o]})}function Wo({error:e}){at.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:nt.colors.background,textAlign:"center"});const t=at.create("error-fallback-icon",{width:"4rem",height:"4rem",color:nt.colors.destructive,marginBottom:"1.5rem"}),n=at.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:nt.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});at.create("error-fallback-message",{fontSize:nt.fontSize.large,color:nt.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=at.create("error-fallback-details",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,backgroundColor:nt.colors.muted,padding:"1rem",borderRadius:nt.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=at.create("error-fallback-support",{fontSize:nt.fontSize.default,color:nt.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=at.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=e||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return _e(jo,{title:s.title,description:s.message,noSubscription:!0,children:_e(pt,{children:_e(zo,{className:at.name("loading-container"),children:[_e(()=>_e("svg",{className:t,fill:"currentColor",viewBox:"0 0 20 20",children:_e("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),{}),_e("h1",{className:n,children:s.title}),s.details&&_e("div",{className:r,children:[_e("strong",{children:"Error Details:"}),_e("br",{}),s.details,s.statusCode&&_e(k,{children:[_e("br",{}),_e("strong",{children:"Status Code:"})," ",s.statusCode]})]}),_e("p",{className:i,children:ue(s)}),_e("div",{className:o,children:_e(Lo,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function qo({message:e,estimatedTime:t}){const n=at.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=at.create("maintenance-icon",{width:"4rem",height:"4rem",color:nt.colors.primary,marginBottom:"1.5rem"}),i=at.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:nt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=at.create("maintenance-message",{fontSize:nt.fontSize.default,color:nt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=at.create("maintenance-info-box",{backgroundColor:nt.colors.muted,borderRadius:nt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=at.create("maintenance-info-title",{fontSize:nt.fontSize.default,fontWeight:"600",color:nt.colors.foreground,marginBottom:"0.5rem"}),c=at.create("maintenance-info-text",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,lineHeight:"1.4"}),l=at.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return _e(jo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:_e(pt,{children:_e(zo,{children:_e("div",{className:n,children:[_e(()=>_e("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:_e("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"})}),{}),_e("h1",{className:i,children:"We'll be right back"}),_e("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),_e("div",{className:s,children:[_e("p",{className:a,children:"What's happening?"}),_e("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&_e("p",{className:c,style:{marginTop:"0.5rem"},children:[_e("strong",{children:"Estimated time:"})," ",t]})]}),_e("div",{className:l,children:_e(Lo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Fo({size:e="default",style:t="normal",className:n,children:r}){const i=at.create("text",{marginTop:"0",marginBottom:"0"}),o=at.create("text-small",{fontSize:nt.fontSize.small}),s=at.create("text-default",{fontSize:nt.fontSize.default}),a=at.create("text-italic",{fontStyle:"italic"}),c=at.create("text-bold",{fontWeight:"bold"}),l=at.create("text-underline",{textDecoration:"underline"}),u=ft({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=ft({[o]:"small"===e,[s]:"default"===e});return _e("p",{className:ft(i,d,u,n),children:r})}function Bo({title:e,description:t}){return _e("div",{className:at.create("section-header",{}),children:[_e("p",{className:at.create("section-title",{fontSize:nt.fontSize.large,margin:"0",color:nt.colors.foreground}),children:e}),t&&_e(Fo,{className:at.create("section-description",{color:nt.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 Ho({selected:e}){return _e("div",{className:ft(at.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${nt.borderWidth} solid transparent`}),e?at.create("selected-indicator-selected",{backgroundColor:nt.colors.primary}):at.create("selected-indicator-unselected",{border:`${nt.borderWidth} solid ${nt.colors.border}`}))})}function Uo({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount);return _e("div",{className:at.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[_e(Bo,{title:"Excess Options"}),_e("div",{className:at.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return _e("div",{className:ft(at.create("excess-option-card",{borderRadius:nt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?at.create("excess-option-card-selected",{border:`2px solid ${nt.colors.primary}`,backgroundColor:nt.colors.accent}):at.create("excess-option-card-unselected",{border:`2px solid ${nt.colors.border}`,backgroundColor:nt.colors.card})),onClick:()=>n(e.id),children:[_e(Ho,{selected:r}),_e("div",{className:at.create("excess-amount",{color:nt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})})]})}function Zo(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function Go(e){switch(e){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}}function Yo({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=He(()=>{if(!n)return[];const r=e.filter(e=>e.excess_id===n&&e.amount.success).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)=>("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0)-("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0))},[e,t,n]);return n?_e(Jo,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):_e("div",{className:at.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:_e(Jo,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function Jo({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return _e("div",{className:at.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[_e(Bo,{title:"Payment Options"}),_e("div",r?{className:at.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>_e(Vo,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:at.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${nt.colors.border}`,borderRadius:nt.radius.default,backgroundColor:nt.colors.muted}),children:_e(Fo,{className:at.create("placeholder-text",{color:nt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function Vo({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;return _e("div",{className:ft(at.create("payment-option-row",{borderRadius:nt.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?at.create("payment-option-row-selected",{border:`2px solid ${nt.colors.primary}`,backgroundColor:nt.colors.accent}):at.create("payment-option-row-unselected",{border:`2px solid ${nt.colors.border}`,backgroundColor:nt.colors.card})),onClick:()=>n(e),children:[_e(Ho,{selected:r}),_e("div",{className:at.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[_e("div",{className:at.create("frequency-title",{fontSize:nt.fontSize.default,fontWeight:"500",color:nt.colors.foreground}),children:Go(e.amount.frequency)}),_e("div",{className:at.create("gateway-description",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground}),children:["via ",e.gateway.name]})]}),_e("div",{className:at.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[_e(Fo,{className:at.create("amount-text",{textAlign:"right"}),children:"one-time"===e.amount.frequency?Zo(e.amount.dueToday):`${Zo(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`}),_e(Fo,{size:"small",className:at.create("gateway-fee-text",{textAlign:"right",color:nt.colors.mutedForeground}),children:[Zo(e.amount.gatewayFee)," fee"]})]})]})}function Qo({label:e,value:t,isTotal:n=!1,className:r}){return _e("div",{className:ft(at.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[_e("span",{className:at.create("summary-label",{color:nt.colors.mutedForeground,fontSize:nt.fontSize.small}),children:e}),_e("span",{className:at.create("summary-value",{fontWeight:n?"600":"500",color:nt.colors.foreground,fontSize:n?nt.fontSize.large:"inherit"}),children:t})]})}function Xo({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){const l=He(()=>n?e.find(e=>e.id===n):null,[e,n]),u=He(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]);return _e("div",{className:at.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[_e(Bo,{title:"Payment Summary"}),_e("div",{className:at.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${nt.colors.border}`}),children:[_e("div",{className:at.create("summary-section-title",{fontSize:nt.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:nt.colors.foreground}),children:"Excess Amount"}),l?_e(Qo,{label:`$${Number(l.excess_amount).toFixed(0)} excess`,value:Zo(l.premium_total)}):_e(Fo,{className:at.create("summary-placeholder",{color:nt.colors.mutedForeground,margin:"0",fontSize:nt.fontSize.small}),children:"No excess selected"})]}),_e("div",{className:at.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${nt.colors.border}`}),children:[_e("div",{className:at.create("summary-section-title",{fontSize:nt.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:nt.colors.foreground}),children:"Payment Method"}),r&&u?_e("div",{className:at.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:_e("div",{className:at.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[_e("span",{className:at.create("gateway-name",{fontWeight:"500",color:nt.colors.foreground}),children:Go(r.amount.frequency)}),_e("span",{className:at.create("gateway-provider",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground}),children:["via ",u.name]})]})}):_e(Fo,{className:at.create("summary-placeholder",{color:nt.colors.mutedForeground,margin:"0",fontSize:nt.fontSize.small}),children:"No payment method selected"})]}),r&&_e("div",{className:at.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${nt.colors.border}`}),children:[_e("div",{className:at.create("summary-section-title",{fontSize:nt.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:nt.colors.foreground}),children:"Payment Details"}),_e("div",{className:at.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?_e(k,{children:[_e(Qo,{label:"Total Due Today:",value:Zo(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&_e(Qo,{label:"Gateway Fee:",value:Zo(r.amount.gatewayFee)})]}):_e(k,{children:[_e(Qo,{label:"Due Today:",value:Zo(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&_e(Qo,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:Zo(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&_e(Qo,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&_e(k,{children:_e(Qo,{label:"Total Payable:",value:Zo(r.amount.totalRepayable),className:at.create("total-item",{})})})]})})]}),c&&_e("div",{className:at.create("continue-later-success",{backgroundColor:`${nt.colors.accent}`,padding:"12px 16px",borderRadius:nt.radius.default,borderLeft:`4px solid ${nt.colors.primary}`}),children:[_e("h4",{className:at.create("success-title",{margin:"0 0 4px 0",color:nt.colors.primary,fontSize:nt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),_e("p",{className:at.create("success-text",{margin:"0",fontSize:nt.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&&_e(Lo,{onClick:s,disabled:a,variant:"outline",className:at.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:nt.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),_e(Lo,{onClick:i,disabled:!o,className:at.create("purchase-button",{width:"100%",height:"3rem",fontSize:nt.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function Ko({isOpen:e,onClose:t,onSuccess:n,onError:r,paymentRequest:i,httpClient:o}){const{fsm:s}=wt(()=>({})),[a,c]=qe("initiating"),[l,u]=qe(null),[d,h]=qe(null),[f,m]=qe(null);Fe(()=>{e&&i&&p()},[e,i]);const p=async()=>{var e;if(i)try{c("initiating"),u(null);const t={...i,returnUrl:window.location.href};let n;if(o&&(null===(e=i.metadata)||void 0===e?void 0:e.gateway)){const e=i.metadata.gateway;n=await o.initiatePayment(t,e)}else{if(!s)throw new Error("No payment handler available");n=await s.initiatePayment(t)}m(n.transaction_id),c("redirecting"),window.location.href=n.gateway_acceptance_url}catch(e){u(e.message||"Failed to initiate payment"),c("failed")}},g=()=>{d&&!d.closed&&d.close(),c("initiating"),u(null),m(null),h(null),t()};return e?_e("div",{className:at.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:[_e("div",{className:at.create("modal-content",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${nt.colors.border}`}),children:[_e("div",{className:at.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[_e("div",{className:at.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(a){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),_e("h2",{className:at.create("modal-title",{margin:"0",color:nt.colors.foreground,fontSize:nt.fontSize.large}),children:"Payment Processing"})]}),_e("div",{className:at.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[_e(Fo,{className:at.create("status-message",{fontSize:nt.fontSize.default,color:nt.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(a){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"}})()}),l&&_e(Fo,{className:at.create("error-message",{color:nt.colors.destructive,fontSize:nt.fontSize.small,padding:"0.75rem",backgroundColor:nt.colors.destructive+"10",borderRadius:nt.radius.default,border:`1px solid ${nt.colors.destructive}30`}),children:l}),("redirecting"===a||"initiating"===a)&&_e("div",{className:at.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${nt.colors.border}`,borderTop:`3px solid ${nt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),_e("div",{className:at.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===a||"cancelled"===a?_e(k,{children:[_e(Lo,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===a&&_e(Lo,{onClick:()=>{c("initiating"),u(null),p()},children:"Try Again"})]}):_e(Lo,"completed"===a?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===a,children:"Cancel"})})]}),_e("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function es({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:_e("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:nt.colors.primary||"#10b981"},children:_e("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:_e("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:nt.colors.destructive},children:[_e("circle",{cx:"12",cy:"12",r:"10"}),_e("path",{d:"m15 9-6 6"}),_e("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:_e("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:nt.colors.secondary},children:[_e("circle",{cx:"12",cy:"12",r:"10"}),_e("path",{d:"m15 9-6 6"}),_e("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:_e("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:nt.colors.destructive},children:[_e("circle",{cx:"12",cy:"12",r:"10"}),_e("path",{d:"M12 8v4"}),_e("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=at.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=at.create("modal-content",{backgroundColor:nt.colors.background,borderRadius:nt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${nt.borderWidth} solid ${nt.colors.border}`}),a=at.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=at.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground,margin:"0"}),l=at.create("modal-message",{color:nt.colors.foreground,lineHeight:"1.5",margin:"0"});at.create("transaction-info",{backgroundColor:nt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:nt.radius.small,border:`${nt.borderWidth} solid ${nt.colors.border}`,fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,wordBreak:"break-all"});const u=at.create("modal-button",{backgroundColor:nt.colors.primary,color:nt.colors.primaryForeground,border:"none",borderRadius:nt.radius.default,padding:"0.75rem 1.5rem",fontSize:nt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=at.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return _e("div",{className:o,onClick:r,children:_e("div",{className:s,onClick:e=>e.stopPropagation(),children:_e("div",{className:a,children:[i.icon,_e("div",{className:d,children:[_e("h2",{className:c,children:i.title}),_e("p",{className:l,children:i.message})]}),_e("button",{className:u,onClick:r,children:i.buttonText})]})})})}function ts({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=wt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=qe(!1),[c,l]=qe(null),[u,d]=qe(!1),[h,f]=qe(!1),m=e.calculations,p=e.payment_options,g=e.payment_gateways;Fe(()=>{const e=m.find(e=>e.id===n);if(e&&i){const n=p.some(e=>"monthly"===e.amount.frequency),r=t.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);ye(i,e,p.length,n,o)}},[]);const y=Boolean(n&&r),v=null==i?void 0:i.payment_return,w=v&&("declined"===v.paymentStatus||"cancelled"===v.paymentStatus||"error"===v.paymentStatus);return _e(jo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:_e(pt,{children:[_e("div",{className:at.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:nt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[_e("div",{className:at.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:nt.colors.card,boxShadow:nt.shadow.sm,borderRadius:nt.radius.large,display:"flex",flexDirection:"column"}),children:[_e("div",{className:at.create("checkout-header",{paddingInline:nt.spacing.xl,paddingTop:nt.spacing.xl,paddingBottom:nt.spacing.lg},{"(max-width: 768px)":{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingTop:nt.spacing.md}}),children:[_e("h2",{className:at.create("checkout-title",{margin:"0",marginBottom:nt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:nt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),_e("p",{className:at.create("checkout-description",{margin:"0",fontSize:nt.fontSize.default,lineHeight:"1.6",color:nt.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),_e("hr",{className:at.create("checkout-header-border",{marginTop:nt.spacing.lg,borderColor:nt.colors.border})})]}),_e("div",{className:at.create("checkout-sections",{paddingInline:nt.spacing.xl,paddingBottom:nt.spacing.xl,display:"flex",flexDirection:"column",gap:nt.spacing.lg},{"(max-width: 768px)":{paddingInline:nt.spacing.lg,paddingBottom:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingBottom:nt.spacing.md}}),children:[_e(Uo,{excessOptions:m,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),_e(Yo,{paymentOptions:p,paymentGateways:g,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),_e("div",{className:at.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:_e("div",{className:at.create("checkout-sidebar-sticky",{position:"sticky",top:nt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:_e("div",{className:at.create("checkout-sidebar-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,boxShadow:nt.shadow.sm,padding:nt.spacing.lg},{"(max-width: 768px)":{padding:nt.spacing.md}}),children:_e(Xo,{excessOptions:m,paymentGateways:g,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:y,onContinueLater:async()=>{var t,s;try{let t;f(!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=e.calculations.map(e=>e.calculation_id);if(0===a.length)return void alert("No calculations available. Please try again.");const c={};n&&(c.selected_excess_id=n),(null==r?void 0:r.gateway_id)&&(c.selected_gateway_id=r.gateway_id),(null==r?void 0:r.calculation_id)&&(c.selected_calculation_id=r.calculation_id),c.source="checkout_page";const l=g.map(e=>e.id),u={payment_type:"quote",quote_intent_id:e.quote_intent.id,calculation_ids:a,payment_gateway_ids:l,email:t,metadata:c};await o.createPaymentLink(u),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{f(!1)}},continueLaterLoading:h,showContinueLaterSuccess:u})})})})]}),w&&_e(es,{type:v.paymentStatus,transactionId:v.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{t.updateQuoteIntent({payment_return:void 0})}}),_e(Ko,{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 ns({results:e}){var t,n,r;const{quoteIntent:i}=wt(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=at.create("referral-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:nt.spacing.xl,boxShadow:nt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:nt.spacing.lg},"(max-width: 480px)":{padding:nt.spacing.md}}),l=at.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:nt.spacing.lg}),u=at.create("referral-icon",{width:"4rem",height:"4rem",color:nt.colors.primary}),d=at.create("referral-header",{textAlign:"center",marginBottom:nt.spacing.xl}),h=at.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:nt.colors.primary,marginBottom:nt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=at.create("referral-subtitle",{fontSize:nt.fontSize.default,color:nt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),m=at.create("referral-process-box",{backgroundColor:nt.colors.accent,borderRadius:nt.radius.default,padding:nt.spacing.lg,marginBottom:nt.spacing.xl}),p=at.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:nt.colors.accentForeground,marginBottom:nt.spacing.md,marginTop:"0"}),g=at.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:nt.spacing.sm}),y=at.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:nt.fontSize.small,color:nt.colors.accentForeground,lineHeight:"1.6"}),v=at.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:nt.colors.primary,color:nt.colors.primaryForeground,borderRadius:"50%",marginRight:nt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=at.create("referral-contact-section",{borderTop:`1px solid ${nt.colors.border}`,paddingTop:nt.spacing.xl,marginTop:nt.spacing.xl,textAlign:"center"}),b=at.create("referral-contact-text",{fontSize:nt.fontSize.default,color:nt.colors.foreground,marginBottom:nt.spacing.lg}),x=at.create("referral-actions",{display:"flex",gap:nt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:nt.spacing.lg}),k=at.create("referral-reference",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,marginTop:nt.spacing.md});return _e(jo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:_e(pt,{children:_e(zo,{children:_e("div",{className:c,children:[_e("div",{className:l,children:_e(()=>_e("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:[_e("path",{d:"M7 10v12"}),_e("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"})]}),{})}),_e("div",{className:d,children:[_e("h1",{className:h,children:"Thanks for your quote request!"}),_e("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),_e("div",{className:m,children:[_e("h3",{className:p,children:"What happens next?"}),_e("ul",{className:g,children:[_e("li",{className:y,children:[_e("span",{className:v,children:"1"}),_e("span",{children:"Our team will review your application within 1-2 business days"})]}),_e("li",{className:y,children:[_e("span",{className:v,children:"2"}),_e("span",{children:"We'll contact you with either approval or additional requirements"})]}),_e("li",{className:y,children:[_e("span",{className:v,children:"3"}),_e("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&_e("div",{className:w,children:[_e("p",{className:b,children:"Need to speak with someone about your quote?"}),_e("div",{className:x,children:[s&&_e(Lo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[_e("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:_e("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&&_e(Lo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[_e("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:[_e("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),_e("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)&&_e("div",{className:k,children:["Quote Reference: ",_e("strong",{children:e.quote_intent.reference})]})]})]})})})})}function rs({results:e}){return"referral"===e.outcome_type?_e(ns,{results:e}):_e(ts,{results:e})}function is({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Be(null),[d,h]=qe("");function f(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}Fe(()=>{h(null!=e&&""!==e?f(e):"")},[e]);const m=at.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=at.create("money-input-prefix",{position:"absolute",left:"1rem",color:nt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=at.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return _e("div",{className:m,children:[l&&_e("span",{className:p,children:l}),_e("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=f(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:ft(a,l&&g)})]})}function os(e){var t,n,r,i;const o=at.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${nt.borderWidth} solid ${e.hasError?nt.colors.destructive:nt.colors.input}`,borderRadius:nt.radius.default,fontSize:nt.fontSize.default,backgroundColor:nt.colors.card,color:nt.colors.foreground,transition:nt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px ${nt.colors.destructive}20`:"none"});at.pseudoElement("input",":focus",{borderColor:nt.colors.ring,boxShadow:`0 0 0 3px ${nt.colors.ring}20`});const s=at.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${nt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:nt.fontSize.default,backgroundColor:"transparent",color:nt.colors.foreground}),a=at.create("select-wrapper",{border:`${nt.borderWidth} solid ${e.hasError?nt.colors.destructive:nt.colors.input}`,borderRadius:nt.radius.default,backgroundColor:nt.colors.card,transition:nt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px ${nt.colors.destructive}20`:"none",overflow:"hidden"});at.pseudoElement("select-wrapper",":focus-within",{borderColor:nt.colors.ring,boxShadow:`0 0 0 3px ${nt.colors.ring}20`});const{onChange:c,className:l,validation:u,errors:d,...h}=e;function f(e){c(e.currentTarget.value)}function m(e){c(e.currentTarget.value)}if("select"===e.type)return _e("div",{className:a,children:_e("select",{...h,onChange:f,className:s,children:[_e("option",{value:"",children:"Select an option"}),null===(n=null===(t=e.validation)||void 0===t?void 0:t.options)||void 0===n?void 0:n.map(e=>_e("option",{value:e.value,children:e.label},e.value))]})});if("date"===e.type)return _e("input",{...h,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:m,onChange:f,className:ft(o,l)});if("monthyear"===e.type){function p(e){const t=e.currentTarget.value;c(t?`${t}-01`:"")}const g=e.value?e.value.substring(0,7):"";return _e("input",{...h,type:"month",value:g,onInput:p,onChange:p,className:ft(o,l)})}if("year"===e.type){const y=(new Date).getFullYear();return _e("input",{...h,type:"number",min:y-100,max:y,placeholder:"YYYY",onInput:m,onChange:f,className:ft(o,l)})}if("money"===e.type)return _e(is,{value:e.value,onChange:c,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:ft(o,l),hasError:e.hasError});if("checkbox"===e.type){const v=!0===e.value||"true"===e.value||"true"===e.value,w=at.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),b=at.create("checkbox-"+(v?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${v?nt.colors.primary:e.hasError?nt.colors.destructive:nt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:v?nt.colors.primary:nt.colors.card,transition:nt.transition,position:"absolute"});function x(e){e.preventDefault(),c(v?"false":"true")}return at.pseudoElement("checkbox-"+(v?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px ${nt.colors.ring}20`}),_e("div",{className:w,children:[_e("input",{type:"checkbox",id:e.id,name:e.name,checked:v,onClick:x,className:ft(b,l),required:e.required,readOnly:!0}),v&&_e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:nt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:_e("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const k=at.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),S=at.create("boolean-radio-group",{display:"flex",gap:"1rem"}),N=at.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),$=at.create("boolean-radio",{accentColor:nt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),_=at.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${nt.borderWidth} solid ${e.hasError?nt.colors.destructive:nt.colors.input}`,borderRadius:nt.radius.default,fontSize:nt.fontSize.default,backgroundColor:nt.colors.card,color:nt.colors.foreground,transition:nt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px ${nt.colors.destructive}20`:"none",resize:"vertical",fontFamily:nt.fontFamily});at.pseudoElement("boolean-textarea",":focus",{borderColor:nt.colors.ring,boxShadow:`0 0 0 3px ${nt.colors.ring}20`});const E=!0===e.value||"true"===e.value,C=!1===e.value||"false"===e.value,T=e.answer||"",I=e.booleanConfig,M=(null==I?void 0:I.enable_details_textbox)&&("yes"===I.show_details_on&&E||"no"===I.show_details_on&&C);function P(t){c(t),(!(null==I?void 0:I.enable_details_textbox)||!("yes"===I.show_details_on&&"true"===t||"no"===I.show_details_on&&"false"===t))&&e.onAnswerChange&&e.onAnswerChange("")}return _e("div",{className:ft(k,l),children:[_e("div",{className:S,children:[_e("label",{className:N,children:[_e("input",{type:"radio",name:e.name,checked:E,onChange:()=>P("true"),className:$}),_e("span",{children:"Yes"})]}),_e("label",{className:N,children:[_e("input",{type:"radio",name:e.name,checked:C,onChange:()=>P("false"),className:$}),_e("span",{children:"No"})]})]}),M&&_e("textarea",{placeholder:(null==I?void 0:I.details_placeholder)||"Please provide details",value:T,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:_})]})}return _e("input",{...h,onInput:m,onChange:f,className:ft(o,l)})}function ss({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,lastUpdated:i,isSaving:o}=wt(e=>{var t,n;return{lastUpdated:null!==(n=null===(t=e.getFormProgress())||void 0===t?void 0:t.last_updated)&&void 0!==n?n:null,isSaving:e.getIsSaving()}}),s=Be(null),a=Be(null);Fe(()=>{if(s.current&&a.current){const e=a.current,t=s.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[t]);const c=Math.round((t+1)/e.length*100);return _e("div",{className:at.create("sidebar-navigation",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:nt.spacing.lg,boxShadow:nt.shadow.sm,position:"sticky",top:nt.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:nt.spacing.lg}),children:[_e("div",{className:at.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:nt.spacing.sm}),children:[_e("span",{className:at.create("sidebar-progress-text",{fontSize:nt.fontSize.small,fontWeight:"600",color:nt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),_e("div",{className:at.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:nt.colors.muted,borderRadius:nt.radius.small,overflow:"hidden"}),children:_e("div",{className:at.create("sidebar-progress-fill",{height:"100%",backgroundColor:nt.colors.primary,borderRadius:nt.radius.small,transition:nt.transition,width:`${c}%`})})})]}),_e("hr",{className:at.create("sidebar-divider",{borderColor:nt.colors.border})}),_e("nav",{ref:a,className:at.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:nt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:nt.spacing.sm}),children:e.map((e,i)=>{const a=i===t,c=n.includes(i),l=r.canNavigateToPage(i),u=at.create(`sidebar-nav-item-${i}`,{display:"flex",alignItems:"flex-start",gap:nt.spacing.sm,padding:`${nt.spacing.sm} ${nt.spacing.sm}`,borderRadius:nt.radius.default,border:"none",backgroundColor:a?nt.colors.accent:"transparent",color:a?nt.colors.accentForeground:nt.colors.foreground,cursor:l&&!o?"pointer":"not-allowed",transition:nt.transition,textAlign:"left",width:"100%",fontFamily:nt.fontFamily,fontSize:nt.fontSize.small,opacity:l&&!o?"1":"0.5"});return l&&!a&&at.pseudoElement(`sidebar-nav-item-${i}`,":hover",{backgroundColor:nt.colors.muted}),_e("button",{ref:a?s:null,onClick:()=>{return e=i,void((null==r?void 0:r.canNavigateToPage(e))&&r.navigateToPage(e));var e},disabled:!l||o,className:u,children:[_e("div",{className:at.create(`sidebar-indicator-${i}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:c?nt.colors.primary:a?nt.colors.accentForeground:nt.colors.muted,color:c?nt.colors.primaryForeground:a?nt.colors.accent:nt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?_e("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:_e("path",{d:"M20 6 9 17l-5-5"})}):i+1}),_e("div",{className:at.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:_e("span",{className:at.create("sidebar-page-title",{fontWeight:a?"600":"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),children:e.title})})]},e.id)})}),_e("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==r||r.reset())},className:at.create("sidebar-reset-button",{padding:`${nt.spacing.sm} ${nt.spacing.md}`,border:`${nt.borderWidth} solid ${nt.colors.border}`,borderRadius:nt.radius.default,backgroundColor:"transparent",color:nt.colors.mutedForeground,fontSize:nt.fontSize.small,fontFamily:nt.fontFamily,cursor:"pointer",transition:nt.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),i&&_e("div",{className:at.create("sidebar-last-saved",{fontSize:"0.6875rem",color:nt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Ro.fromJSDate(new Date(i)).toFormat("T")]})]})}function as({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=wt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=qe(!1),a=Math.round((t+1)/e.length*100);return _e("div",{className:at.create("mobile-sidebar",{overflow:"hidden"}),children:[_e("button",{onClick:()=>s(!o),className:at.create("mobile-sidebar-header",{width:"100%",padding:nt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:nt.spacing.sm}),children:[_e("div",{className:at.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[_e("span",{className:at.create("mobile-sidebar-step-text",{fontSize:nt.fontSize.small,fontWeight:"600",color:nt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),_e("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:at.create("mobile-sidebar-chevron",{transition:nt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:nt.colors.mutedForeground}),children:_e("path",{d:"m6 9 6 6 6-6"})})]}),_e("div",{className:at.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:nt.colors.muted,borderRadius:nt.radius.small,overflow:"hidden"}),children:_e("div",{className:at.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:nt.colors.primary,borderRadius:nt.radius.small,transition:nt.transition,width:`${a}%`})})})]}),_e("hr",{className:at.create("mobile-sidebar-border",{borderColor:nt.colors.border})}),o&&_e("div",{className:at.create("mobile-sidebar-content",{padding:nt.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const a=o===t,c=n.includes(o),l=r.canNavigateToPage(o);return _e("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),s(!1)));var e},disabled:!l||i,className:at.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:nt.spacing.sm,padding:nt.spacing.sm,border:"none",borderRadius:nt.radius.default,backgroundColor:a?nt.colors.accent:"transparent",color:a?nt.colors.accentForeground:nt.colors.foreground,cursor:l&&!i?"pointer":"not-allowed",opacity:l&&!i?"1":"0.5",transition:nt.transition,width:"100%",textAlign:"left",fontFamily:nt.fontFamily}),children:[_e("div",{className:at.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?nt.colors.primary:a?nt.colors.accentForeground:nt.colors.muted,color:c?nt.colors.primaryForeground:a?nt.colors.accent:nt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?_e("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:_e("path",{d:"M20 6 9 17l-5-5"})}):o+1}),_e("span",{className:at.create("mobile-sidebar-page-title",{fontSize:nt.fontSize.small,fontWeight:a?"600":"500"}),children:e.title})]},e.id)})})]})}function cs({organisation:e}){return _e("div",{className:at.create("welcome-card",{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},{"(max-width: 950px)":{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingTop:nt.spacing.md}}),children:[_e("h2",{className:at.create("welcome-title",{margin:"0",marginBottom:nt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:nt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:nt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),_e("p",{className:at.create("welcome-text",{margin:"0",fontSize:nt.fontSize.default,lineHeight:"1.6",color:nt.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."}),_e("hr",{className:at.create("welcome-border",{marginTop:nt.spacing.lg,borderColor:nt.colors.border})})]})}function ls({title:e,description:t}){return _e(jo,{title:e,description:t,children:_e(pt,{children:_e(zo,{className:at.name("error-container"),children:_e("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:[_e("path",{d:"M4.929 4.929 19.07 19.071"}),_e("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function us({errors:e,className:t}){return e&&0!==e.length?_e("div",{className:at.create("field-error",{color:nt.colors.destructive,fontSize:nt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>_e("span",{className:at.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function ds({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=qe(!1);return _e("label",{for:e,className:at.create("label",{display:"flex",flexDirection:"column"}),...o,children:[_e("span",{className:at.create("label-text",{marginBottom:nt.spacing.sm,fontSize:nt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:nt.spacing.sm,color:nt.colors.foreground}),children:[_e("span",{children:[t,r&&_e("span",{className:at.create("label-required-indicator",{color:nt.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&_e("span",{className:at.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[_e("svg",{className:at.create("tooltip-icon",{width:"1rem",height:"1rem",color:nt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[_e("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),_e("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_e("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&_e("span",{className:at.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:nt.colors.popover,color:nt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:nt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,_e("span",{className:at.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 ${nt.colors.popover}`})})]})]})]}),n]})}function hs(e){switch(null!=e?e:100){case 25:return at.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return at.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return at.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return at.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return at.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return at.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function fs(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 ms({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=at.create("validated-field",{display:"flex",flexDirection:"column",gap:nt.spacing.sm});if("checkbox"===e.type){const t=at.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:nt.spacing.sm}),a=at.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=at.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=at.create("checkbox-label-text",{fontSize:nt.fontSize.default,fontWeight:"600",color:nt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return _e("div",{className:ft(s,hs(e.width),r),children:[_e("div",{className:t,children:_e("div",{className:a,children:[_e("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),_e("label",{htmlFor:i,className:c,children:[_e("span",{className:l,children:[e.label,e.required&&_e("span",{className:at.create("checkbox-required-indicator",{color:nt.colors.destructive}),children:"*"})]}),e.description&&_e("div",{className:at.create("checkbox-field-description",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:fs(e.description)}})]})]})}),_e(us,{errors:o})]})}return _e("div",{className:ft(s,hs(e.width),r),children:[_e(ds,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&_e("div",{className:at.create("field-description",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,marginBottom:nt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:fs(e.description)}}),n]}),_e(us,{errors:o})]})}function ps({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:nt.colors.secondary+"08",borderColor:nt.colors.secondary+"30",iconColor:nt.colors.secondary,titleColor:nt.colors.foreground},error:{backgroundColor:nt.colors.destructive+"08",borderColor:nt.colors.destructive,iconColor:nt.colors.destructive,titleColor:nt.colors.destructive},critical:{backgroundColor:nt.colors.destructive+"10",borderColor:nt.colors.destructive,iconColor:nt.colors.destructive,titleColor:nt.colors.destructive}}[e.severity],o=at.create("error-card",{padding:nt.spacing.md,borderRadius:nt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:nt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=at.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=at.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=at.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=at.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=at.create("error-card-title",{fontSize:nt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=at.create("error-card-message",{fontSize:nt.fontSize.small,color:nt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=at.create("error-card-details",{fontSize:"0.8125rem",color:nt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:nt.colors.muted,padding:"0.625rem",borderRadius:nt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=at.create("error-card-support",{fontSize:"0.8125rem",color:nt.colors.mutedForeground,lineHeight:"1.4"}),m=at.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:nt.colors.mutedForeground,cursor:"pointer",borderRadius:nt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:nt.transition});return at.pseudoElement("error-card-dismiss",":hover",{backgroundColor:nt.colors.muted,color:nt.colors.foreground}),_e("div",{className:ft(o,n),children:_e("div",{className:s,children:[_e(()=>"warning"===e.severity?_e("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:_e("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"})}):_e("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:_e("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"})}),{}),_e("div",{className:c,children:[_e("div",{className:l,children:[_e("div",{className:u,children:e.title}),_e("div",{className:d,children:e.message}),r&&e.details&&_e("div",{className:h,children:e.details}),_e("div",{className:f,children:ue(e)})]}),t&&_e("button",{className:m,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:_e("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:[_e("path",{d:"M18 6 6 18"}),_e("path",{d:"m6 6 12 12"})]})})]})]})})}function gs(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 ys(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 vs(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 ws(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}`)}}at.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:nt.colors.muted,borderColor:nt.colors.primary,color:nt.colors.primary});class bs{static create(e){switch(e){case"string":case"text":case"select":return gs;case"numeric":return ys;case"boolean":return vs;case"date":return ws;default:throw new Error(`Unsupported condition type: ${e}`)}}}function xs(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:ks(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 ks(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=bs.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var Ss=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:bs,booleanMatchesCondition:vs,checkSimpleConditions:xs,dateMatchesCondition:ws,numericMatchesCondition:ys,textMatchesCondition:gs});function Ns(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=wt(e=>({definition:e.getFormDefinition(),currentPageIndex:e.getCurrentPageIndex(),totalPages:e.getTotalPages(),results:e.getCalculationResult(),validationErrors:e.getValidationErrors(),generalErrors:e.getGeneralErrors(),quoteIntent:e.getQuoteIntent(),isSaving:e.getIsSaving()})),l=t.pages[n];if(!l)return _e(ls,{title:"Unexpected Error",description:"No page available"});const u=Be(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)=>{const n=new Date;let r=new Date;switch(e){case"today":r=n;break;case"+1week":r.setDate(n.getDate()+7);break;case"+1month":r.setMonth(n.getMonth()+1);break;case"+1year":r.setFullYear(n.getFullYear()+1);break;default:return""}const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return t?`${i}-${o}-01`:`${i}-${o}-${s}`},f=e=>{const t=c.getFormProgress().page_data[l.id];return((null==t?void 0:t.U)||{})[e]||""},m=c.getFormProgress().page_data[l.id]||{},p=null==s?void 0:s.payment_return,g=p&&("declined"===p.paymentStatus||"cancelled"===p.paymentStatus||"error"===p.paymentStatus),y=c.getFormProgress().completed_pages||[];return _e(jo,{title:l.title,description:l.description,hideHeader:!0,children:_e("div",{children:[g&&_e(es,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),_e(pt,{children:_e("div",{className:at.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:nt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[_e("div",{className:at.create("form-content-wrapper",{minWidth:"0",backgroundColor:nt.colors.card,boxShadow:nt.shadow.sm,borderRadius:nt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[_e("div",{className:at.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:_e(as,{pages:t.pages,currentPageIndex:n,completedPages:y})}),n>0&&_e("div",{className:at.create("page-heading-container",{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},{"(max-width: 950px)":{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingTop:nt.spacing.md}}),children:[_e("div",{className:at.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:nt.spacing.lg}),children:_e("div",{className:at.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[_e("h1",{className:at.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:nt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&_e("p",{className:at.create("page-template-description",{margin:"0",marginTop:nt.spacing.sm,fontSize:nt.fontSize.small,lineHeight:"1.5",color:nt.colors.foreground,opacity:"0.7"}),children:l.description})]})}),_e("hr",{className:at.create("page-heading-border",{marginTop:nt.spacing.lg,borderColor:nt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&_e(cs,{organisation:s.organisation}),o.length>0&&o.map(e=>_e(ps,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),_e("div",{className:at.create("form-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:nt.spacing.lg,boxShadow:nt.shadow.sm,display:"flex",flexDirection:"column",gap:nt.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:nt.spacing.md,gap:nt.spacing.lg},"(max-width: 480px)":{padding:nt.spacing.md,gap:nt.spacing.md}}),children:[_e("form",{onSubmit:e=>e.preventDefault(),className:at.create("form-fields-container",{flex:"1"}),children:_e("div",{className:at.create("form-content-page",{display:"grid",gap:nt.spacing.md,rowGap:nt.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=xs(m,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),r="show"===t.visibility.action?n.matched:!n.matched;return u.current.get(t.id)!==r&&(e((t.label,t.code)),e(),u.current.set(t.id,r)),r})(t)?_e(ms,{field:t,errors:i,children:_e(os,{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:f(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,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},t.id):null})})}),_e("hr",{className:at.create("form-navigation-border",{borderColor:nt.colors.border})}),_e("div",{className:at.create("form-navigation-inline",{paddingTop:nt.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&_e(Lo,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),_e(Lo,{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"})]})]})]}),_e("div",{className:at.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:_e(ss,{pages:t.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function $s(){var e,t,n;const{quoteIntent:r,fsm:i}=wt(e=>({quoteIntent:e.getQuoteIntent(),fsm:e})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,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;Fe(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?be(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&xe(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=at.create("success-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:nt.spacing.xl,boxShadow:nt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:nt.spacing.lg},"(max-width: 480px)":{padding:nt.spacing.md}}),f=at.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:nt.spacing.lg}),m=at.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=at.create("success-header",{textAlign:"center",marginBottom:nt.spacing.xl}),g=at.create("success-title",{margin:"0",marginBottom:nt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:nt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=at.create("success-message",{fontSize:nt.fontSize.default,lineHeight:"1.6",color:nt.colors.foreground,opacity:"0.9",margin:"0"}),v=at.create("success-contact-section",{borderTop:`1px solid ${nt.colors.border}`,paddingTop:nt.spacing.xl,marginTop:nt.spacing.xl}),w=at.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:nt.colors.foreground,marginBottom:nt.spacing.md,textAlign:"center"}),b=at.create("success-contact-details",{backgroundColor:nt.colors.accent,borderRadius:nt.radius.default,padding:nt.spacing.md,display:"flex",flexDirection:"column",gap:nt.spacing.sm,marginBottom:nt.spacing.lg}),x=at.create("success-contact-item",{display:"flex",alignItems:"center",gap:nt.spacing.sm,fontSize:nt.fontSize.small,color:nt.colors.accentForeground}),k=at.create("success-actions",{display:"flex",gap:nt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=at.create("success-reference",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,textAlign:"center",marginTop:nt.spacing.md});return _e(jo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e(zo,{children:_e("div",{className:h,children:[_e("div",{className:f,children:_e("div",{className:m,children:_e("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:_e("path",{d:"M20 6 9 17l-5-5"})})})}),_e("div",{className:p,children:[_e("h1",{className:g,children:"Payment Complete!"}),_e("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&&_e("div",{className:v,children:[_e("h3",{className:w,children:"Need assistance?"}),_e("div",{className:b,children:[l&&_e("div",{className:x,children:[_e("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:[_e("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),_e("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),_e("span",{children:l})]}),u&&_e("div",{className:x,children:[_e("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:_e("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"})}),_e("span",{children:u})]})]}),_e("div",{className:k,children:[u&&_e(Lo,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[_e("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:_e("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&&_e(Lo,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[_e("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:[_e("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),_e("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&_e("div",{className:S,children:["Quote Reference: ",_e("strong",{children:r.reference})]})]})})})})}class _s{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 ct}).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)}}function Es({paymentLinkId:t,signedUrl:n}){var r,i,o,s,a,c,l;const{httpClient:u}=function(){const e=vt(),{httpClient:t,paymentLinkConfig:n}=e;if(!n||!t)throw new Error("usePaymentLink can only be used in payment link mode. If you're in quote mode, use useQuoteForm instead.");return{httpClient:t,paymentLinkId:n.paymentLinkId,signedUrl:n.signedUrl}}(),[d,h]=qe(null),[f,m]=qe([]),[p,g]=qe([]),[y,v]=qe(!0),[w,b]=qe(null),[x,S]=qe(!1),[N,$]=qe(null),[_,E]=qe(null),[C,T]=qe(null),[I,M]=qe(!1),[P,D]=qe(null),[R,O]=qe(null);Fe(()=>{j()},[t]);const j=async()=>{try{v(!0);const t=new URLSearchParams(window.location.search),r=t.get("transactionId"),i=t.get("status");r&&i&&(M(!0),D(i),O(r));const o=await u.getPaymentLinkDetails(n);if("paid"===o.status&&!I&&(!r||"completed"!==i&&"success"!==i))return void b("This payment link has already been used.");if("expired"===o.status)return void b("This payment link has expired.");if(o.organisation&&o.organisation.theme)try{await _s.loadTheme({slug:o.organisation.slug,theme_url:o.organisation.theme.css_url})}catch(t){e()}g(o.payment_gateways||[]),m(o.payment_options||[]),h(o)}catch(e){b("Failed to load payment details. Please check your link.")}finally{v(!1)}};if(y)return _e(jo,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e("div",{className:at.create("payment-link-loading-card",{textAlign:"center",padding:nt.spacing.xl,backgroundColor:nt.colors.card,borderRadius:nt.radius.large,boxShadow:nt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:_e("p",{className:at.create("loading-text",{color:nt.colors.mutedForeground,fontSize:nt.fontSize.default}),children:"Loading payment details..."})})})});if(w)return _e(jo,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e("div",{className:at.create("payment-link-error-card",{textAlign:"center",padding:nt.spacing.xl,backgroundColor:nt.colors.card,borderRadius:nt.radius.large,boxShadow:nt.shadow.sm,border:`2px solid ${nt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[_e("h2",{className:at.create("error-title",{color:nt.colors.destructive,marginBottom:nt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),_e("p",{className:at.create("error-message",{color:nt.colors.foreground,fontSize:nt.fontSize.default,margin:"0"}),children:w})]})})});if(!d)return null;const z=new URLSearchParams(window.location.search),A=z.get("transactionId"),L=z.get("status"),W=A&&L;if("paid"===d.status&&("completed"===L||"success"===L||W||I||"completed"===P)){const e=null===(r=d.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=d.organisation)||void 0===i?void 0:i.phone,n=e||t;return _e(jo,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e("div",{className:at.create("payment-success-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,padding:nt.spacing.xl,boxShadow:nt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[_e("div",{className:at.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:nt.spacing.lg}),children:_e("div",{className:at.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:_e("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:_e("path",{d:"M20 6 9 17l-5-5"})})})}),_e("div",{className:at.create("success-header",{textAlign:"center",marginBottom:nt.spacing.xl}),children:[_e("h1",{className:at.create("success-title",{margin:"0",marginBottom:nt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:nt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),_e("p",{className:at.create("success-message",{fontSize:nt.fontSize.default,lineHeight:"1.6",color:nt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&_e("div",{className:at.create("contact-section",{borderTop:`1px solid ${nt.colors.border}`,paddingTop:nt.spacing.xl,marginTop:nt.spacing.xl}),children:[_e("h3",{className:at.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:nt.colors.foreground,marginBottom:nt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),_e("div",{className:at.create("contact-details",{backgroundColor:nt.colors.accent,borderRadius:nt.radius.default,padding:nt.spacing.md,display:"flex",flexDirection:"column",gap:nt.spacing.sm,marginBottom:nt.spacing.lg}),children:[e&&_e("div",{className:at.create("contact-item",{display:"flex",alignItems:"center",gap:nt.spacing.sm,fontSize:nt.fontSize.small,color:nt.colors.accentForeground}),children:_e("span",{children:["Email: ",e]})}),t&&_e("div",{className:at.create("contact-item",{display:"flex",alignItems:"center",gap:nt.spacing.sm,fontSize:nt.fontSize.small,color:nt.colors.accentForeground}),children:_e("span",{children:["Phone: ",t]})})]}),(R||A)&&_e("div",{className:at.create("reference",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,textAlign:"center",marginTop:nt.spacing.md}),children:["Transaction ID: ",_e("strong",{children:null===(o=R||A)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}if(W&&("failed"===L||"cancelled"===L||"failed"===P||"cancelled"===P))return _e(jo,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:_e(pt,{children:_e("div",{className:at.create("payment-error-card",{textAlign:"center",padding:nt.spacing.xl,backgroundColor:nt.colors.card,borderRadius:nt.radius.large,boxShadow:nt.shadow.sm,border:`2px solid ${nt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[_e("h2",{className:at.create("error-title",{color:nt.colors.destructive,marginBottom:nt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===L||"cancelled"===P?"Payment Cancelled":"Payment Failed"}),_e("p",{className:at.create("error-message",{color:nt.colors.foreground,fontSize:nt.fontSize.default,margin:"0",marginBottom:nt.spacing.lg}),children:"cancelled"===L||"cancelled"===P?"Your payment was cancelled. You can try again by refreshing this page.":"There was an issue processing your payment. Please try again."}),_e(Lo,{onClick:()=>window.location.reload(),children:"Try Again"})]})})});const q="quote"===d.payment_type||"renewal"===d.payment_type,F=d.snapshot_data.calculations||(d.snapshot_data.calculation?[d.snapshot_data.calculation]:[]),B=F.length>1,H=F.find(e=>(e.id||e.calculation_id)===_),U=d.snapshot_data.product_name||d.snapshot_data.description||"Payment",Z=f.find(e=>e.gateway_id===C&&e.calculation_id===_),G=(null===(s=null==Z?void 0:Z.amount)||void 0===s?void 0:s.totalRepayable)?Z.amount.totalRepayable:(null==H?void 0:H.premium_payable)||d.snapshot_data.amount||0,Y=new Date(d.expires_at);return _e(jo,{title:"Complete Your "+("renewal"===d.payment_type?"Renewal":"Purchase"),noSubscription:!0,hideHeader:!0,children:_e(pt,{children:[_e("div",{className:at.create("payment-link-card",{backgroundColor:nt.colors.card,borderRadius:nt.radius.large,boxShadow:nt.shadow.sm,maxWidth:"900px",margin:"0 auto"}),children:[_e("div",{className:at.create("payment-link-header",{paddingInline:nt.spacing.xl,paddingTop:nt.spacing.xl,paddingBottom:nt.spacing.lg},{"(max-width: 768px)":{paddingInline:nt.spacing.lg,paddingTop:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingTop:nt.spacing.md}}),children:[_e("h2",{className:at.create("payment-link-title",{margin:"0",marginBottom:nt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:nt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"renewal"===d.payment_type?"Policy Renewal":"Complete Your Purchase"}),_e("p",{className:at.create("payment-link-subtitle",{margin:"0",fontSize:nt.fontSize.default,lineHeight:"1.6",color:nt.colors.foreground,opacity:"0.9"}),children:U}),_e("hr",{className:at.create("payment-link-header-border",{marginTop:nt.spacing.lg,borderColor:nt.colors.border})})]}),_e("div",{className:at.create("payment-link-content",{paddingInline:nt.spacing.xl,paddingBottom:nt.spacing.xl,display:"flex",flexDirection:"column",gap:nt.spacing.lg},{"(max-width: 768px)":{paddingInline:nt.spacing.lg,paddingBottom:nt.spacing.lg},"(max-width: 480px)":{paddingInline:nt.spacing.md,paddingBottom:nt.spacing.md}}),children:[_e("div",{className:at.create("expiry-notice",{backgroundColor:nt.colors.accent,padding:"14px 18px",borderRadius:nt.radius.default,borderLeft:`4px solid ${nt.colors.primary}`}),children:_e("p",{className:at.create("expiry-text",{margin:"0",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:["This payment link expires on ",_e("strong",{children:Y.toLocaleDateString()})]})}),q&&B&&_e("div",{children:[_e("h3",{className:at.create("section-title",{marginTop:"0",marginBottom:nt.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground}),children:"Select Your Excess Amount"}),_e("div",{className:at.create("calculation-options",{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:nt.spacing.md},{"(max-width: 480px)":{gridTemplateColumns:"1fr"}}),children:F.map(e=>{const t=e.id||e.calculation_id,n=_===t;return _e("div",{className:at.create(`calc-option-${t}`,{padding:nt.spacing.md,border:`2px solid ${n?nt.colors.primary:nt.colors.border}`,borderRadius:nt.radius.default,cursor:"pointer",backgroundColor:n?nt.colors.accent:nt.colors.card,transition:"all 0.2s ease",position:"relative",boxShadow:n?nt.shadow.sm:"none"}),onClick:()=>E(t),children:[_e("div",{className:at.create("excess-amount",{fontSize:"1.5rem",fontWeight:"700",color:nt.colors.primary,marginBottom:"4px"}),children:["$",Number(e.excess_amount).toFixed(0)]}),_e("div",{className:at.create("excess-label",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,marginBottom:nt.spacing.sm}),children:"Excess"}),_e("div",{className:at.create("premium",{fontSize:"1.125rem",fontWeight:"600",color:nt.colors.foreground}),children:["$",Number(e.premium_payable).toFixed(2)]}),_e("div",{className:at.create("premium-label",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground}),children:"Annual Premium"}),n&&_e("div",{className:at.create("selected-badge",{position:"absolute",top:"10px",right:"10px",width:"24px",height:"24px",borderRadius:"50%",backgroundColor:nt.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",color:nt.colors.primaryForeground}),children:_e("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"✓"})})]},t)})})]}),q&&!B&&H&&_e("div",{className:at.create("coverage-details",{backgroundColor:nt.colors.accent,padding:nt.spacing.md,borderRadius:nt.radius.default,border:`1px solid ${nt.colors.border}`}),children:[_e("h3",{className:at.create("section-title",{marginTop:"0",marginBottom:nt.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground}),children:"Coverage Details"}),_e("div",{className:at.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[_e("span",{className:at.create("detail-label",{fontSize:nt.fontSize.default,color:nt.colors.mutedForeground}),children:"Excess Amount:"}),_e("strong",{className:at.create("detail-value",{fontSize:nt.fontSize.large,color:nt.colors.foreground}),children:["$",Number(H.excess_amount).toFixed(2)]})]})]}),p.length>0&&_e("div",{children:[_e("h3",{className:at.create("section-title",{marginTop:"0",marginBottom:nt.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground}),children:"Select Payment Method"}),_e("div",{className:at.create("gateway-options",{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:nt.spacing.md}),children:p.map(e=>{const t=C===e.id,n=f.find(t=>t.gateway_id===e.id&&t.calculation_id===_);return _e("div",{className:at.create(`gateway-option-${e.id}`,{padding:nt.spacing.md,border:`2px solid ${t?nt.colors.primary:nt.colors.border}`,borderRadius:nt.radius.default,cursor:"pointer",backgroundColor:t?nt.colors.accent:nt.colors.card,transition:"all 0.2s ease",position:"relative",boxShadow:t?nt.shadow.sm:"none"}),onClick:()=>T(e.id),children:[_e("div",{className:at.create("gateway-name",{fontSize:"1.125rem",fontWeight:"700",color:nt.colors.primary,marginBottom:"4px"}),children:e.name}),_e("div",{className:at.create("gateway-description",{fontSize:nt.fontSize.small,color:nt.colors.mutedForeground,marginBottom:nt.spacing.sm}),children:["windcave"===e.code&&"Pay in full","redplanet"===e.code&&n&&`$${Number(n.amount.installmentAmount).toFixed(2)}/month`,"redplanet"===e.code&&!n&&"Monthly installments"]}),n&&"redplanet"===e.code&&_e("div",{className:at.create("installment-details",{fontSize:nt.fontSize.small,color:nt.colors.foreground}),children:[n.amount.numberOfInstallments," payments"]}),t&&_e("div",{className:at.create("selected-badge",{position:"absolute",top:"10px",right:"10px",width:"24px",height:"24px",borderRadius:"50%",backgroundColor:nt.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",color:nt.colors.primaryForeground}),children:_e("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"✓"})})]},e.id)})})]}),C&&_&&(()=>{const e=p.find(e=>e.id===C),t=f.find(e=>e.gateway_id===C&&e.calculation_id===_);return"redplanet"===(null==e?void 0:e.code)&&t?_e("div",{className:at.create("payment-method-breakdown",{backgroundColor:nt.colors.accent,padding:nt.spacing.md,borderRadius:nt.radius.default,border:`1px solid ${nt.colors.border}`}),children:[_e("h3",{className:at.create("section-title",{marginTop:"0",marginBottom:nt.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground}),children:"Payment Plan Details"}),_e("div",{className:at.create("payment-breakdown-items",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:[_e("div",{className:at.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{className:at.create("breakdown-label",{color:nt.colors.mutedForeground}),children:"Due Today:"}),_e("span",{className:at.create("breakdown-value",{fontWeight:"600",fontSize:nt.fontSize.large}),children:["$",Number(t.amount.dueToday||0).toFixed(2)]})]}),t.amount.installmentAmount&&_e("div",{className:at.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{className:at.create("breakdown-label",{color:nt.colors.mutedForeground}),children:"Then Monthly:"}),_e("span",{className:at.create("breakdown-value",{fontWeight:"500"}),children:["$",Number(t.amount.installmentAmount).toFixed(2)]})]}),t.amount.numberOfInstallments&&_e("div",{className:at.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{className:at.create("breakdown-label",{color:nt.colors.mutedForeground}),children:"Number of Payments:"}),_e("span",{className:at.create("breakdown-value",{fontWeight:"500"}),children:t.amount.numberOfInstallments})]}),t.amount.totalRepayable&&_e("div",{className:at.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:nt.fontSize.default,color:nt.colors.foreground,paddingTop:nt.spacing.sm,marginTop:nt.spacing.sm,borderTop:`1px solid ${nt.colors.border}`}),children:[_e("span",{className:at.create("breakdown-label",{fontWeight:"600"}),children:"Total Payable:"}),_e("span",{className:at.create("breakdown-value",{fontWeight:"600",color:nt.colors.primary}),children:["$",Number(t.amount.totalRepayable).toFixed(2)]})]})]})]}):null})(),_e("div",{className:at.create("amount-breakdown",{backgroundColor:nt.colors.accent,padding:nt.spacing.md,borderRadius:nt.radius.default,border:`1px solid ${nt.colors.border}`}),children:[_e("h3",{className:at.create("section-title",{marginTop:"0",marginBottom:nt.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:nt.colors.foreground}),children:q?"Premium Breakdown":"Payment Details"}),_e(k,q&&H?{children:[_e("div",{className:at.create("detail-row",{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{children:"Premium (excluding fees):"}),_e("span",{children:["$",Number(H.premium_subtotal).toFixed(2)]})]}),null===(c=null===(a=H.result)||void 0===a?void 0:a.fees)||void 0===c?void 0:c.map((e,t)=>_e("div",{className:at.create(`fee-row-${t}`,{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{children:[e.name,":"]}),_e("span",{children:["$",Number(e.amount).toFixed(2)]})]},t))]}:{children:null===(l=d.snapshot_data.line_items)||void 0===l?void 0:l.map((e,t)=>_e("div",{className:at.create(`line-item-${t}`,{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:nt.fontSize.default,color:nt.colors.foreground}),children:[_e("span",{children:[e.name,":"]}),_e("span",{children:["$",Number(e.amount).toFixed(2)]})]},t))}),_e("div",{className:at.create("total-row",{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:nt.spacing.md,paddingTop:nt.spacing.md,borderTop:`2px solid ${nt.colors.border}`}),children:[_e("span",{className:at.create("total-label",{fontSize:"1.125rem",fontWeight:"600",color:nt.colors.foreground}),children:q?"Total Premium:":"Total Amount:"}),_e("span",{className:at.create("total-amount",{fontSize:"1.5rem",fontWeight:"700",color:nt.colors.primary}),children:["$",Number(G).toFixed(2)]})]})]}),_e("div",{className:at.create("important-notice",{backgroundColor:nt.colors.accent,padding:nt.spacing.md,borderRadius:nt.radius.default,borderLeft:`4px solid ${nt.colors.primary}`}),children:_e("p",{className:at.create("notice-text",{margin:"0",fontSize:nt.fontSize.default,color:nt.colors.foreground,lineHeight:"1.6"}),children:[_e("strong",{children:"Please note:"})," The amounts shown are fixed at the time the quote was generated. If you need to make changes to your coverage, please request a new quote."]})}),_e(Lo,{onClick:()=>{if(!d)return;if(!_)return void alert("Please select an excess amount before proceeding.");if(!C)return void alert("Please select a payment method before proceeding.");const e="quote"===d.payment_type||"renewal"===d.payment_type;let t=null;if(d.snapshot_data.calculations&&(t=d.snapshot_data.calculations.find(e=>(e.id||e.calculation_id)===_)),e&&!t)return void alert("Payment configuration error. Please try again.");const n=p.find(e=>e.id===C);if(!n)return void alert("Payment method not available. Please try again.");const r=d.snapshot_data.form_data||{};let i="Customer";if(r.page_data)for(const e in r.page_data){const t=r.page_data[e];if(t&&"object"==typeof t){if(t.client_first_name){i=`${t.client_first_name} ${t.client_last_name||""}`.trim();break}if(t.client_name){i=t.client_name;break}if(t.full_name){i=t.full_name;break}if(t.name){i=t.name;break}if(t.first_name){i=`${t.first_name} ${t.last_name||""}`.trim();break}}}const o=d.quote_intent_id;if(!o)return void alert("No quote found.");const s=_,a={quoteIntentId:o,excessId:t.excess_id||"",gatewayId:C,calculationId:s,clientDetails:{legalName:i},metadata:{payment_link_id:d.id,payment_type:d.payment_type,gateway:n}};$(a),S(!0)},className:at.create("payment-button",{width:"100%",padding:"18px",fontSize:"1.125rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1rem",padding:"16px"}}),children:["Proceed to Payment - $",Number(G).toFixed(2)]})]})]}),x&&N&&_e(Ko,{isOpen:x,onClose:()=>{S(!1),$(null)},onSuccess:()=>{S(!1),$(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},paymentRequest:N,httpClient:u})]})})}function Cs(){const e=vt(),{paymentLinkConfig:t}=e;if(t)return _e(Es,{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl});const n=window.location.pathname.match(/\/pay\/([a-f0-9-]+)/);if(n&&n[1])return _e(Es,{paymentLinkId:n[1],signedUrl:window.location.href});const{isCalculating:r,results:i,quoteIntent:o}=wt(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent()})),s="paid"===(null==o?void 0:o.status)||"completed"===(null==o?void 0:o.status);return r?_e(Ao,{message:"Processing your quote, please wait..."}):s?_e($s,{}):i?_e(rs,{results:i}):_e(Ns,{})}function Ts(e){return _e(yt,{...e,children:_e(Cs,{})})}_s.loadedThemes=new Set,_s.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"};class Is extends S{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return fd}).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=re("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return le(e)?_e(qo,{message:e.message}):_e(Wo,{error:e})}return this.props.children}}function Ms({config:t,initializeFormContext:n}){const[r,i]=qe({type:"loading",message:"Loading application..."});return Fe(()=>{(async()=>{try{e();const r=await n(t);if("payment"!==t.mode&&(!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?re("maintenance",t):re("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),_e(Is,{children:_e("div",{className:at.create("root",{fontFamily:nt.fontFamily,backgroundColor:nt.colors.background,minHeight:"100vh",color:nt.colors.foreground}),children:function(){switch(r.type){case"loading":return _e(Ao,{message:r.message});case"error":return le(r.error)?_e(qo,{message:r.error.message}):_e(Wo,{error:r.error});case"success":return _e(Ts,{...r.formContextProps});default:return _e(Wo,{})}}()})})}const Ps="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ds=globalThis,Rs="10.17.0";function Os(){return js(Ds),Ds}function js(e){const t=e.oe=e.oe||{};return t.version=t.version||Rs,t[Rs]=t[Rs]||{}}function zs(e,t,n=Ds){const r=n.oe=n.oe||{},i=r[Rs]=r[Rs]||{};return i[e]||(i[e]=t())}const As=["debug","info","warn","error","log","assert","trace"],Ls={};function Ws(e){if(!("console"in Ds))return e();const t=Ds.console,n={},r=Object.keys(Ls);r.forEach(e=>{const r=Ls[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function qs(){return Bs().enabled}function Fs(e,...t){Ps&&qs()&&Ws(()=>{Ds.console[e](`Sentry Logger [${e}]:`,...t)})}function Bs(){return Ps?zs("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Hs=function(){Bs().enabled=!0},Us=function(...e){Fs("log",...e)},Zs=function(...e){Fs("warn",...e)},Gs=function(...e){Fs("error",...e)},Ys="?",Js=/\(error: (.*)\)/,Vs=/captureMessage|captureException/;function Qs(...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=Js.test(n)?n.replace(Js,"$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(Xs(t).function||"")&&t.pop(),t.reverse(),Vs.test(Xs(t).function||"")&&(t.pop(),Vs.test(Xs(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Xs(t).filename,function:e.function||Ys}))}(i.slice(r))}}function Xs(e){return e[e.length-1]||{}}const Ks="<anonymous>";function ea(e){try{return e&&"function"==typeof e&&e.name||Ks}catch{return Ks}}function ta(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 na={},ra={};function ia(e,t){na[e]=na[e]||[],na[e].push(t)}function oa(e,t){if(!ra[e]){ra[e]=!0;try{t()}catch(t){Ps&&Gs(`Error while instrumenting ${e}`,t)}}}function sa(e,t){const n=e&&na[e];if(n)for(const r of n)try{r(t)}catch(t){Ps&&Gs(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ea(r)}\nError:`,t)}}let aa=null;function ca(){aa=Ds.onerror,Ds.onerror=function(e,t,n,r,i){return sa("error",{column:r,error:i,line:n,msg:e,url:t}),!!aa&&aa.apply(this,arguments)},Ds.onerror.se=!0}let la=null;function ua(){la=Ds.onunhandledrejection,Ds.onunhandledrejection=function(e){return sa("unhandledrejection",e),!la||la.apply(this,arguments)},Ds.onunhandledrejection.se=!0}const da={}.toString;function ha(e){switch(da.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ka(e,Error)}}function fa(e,t){return da.call(e)===`[object ${t}]`}function ma(e){return fa(e,"ErrorEvent")}function pa(e){return fa(e,"DOMError")}function ga(e){return fa(e,"String")}function ya(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function va(e){return null===e||ya(e)||"object"!=typeof e&&"function"!=typeof e}function wa(e){return fa(e,"Object")}function ba(e){return"undefined"!=typeof Event&&ka(e,Event)}function xa(e){return Boolean(e?.then&&"function"==typeof e.then)}function ka(e,t){try{return e instanceof t}catch{return!1}}function Sa(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const Na=Ds;function $a(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=_a(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 _a(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Na.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&&ga(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 Ea(){try{return Na.document.location.href}catch{return""}}function Ca(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ta(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Sa(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ia(e,t,n=!1){return!!ga(e)&&(fa(t,"RegExp")?t.test(e):!!ga(t)&&(n?e===t:e.includes(t)))}function Ma(e,t=[],n=!1){return t.some(t=>Ia(e,t,n))}function Pa(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Ra(i,r);try{e[t]=i}catch{Ps&&Us(`Failed to replace method "${t}" in object`,e)}}function Da(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Ps&&Us(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ra(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Da(e,"__sentry_original__",t)}catch{}}function Oa(e){return e.de}function ja(e){if(ha(e))return{message:e.message,name:e.name,stack:e.stack,...Aa(e)};if(ba(e)){const t={type:e.type,target:za(e.target),currentTarget:za(e.currentTarget),...Aa(e)};return"undefined"!=typeof CustomEvent&&ka(e,CustomEvent)&&(t.detail=e.detail),t}return e}function za(e){try{return"undefined"!=typeof Element&&ka(e,Element)?$a(e):{}.toString.call(e)}catch{return"<unknown>"}}function Aa(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 La(e=function(){const e=Ds;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 Wa(e){return e.exception?.values?.[0]}function qa(e){const{message:t,event_id:n}=e;if(t)return t;const r=Wa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Fa(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 Ba(e,t){const n=Wa(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 Ha(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Da(e,"__sentry_captured__",!0)}catch{}return!1}function Ua(){return Date.now()/1e3}let Za;function Ga(){return(Za??(Za=function(){const{performance:e}=Ds;if(!e?.now||!e.timeOrigin)return Ua;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function Ya(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||Ga(),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:La()),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 Ja(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]=Ja(r[e],t[e],n-1));return r}function Va(){return La()}function Qa(){return La().substring(16)}const Xa="_sentrySpan";function Ka(e,t){t?Da(e,Xa,t):delete e[Xa]}function ec(e){return e[Xa]}class tc{constructor(){this.fe=!1,this.me=[],this.pe=[],this.ge=[],this.ye=[],this.ve={},this.we={},this.be={},this.xe={},this.ke={},this.Se={traceId:Va(),sampleRand:Math.random()}}clone(){const e=new tc;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.Ee=this.Ee,e.pe=[...this.pe],e.ye=[...this.ye],e.ke={...this.ke},e.Se={...this.Se},e.Ce=this.Ce,e.Te=this.Te,Ka(e,ec(this)),e}setClient(e){this.Ce=e}setLastEventId(e){this.Te=e}getClient(){return this.Ce}lastEventId(){return this.Te}addScopeListener(e){this.me.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&&Ya(this.$e,{user:e}),this.Ie(),this}getUser(){return this.ve}setTags(e){return this.we={...this.we,...e},this.Ie(),this}setTag(e,t){return this.we={...this.we,[e]:t},this.Ie(),this}setExtras(e){return this.be={...this.be,...e},this.Ie(),this}setExtra(e,t){return this.be={...this.be,[e]:t},this.Ie(),this}setFingerprint(e){return this.Ee=e,this.Ie(),this}setLevel(e){return this.Ne=e,this.Ie(),this}setTransactionName(e){return this._e=e,this.Ie(),this}setContext(e,t){return null===t?delete this.xe[e]:this.xe[e]=t,this.Ie(),this}setSession(e){return e?this.$e=e:delete this.$e,this.Ie(),this}getSession(){return this.$e}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof tc?t.getScopeData():wa(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.Ee=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.Ee=void 0,this.$e=void 0,Ka(this,void 0),this.ye=[],this.setPropagationContext({traceId:Va(),sampleRand:Math.random()}),this.Ie(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Ua(),...e,message:e.message?Ca(e.message,2048):e.message};return this.ge.push(r),this.ge.length>n&&(this.ge=this.ge.slice(-n),this.Ce?.recordDroppedEvent("buffer_overflow","log_item")),this.Ie(),this}getLastBreadcrumb(){return this.ge[this.ge.length-1]}clearBreadcrumbs(){return this.ge=[],this.Ie(),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.Ee||[],eventProcessors:this.pe,propagationContext:this.Se,sdkProcessingMetadata:this.ke,transactionName:this._e,span:ec(this)}}setSDKProcessingMetadata(e){return this.ke=Ja(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||La();if(!this.Ce)return Ps&&Zs("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ce.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||La();if(!this.Ce)return Ps&&Zs("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this.Ce.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||La();return this.Ce?(this.Ce.captureEvent(e,{...t,event_id:n},this),n):(Ps&&Zs("No client configured on scope - will not capture event!"),n)}Ie(){this.fe||(this.fe=!0,this.me.forEach(e=>{e(this)}),this.fe=!1)}}class nc{constructor(e,t){let n,r;n=e||new tc,r=t||new tc,this.Me=[{scope:n}],this.Pe=r}withScope(e){const t=this.De();let n;try{n=e(t)}catch(e){throw this.Re(),e}return xa(n)?n.then(e=>(this.Re(),e),e=>{throw this.Re(),e}):(this.Re(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Pe}getStackTop(){return this.Me[this.Me.length-1]}De(){const e=this.getScope().clone();return this.Me.push({client:this.getClient(),scope:e}),e}Re(){return!(this.Me.length<=1||!this.Me.pop())}}function rc(){const e=js(Os());return e.stack=e.stack||new nc(zs("defaultCurrentScope",()=>new tc),zs("defaultIsolationScope",()=>new tc))}function ic(e){return rc().withScope(e)}function oc(e,t){const n=rc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function sc(e){return rc().withScope(()=>e(rc().getIsolationScope()))}function ac(e){const t=js(e);return t.acs?t.acs:{withIsolationScope:sc,withScope:ic,withSetScope:oc,withSetIsolationScope:(e,t)=>sc(t),getCurrentScope:()=>rc().getScope(),getIsolationScope:()=>rc().getIsolationScope()}}function cc(){return ac(Os()).getCurrentScope()}function lc(){return ac(Os()).getIsolationScope()}function uc(...e){const t=ac(Os());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function dc(){return cc().getClient()}function hc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||Qa()};return r&&(o.parent_span_id=r),o}const fc="sentry.profile_id",mc="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 gc(e){const t=e;return{scope:t.Oe,isolationScope:pc(t.je)}}const yc=/^sentry-/;function vc(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 wc=/^o(\d+)\./,bc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function xc(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 kc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Sc(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(wc);return t?.[1]}(n)),r}let Nc=!1;function $c(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Tc(e).parent_span_id,o=gc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||Qa():t,trace_id:n}}function _c(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 Ec(e){return"number"==typeof e?Cc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Cc(e.getTime()):Ga()}function Cc(e){return e>9999999999?e/1e3:e}function Tc(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:Ec(i),timestamp:Ec(s)||void 0,status:Ic(a),op:r["sentry.op"],origin:r["sentry.origin"],links:_c(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ic(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Mc(e){return e.ze||e}function Pc(){Nc||(Ws(()=>{}),Nc=!0)}function Dc(e){Us(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Rc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(jc(n)){if(Ia(e.description,n))return Ps&&Dc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Ia(e.description,n.name),r=!n.op||e.op&&Ia(e.op,n.op);if(t&&r)return Ps&&Dc(e),!0}return!1}function Oc(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 jc(e){return"string"==typeof e||e instanceof RegExp}const zc="production";function Ac(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||zc,release:n.release,public_key:r,trace_id:e,org_id:Sc(t)};return t.emit("createDsc",i),i}function Lc(e){const t=dc();if(!t)return{};const n=Mc(e),r=Tc(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&&(ga(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=vc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):vc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(yc)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Ac(e.spanContext().traceId,t),h=i["sentry.source"],f=r.description;return"url"!==h&&f&&(d.transaction=f),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=dc()?.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")??gc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function Wc(e,t=100,n=1/0){try{return Fc("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function qc(e,t=3,n=102400){const r=Wc(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?qc(e,t-1,n):r;var i}function Fc(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.Le)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(Sa(t))return"[VueViewModel]";if(wa(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${ea(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.We)return t;const c="number"==typeof t.qe?t.qe:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const l=t;if(l&&"function"==typeof l.toJSON)try{return Fc("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=ja(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]=Fc(e,t,c-1,r,i),d++}return s(t),u}function Bc(e,t=[]){return[e,t]}function Hc(e,t){const[n,r]=e;return[n,[...r,t]]}function Uc(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function Zc(e){const t=js(Ds);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function Gc(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[Zc(r),e]:r.push("string"==typeof e?Zc(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(Wc(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 Yc(e){const t="string"==typeof e.data?Zc(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Jc={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 Vc(e){return Jc[e]}function Qc(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Xc(e){return new el(t=>{t(e)})}function Kc(e){return new el((t,n)=>{n(e)})}class el{constructor(e){this.Fe=0,this.Be=[],this.He(e)}then(e,t){return new el((n,r)=>{this.Be.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 el((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.Be.slice();this.Be=[],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&&(xa(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 tl(e,t,n,r=0){try{const i=nl(t,n,e,r);return xa(i)?i:Xc(i)}catch(e){return Kc(e)}}function nl(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Ps&&null===o&&Us(`Event processor "${i.id||"?"}" dropped event`),xa(o)?o.then(e=>nl(e,t,n,r+1)):nl(o,t,n,r+1)}function rl(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:f,span:m}=t;il(e,"extra",n),il(e,"tags",r),il(e,"user",i),il(e,"contexts",o),e.sdkProcessingMetadata=Ja(e.sdkProcessingMetadata,a,2),s&&(e.level=s),f&&(e.transactionName=f),m&&(e.span=m),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 il(e,t,n){e[t]=Ja(e[t],n,1)}let ol,sl,al;function cl(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||La(),timestamp:t.timestamp||Ua()},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||zc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=Ca(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=Ds.Ge;if(!t)return{};const n=Object.keys(t);return al&&n.length===sl||(sl=n.length,al=n.reduce((n,r)=>{ol||(ol={});const i=ol[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,ol[r]=[s,a];break}}}return n},{})),al}(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 tc;return n.update(t),n}(r,n.captureContext);n.mechanism&&Ba(c,n.mechanism);const d=i?i.getEventProcessors():[],h=zs("globalScope",()=>new tc).getScopeData();o&&rl(h,o.getScopeData()),u&&rl(h,u.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),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:$c(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Lc(t),...e.sdkProcessingMetadata};const n=Tc(Mc(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),tl([...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:Wc(e.data,t,n)}}))},...e.user&&{user:Wc(e.user,t,n)},...e.contexts&&{contexts:Wc(e.contexts,t,n)},...e.extra&&{extra:Wc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Wc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Wc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Wc(e.contexts.flags,3,n)),r}(e,s,a):e))}function ll(e){return cc().captureException(e,void 0)}function ul(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return cc().captureMessage(e,n,r)}function dl(e,t){return cc().captureEvent(e,t)}function hl(e){const t=lc(),n=cc(),{userAgent:r}=Ds.navigator||{},i=function(e){const t=Ga(),n={sid:La(),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&&Ya(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&Ya(o,{status:"exited"}),fl(),t.setSession(i),i}function fl(){const e=lc(),t=cc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),Ya(e,t)}(t),ml(),e.setSession()}function ml(){const e=lc(),t=dc(),n=e.getSession();n&&t&&t.captureSession(n)}function pl(e=!1){e?fl():ml()}const gl=[];function yl(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 vl(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function wl(e,t,n){if(n[t.name])Ps&&Us(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===gl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),gl.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)}Ps&&Us(`Integration installed: ${t.name}`)}}function bl(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 xl="Not capturing exception because it's already been captured.",kl="Discarded session because of missing or non-string release",Sl=Symbol.for("SentryInternalError"),Nl=Symbol.for("SentryDoNotSendEventError");function $l(e){return{message:e,[Sl]:!0}}function _l(e){return{message:e,[Nl]:!0}}function El(e){return!!e&&"object"==typeof e&&Sl in e}function Cl(e){return!!e&&"object"==typeof e&&Nl in e}class Tl{constructor(e){if(this.Ye=e,this.Je={},this.Ve=0,this.Qe={},this.Xe={},this.pe=[],e.dsn?this.Ke=function(e){const t="string"==typeof e?function(e){const t=bc.exec(e);if(!t)return void Ws(()=>{});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 kc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):kc(e);if(t&&function(e){if(!Ps)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Gs(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Gs(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Gs(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Gs(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Ps&&Zs("No DSN provided, client will not send events."),this.Ke){const i=(t=this.Ke,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.Ye.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r}captureException(e,t,n){const r=La();if(Ha(e))return Ps&&Us(xl),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:La(),...n},o=ya(e)?e:String(e),s=va(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=La();if(t?.originalException&&Ha(t.originalException))return Ps&&Us(xl),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),Ya(e,{init:!1})}getDsn(){return this.Ke}getOptions(){return this.Ye}getSdkMetadata(){return this.Ye.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.Ye.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.ct()}getIntegrationByName(e){return this.Je[e]}addIntegration(e){const t=this.Je[e.name];wl(this,e,this.Je),t||vl(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=Qc(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:xc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,Bc(s,[[{type:o},e]])}(e,this.Ke,this.Ye.et,this.Ye.tunnel);for(const e of t.attachments||[])n=Hc(n,Yc(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=zc}=this.Ye;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Ps&&Zs(kl));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Ps&&Zs(kl));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=Qc(n);return Bc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:xc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.Ke,this.Ye.et,this.Ye.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ye.sendClientReports){const r=`${e}:${t}`;Ps&&Us(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.Qe[r]=(this.Qe[r]||0)+n}}on(e,t){const n=this.Xe[e]=this.Xe[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.Xe[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 Ps&&Gs("Error while sending envelope:",e),{}}return Ps&&Gs("Transport disabled"),{}}ct(){const{integrations:e}=this.Ye;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&wl(e,t,n)}),n}(this,e),vl(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)&&(Ya(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.Ve)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),cl(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:hc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Ac(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=cc(),r=lc()){return Ps&&Il(e)&&Us(`Captured error event \`${bl(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{Ps&&(Cl(e)?Us(e.message):El(e)?Zs(e.message):Zs(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Ml(e),a=Il(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"),Kc(_l(`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),_l("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(Il(c)&&i)return i(c,r);if(Ml(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?.[fc],exclusive_time:s?.[mc],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Rc(t,a))return null;if(s){const e=s(t);e?c=Ja(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&&{[fc]:l.profile_id},...l.exclusive_time&&{[mc]:l.exclusive_time}}}},measurements:l.measurements}):Pc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Rc(e,a))Oc(n,e);else if(s){const n=s(e);n?t.push(n):(Pc(),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(xa(e))return e.then(e=>{if(!wa(e)&&null!==e)throw $l(n);return e},e=>{throw $l(`${t} rejected with ${e}`)});if(!wa(e)&&null!==e)throw $l(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 _l(`${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(Cl(e)||El(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),$l(`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.Ve++,e.then(e=>(this.Ve--,e),e=>(this.Ve--,e))}gt(){const e=this.Qe;return this.Qe={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}yt(){Ps&&Us("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(Ps&&Us("No outcomes to send"));if(!this.Ke)return void(Ps&&Us("No dsn provided, will not send outcomes"));Ps&&Us("Sending outcomes:",e);const t=(n=e,Bc((r=this.Ye.tunnel&&xc(this.Ke))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Ua(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Il(e){return void 0===e.type}function Ml(e){return"transaction"===e.type}function Pl(e){const t=function(e){return Dl().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=xc(r)),Bc(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());Dl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Dl(){return zs("clientToLogBufferMap",()=>new WeakMap)}const Rl=Symbol.for("SentryBufferFullError");function Ol(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 Kc(Rl);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return Xc(!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(Uc(i,(t,n)=>{const i=Vc(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=Bc(i[0],o),a=t=>{Uc(s,(n,r)=>{e.recordDroppedEvent(t,Vc(r))})};return n.add(()=>t({body:Gc(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ps&&Zs(`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"),Ps&&Gs("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Rl)return Ps&&Gs("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function jl(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 zl(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 Al=100;function Ll(e,t){const n=dc(),r=lc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Al}=n.getOptions();if(o<=0)return;const s={timestamp:Ua(),...e},a=i?Ws(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let Wl;const ql=new WeakMap,Fl=()=>({name:"FunctionToString",setupOnce(){Wl=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Oa(this),n=ql.has(dc())&&void 0!==t?t:this;return Wl.apply(n,e)}}catch{}},setup(e){ql.set(e,!0)}}),Bl=[/^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$/],Hl=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=Zl(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=Zl(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&&Ma(n,t)}(e,t.ignoreTransactions))return Ps&&Zs(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${qa(e)}`),!0}else{if(function(e,t){return!!t?.length&&bl(e).some(e=>Ma(e,t))}(e,t.ignoreErrors))return Ps&&Zs(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${qa(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 Ps&&Zs(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${qa(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Gl(e);return!!n&&Ma(n,t)}(e,t.denyUrls))return Ps&&Zs(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${qa(e)}.\nUrl: ${Gl(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Gl(e);return!n||Ma(n,t)}(e,t.allowUrls))return Ps&&Zs(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${qa(e)}.\nUrl: ${Gl(e)}`),!0}return!1}(n,t)?null:n}}},Ul=(e={})=>({...Hl(e),name:"InboundFilters"});function Zl(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Bl],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Gl(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 Ps&&Gs(`Cannot extract url for event ${qa(e)}`),null}}function Yl(e,t,n,r,i,o){if(!i.exception?.values||!o||!ka(o.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Jl(e,t,r,o.originalException,n,i.exception.values,s,0))}function Jl(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(ka(r[i],Error)){Vl(s,a);const o=e(t,r[i]),l=c.length;Ql(o,i,l,a),c=Jl(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(ka(r,Error)){Vl(s,a);const l=e(t,r),u=c.length;Ql(l,`errors[${o}]`,u,a),c=Jl(e,t,n,r,i,[l,...c],l,u)}}),c}function Vl(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Ql(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Xl(){"console"in Ds&&As.forEach(function(e){e in Ds.console&&Pa(Ds.console,e,function(t){return Ls[e]=t,function(...t){sa("console",{args:t,level:e});const n=Ls[e];n?.apply(Ds.console,t)}})})}const Kl=()=>{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&&(!!tu(e,t)&&!!eu(e,t))))}(e,t)||!!function(e,t){const n=nu(t),r=nu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!tu(e,t)&&!!eu(e,t)))}(e,t))}(t,e))return Ps&&Zs("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function eu(e,t){let n=ta(e),r=ta(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 tu(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 nu(e){return e.exception?.values?.[0]}function ru(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const iu=Ds;function ou(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function su(e,t){const n="fetch";ia(n,e),oa(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in iu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(ou(iu.fetch))return!0;let e=!1;const t=iu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=ou(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Ps&&Zs("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Pa(Ds,"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:cu(t),method:au(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:cu(t),method:au(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*Ga(),virtualError:n,headers:lu(t)};return sa("fetch",{...o}),e.apply(Ds,t).then(async e=>(sa("fetch",{...o,endTimestamp:1e3*Ga(),response:e}),e),e=>{if(sa("fetch",{...o,endTimestamp:1e3*Ga(),error:e}),ha(e)&&void 0===e.stack&&(e.stack=n.stack,Da(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 au(e,t){return!!e&&"object"==typeof e&&!!e[t]}function cu(e){return"string"==typeof e?e:e?au(e,"url")?e.url:e.toString?e.toString():"":""}function lu(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&&ka(t,Request))return new Headers(t.headers)}catch{}}const uu=Ds;let du=0;function hu(){return du>0}function fu(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(Oa(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>fu(e,t));return e.apply(this,r)}catch(e){throw du++,setTimeout(()=>{du--}),uc(r=>{r.addEventProcessor(e=>(t.mechanism&&(Fa(e,void 0),Ba(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),ll(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Ra(n,e),Da(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function mu(e,t){const n=gu(e,t),r={type:wu(t),value:bu(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:[mu(e,t)]}}}function gu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&yu.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 yu=/Minified React error #\d+;/i;function vu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function wu(e){const t=e?.name;return!t&&vu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function bu(e){const t=e?.message;return vu(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 xu(e,t,n,r,i){let o;if(ma(t)&&t.error)return pu(e,t.error);if(pa(t)||fa(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=ku(e,s,n,r),Fa(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ha(t)?pu(e,t):wa(t)||ba(t)?(o=function(e,t,n,r){const i=dc(),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:qc(t,o)};if(s)return{exception:{values:[mu(e,s)]},extra:a};const c={exception:{values:[{type:ba(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Su(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=gu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),Ba(o,{synthetic:!0}),o):(o=ku(e,t,n,r),Fa(o,`${t}`),Ba(o,{synthetic:!0}),o)}function ku(e,t,n,r){const i={};if(r&&n){const r=gu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),Ba(i,{synthetic:!0})}if(ya(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Su(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(ja(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return Ca(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:Ca(r,t)}return""}(e),r=t?"promise rejection":"exception";return ma(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:ba(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 Nu extends Tl{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:uu.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:Rs})),version:Rs}),e.et=i}(t,"browser",["browser"],uu.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.Ye;uu.document&&(i||o)&&uu.document.addEventListener("visibilitychange",()=>{"hidden"===uu.document.visibilityState&&(i&&this.yt(),o&&Pl(this))}),o&&(this.on("flush",()=>{Pl(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{Pl(this)},5e3)})),r&&this.on("beforeSendSession",zl)}eventFromException(e,t){return function(e,t,n,r){const i=xu(e,t,n?.syntheticException||void 0,r);return Ba(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Xc(i)}(this.Ye.stackParser,e,t,this.Ye.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=ku(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Xc(o)}(this.Ye.stackParser,e,t,n,this.Ye.attachStacktrace)}ut(e,t,n,r){return e.platform=e.platform||"javascript",super.ut(e,t,n,r)}}const $u="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,_u=Ds;let Eu,Cu,Tu,Iu;function Mu(){if(!_u.document)return;const e=sa.bind(null,"dom"),t=Pu(e,!0);_u.document.addEventListener("click",t,!1),_u.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=_u,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Pa(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=Pu(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Pa(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 Pu(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;Da(n,"_sentryCaptured",!0),r&&!r.St&&Da(r,"_sentryId",La());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Cu)return!1;try{if(!e.target||e.target.St!==Tu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Cu=n.type,Tu=r?r.St:void 0),clearTimeout(Eu),Eu=_u.setTimeout(()=>{Tu=void 0,Cu=void 0},1e3)}}function Du(e){const t="history";ia(t,e),oa(t,Ru)}function Ru(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Iu,i=function(e){try{return new URL(e,_u.location.origin).toString()}catch{return e}}(String(n));if(Iu=i,r===i)return e.apply(this,t);sa("history",{from:r,to:i})}return e.apply(this,t)}}_u.addEventListener("popstate",()=>{const e=_u.location.href,t=Iu;Iu=e,t!==e&&sa("history",{from:t,to:e})}),"history"in iu&&iu.history&&(Pa(_u.history,"pushState",e),Pa(_u.history,"replaceState",e))}const Ou={},ju="__sentry_xhr_v3__";function zu(){if(!_u.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*Ga(),o=ga(n[0])?n[0].toUpperCase():void 0,s=function(e){if(ga(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[ju]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[ju];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}sa("xhr",{endTimestamp:1e3*Ga(),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[ju];return o&&ga(r)&&ga(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[ju];return r?(void 0!==n[0]&&(r.body=n[0]),sa("xhr",{startTimestamp:1e3*Ga(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Au(e,t=function(e){const t=Ou[e];if(t)return t;let n=_u[e];if(ou(n))return Ou[e]=n.bind(_u);const r=_u.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){$u&&Zs(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Ou[e]=n.bind(_u):n}("fetch")){let n=0,r=0;return Ol(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 Ou.fetch=void 0,e}finally{n-=o,r--}})}function Lu(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?Ys:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Wu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fu=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bu=/at (.+?) ?\(data:(.+?),/,Hu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Uu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zu=Qs([30,e=>{const t=e.match(Bu);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Wu.exec(e);if(n){const[,e,t,r]=n;return Lu(e,Ys,+t,+r)}const r=qu.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=Fu.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Gu(r[1]||Ys,r[2]);return Lu(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=Hu.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Uu.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]||Ys;return[n,e]=Gu(n,e),Lu(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Gu=(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]:Ys,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Yu="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ju=(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";ia(t,e),oa(t,Xl)}(function(e){return function(t){if(dc()!==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:Ta(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ta(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Ll(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(dc()!==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&&(Yu&&Zs(`\`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=$a(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!Na.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}),Ll(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),ia("dom",n),oa("dom",Mu)),t.xhr&&function(e){ia("xhr",e),oa("xhr",zu)}(function(e){return function(t){if(dc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[ju];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:ru(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Ll(d,u)}}(e)),t.fetch&&su(function(e){return function(t){if(dc()!==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),Ll(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:ru(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Ll(a,s)}}}(e)),t.history&&Du(function(e){return function(t){if(dc()!==e)return;let n=t.from,r=t.to;const i=jl(uu.location.href);let o=n?jl(n):void 0;const s=jl(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),Ll({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){dc()===e&&Ll({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:qa(t)},{event:t})}}(e))}}},Vu=["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"],Qu=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Pa(uu,"setTimeout",Xu),t.setInterval&&Pa(uu,"setInterval",Xu),t.requestAnimationFrame&&Pa(uu,"requestAnimationFrame",Ku),t.XMLHttpRequest&&"XMLHttpRequest"in uu&&Pa(XMLHttpRequest.prototype,"send",ed);const e=t.eventTarget;e&&(Array.isArray(e)?e:Vu).forEach(e=>function(e,t){const n=uu,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Pa(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=fu(i.handleEvent,{mechanism:{data:{handler:ea(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,fu(i,{mechanism:{data:{handler:ea(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Pa(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 Xu(e){return function(...t){const n=t[0];return t[0]=fu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ea(e)}`}}),e.apply(this,t)}}function Ku(e){return function(t){return e.apply(this,[fu(t,{mechanism:{data:{handler:ea(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function ed(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Pa(n,e,function(t){const n={mechanism:{data:{handler:ea(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Oa(t);return r&&(n.mechanism.data.handler=ea(r)),fu(t,n)})}),e.apply(this,t)}}const td=(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";ia(t,t=>{const{stackParser:n,attachStacktrace:r}=rd();if(dc()!==e||hu())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(ga(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)??Ea();return 0===c.length&&c.push({colno:l,filename:d,function:Ys,in_app:!0,lineno:u}),e}(xu(n,c||i,void 0,r,!1),o,s,a);l.level="error",dl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),oa(t,ca)}()}(e),nd("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";ia(t,t=>{const{stackParser:n,attachStacktrace:r}=rd();if(dc()!==e||hu())return;const i=function(e){if(va(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),o=va(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:xu(n,i,void 0,r,!0);o.level="error",dl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),oa(t,ua)}()}(e),nd("onunhandledrejection"))}}};function nd(e){Yu&&Us(`Global Handler attached: ${e}`)}function rd(){const e=dc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const id=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){Yl(mu,i.getOptions().stackParser,n,t,e,r)}}};let od=!1;function sd(t){if(od)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===uu.window)return!1;const e=uu;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Ea();return!(uu===uu.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(Yu&&Ws(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||Zu,Array.isArray(r)?Qs(...r):r),integrations:yl({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[Ul(),Fl(),Qu(),Ju(),td(),id(),Kl(),{name:"HttpContext",preprocessEvent(e){if(!uu.navigator&&!uu.location&&!uu.document)return;const t=function(){const e=Ea(),{referrer:t}=uu.document||{},{userAgent:n}=uu.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!==uu.document?(hl({ignoreDuration:!0}),pl(),Du(({from:e,to:t})=>{void 0!==e&&e!==t&&(hl({ignoreDuration:!0}),pl())})):Yu&&Zs("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||Au};var r;!function(e,t){!0===t.debug&&(Ps?Hs():Ws(()=>{})),cc().update(t.initialScope);const n=new e(t);(function(e){cc().setClient(e)})(n),n.init()}(Nu,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:[Ju({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Kl()],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"]}),od=!0,e()}catch(e){}else e()}function ad(t,n){if(od)try{n?uc(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),ll(t)}):ll(t)}catch(t){e()}}function cd(t,n="info",r){if(od)try{r?uc(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),ul(t,n)}):ul(t,n)}catch(t){e()}}function ld(t){if(od)try{!function(e){lc().setUser(e)}(t)}catch(t){e()}}function ud(t){if(od)try{Ll(t)}catch(t){e()}}function dd(t,n){if(od)try{!function(e,t){lc().setTag(e,t)}(t,n)}catch(t){e()}}function hd(){return od}var fd=Object.freeze({__proto__:null,addBreadcrumb:ud,captureException:ad,captureMessage:cd,initializeSentry:sd,isSentryInitialized:hd,setTag:dd,setUser:ld});const md="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",pd="production",gd="insureos-scripts",yd=!0,vd=1,wd=.1;class bd{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 xd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{sd({dsn:md,environment:pd,release:gd,enabled:yd,sampleRate:vd,tracesSampleRate:wd}),this.sentryInitialized=!0,e()}catch(t){e()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode){if(!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'");if(!e.signedUrl)throw new Error("signedUrl is required when mode is 'payment'")}else if(!e.product)throw new Error("product is required when mode is 'quote' or undefined")}initializeAnalyticsOnce(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new bd({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}),he(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=[],R(r,e=r.i=b(k,null,[e]),i||m,m,r.namespaceURI,i?null:r.firstChild?t.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),j(o,e,s)}(b(Ms,{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 H({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 Ne(t)}async initializeFormContext(t){const n=this.createHttpClient(t);if("payment"===t.mode)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl}};const r="sessionStorage"===t.storageType?new Z:new U;r.isAvailable()?e(r.constructor.name):e();const i=new Y(r),o=new J(i),s=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent(t.product);return e(),{id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_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}},a=async r=>{e();const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id"),a=await n.getQuoteIntent(r);let c;if(e(),e(a.cached_result),a.cached_result?(e(),e(a.cached_result.outcome_type)):e(),s&&a.payment_transactions){e();const t=a.payment_transactions.find(e=>e.id===s);if(t){e();let n="unknown";switch(t.status){case"completed":n="success";break;case"failed":n="declined";break;case"cancelled":n="cancelled";break;default:n="error"}c={paymentTransactionId:t.id,paymentStatus:n,transactionStatus:t};const r=new URL(window.location.href);r.searchParams.delete("transaction_id"),r.searchParams.delete("payment_id"),r.searchParams.delete("payment"),r.searchParams.delete("payment_status"),r.searchParams.delete("status"),window.history.replaceState({},"",r.toString())}else e()}const l={id:a.quote_intent.id,url:a.url,calculate_url:a.calculate_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,cached_result:a.cached_result};return e(),c&&i.saveQuoteIntent(t.orgId,l),l};e();const c=`insure_os_quote_intent_${t.orgId}`;localStorage.getItem(c),e(),i.getQuoteIntent(t.orgId),e(),e();let l=null,u=!1;try{const n=i.getQuoteIntent(t.orgId),r=await o.getOrCreateQuoteIntent(t.orgId,s,a);e(),e(r.cached_result),r.cached_result&&e(r.cached_result.outcome_type),l=r,u=!n}catch(n){if(e(),!(n instanceof F&&404===n.statusCode))throw n;e(),o.clearQuoteIntent(t.orgId),l=await o.getOrCreateQuoteIntent(t.orgId,s,a),u=!0}if(u&&l&&me(l),!l)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(e(),localStorage.clear());const d=new ke(l,n,o,{autoSave:l.form_definition.settings.autoSave,autoSaveInterval:l.form_definition.settings.autoSaveInterval});if(l.form_data&&d.restoreFormProgress(l.form_data),e(l.cached_result),l.cached_result?(e(l.cached_result),d.restoreCalculationResult(l.cached_result),e(),e(d.hasCalculationResponse())):e(),l.organisation&&l.organisation.theme)try{await _s.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:l,quoteIntentStore:o,formStateManager:d}}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 kd=new xd;"undefined"!=typeof window&&(window.InsureOS=kd,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");if(n&&r){const t=e.searchParams.get("container"),i=t?document.getElementById(t):document.body;if(i){const e={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await kd.mount(i,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Sd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Sd.instance)return Sd.instance;Sd.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 Sd).startMeasurement(e)}static endMeasurement(e){return(new Sd).endMeasurement(e)}static measureMemoryUsage(){return(new Sd).measureMemoryUsage()}static async measureApiCall(e,t){return(new Sd).measureApiCall(e,t)}static getMetrics(){return(new Sd).getMetrics()}static generateReport(){return(new Sd).generateReport()}}var Nd;exports.VersionStrategy=void 0,(Nd=exports.VersionStrategy||(exports.VersionStrategy={})).FIXED="fixed",Nd.LATEST="latest";let $d=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)}},_d=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new $d(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 $d(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)}},Ed=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new $d(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 Cd=Object.freeze({__proto__:null,Headers:$d,Request:_d,Response:Ed,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new _d(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 $d;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Ed(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 Td{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 Td((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Td?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Td?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 Td(t=>t(e))}static reject(e){return new Td((t,n)=>n(e))}static all(e){return new Td((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 Id=Object.freeze({__proto__:null,PromisePolyfill:Td});class Md{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 Pd=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 Md(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:Md});exports.DataLayerManager=bd,exports.EnhancedHttpClient=H,exports.ErrorHandlingStrategy=class{handleNetworkError(e){return new F(exports.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new F(exports.ErrorType.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(exports.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new F(exports.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new F(exports.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new F(exports.ErrorType.API_ERROR,`Request failed: ${e.statusText}`,t,e.status)}handleStorageError(e){return new F(exports.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(e){switch(e.type){case exports.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case exports.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case exports.ErrorType.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 exports.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case exports.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case exports.ErrorType.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."}}},exports.FormStateManager=ke,exports.InsureOS=kd,exports.InsureOSClient=xd,exports.InsureOSError=F,exports.LocalStateManager=Y,exports.LocalStorageAdapter=U,exports.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},exports.PerformanceMonitor=Sd,exports.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(e){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return Cd});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 Id});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 Pd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},exports.RetryStrategy=B,exports.SessionStorageAdapter=Z,exports.ThemeLoader=_s,exports.addBreadcrumb=ud,exports.captureException=ad,exports.captureMessage=cd,exports.createAppError=re,exports.getAnalytics=function(){return de},exports.getSupportMessage=ue,exports.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},exports.initializeAnalytics=he,exports.initializeSentry=sd,exports.isSentryInitialized=hd,exports.parseServerValidationErrors=K,exports.setTag=dd,exports.setUser=ld,exports.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},exports.shouldShowMaintenancePage=le,exports.trackFormProgress=pe,exports.trackPaymentCompleted=be,exports.trackPaymentFailed=xe,exports.trackPaymentInitiated=we,exports.trackQuoteAtCheckout=ye,exports.trackQuoteCalculated=ge,exports.trackQuoteReferred=ve,exports.trackQuoteStarted=me,exports.validateField=Q,exports.validatePage=X;
|
|
1
|
+
"use strict";const e=()=>{globalThis.insureOSDebug};var t,n,r,i,o,s,a,c,l,u,d,h,f,m={},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),R(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,z(c,r,l),r.v!=s&&$(r)));C.P=0}function E(e,t,n,r,i,o,s,a,c,l,u){var d,h,f,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._=I(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)),W(a,a));return r}(n,t,S,c,$),d=0;d<$;d++)null!=(f=n.i[d])&&(h=-1==f._?m:S[f._]||m,f._=d,w=R(e,f,h,i,o,s,a,c,l,u),g=f.v,f.ref&&h.ref!=f.ref&&(h.ref&&L(h.ref,null,f),u.push(f.ref,f.k||g,f)),null==v&&null!=g&&(v=g),(b=!!(4&f.C))||h.i===f.i?c=T(f,c,e,b):"function"==typeof f.type&&void 0!==w?c=w:g&&(c=g.nextSibling),f.C&=-7);return n.v=v,c}function T(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=T(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 I(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 M(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 P(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||M(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||M(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 D(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 R(e,t,r,i,o,s,a,c,l,u){var d,h,f,m,p,g,b,x,N,$,_,C,T,I,M,P,D,R=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 R)try{if(x=t.props,N="prototype"in R&&R.prototype.render,$=(d=R.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 R(x,_):(t.k=h=new S(x,_),h.constructor=R,h.render=F),$&&$.sub(h),h.props=x,h.state||(h.state={}),h.context=_,h.O=i,f=h.I=!0,h.A=[],h.L=[]),N&&null==h.W&&(h.W=h.state),N&&null!=R.getDerivedStateFromProps&&(h.W==h.state&&(h.W=v({},h.W)),v(h.W,R.getDerivedStateFromProps(x,h.W))),m=h.props,p=h.state,h.N=t,f)N&&null==R.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),N&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(N&&null==R.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,_),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.W,_)||t.N==r.N){for(t.N!=r.N&&(h.props=x,h.state=h.W,h.I=!1),t.v=r.v,t.i=r.i,t.i.some(function(e){e&&(e.m=t)}),C=0;C<h.L.length;C++)h.A.push(h.L[C]);h.L=[],h.A.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.W,_),N&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=_,h.props=x,h.R=e,h.v=!1,T=n.P,I=0,N){for(h.state=h.W,h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),M=0;M<h.L.length;M++)h.A.push(h.L[M]);h.L=[]}else do{h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),h.state=h.W}while(h.I&&++I<25);h.state=h.W,null!=h.getChildContext&&(i=v(v({},i),h.getChildContext())),N&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),P=d,null!=d&&d.type===k&&null==d.key&&(P=j(d.props.children)),c=E(e,y(P)?P:[P],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(D=s.length;D--;)w(s[D]);O(t)}else t.v=r.v,t.i=r.i,e.then||O(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 O(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(O)}function z(e,t,r){for(var i=0;i<r.length;i++)L(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,f,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||m,!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)f=g;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;P(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||P(e,d,g,x[d],s);if(h)l||f&&(h.H==f.H||h.H==e.innerHTML)||(e.innerHTML=h.H),r.i=[];else if(f&&(e.innerHTML=""),E("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])&&P(e,d,v,x[d],s),d="checked",null!=b&&b!=e[d]&&P(e,d,b,x[d],s))}return e}function L(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 W(e,t,r){var i,o;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||L(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&W(i[o],t,r||"function"!=typeof e.type);r||w(e.v),e.k=e.m=e.v=void 0}function F(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.W&&this.W!=this.state?this.W:this.W=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.N&&(t&&this.L.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=D(!1),d=D(!0),h=0,exports.ErrorType=void 0,(f=exports.ErrorType||(exports.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",f.API_ERROR="API_ERROR",f.VALIDATION_ERROR="VALIDATION_ERROR",f.STORAGE_ERROR="STORAGE_ERROR",f.TIMEOUT_ERROR="TIMEOUT_ERROR",f.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class q extends Error{constructor(e,t,n=!1,r,i,o){super(t),this.type=e,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class B{constructor(e){this.config=e}shouldRetry(e,t){return!(t>=this.config.maxRetries)&&this.isRetryableError(e)}getDelay(e,t){if(t){const e=parseInt(t,10);if(!isNaN(e))return 1e3*e}const n=this.config.baseDelay*Math.pow(2,e);return Math.min(n,this.config.maxDelay)}isRetryableError(e){return e instanceof q?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}class H{constructor(e){this.config=e,this.retryStrategy=new B(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 q)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new q(exports.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new q(exports.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}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"})}initiatePayment(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${t.code}/initiate`,method:"POST",body:e})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${t.code}/status/${e}`,method:"GET"})}createPaymentLink(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links`,method:"POST",body:e})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}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 q&&(t.type,t.message)),e(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw e(),n;const o=t instanceof q?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 q(exports.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);if(429===t.status)return new q(exports.ErrorType.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 q(exports.ErrorType.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 q(exports.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.error.details):new q(exports.ErrorType.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 q(exports.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,t.status)}if(400===t.status)try{const e=i;return e.errors?new q(exports.ErrorType.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.errors):new q(exports.ErrorType.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,t.status)}catch(e){return new q(exports.ErrorType.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 q(exports.ErrorType.API_ERROR,e,!1,t.status)}return new q(exports.ErrorType.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 md}).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 U{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 Z{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class G{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}G.KEY_PREFIX="insure_os_",G.SEPARATOR="_";class Y{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||Y.DEFAULT_EXPIRATION_MS,namespace:t.namespace||Y.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(e),r=G.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=G.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return G.generateKey(this.config.namespace,e)}}Y.DEFAULT_EXPIRATION_MS=864e5,Y.DEFAULT_NAMESPACE="quote_intent";class J{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class V{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function Q(e,t){const n=t.operator,r=t.value,i=null==r?"":String(r),o=null==e?"":String(e);switch(n){case"=":return o===i;case"!=":return o!==i;case"contains":return o.includes(i);case"not_contains":return!o.includes(i);case"starts_with":return o.startsWith(i);case"ends_with":return o.endsWith(i);case"is_empty":return void 0===e||null==e||""===e||""===e.trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function X(e,t){const n=t.operator,r=null==t.value?0:Number(t.value),i=null==e?0:Number(e.toString().replace(/,/g,"").trim());switch(n){case">":return i>r;case">=":return i>=r;case"<":return i<r;case"<=":return i<=r;case"=":return i===r;case"!=":return i!==r;case"is_empty":return void 0===e||null==e||""===e||""===e.toString().trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function K(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 ee(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 te{static create(e){switch(e){case"string":case"text":case"select":return Q;case"numeric":return X;case"boolean":return K;case"date":return ee;default:throw new Error(`Unsupported condition type: ${e}`)}}}function ne(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:re(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 re(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=te.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var ie=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:te,booleanMatchesCondition:K,checkSimpleConditions:ne,dateMatchesCondition:ee,numericMatchesCondition:X,textMatchesCondition:Q});function oe(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 se(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=ne(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=oe(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=ne(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 ae(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class ce{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:ae(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 le{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 ue{constructor(e){this.httpClient=e}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function de(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 md}).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 he(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 he(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:me(e),title:fe(e),message:n||t.message,retryable:ge(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:me(e),title:fe(e),message:n||l,retryable:ge(e,0),timestamp:a,trackingId:c}}function he(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=ge(t,n);return{id:e,type:t,severity:s,statusCode:n,title:fe(t,n),message:i||pe(t,n,r),details:r,retryable:a,timestamp:o}}function fe(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Service Unavailable";if(t>=500)return"Server Error";if(t>=400)return"Validation Error"}switch(e){case"initialization":return"Initialization Error";case"calculation":return"Calculation Error";case"network":return"Network Error";case"validation":return"Validation Error";case"maintenance":return"Maintenance Mode";default:return"Unexpected Error"}}function me(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function pe(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 ge(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 ye(e){return"maintenance"===e.type||503===e.statusCode}function ve(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 we=null;function be(e){we=e}function xe(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 ke(e){var t,n;if(!(null==we?void 0:we.isEnabled()))return;const r={...xe(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};we.push(r)}function Se(e,t,n,r){var i,o;if(!(null==we?void 0:we.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={...xe(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};we.push(c)}function Ne(e,t){if(!(null==we?void 0:we.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={...xe(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};we.push(l)}function $e(e,t,n,r,i){if(!(null==we?void 0:we.isEnabled()))return;const o={...xe(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};we.push(o)}function _e(e,t){if(!(null==we?void 0:we.isEnabled()))return;const n=t.referrals||[],r={...xe(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};we.push(r)}function Ce(e,t,n,r){if(!(null==we?void 0:we.isEnabled()))return;const i={...xe(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};we.push(i)}function Ee(e,t,n,r,i,o){if(!(null==we?void 0:we.isEnabled()))return;const s={...xe(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};we.push(s)}function Te(e,t,n,r,i,o){if(!(null==we?void 0:we.isEnabled()))return;const s={...xe(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};we.push(s)}class Ie{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 ce(t,i,n),this.autoSaveManager=new V(this.config,this.saveFormData.bind(this)),this.navigationManager=new le(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ue(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){this.autoSaveManager.startTyping(),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(e){this.isUserTyping()||(this.formData=e,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=de("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;Se(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=se(t,this.formData.page_data[t.id]||{});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=oe(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 ie});e.pages.forEach(e=>{const r=this.formData.page_data[e.id]||{},i={};e.fields.forEach(e=>{const t=e.code||e.id,o=r[t];let s=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});s="show"===e.visibility.action?t.matched:!t.matched}s&&void 0!==o&&(i[t]=o)}),t.page_data[e.id]=i});const r=this.processRatingFactorMappings(t),i={...t,page_data:{...t.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){e();const t=this.getFormDefinition(),n=[];for(const r of t.pages){const t=se(r,this.formData.page_data[r.id]||{});e(r.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?Ne(this.quoteIntent,e):"referral"===e.outcome_type&&_e(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()}}notify(){this.subscribers.forEach(e=>e(this))}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&&Ce(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 Me{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){const t=this.response.product.form_definition,n={...this.response.quote_intent.form_data};n.page_data||(n.page_data={});for(const r of t.pages){const t=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;e.hasOwnProperty(r)?t[r]=e[r]:("text"===n.type&&(t[r]="sample"),"number"===n.type&&(t[r]=1),"checkbox"===n.type&&(t[r]=!0))}n.page_data[r.id]=t}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class Pe{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Me(this.httpClient,n)}}var De=0;function Re(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:--De,_:-1,C:0,V:o,X: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 Oe,ze,je,Ae,Le=0,We=[],Fe=n,qe=Fe.p,Be=Fe.P,He=Fe.diffed,Ue=Fe.k,Ze=Fe.unmount,Ge=Fe.m;function Ye(e,t){Fe.A&&Fe.A(ze,e,Le||t),Le=0;var n=ze.K||(ze.K={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function Je(e){return Le=1,function(e,t){var n=Ye(Oe++,2);if(n.t=e,!n.k&&(n.m=[ot(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=ze,!ze.te)){var r=function(e,t,r){if(!n.k.K)return!0;var o=n.k.K.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};ze.te=!0;var i=ze.shouldComponentUpdate,o=ze.componentWillUpdate;ze.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)},ze.shouldComponentUpdate=r}return n.ee||n.m}(ot,e)}function Ve(e,t){var n=Ye(Oe++,3);!Fe.W&&it(n.K,t)&&(n.m=e,n.u=t,ze.K.A.push(n))}function Qe(e){return Le=5,Xe(function(){return{current:e}},[])}function Xe(e,t){var n=Ye(Oe++,7);return it(n.K,t)&&(n.m=e(),n.K=t,n.A=e),n.m}function Ke(){for(var e;e=We.shift();)if(e.R&&e.K)try{e.K.A.forEach(nt),e.K.A.forEach(rt),e.K.A=[]}catch(t){e.K.A=[],Fe.v(t,e.N)}}Fe.p=function(e){ze=null,qe&&qe(e)},Fe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Ge&&Ge(e,t)},Fe.P=function(e){Be&&Be(e),Oe=0;var t=(ze=e.k).K;t&&(je===ze?(t.A=[],ze.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(nt),t.A.forEach(rt),t.A=[],Oe=0)),je=ze},Fe.diffed=function(e){He&&He(e);var t=e.k;t&&t.K&&(t.K.A.length&&(1!==We.push(t)&&Ae===Fe.requestAnimationFrame||((Ae=Fe.requestAnimationFrame)||tt)(Ke)),t.K.m.forEach(function(e){e.u&&(e.K=e.u),e.u=void 0})),je=ze=null},Fe.k=function(e,t){t.some(function(e){try{e.A.forEach(nt),e.A=e.A.filter(function(e){return!e.m||rt(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],Fe.v(n,e.N)}}),Ue&&Ue(e,t)},Fe.unmount=function(e){Ze&&Ze(e);var t,n=e.k;n&&n.K&&(n.K.m.forEach(function(e){try{nt(e)}catch(e){t=e}}),n.K=void 0,t&&Fe.v(t,n.N))};var et="function"==typeof requestAnimationFrame;function tt(e){var t,n=function(){clearTimeout(r),et&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);et&&(t=requestAnimationFrame(n))}function nt(e){var t=ze,n=e.k;"function"==typeof n&&(e.k=void 0,n()),ze=t}function rt(e){var t=ze;e.k=e.m(),ze=t}function it(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ot(e,t){return"function"==typeof t?t(e):t}const st="insure-os";let at=!1;const ct=new Map,lt={[`--${st}-radius`]:"0.75rem",[`--${st}-radius-sm`]:"0.5rem",[`--${st}-radius-lg`]:"1rem",[`--${st}-background`]:"oklch(0.955 0 0)",[`--${st}-foreground`]:"oklch(0.145 0 0)",[`--${st}-card`]:"oklch(1 0 0)",[`--${st}-card-foreground`]:"oklch(0.145 0 0)",[`--${st}-popover`]:"oklch(1 0 0)",[`--${st}-popover-foreground`]:"oklch(0.145 0 0)",[`--${st}-primary`]:"oklch(0.205 0 0)",[`--${st}-primary-foreground`]:"oklch(0.985 0 0)",[`--${st}-secondary`]:"oklch(0.97 0 0)",[`--${st}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${st}-muted`]:"oklch(0.97 0 0)",[`--${st}-muted-foreground`]:"oklch(0.556 0 0)",[`--${st}-accent`]:"oklch(0.97 0 0)",[`--${st}-accent-foreground`]:"oklch(0.205 0 0)",[`--${st}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${st}-border`]:"oklch(0.9 0 0)",[`--${st}-input`]:"oklch(0.9 0 0)",[`--${st}-ring`]:"oklch(0.708 0 0)",[`--${st}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${st}-font-size-large`]:"18px",[`--${st}-font-size-small`]:"14px",[`--${st}-font-size`]:"16px",[`--${st}-border-width`]:"1px",[`--${st}-transition-duration`]:"200ms",[`--${st}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${st}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${st}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${st}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${st}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${st}-spacing-sm`]:"0.75rem",[`--${st}-spacing`]:"1rem",[`--${st}-spacing-md`]:"1.5rem",[`--${st}-spacing-lg`]:"2rem",[`--${st}-spacing-xl`]:"3rem"},ut={colors:{background:`var(--${st}-background)`,foreground:`var(--${st}-foreground)`,card:`var(--${st}-card)`,popover:`var(--${st}-popover)`,popoverForeground:`var(--${st}-popover-foreground)`,primary:`var(--${st}-primary)`,primaryForeground:`var(--${st}-primary-foreground)`,secondary:`var(--${st}-secondary)`,muted:`var(--${st}-muted)`,mutedForeground:`var(--${st}-muted-foreground)`,accent:`var(--${st}-accent)`,accentForeground:`var(--${st}-accent-foreground)`,destructive:`var(--${st}-destructive)`,border:`var(--${st}-border)`,input:`var(--${st}-input)`},fontSize:{small:`var(--${st}-font-size-small)`,default:`var(--${st}-font-size)`,large:`var(--${st}-font-size-large)`},radius:{small:`var(--${st}-radius-sm)`,default:`var(--${st}-radius)`,large:`var(--${st}-radius-lg)`},shadow:{sm:`var(--${st}-shadow-sm)`,md:`var(--${st}-shadow-md)`},spacing:{sm:`var(--${st}-spacing-sm)`,md:`var(--${st}-spacing-md)`,lg:`var(--${st}-spacing-lg)`,xl:`var(--${st}-spacing-xl)`},fontFamily:`var(--${st}-font-family)`,borderWidth:`var(--${st}-border-width)`,transition:`var(--${st}-transition-duration) var(--${st}-transition-timing-function)`},dt=new Set;function ht(e){if(!document.getElementById(`${st}-styles`)){const e=document.createElement("style");e.id=`${st}-styles`,document.head.appendChild(e)}document.getElementById(`${st}-styles`).textContent+=e+"\n"}function ft(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 mt(){at||(ht(`:root {\n${Object.entries(lt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),at=!0)}const pt={name:e=>`${st}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){mt();const r=ft(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=ct.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return dt.has(a)||(ht(`.${c} { ${r} }`),dt.add(a)),ct.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${st}-${e}`;return dt.has(`keyframes-${e}`)||(ht(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${ft(t)} }`).join("\n")}\n}`),dt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;ht(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${st}-${e} { ${ft(t)} }`).join("\n")}\n}`),dt.add(n)},pseudoElement(e,t,n){const r=`${st}-${e}`,i=`${e}-${t}`;return dt.has(i)||(ht(`.${r}${t} { ${ft(n)} }`),dt.add(i)),r}};var gt=Object.freeze({__proto__:null,baseVariables:lt,styles:pt,theme:ut,updateBaseVariables:function(t){e(),Object.assign(lt,t);const n=document.getElementById(`${st}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(lt).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 mt()}});function yt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var vt,wt={exports:{}};function bt(){return vt||(vt=1,e=wt,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}()),wt.exports;var e}var xt=yt(bt());function kt({size:e="small"}){const t=pt.create("spinner-small",{width:"16px",height:"16px"}),n=pt.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return pt.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Re("div",{className:pt.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Re("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:xt(r),children:Re("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function St({className:e,children:t,size:n="md"}){const r={sm:ut.spacing.sm,md:ut.spacing.md,lg:ut.spacing.lg,xl:ut.spacing.xl},i=pt.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?ut.spacing.lg:"lg"===n?ut.spacing.md:r[n]},"(max-width: 480px)":{padding:ut.spacing.sm}});return Re("div",{className:xt(i,e),children:t})}const Nt=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 $t({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o}){return Re(Nt.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function _t(){const e=function(e){var t=ze.context[e.k],n=Ye(Oe++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(ze)),t.props.value):e.m}(Nt);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function Ct(e){const t=_t(),{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]=Je(()=>e(n));return Ve(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Et extends Error{}class Tt extends Et{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class It extends Et{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Mt extends Et{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Pt extends Et{}class Dt extends Et{constructor(e){super(`Invalid unit ${e}`)}}class Rt extends Et{}class Ot extends Et{constructor(){super("Zone is an abstract class")}}const zt="numeric",jt="short",At="long",Lt={year:zt,month:zt,day:zt},Wt={year:zt,month:jt,day:zt},Ft={year:zt,month:jt,day:zt,weekday:jt},qt={year:zt,month:At,day:zt},Bt={year:zt,month:At,day:zt,weekday:At},Ht={hour:zt,minute:zt},Ut={hour:zt,minute:zt,second:zt},Zt={hour:zt,minute:zt,second:zt,timeZoneName:jt},Gt={hour:zt,minute:zt,second:zt,timeZoneName:At},Yt={hour:zt,minute:zt,hourCycle:"h23"},Jt={hour:zt,minute:zt,second:zt,hourCycle:"h23"},Vt={hour:zt,minute:zt,second:zt,hourCycle:"h23",timeZoneName:jt},Qt={hour:zt,minute:zt,second:zt,hourCycle:"h23",timeZoneName:At},Xt={year:zt,month:zt,day:zt,hour:zt,minute:zt},Kt={year:zt,month:zt,day:zt,hour:zt,minute:zt,second:zt},en={year:zt,month:jt,day:zt,hour:zt,minute:zt},tn={year:zt,month:jt,day:zt,hour:zt,minute:zt,second:zt},nn={year:zt,month:jt,day:zt,weekday:jt,hour:zt,minute:zt},rn={year:zt,month:At,day:zt,hour:zt,minute:zt,timeZoneName:jt},on={year:zt,month:At,day:zt,hour:zt,minute:zt,second:zt,timeZoneName:jt},sn={year:zt,month:At,day:zt,weekday:At,hour:zt,minute:zt,timeZoneName:At},an={year:zt,month:At,day:zt,weekday:At,hour:zt,minute:zt,second:zt,timeZoneName:At};class cn{get type(){throw new Ot}get name(){throw new Ot}get ianaName(){return this.name}get isUniversal(){throw new Ot}offsetName(e,t){throw new Ot}formatOffset(e,t){throw new Ot}offset(e){throw new Ot}equals(e){throw new Ot}get isValid(){throw new Ot}}let ln=null;class un extends cn{static get instance(){return null===ln&&(ln=new un),ln}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ir(e,t,n)}formatOffset(e,t){return Rr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const dn=new Map,hn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},fn=new Map;class mn extends cn{static create(e){let t=fn.get(e);return void 0===t&&fn.set(e,t=new mn(e)),t}static resetCache(){fn.clear(),dn.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=mn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ir(e,t,n,this.name)}formatOffset(e,t){return Rr(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=dn.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"}),dn.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=hn[t];"era"===t?r[o]=i:lr(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,(_r({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 pn={};const gn=new Map;function yn(e,t={}){const n=JSON.stringify([e,t]);let r=gn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),gn.set(n,r)),r}const vn=new Map,wn=new Map;let bn=null;const xn=new Map;function kn(e){let t=xn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),xn.set(e,t)),t}const Sn=new Map;function Nn(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class $n{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=vn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),vn.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 vr(this.floor?Math.floor(e):kr(e,3),this.padTo)}}class _n{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&&mn.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=yn(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 Cn{constructor(e,t,n){this.opts={style:"long",...n},!t&&hr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=wn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),wn.set(i,o)),o}(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===n&&o){const n="days"===e;switch(t){case 1:return n?"tomorrow":`next ${i[e][0]}`;case-1:return n?"yesterday":`last ${i[e][0]}`;case 0:return n?"today":`this ${i[e][0]}`}}const s=Object.is(t,-0)||t<0,a=Math.abs(t),c=1===a,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return s?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const En={firstDay:1,minimalDays:4,weekend:[6,7]};class Tn{static fromOpts(e){return Tn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||Gn.defaultLocale,s=o||(i?"en-US":bn||(bn=(new Intl.DateTimeFormat).resolvedOptions().locale,bn)),a=t||Gn.defaultNumberingSystem,c=n||Gn.defaultOutputCalendar,l=gr(r)||Gn.defaultWeekSettings;return new Tn(s,a,c,l,o)}static resetCache(){bn=null,gn.clear(),vn.clear(),wn.clear(),xn.clear(),Sn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Tn.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=yn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=yn(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"===kn(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?Tn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,gr(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 Nn(this,e,Lr,()=>{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=qo.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Nn(this,e,Br,()=>{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=qo.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Nn(this,void 0,()=>Hr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[qo.utc(2016,11,13,9),qo.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Nn(this,e,Yr,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[qo.utc(-40,1,1),qo.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 $n(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new _n(e,this.intl,t)}relFormatter(e={}){return new Cn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=pn[n];return r||(r=new Intl.ListFormat(e,t),pn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||kn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:fr()?function(e){let t=Sn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...En,...t}),Sn.set(e,t)}return t}(this.locale):En}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let In=null;class Mn extends cn{static get utcInstance(){return null===In&&(In=new Mn(0)),In}static instance(e){return 0===e?Mn.utcInstance:new Mn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Mn(Mr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Rr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Rr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Rr(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 Pn extends cn{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 Dn(e,t){if(lr(e)||null===e)return t;if(e instanceof cn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?un.instance:"utc"===n||"gmt"===n?Mn.utcInstance:Mn.parseSpecifier(n)||mn.create(e)}return ur(e)?Mn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Pn(e)}const Rn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},On={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},zn=Rn.hanidec.replace(/[\[|\]]/g,"").split(""),jn=new Map;function An({numberingSystem:e},t=""){const n=e||"latn";let r=jn.get(n);void 0===r&&(r=new Map,jn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Rn[n]}${t}`),r.set(t,i)),i}let Ln,Wn=()=>Date.now(),Fn="system",qn=null,Bn=null,Hn=null,Un=60,Zn=null;class Gn{static get now(){return Wn}static set now(e){Wn=e}static set defaultZone(e){Fn=e}static get defaultZone(){return Dn(Fn,un.instance)}static get defaultLocale(){return qn}static set defaultLocale(e){qn=e}static get defaultNumberingSystem(){return Bn}static set defaultNumberingSystem(e){Bn=e}static get defaultOutputCalendar(){return Hn}static set defaultOutputCalendar(e){Hn=e}static get defaultWeekSettings(){return Zn}static set defaultWeekSettings(e){Zn=gr(e)}static get twoDigitCutoffYear(){return Un}static set twoDigitCutoffYear(e){Un=e%100}static get throwOnInvalid(){return Ln}static set throwOnInvalid(e){Ln=e}static resetCaches(){Tn.resetCache(),mn.resetCache(),qo.resetCache(),jn.clear()}}class Yn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Jn=[0,31,59,90,120,151,181,212,243,273,304,334],Vn=[0,31,60,91,121,152,182,213,244,274,305,335];function Qn(e,t){return new Yn("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Xn(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 Kn(e,t,n){return n+(Sr(e)?Vn:Jn)[t-1]}function er(e,t){const n=Sr(e)?Vn:Jn,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function tr(e,t){return(e-t+7)%7+1}function nr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=Kn(r,i,o),a=tr(Xn(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=Er(c,t,n)):l>Er(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Or(e)}}function rr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=tr(Xn(r,1,t),n),a=Nr(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=Nr(c)):l>a?(c=r+1,l-=Nr(r)):c=r;const{month:u,day:d}=er(c,l);return{year:c,month:u,day:d,...Or(e)}}function ir(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:Kn(t,n,r),...Or(e)}}function or(e){const{year:t,ordinal:n}=e,{month:r,day:i}=er(t,n);return{year:t,month:r,day:i,...Or(e)}}function sr(e,t){if(!lr(e.localWeekday)||!lr(e.localWeekNumber)||!lr(e.localWeekYear)){if(!lr(e.weekday)||!lr(e.weekNumber)||!lr(e.weekYear))throw new Pt("Cannot mix locale-based week fields with ISO-based week fields");return lr(e.localWeekday)||(e.weekday=e.localWeekday),lr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),lr(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 ar(e){const t=dr(e.year),n=yr(e.month,1,12),r=yr(e.day,1,$r(e.year,e.month));return t?n?!r&&Qn("day",e.day):Qn("month",e.month):Qn("year",e.year)}function cr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=yr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=yr(n,0,59),a=yr(r,0,59),c=yr(i,0,999);return o?s?a?!c&&Qn("millisecond",i):Qn("second",r):Qn("minute",n):Qn("hour",t)}function lr(e){return void 0===e}function ur(e){return"number"==typeof e}function dr(e){return"number"==typeof e&&e%1==0}function hr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function fr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function mr(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 pr(e,t){return{}.hasOwnProperty.call(e,t)}function gr(e){if(null==e)return null;if("object"!=typeof e)throw new Rt("Week settings must be an object");if(!yr(e.firstDay,1,7)||!yr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!yr(e,1,7)))throw new Rt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function yr(e,t,n){return dr(e)&&e>=t&&e<=n}function vr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function wr(e){return lr(e)||null===e||""===e?void 0:parseInt(e,10)}function br(e){return lr(e)||null===e||""===e?void 0:parseFloat(e)}function xr(e){if(!lr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function kr(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 Sr(e){return e%4==0&&(e%100!=0||e%400==0)}function Nr(e){return Sr(e)?366:365}function $r(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Sr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function _r(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 Cr(e,t,n){return-tr(Xn(e,1,t),n)+t-1}function Er(e,t=4,n=1){const r=Cr(e,t,n),i=Cr(e+1,t,n);return(Nr(e)-r+i)/7}function Tr(e){return e>99?e:e>Gn.twoDigitCutoffYear?1900+e:2e3+e}function Ir(e,t,n,r=null){const i=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:t,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function Mr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Pr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Rt(`Invalid unit value ${e}`);return t}function Dr(e,t){const n={};for(const r in e)if(pr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Pr(i)}return n}function Rr(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}${vr(n,2)}:${vr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${vr(n,2)}${vr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Or(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const zr=["January","February","March","April","May","June","July","August","September","October","November","December"],jr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ar=["J","F","M","A","M","J","J","A","S","O","N","D"];function Lr(e){switch(e){case"narrow":return[...Ar];case"short":return[...jr];case"long":return[...zr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Wr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Fr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qr=["M","T","W","T","F","S","S"];function Br(e){switch(e){case"narrow":return[...qr];case"short":return[...Fr];case"long":return[...Wr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Hr=["AM","PM"],Ur=["Before Christ","Anno Domini"],Zr=["BC","AD"],Gr=["B","A"];function Yr(e){switch(e){case"narrow":return[...Gr];case"short":return[...Zr];case"long":return[...Ur];default:return null}}function Jr(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Vr={D:Lt,DD:Wt,DDD:qt,DDDD:Bt,t:Ht,tt:Ut,ttt:Zt,tttt:Gt,T:Yt,TT:Jt,TTT:Vt,TTTT:Qt,f:Xt,ff:en,fff:rn,ffff:sn,F:Kt,FF:tn,FFF:on,FFFF:an};class Qr{static create(e,t={}){return new Qr(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 Vr[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 vr(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 Lr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Br(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=Qr.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return Yr(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return Jr(Qr.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 Hr[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=Qr.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 Jr(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 Xr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Kr(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function ei(...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 ti(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 ni(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=wr(t[n+i]);return[r,null,n+i]}}const ri=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ii=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,oi=RegExp(`${ii.source}(?:${ri.source}?(?:\\[(${Xr.source})\\])?)?`),si=RegExp(`(?:[Tt]${oi.source})?`),ai=ni("weekYear","weekNumber","weekDay"),ci=ni("year","ordinal"),li=RegExp(`${ii.source} ?(?:${ri.source}|(${Xr.source}))?`),ui=RegExp(`(?: ${li.source})?`);function di(e,t,n){const r=e[t];return lr(r)?n:wr(r)}function hi(e,t){return[{hours:di(e,t,0),minutes:di(e,t+1,0),seconds:di(e,t+2,0),milliseconds:xr(e[t+3])},null,t+4]}function fi(e,t){const n=!e[t]&&!e[t+1],r=Mr(e[t+1],e[t+2]);return[{},n?null:Mn.instance(r),t+3]}function mi(e,t){return[{},e[t]?mn.create(e[t]):null,t+1]}const pi=RegExp(`^T?${ii.source}$`),gi=/^-?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 yi(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(br(n)),months:h(br(r)),weeks:h(br(i)),days:h(br(o)),hours:h(br(s)),minutes:h(br(a)),seconds:h(br(c),"-0"===c),milliseconds:h(xr(l),d)}]}const vi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function wi(e,t,n,r,i,o,s){const a={year:2===t.length?Tr(wr(t)):wr(t),month:jr.indexOf(n)+1,day:wr(r),hour:wr(i),minute:wr(o)};return s&&(a.second=wr(s)),e&&(a.weekday=e.length>3?Wr.indexOf(e)+1:Fr.indexOf(e)+1),a}const bi=/^(?:(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 xi(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=wi(t,i,r,n,o,s,a);let f;return f=c?vi[c]:l?0:Mr(u,d),[h,new Mn(f)]}const ki=/^(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$/,Si=/^(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$/,Ni=/^(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 $i(e){const[,t,n,r,i,o,s,a]=e;return[wi(t,i,r,n,o,s,a),Mn.utcInstance]}function _i(e){const[,t,n,r,i,o,s,a]=e;return[wi(t,a,n,r,i,o,s),Mn.utcInstance]}const Ci=Kr(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,si),Ei=Kr(/(\d{4})-?W(\d\d)(?:-?(\d))?/,si),Ti=Kr(/(\d{4})-?(\d{3})/,si),Ii=Kr(oi),Mi=ei(function(e,t){return[{year:di(e,t),month:di(e,t+1,1),day:di(e,t+2,1)},null,t+3]},hi,fi,mi),Pi=ei(ai,hi,fi,mi),Di=ei(ci,hi,fi,mi),Ri=ei(hi,fi,mi),Oi=ei(hi),zi=Kr(/(\d{4})-(\d\d)-(\d\d)/,ui),ji=Kr(li),Ai=ei(hi,fi,mi),Li="Invalid Duration",Wi={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}},Fi={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},...Wi},qi={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},...Wi},Bi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Hi=Bi.slice(0).reverse();function Ui(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 Ji(r)}function Zi(e,t){let n=t.milliseconds??0;for(const r of Hi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Gi(e,t){const n=Zi(e,t)<0?-1:1;Bi.reduceRight((r,i)=>{if(lr(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),Bi.reduce((n,r)=>{if(lr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Yi(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class Ji{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?qi:Fi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Tn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Ji.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Rt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Ji({values:Dr(e,Ji.normalizeUnit),loc:Tn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ur(e))return Ji.fromMillis(e);if(Ji.isDuration(e))return e;if("object"==typeof e)return Ji.fromObject(e);throw new Rt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return ti(e,[gi,yi])}(e);return n?Ji.fromObject(n,t):Ji.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return ti(e,[pi,Oi])}(e);return n?Ji.fromObject(n,t):Ji.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Rt("need to specify a reason the Duration is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(Gn.throwOnInvalid)throw new Mt(n);return new Ji({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 Dt(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?Qr.create(this.loc,n).formatDurationFromString(this,e):Li}toHuman(e={}){if(!this.isValid)return Li;const t=!1!==e.showZeros,n=Bi.map(n=>{const r=this.values[n];return lr(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+=kr(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},qo.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?Zi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Ji.fromDurationLike(e),n={};for(const e of Bi)(pr(t.values,e)||pr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return Ui(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Ji.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]=Pr(e(this.values[n],n));return Ui(this,{values:t},!0)}get(e){return this[Ji.normalizeUnit(e)]}set(e){return this.isValid?Ui(this,{values:{...this.values,...Dr(e,Ji.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return Ui(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 Gi(this.matrix,e),Ui(this,{values:e},!0)}rescale(){return this.isValid?Ui(this,{values:Yi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>Ji.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Bi)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;ur(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else ur(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 Gi(this.matrix,t),Ui(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 Ui(this,{values:e},!0)}removeZeros(){return this.isValid?Ui(this,{values:Yi(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 Bi)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Vi="Invalid Interval";class Qi{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 Rt("need to specify a reason the Interval is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(Gn.throwOnInvalid)throw new It(n);return new Qi({invalid:n})}static fromDateTimes(e,t){const n=Bo(e),r=Bo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?Qi.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:Qi.invalid("missing or invalid end"):Qi.invalid("missing or invalid start")}(n,r);return null==i?new Qi({start:n,end:r}):i}static after(e,t){const n=Ji.fromDurationLike(t),r=Bo(e);return Qi.fromDateTimes(r,r.plus(n))}static before(e,t){const n=Ji.fromDurationLike(t),r=Bo(e);return Qi.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=qo.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=qo.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return Qi.fromDateTimes(e,o);if(i){const n=Ji.fromISO(r,t);if(n.isValid)return Qi.after(e,n)}else if(s){const e=Ji.fromISO(n,t);if(e.isValid)return Qi.before(o,e)}}return Qi.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?Qi.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Bo).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(Qi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=Ji.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(Qi.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:Qi.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 Qi.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(Qi.fromDateTimes(t,e.time)),t=null);return Qi.merge(r)}difference(...e){return Qi.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Vi}[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=Lt,t={}){return this.isValid?Qr.create(this.s.loc.clone(t),e).formatInterval(this):Vi}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Vi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Vi}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Vi}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Vi}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Ji.invalid(this.invalidReason)}mapEndpoints(e){return Qi.fromDateTimes(e(this.s),e(this.e))}}class Xi{static hasDST(e=Gn.defaultZone){const t=qo.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return mn.isValidZone(e)}static normalizeZone(e){return Dn(e,Gn.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Tn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Tn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Tn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Tn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Tn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Tn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Tn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Tn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Tn.create(t,null,"gregory").eras(e)}static features(){return{relative:hr(),localeWeek:fr()}}}function Ki(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(Ji.fromMillis(r).as("days"))}function eo(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(Rn.hanidec))t+=zn.indexOf(e[n]);else for(const e in On){const[n,i]=On[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const to=`[ ${String.fromCharCode(160)}]`,no=new RegExp(to,"g");function ro(e){return e.replace(/\./g,"\\.?").replace(no,to)}function io(e){return e.replace(/\./g,"").replace(no," ").toLowerCase()}function oo(e,t){return null===e?null:{regex:RegExp(e.map(ro).join("|")),deser:([n])=>e.findIndex(e=>io(n)===io(e))+t}}function so(e,t){return{regex:e,deser:([,e,t])=>Mr(e,t),groups:t}}function ao(e){return{regex:e,deser:([e])=>e}}const co={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 lo=null;function uo(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=mo(Qr.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class ho{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=uo(Qr.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=An(t),r=An(t,"{2}"),i=An(t,"{3}"),o=An(t,"{4}"),s=An(t,"{6}"),a=An(t,"{1,2}"),c=An(t,"{1,3}"),l=An(t,"{1,6}"),u=An(t,"{1,9}"),d=An(t,"{2,4}"),h=An(t,"{4,6}"),f=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return f(m);switch(m.val){case"G":return oo(t.eras("short"),0);case"GG":return oo(t.eras("long"),0);case"y":return eo(l);case"yy":case"kk":return eo(d,Tr);case"yyyy":case"kkkk":return eo(o);case"yyyyy":return eo(h);case"yyyyyy":return eo(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return eo(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return eo(r);case"MMM":return oo(t.months("short",!0),1);case"MMMM":return oo(t.months("long",!0),1);case"LLL":return oo(t.months("short",!1),1);case"LLLL":return oo(t.months("long",!1),1);case"o":case"S":return eo(c);case"ooo":case"SSS":return eo(i);case"u":return ao(u);case"uu":return ao(a);case"uuu":case"E":case"c":return eo(n);case"a":return oo(t.meridiems(),0);case"EEE":return oo(t.weekdays("short",!1),1);case"EEEE":return oo(t.weekdays("long",!1),1);case"ccc":return oo(t.weekdays("short",!0),1);case"cccc":return oo(t.weekdays("long",!0),1);case"Z":case"ZZ":return so(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return so(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return ao(/[a-z_+-/]{1,256}?/i);case" ":return ao(/[^\S\n\r]/);default:return f(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(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(pr(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;lr(e.z)||(n=mn.create(e.z)),lr(e.Z)||(n||(n=new Mn(e.Z)),t=e.Z),lr(e.q)||(e.M=3*(e.q-1)+1),lr(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),lr(e.u)||(e.S=xr(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(pr(n,"a")&&pr(n,"H"))throw new Pt("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 fo(e,t,n){return new ho(e,n).explainFromTokens(t)}function mo(e,t){if(!e)return null;const n=Qr.create(t,e).dtFormatter((lo||(lo=qo.fromMillis(1555555555555)),lo)),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=co[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const po="Invalid DateTime",go=864e13;function yo(e){return new Yn("unsupported zone",`the zone "${e.name}" is not supported`)}function vo(e){return null===e.weekData&&(e.weekData=nr(e.c)),e.weekData}function wo(e){return null===e.localWeekData&&(e.localWeekData=nr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function bo(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new qo({...n,...t,old:n})}function xo(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 ko(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 So(e,t,n){return xo(_r(e),t,n)}function No(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,$r(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=Ji.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=_r(o);let[c,l]=xo(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function $o(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=qo.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return qo.invalid(new Yn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function _o(e,t,n=!0){return e.isValid?Qr.create(Tn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Co(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=vr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=vr(e.c.month),"month"===n)return i;i+="-"}else if(i+=vr(e.c.month),"month"===n)return i;return i+=vr(e.c.day),i}function Eo(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=vr(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=vr(e.c.minute),"minute"===s)break;a&&(c+=":",c+=vr(e.c.second))}else{if(c+=vr(e.c.minute),"minute"===s)break;a&&(c+=vr(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=vr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=vr(Math.trunc(-e.o/60)),c+=":",c+=vr(Math.trunc(-e.o%60))):(c+="+",c+=vr(Math.trunc(e.o/60)),c+=":",c+=vr(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const To={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Io={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Mo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Po=["year","month","day","hour","minute","second","millisecond"],Do=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Ro=["year","ordinal","hour","minute","second","millisecond"];function Oo(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 Dt(e);return t}function zo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Oo(e)}}function jo(e,t){const n=Dn(t.zone,Gn.defaultZone);if(!n.isValid)return qo.invalid(yo(n));const r=Tn.fromObject(t);let i,o;if(lr(e.year))i=Gn.now();else{for(const t of Po)lr(e[t])&&(e[t]=To[t]);const t=ar(e)||cr(e);if(t)return qo.invalid(t);const r=function(e){if(void 0===Wo&&(Wo=Gn.now()),"iana"!==e.type)return e.offset(Wo);const t=e.name;let n=Fo.get(t);return void 0===n&&(n=e.offset(Wo),Fo.set(t,n)),n}(n);[i,o]=So(e,r,n)}return new qo({ts:i,zone:n,loc:r,o:o})}function Ao(e,t,n){const r=!!lr(n.round)||n.round,i=lr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=kr(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 Lo(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 Wo;const Fo=new Map;class qo{constructor(e){const t=e.zone||Gn.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Yn("invalid input"):null)||(t.isValid?null:yo(t));this.ts=lr(e.ts)?Gn.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=ur(e.o)&&!e.old?e.o:t.offset(this.ts);r=ko(this.ts,o),n=Number.isNaN(r.year)?new Yn("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Tn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new qo({})}static local(){const[e,t]=Lo(arguments),[n,r,i,o,s,a,c]=t;return jo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Lo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=Mn.utcInstance,jo({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 qo.invalid("invalid input");const r=Dn(t.zone,Gn.defaultZone);return r.isValid?new qo({ts:n,zone:r,loc:Tn.fromObject(t)}):qo.invalid(yo(r))}static fromMillis(e,t={}){if(ur(e))return e<-go||e>go?qo.invalid("Timestamp out of range"):new qo({ts:e,zone:Dn(t.zone,Gn.defaultZone),loc:Tn.fromObject(t)});throw new Rt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ur(e))return new qo({ts:1e3*e,zone:Dn(t.zone,Gn.defaultZone),loc:Tn.fromObject(t)});throw new Rt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Dn(t.zone,Gn.defaultZone);if(!n.isValid)return qo.invalid(yo(n));const r=Tn.fromObject(t),i=Dr(e,zo),{minDaysInFirstWeek:o,startOfWeek:s}=sr(i,r),a=Gn.now(),c=lr(t.specificOffset)?n.offset(a):t.specificOffset,l=!lr(i.ordinal),u=!lr(i.year),d=!lr(i.month)||!lr(i.day),h=u||d,f=i.weekYear||i.weekNumber;if((h||l)&&f)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new Pt("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=ko(a,c);m?(p=Do,g=Io,y=nr(y,o,s)):l?(p=Ro,g=Mo,y=ir(y)):(p=Po,g=To);let v=!1;for(const e of p)lr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=m?function(e,t=4,n=1){const r=dr(e.weekYear),i=yr(e.weekNumber,1,Er(e.weekYear,t,n)),o=yr(e.weekday,1,7);return r?i?!o&&Qn("weekday",e.weekday):Qn("week",e.weekNumber):Qn("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=dr(e.year),n=yr(e.ordinal,1,Nr(e.year));return t?!n&&Qn("ordinal",e.ordinal):Qn("year",e.year)}(i):ar(i),b=w||cr(i);if(b)return qo.invalid(b);const x=m?rr(i,o,s):l?or(i):i,[k,S]=So(x,c,n),N=new qo({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?qo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:qo.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return ti(e,[Ci,Mi],[Ei,Pi],[Ti,Di],[Ii,Ri])}(e);return $o(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return ti(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[bi,xi])}(e);return $o(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return ti(e,[ki,$i],[Si,$i],[Ni,_i])}(e);return $o(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(lr(e)||lr(t))throw new Rt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Tn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=fo(e,t,n);return[r,i,o,s]}(o,e,t);return l?qo.invalid(l):$o(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return qo.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return ti(e,[zi,Mi],[ji,Ai])}(e);return $o(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Rt("need to specify a reason the DateTime is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(Gn.throwOnInvalid)throw new Tt(n);return new qo({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=mo(e,Tn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return uo(Qr.parseFormat(e),Tn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Wo=void 0,Fo.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?vo(this).weekYear:NaN}get weekNumber(){return this.isValid?vo(this).weekNumber:NaN}get weekday(){return this.isValid?vo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?wo(this).weekday:NaN}get localWeekNumber(){return this.isValid?wo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?wo(this).weekYear:NaN}get ordinal(){return this.isValid?ir(this.c).ordinal:NaN}get monthShort(){return this.isValid?Xi.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Xi.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Xi.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Xi.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=_r(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=ko(a,o),u=ko(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[bo(this,{ts:a}),bo(this,{ts:c})]:[this]}get isInLeapYear(){return Sr(this.year)}get daysInMonth(){return $r(this.year,this.month)}get daysInYear(){return this.isValid?Nr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Er(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Er(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=Qr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Mn.instance(e),t)}toLocal(){return this.setZone(Gn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Dn(e,Gn.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]=So(n,t,e)}return bo(this,{ts:r,zone:e})}return qo.invalid(yo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return bo(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=Dr(e,zo),{minDaysInFirstWeek:n,startOfWeek:r}=sr(t,this.loc),i=!lr(t.weekYear)||!lr(t.weekNumber)||!lr(t.weekday),o=!lr(t.ordinal),s=!lr(t.year),a=!lr(t.month)||!lr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Pt("Can't mix ordinal dates with month/day");let u;i?u=rr({...nr(this.c,n,r),...t},n,r):lr(t.ordinal)?(u={...this.toObject(),...t},lr(t.day)&&(u.day=Math.min($r(u.year,u.month),u.day))):u=or({...ir(this.c),...t});const[d,h]=So(u,this.o,this.zone);return bo(this,{ts:d,o:h})}plus(e){return this.isValid?bo(this,No(this,Ji.fromDurationLike(e))):this}minus(e){return this.isValid?bo(this,No(this,Ji.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=Ji.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?Qr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):po}toLocaleString(e=Lt,t={}){return this.isValid?Qr.create(this.loc.clone(t),e).formatDateTime(this):po}toLocaleParts(e={}){return this.isValid?Qr.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=Co(this,s,o=Oo(o));return Po.indexOf(o)>=3&&(a+="T"),a+=Eo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Co(this,"extended"===e,Oo(t)):null}toISOWeekDate(){return _o(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=Oo(s),(r&&Po.indexOf(s)>=3?"T":"")+Eo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return _o(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return _o(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Co(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")),_o(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():po}[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 Ji.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(Ji.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=Ki(e,t);return(n-n%7)/7}],["days",Ki]],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=Ji.fromObject(o,r);return l.length>0?Ji.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(qo.now(),e,t)}until(e){return this.isValid?Qi.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||qo.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),Ao(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ao(e.base||qo.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(qo.isDateTime))throw new Rt("min requires all arguments be DateTimes");return mr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(qo.isDateTime))throw new Rt("max requires all arguments be DateTimes");return mr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return fo(Tn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return qo.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Tn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new ho(i,e)}static fromFormatParser(e,t,n={}){if(lr(e)||lr(t))throw new Rt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Tn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Rt(`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?qo.invalid(l):$o(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Lt}static get DATE_MED(){return Wt}static get DATE_MED_WITH_WEEKDAY(){return Ft}static get DATE_FULL(){return qt}static get DATE_HUGE(){return Bt}static get TIME_SIMPLE(){return Ht}static get TIME_WITH_SECONDS(){return Ut}static get TIME_WITH_SHORT_OFFSET(){return Zt}static get TIME_WITH_LONG_OFFSET(){return Gt}static get TIME_24_SIMPLE(){return Yt}static get TIME_24_WITH_SECONDS(){return Jt}static get TIME_24_WITH_SHORT_OFFSET(){return Vt}static get TIME_24_WITH_LONG_OFFSET(){return Qt}static get DATETIME_SHORT(){return Xt}static get DATETIME_SHORT_WITH_SECONDS(){return Kt}static get DATETIME_MED(){return en}static get DATETIME_MED_WITH_SECONDS(){return tn}static get DATETIME_MED_WITH_WEEKDAY(){return nn}static get DATETIME_FULL(){return rn}static get DATETIME_FULL_WITH_SECONDS(){return on}static get DATETIME_HUGE(){return sn}static get DATETIME_HUGE_WITH_SECONDS(){return an}}function Bo(e){if(qo.isDateTime(e))return e;if(e&&e.valueOf&&ur(e.valueOf()))return qo.fromJSDate(e);if(e&&"object"==typeof e)return qo.fromObject(e);throw new Rt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function Ho({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Re("div",{className:pt.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:ut.colors.accent}),children:Re("div",{className:pt.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Re("div",{className:pt.create("page-heading-wrapper",{width:"100%",marginBottom:ut.spacing.lg}),children:Re(St,{children:Re("div",{className:pt.create("page-heading-container",{backgroundColor:ut.colors.primary,color:ut.colors.primaryForeground,borderRadius:ut.radius.large,padding:`${ut.spacing.lg} ${ut.spacing.xl}`,boxShadow:ut.shadow.md}),children:Re("div",{className:pt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ut.spacing.lg}),children:Re("div",{className:pt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Re("h1",{className:pt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ut.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Re("p",{className:pt.create("page-template-description",{margin:"0",marginTop:ut.spacing.sm,fontSize:ut.fontSize.small,lineHeight:"1.5",color:ut.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function Uo({className:e,children:t}){const n=pt.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Re("div",{className:xt(n,e),children:t})}function Zo({message:e}){return Re(Ho,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re(Uo,{className:pt.name("loading-container"),children:Re(kt,{size:"large"})})})})}function Go({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:ut.colors.primary,color:ut.colors.primaryForeground,boxShadow:ut.shadow.sm},outline:{border:`${ut.borderWidth} solid ${ut.colors.primary}`,backgroundColor:ut.colors.card,color:ut.colors.primary,boxShadow:ut.shadow.sm}},l=pt.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:ut.radius.default,cursor:"pointer",fontSize:ut.fontSize.default,fontWeight:"500",transition:ut.transition,fontFamily:ut.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});pt.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),pt.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:ut.shadow.md}),pt.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:ut.shadow.sm});const u=pt.create(`button-${e}`,{...c[e]});return Re("button",{type:t,className:xt(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Re(kt,{size:"small"}),o]})}function Yo({error:e}){pt.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:ut.colors.background,textAlign:"center"});const t=pt.create("error-fallback-icon",{width:"4rem",height:"4rem",color:ut.colors.destructive,marginBottom:"1.5rem"}),n=pt.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:ut.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});pt.create("error-fallback-message",{fontSize:ut.fontSize.large,color:ut.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=pt.create("error-fallback-details",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,backgroundColor:ut.colors.muted,padding:"1rem",borderRadius:ut.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=pt.create("error-fallback-support",{fontSize:ut.fontSize.default,color:ut.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=pt.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=e||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return Re(Ho,{title:s.title,description:s.message,noSubscription:!0,children:Re(St,{children:Re(Uo,{className:pt.name("loading-container"),children:[Re(()=>Re("svg",{className:t,fill:"currentColor",viewBox:"0 0 20 20",children:Re("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),{}),Re("h1",{className:n,children:s.title}),s.details&&Re("div",{className:r,children:[Re("strong",{children:"Error Details:"}),Re("br",{}),s.details,s.statusCode&&Re(k,{children:[Re("br",{}),Re("strong",{children:"Status Code:"})," ",s.statusCode]})]}),Re("p",{className:i,children:ve(s)}),Re("div",{className:o,children:Re(Go,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function Jo({message:e,estimatedTime:t}){const n=pt.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=pt.create("maintenance-icon",{width:"4rem",height:"4rem",color:ut.colors.primary,marginBottom:"1.5rem"}),i=pt.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:ut.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=pt.create("maintenance-message",{fontSize:ut.fontSize.default,color:ut.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=pt.create("maintenance-info-box",{backgroundColor:ut.colors.muted,borderRadius:ut.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=pt.create("maintenance-info-title",{fontSize:ut.fontSize.default,fontWeight:"600",color:ut.colors.foreground,marginBottom:"0.5rem"}),c=pt.create("maintenance-info-text",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,lineHeight:"1.4"}),l=pt.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Re(Ho,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Re(St,{children:Re(Uo,{children:Re("div",{className:n,children:[Re(()=>Re("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:Re("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"})}),{}),Re("h1",{className:i,children:"We'll be right back"}),Re("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Re("div",{className:s,children:[Re("p",{className:a,children:"What's happening?"}),Re("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Re("p",{className:c,style:{marginTop:"0.5rem"},children:[Re("strong",{children:"Estimated time:"})," ",t]})]}),Re("div",{className:l,children:Re(Go,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Vo({size:e="default",style:t="normal",className:n,children:r}){const i=pt.create("text",{marginTop:"0",marginBottom:"0"}),o=pt.create("text-small",{fontSize:ut.fontSize.small}),s=pt.create("text-default",{fontSize:ut.fontSize.default}),a=pt.create("text-italic",{fontStyle:"italic"}),c=pt.create("text-bold",{fontWeight:"bold"}),l=pt.create("text-underline",{textDecoration:"underline"}),u=xt({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=xt({[o]:"small"===e,[s]:"default"===e});return Re("p",{className:xt(i,d,u,n),children:r})}function Qo({title:e,description:t}){return Re("div",{className:pt.create("section-header",{}),children:[Re("p",{className:pt.create("section-title",{fontSize:ut.fontSize.large,margin:"0",color:ut.colors.foreground}),children:e}),t&&Re(Vo,{className:pt.create("section-description",{color:ut.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 Xo({selected:e}){return Re("div",{className:xt(pt.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${ut.borderWidth} solid transparent`}),e?pt.create("selected-indicator-selected",{backgroundColor:ut.colors.primary}):pt.create("selected-indicator-unselected",{border:`${ut.borderWidth} solid ${ut.colors.border}`}))})}function Ko({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount);return Re("div",{className:pt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Re(Qo,{title:"Excess Options"}),Re("div",{className:pt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Re("div",{className:xt(pt.create("excess-option-card",{borderRadius:ut.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?pt.create("excess-option-card-selected",{border:`2px solid ${ut.colors.primary}`,backgroundColor:ut.colors.accent}):pt.create("excess-option-card-unselected",{border:`2px solid ${ut.colors.border}`,backgroundColor:ut.colors.card})),onClick:()=>n(e.id),children:[Re(Xo,{selected:r}),Re("div",{className:pt.create("excess-amount",{color:ut.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})})]})}function es(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function ts(e){switch(e){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}}function ns({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=Xe(()=>{if(!n)return[];const r=e.filter(e=>e.excess_id===n&&e.amount.success).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)=>("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0)-("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0))},[e,t,n]);return n?Re(rs,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Re("div",{className:pt.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Re(rs,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function rs({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Re("div",{className:pt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Re(Qo,{title:"Payment Options"}),Re("div",r?{className:pt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Re(is,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:pt.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${ut.colors.border}`,borderRadius:ut.radius.default,backgroundColor:ut.colors.muted}),children:Re(Vo,{className:pt.create("placeholder-text",{color:ut.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function is({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;return Re("div",{className:xt(pt.create("payment-option-row",{borderRadius:ut.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?pt.create("payment-option-row-selected",{border:`2px solid ${ut.colors.primary}`,backgroundColor:ut.colors.accent}):pt.create("payment-option-row-unselected",{border:`2px solid ${ut.colors.border}`,backgroundColor:ut.colors.card})),onClick:()=>n(e),children:[Re(Xo,{selected:r}),Re("div",{className:pt.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[Re("div",{className:pt.create("frequency-title",{fontSize:ut.fontSize.default,fontWeight:"500",color:ut.colors.foreground}),children:ts(e.amount.frequency)}),Re("div",{className:pt.create("gateway-description",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground}),children:["via ",e.gateway.name]})]}),Re("div",{className:pt.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[Re(Vo,{className:pt.create("amount-text",{textAlign:"right"}),children:"one-time"===e.amount.frequency?es(e.amount.dueToday):`${es(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`}),Re(Vo,{size:"small",className:pt.create("gateway-fee-text",{textAlign:"right",color:ut.colors.mutedForeground}),children:[es(e.amount.gatewayFee)," fee"]})]})]})}function os({label:e,value:t,isTotal:n=!1,className:r}){return Re("div",{className:xt(pt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Re("span",{className:pt.create("summary-label",{color:ut.colors.mutedForeground,fontSize:ut.fontSize.small}),children:e}),Re("span",{className:pt.create("summary-value",{fontWeight:n?"600":"500",color:ut.colors.foreground,fontSize:n?ut.fontSize.large:"inherit"}),children:t})]})}function ss({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){const l=Xe(()=>n?e.find(e=>e.id===n):null,[e,n]),u=Xe(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]);return Re("div",{className:pt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Re(Qo,{title:"Payment Summary"}),Re("div",{className:pt.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ut.colors.border}`}),children:[Re("div",{className:pt.create("summary-section-title",{fontSize:ut.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ut.colors.foreground}),children:"Excess Amount"}),l?Re(os,{label:`$${Number(l.excess_amount).toFixed(0)} excess`,value:es(l.premium_total)}):Re(Vo,{className:pt.create("summary-placeholder",{color:ut.colors.mutedForeground,margin:"0",fontSize:ut.fontSize.small}),children:"No excess selected"})]}),Re("div",{className:pt.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ut.colors.border}`}),children:[Re("div",{className:pt.create("summary-section-title",{fontSize:ut.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ut.colors.foreground}),children:"Payment Method"}),r&&u?Re("div",{className:pt.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:Re("div",{className:pt.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[Re("span",{className:pt.create("gateway-name",{fontWeight:"500",color:ut.colors.foreground}),children:ts(r.amount.frequency)}),Re("span",{className:pt.create("gateway-provider",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground}),children:["via ",u.name]})]})}):Re(Vo,{className:pt.create("summary-placeholder",{color:ut.colors.mutedForeground,margin:"0",fontSize:ut.fontSize.small}),children:"No payment method selected"})]}),r&&Re("div",{className:pt.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ut.colors.border}`}),children:[Re("div",{className:pt.create("summary-section-title",{fontSize:ut.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ut.colors.foreground}),children:"Payment Details"}),Re("div",{className:pt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Re(k,{children:[Re(os,{label:"Total Due Today:",value:es(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Re(os,{label:"Gateway Fee:",value:es(r.amount.gatewayFee)})]}):Re(k,{children:[Re(os,{label:"Due Today:",value:es(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Re(os,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:es(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Re(os,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Re(k,{children:Re(os,{label:"Total Payable:",value:es(r.amount.totalRepayable),className:pt.create("total-item",{})})})]})})]}),c&&Re("div",{className:pt.create("continue-later-success",{backgroundColor:`${ut.colors.accent}`,padding:"12px 16px",borderRadius:ut.radius.default,borderLeft:`4px solid ${ut.colors.primary}`}),children:[Re("h4",{className:pt.create("success-title",{margin:"0 0 4px 0",color:ut.colors.primary,fontSize:ut.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Re("p",{className:pt.create("success-text",{margin:"0",fontSize:ut.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&&Re(Go,{onClick:s,disabled:a,variant:"outline",className:pt.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:ut.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Re(Go,{onClick:i,disabled:!o,className:pt.create("purchase-button",{width:"100%",height:"3rem",fontSize:ut.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function as({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=Ct(()=>({})),[o,s]=Je("initiating"),[a,c]=Je(null),[l,u]=Je(null),[d,h]=Je(null);Ve(()=>{e&&r&&f()},[e,r]);const f=async()=>{if(r)try{s("initiating"),c(null);const e={...r,returnUrl:window.location.href},t=await i.initiatePayment(e);h(t.transaction_id),s("redirecting"),window.location.href=t.gateway_acceptance_url}catch(e){c(e.message||"Failed to initiate payment"),s("failed")}},m=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),t()};return e?Re("div",{className:pt.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:[Re("div",{className:pt.create("modal-content",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ut.colors.border}`}),children:[Re("div",{className:pt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Re("div",{className:pt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Re("h2",{className:pt.create("modal-title",{margin:"0",color:ut.colors.foreground,fontSize:ut.fontSize.large}),children:"Payment Processing"})]}),Re("div",{className:pt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Re(Vo,{className:pt.create("status-message",{fontSize:ut.fontSize.default,color:ut.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&&Re(Vo,{className:pt.create("error-message",{color:ut.colors.destructive,fontSize:ut.fontSize.small,padding:"0.75rem",backgroundColor:ut.colors.destructive+"10",borderRadius:ut.radius.default,border:`1px solid ${ut.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Re("div",{className:pt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ut.colors.border}`,borderTop:`3px solid ${ut.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Re("div",{className:pt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Re(k,{children:[Re(Go,{onClick:m,variant:"outline",children:"Close"}),"cancelled"===o&&Re(Go,{onClick:()=>{s("initiating"),c(null),f()},children:"Try Again"})]}):Re(Go,"completed"===o?{onClick:m,children:"Continue"}:{onClick:m,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Re("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function cs({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:Re("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:ut.colors.primary||"#10b981"},children:Re("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:Re("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:ut.colors.destructive},children:[Re("circle",{cx:"12",cy:"12",r:"10"}),Re("path",{d:"m15 9-6 6"}),Re("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:Re("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:ut.colors.secondary},children:[Re("circle",{cx:"12",cy:"12",r:"10"}),Re("path",{d:"m15 9-6 6"}),Re("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:Re("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:ut.colors.destructive},children:[Re("circle",{cx:"12",cy:"12",r:"10"}),Re("path",{d:"M12 8v4"}),Re("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=pt.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=pt.create("modal-content",{backgroundColor:ut.colors.background,borderRadius:ut.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${ut.borderWidth} solid ${ut.colors.border}`}),a=pt.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=pt.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground,margin:"0"}),l=pt.create("modal-message",{color:ut.colors.foreground,lineHeight:"1.5",margin:"0"});pt.create("transaction-info",{backgroundColor:ut.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:ut.radius.small,border:`${ut.borderWidth} solid ${ut.colors.border}`,fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,wordBreak:"break-all"});const u=pt.create("modal-button",{backgroundColor:ut.colors.primary,color:ut.colors.primaryForeground,border:"none",borderRadius:ut.radius.default,padding:"0.75rem 1.5rem",fontSize:ut.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=pt.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Re("div",{className:o,onClick:r,children:Re("div",{className:s,onClick:e=>e.stopPropagation(),children:Re("div",{className:a,children:[i.icon,Re("div",{className:d,children:[Re("h2",{className:c,children:i.title}),Re("p",{className:l,children:i.message})]}),Re("button",{className:u,onClick:r,children:i.buttonText})]})})})}function ls({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=Ct(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=Je(!1),[c,l]=Je(null),[u,d]=Je(!1),[h,f]=Je(!1),m=new URLSearchParams(window.location.search),p=m.get("status"),g=m.get("transactionId")||m.get("transaction_id"),[y,v]=Je(!(!p||"failed"!==p&&"declined"!==p&&"cancelled"!==p)),w=e.calculations,b=e.payment_options,x=e.payment_gateways;Ve(()=>{const e=w.find(e=>e.id===n);if(e&&i){const n=b.some(e=>"monthly"===e.amount.frequency),r=t.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);$e(i,e,b.length,n,o)}},[]);const k=Boolean(n&&r),S=null==i?void 0:i.payment_return,N=S&&("declined"===S.paymentStatus||"cancelled"===S.paymentStatus||"error"===S.paymentStatus)||y,$=(null==S?void 0:S.paymentStatus)||("failed"===p?"declined":"cancelled"===p?"cancelled":"error"),_=(null==S?void 0:S.paymentTransactionId)||g||void 0;return Re(Ho,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Re(St,{children:[Re("div",{className:pt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:ut.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Re("div",{className:pt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:ut.colors.card,boxShadow:ut.shadow.sm,borderRadius:ut.radius.large,display:"flex",flexDirection:"column"}),children:[Re("div",{className:pt.create("checkout-header",{paddingInline:ut.spacing.xl,paddingTop:ut.spacing.xl,paddingBottom:ut.spacing.lg},{"(max-width: 768px)":{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingTop:ut.spacing.md}}),children:[Re("h2",{className:pt.create("checkout-title",{margin:"0",marginBottom:ut.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ut.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Re("p",{className:pt.create("checkout-description",{margin:"0",fontSize:ut.fontSize.default,lineHeight:"1.6",color:ut.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Re("hr",{className:pt.create("checkout-header-border",{marginTop:ut.spacing.lg,borderColor:ut.colors.border})})]}),Re("div",{className:pt.create("checkout-sections",{paddingInline:ut.spacing.xl,paddingBottom:ut.spacing.xl,display:"flex",flexDirection:"column",gap:ut.spacing.lg},{"(max-width: 768px)":{paddingInline:ut.spacing.lg,paddingBottom:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingBottom:ut.spacing.md}}),children:[Re(Ko,{excessOptions:w,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Re(ns,{paymentOptions:b,paymentGateways:x,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Re("div",{className:pt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Re("div",{className:pt.create("checkout-sidebar-sticky",{position:"sticky",top:ut.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:Re("div",{className:pt.create("checkout-sidebar-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,boxShadow:ut.shadow.sm,padding:ut.spacing.lg},{"(max-width: 768px)":{padding:ut.spacing.md}}),children:Re(ss,{excessOptions:w,paymentGateways:x,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:k,onContinueLater:async()=>{var t,s;try{let t;f(!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=e.calculations.map(e=>e.calculation_id);if(0===a.length)return void alert("No calculations available. Please try again.");const c={};n&&(c.selected_excess_id=n),(null==r?void 0:r.gateway_id)&&(c.selected_gateway_id=r.gateway_id),(null==r?void 0:r.calculation_id)&&(c.selected_calculation_id=r.calculation_id),c.source="checkout_page";const l=x.map(e=>e.id),u={payment_type:"quote",quote_intent_id:e.quote_intent.id,calculation_ids:a,payment_gateway_ids:l,email:t,metadata:c};await o.createPaymentLink(u),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{f(!1)}},continueLaterLoading:h,showContinueLaterSuccess:u})})})})]}),N&&Re(cs,{type:$,transactionId:_,isOpen:!0,onClose:()=>{t.updateQuoteIntent({payment_return:void 0}),v(!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())}}),Re(as,{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 us({results:e}){var t,n,r;const{quoteIntent:i}=Ct(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=pt.create("referral-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:ut.spacing.xl,boxShadow:ut.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ut.spacing.lg},"(max-width: 480px)":{padding:ut.spacing.md}}),l=pt.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:ut.spacing.lg}),u=pt.create("referral-icon",{width:"4rem",height:"4rem",color:ut.colors.primary}),d=pt.create("referral-header",{textAlign:"center",marginBottom:ut.spacing.xl}),h=pt.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:ut.colors.primary,marginBottom:ut.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=pt.create("referral-subtitle",{fontSize:ut.fontSize.default,color:ut.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),m=pt.create("referral-process-box",{backgroundColor:ut.colors.accent,borderRadius:ut.radius.default,padding:ut.spacing.lg,marginBottom:ut.spacing.xl}),p=pt.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:ut.colors.accentForeground,marginBottom:ut.spacing.md,marginTop:"0"}),g=pt.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:ut.spacing.sm}),y=pt.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:ut.fontSize.small,color:ut.colors.accentForeground,lineHeight:"1.6"}),v=pt.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:ut.colors.primary,color:ut.colors.primaryForeground,borderRadius:"50%",marginRight:ut.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=pt.create("referral-contact-section",{borderTop:`1px solid ${ut.colors.border}`,paddingTop:ut.spacing.xl,marginTop:ut.spacing.xl,textAlign:"center"}),b=pt.create("referral-contact-text",{fontSize:ut.fontSize.default,color:ut.colors.foreground,marginBottom:ut.spacing.lg}),x=pt.create("referral-actions",{display:"flex",gap:ut.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:ut.spacing.lg}),k=pt.create("referral-reference",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,marginTop:ut.spacing.md});return Re(Ho,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Re(St,{children:Re(Uo,{children:Re("div",{className:c,children:[Re("div",{className:l,children:Re(()=>Re("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:[Re("path",{d:"M7 10v12"}),Re("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"})]}),{})}),Re("div",{className:d,children:[Re("h1",{className:h,children:"Thanks for your quote request!"}),Re("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Re("div",{className:m,children:[Re("h3",{className:p,children:"What happens next?"}),Re("ul",{className:g,children:[Re("li",{className:y,children:[Re("span",{className:v,children:"1"}),Re("span",{children:"Our team will review your application within 1-2 business days"})]}),Re("li",{className:y,children:[Re("span",{className:v,children:"2"}),Re("span",{children:"We'll contact you with either approval or additional requirements"})]}),Re("li",{className:y,children:[Re("span",{className:v,children:"3"}),Re("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&Re("div",{className:w,children:[Re("p",{className:b,children:"Need to speak with someone about your quote?"}),Re("div",{className:x,children:[s&&Re(Go,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Re("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:Re("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&&Re(Go,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Re("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:[Re("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Re("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)&&Re("div",{className:k,children:["Quote Reference: ",Re("strong",{children:e.quote_intent.reference})]})]})]})})})})}function ds({results:e}){return"referral"===e.outcome_type?Re(us,{results:e}):Re(ls,{results:e})}function hs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Qe(null),[d,h]=Je("");function f(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}Ve(()=>{h(null!=e&&""!==e?f(e):"")},[e]);const m=pt.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=pt.create("money-input-prefix",{position:"absolute",left:"1rem",color:ut.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=pt.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Re("div",{className:m,children:[l&&Re("span",{className:p,children:l}),Re("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=f(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:xt(a,l&&g)})]})}function fs(e){var t,n,r,i;const o=pt.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${ut.borderWidth} solid ${e.hasError?ut.colors.destructive:ut.colors.input}`,borderRadius:ut.radius.default,fontSize:ut.fontSize.default,backgroundColor:ut.colors.card,color:ut.colors.foreground,transition:ut.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ut.colors.destructive} 20%, transparent)`:"none"}),s=pt.name("input");pt.pseudoElement("input",":focus",{border:`${ut.borderWidth} solid ${ut.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ut.colors.primary} 20%, transparent)`,borderRadius:ut.radius.default});const a=pt.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${ut.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:ut.fontSize.default,backgroundColor:"transparent",color:ut.colors.foreground,outline:"none"}),c=pt.create("select-wrapper",{border:`${ut.borderWidth} solid ${e.hasError?ut.colors.destructive:ut.colors.input}`,borderRadius:ut.radius.default,backgroundColor:ut.colors.card,transition:ut.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ut.colors.destructive} 20%, transparent)`:"none"}),l=pt.name("select-wrapper");pt.pseudoElement("select-wrapper",":focus-within",{border:`${ut.borderWidth} solid ${ut.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ut.colors.primary} 20%, transparent)`,borderRadius:ut.radius.default});const{onChange:u,className:d,validation:h,errors:f,...m}=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 Re("div",{className:xt(c,l),children:Re("select",{...m,onChange:p,className:a,children:[e.add_null_option&&Re("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=>Re("option",{value:e.value,children:e.label},e.value))]})})}if("date"===e.type)return Re("input",{...m,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:xt(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 Re("input",{...m,type:"month",value:w,onInput:v,onChange:v,className:xt(o,s,d)})}if("year"===e.type){const b=(new Date).getFullYear();return Re("input",{...m,type:"number",min:b-100,max:b,placeholder:"YYYY",onInput:g,onChange:p,className:xt(o,s,d)})}if("money"===e.type)return Re(hs,{value:e.value,onChange:u,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:xt(o,s,d),hasError:e.hasError});if("checkbox"===e.type){const x=!0===e.value||"true"===e.value||"true"===e.value,k=pt.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),S=pt.create("checkbox-"+(x?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${x?ut.colors.primary:e.hasError?ut.colors.destructive:ut.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:x?ut.colors.primary:ut.colors.card,transition:ut.transition,position:"absolute"}),N=pt.name("checkbox-"+(x?"checked":"unchecked"));function $(e){e.preventDefault(),u(x?"false":"true")}return pt.pseudoElement("checkbox-"+(x?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${ut.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Re("div",{className:k,children:[Re("input",{type:"checkbox",id:e.id,name:e.name,checked:x,onClick:$,className:xt(S,N,d),required:e.required,readOnly:!0}),x&&Re("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:ut.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Re("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const _=pt.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),C=pt.create("boolean-radio-group",{display:"flex",gap:"1rem"}),E=pt.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),T=pt.create("boolean-radio",{accentColor:ut.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),I=pt.name("boolean-radio");pt.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${ut.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const M=pt.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${ut.borderWidth} solid ${e.hasError?ut.colors.destructive:ut.colors.input}`,borderRadius:ut.radius.default,fontSize:ut.fontSize.default,backgroundColor:ut.colors.card,color:ut.colors.foreground,transition:ut.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ut.colors.destructive} 20%, transparent)`:"none",resize:"vertical",fontFamily:ut.fontFamily}),P=pt.name("boolean-textarea");pt.pseudoElement("boolean-textarea",":focus",{border:`${ut.borderWidth} solid ${ut.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ut.colors.primary} 20%, transparent)`,borderRadius:ut.radius.default});const D=!0===e.value||"true"===e.value,R=!1===e.value||"false"===e.value,O=e.answer||"",z=e.booleanConfig,j=(null==z?void 0:z.enable_details_textbox)&&("yes"===z.show_details_on&&D||"no"===z.show_details_on&&R);function A(t){u(t),(!(null==z?void 0:z.enable_details_textbox)||!("yes"===z.show_details_on&&"true"===t||"no"===z.show_details_on&&"false"===t))&&e.onAnswerChange&&e.onAnswerChange("")}return Re("div",{className:xt(_,d),children:[Re("div",{className:C,children:[Re("label",{className:E,children:[Re("input",{type:"radio",name:e.name,checked:D,onChange:()=>A("true"),className:xt(T,I)}),Re("span",{children:"Yes"})]}),Re("label",{className:E,children:[Re("input",{type:"radio",name:e.name,checked:R,onChange:()=>A("false"),className:xt(T,I)}),Re("span",{children:"No"})]})]}),j&&Re("textarea",{placeholder:(null==z?void 0:z.details_placeholder)||"Please provide details",value:O,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:xt(M,P)})]})}return Re("input",{...m,onInput:g,onChange:p,className:xt(o,s,d)})}function ms({pages:t,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=Ct(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=Qe(null),c=Qe(null);e(t.length),e(t.map((e,t)=>({index:t,id:e.id,title:e.title}))),Ve(()=>{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);return Re("div",{className:pt.create("sidebar-navigation",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:ut.spacing.lg,boxShadow:ut.shadow.sm,position:"sticky",top:ut.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:ut.spacing.lg}),children:[Re("div",{className:pt.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:ut.spacing.sm}),children:[Re("span",{className:pt.create("sidebar-progress-text",{fontSize:ut.fontSize.small,fontWeight:"600",color:ut.colors.foreground}),children:["Step ",n+1," of ",t.length]}),Re("div",{className:pt.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ut.colors.muted,borderRadius:ut.radius.small,overflow:"hidden"}),children:Re("div",{className:pt.create("sidebar-progress-fill",{height:"100%",backgroundColor:ut.colors.primary,borderRadius:ut.radius.small,transition:ut.transition,width:`${l}%`})})})]}),Re("hr",{className:pt.create("sidebar-divider",{borderColor:ut.colors.border})}),Re("nav",{ref:c,className:pt.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:ut.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:ut.spacing.sm}),children:t.map((t,o)=>{const c=o===n,l=r.includes(o),u=i.canNavigateToPage(o);o===n&&e(t.title);const d=pt.create(`sidebar-nav-item-${o}`,{display:"flex",alignItems:"flex-start",gap:ut.spacing.sm,padding:`${ut.spacing.sm} ${ut.spacing.sm}`,borderRadius:ut.radius.default,border:"none",backgroundColor:c?ut.colors.accent:"transparent",color:c?ut.colors.accentForeground:ut.colors.foreground,cursor:u&&!s?"pointer":"not-allowed",transition:ut.transition,textAlign:"left",width:"100%",fontFamily:ut.fontFamily,fontSize:ut.fontSize.small,opacity:u&&!s?"1":"0.5"});return u&&!c&&pt.pseudoElement(`sidebar-nav-item-${o}`,":hover",{backgroundColor:ut.colors.muted}),Re("button",{ref:c?a:null,onClick:()=>{return e=o,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!u||s,className:d,children:[Re("div",{className:pt.create(`sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:l?ut.colors.primary:c?ut.colors.accentForeground:ut.colors.muted,color:l?ut.colors.primaryForeground:c?ut.colors.accent:ut.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:l?Re("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:Re("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Re("div",{className:pt.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Re("span",{className:pt.create("sidebar-page-title",{fontWeight:c?"600":"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.title})})]},t.id)})}),Re("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:pt.create("sidebar-reset-button",{padding:`${ut.spacing.sm} ${ut.spacing.md}`,border:`${ut.borderWidth} solid ${ut.colors.border}`,borderRadius:ut.radius.default,backgroundColor:"transparent",color:ut.colors.mutedForeground,fontSize:ut.fontSize.small,fontFamily:ut.fontFamily,cursor:"pointer",transition:ut.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),o&&Re("div",{className:pt.create("sidebar-last-saved",{fontSize:"0.6875rem",color:ut.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",qo.fromJSDate(new Date(o)).toFormat("T")]})]})}function ps({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=Ct(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=Je(!1),a=Math.round((t+1)/e.length*100);return Re("div",{className:pt.create("mobile-sidebar",{overflow:"hidden"}),children:[Re("button",{onClick:()=>s(!o),className:pt.create("mobile-sidebar-header",{width:"100%",padding:ut.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:ut.spacing.sm}),children:[Re("div",{className:pt.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Re("span",{className:pt.create("mobile-sidebar-step-text",{fontSize:ut.fontSize.small,fontWeight:"600",color:ut.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Re("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:pt.create("mobile-sidebar-chevron",{transition:ut.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:ut.colors.mutedForeground}),children:Re("path",{d:"m6 9 6 6 6-6"})})]}),Re("div",{className:pt.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ut.colors.muted,borderRadius:ut.radius.small,overflow:"hidden"}),children:Re("div",{className:pt.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:ut.colors.primary,borderRadius:ut.radius.small,transition:ut.transition,width:`${a}%`})})})]}),Re("hr",{className:pt.create("mobile-sidebar-border",{borderColor:ut.colors.border})}),o&&Re("div",{className:pt.create("mobile-sidebar-content",{padding:ut.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const a=o===t,c=n.includes(o),l=r.canNavigateToPage(o);return Re("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),s(!1)));var e},disabled:!l||i,className:pt.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:ut.spacing.sm,padding:ut.spacing.sm,border:"none",borderRadius:ut.radius.default,backgroundColor:a?ut.colors.accent:"transparent",color:a?ut.colors.accentForeground:ut.colors.foreground,cursor:l&&!i?"pointer":"not-allowed",opacity:l&&!i?"1":"0.5",transition:ut.transition,width:"100%",textAlign:"left",fontFamily:ut.fontFamily}),children:[Re("div",{className:pt.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?ut.colors.primary:a?ut.colors.accentForeground:ut.colors.muted,color:c?ut.colors.primaryForeground:a?ut.colors.accent:ut.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Re("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:Re("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Re("span",{className:pt.create("mobile-sidebar-page-title",{fontSize:ut.fontSize.small,fontWeight:a?"600":"500"}),children:e.title})]},e.id)})})]})}function gs({organisation:e}){return Re("div",{className:pt.create("welcome-card",{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},{"(max-width: 950px)":{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingTop:ut.spacing.md}}),children:[Re("h2",{className:pt.create("welcome-title",{margin:"0",marginBottom:ut.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:ut.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:ut.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Re("p",{className:pt.create("welcome-text",{margin:"0",fontSize:ut.fontSize.default,lineHeight:"1.6",color:ut.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."}),Re("hr",{className:pt.create("welcome-border",{marginTop:ut.spacing.lg,borderColor:ut.colors.border})})]})}function ys({title:e,description:t}){return Re(Ho,{title:e,description:t,children:Re(St,{children:Re(Uo,{className:pt.name("error-container"),children:Re("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:[Re("path",{d:"M4.929 4.929 19.07 19.071"}),Re("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function vs({errors:e,className:t}){return e&&0!==e.length?Re("div",{className:pt.create("field-error",{color:ut.colors.destructive,fontSize:ut.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Re("span",{className:pt.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function ws({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=Je(!1);return Re("label",{for:e,className:pt.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Re("span",{className:pt.create("label-text",{marginBottom:ut.spacing.sm,fontSize:ut.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:ut.spacing.sm,color:ut.colors.foreground}),children:[Re("span",{children:[t,r&&Re("span",{className:pt.create("label-required-indicator",{color:ut.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Re("span",{className:pt.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Re("svg",{className:pt.create("tooltip-icon",{width:"1rem",height:"1rem",color:ut.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Re("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Re("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Re("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Re("span",{className:pt.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:ut.colors.popover,color:ut.colors.popoverForeground,fontSize:"0.875rem",borderRadius:ut.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Re("span",{className:pt.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 ${ut.colors.popover}`})})]})]})]}),n]})}function bs(e){switch(null!=e?e:100){case 25:return pt.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return pt.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return pt.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return pt.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return pt.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return pt.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function xs(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 ks({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=pt.create("validated-field",{display:"flex",flexDirection:"column",gap:ut.spacing.sm});if("checkbox"===e.type){const t=pt.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:ut.spacing.sm}),a=pt.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=pt.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=pt.create("checkbox-label-text",{fontSize:ut.fontSize.default,fontWeight:"600",color:ut.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Re("div",{className:xt(s,bs(e.width),r),children:[Re("div",{className:t,children:Re("div",{className:a,children:[Re("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Re("label",{htmlFor:i,className:c,children:[Re("span",{className:l,children:[e.label,e.required&&Re("span",{className:pt.create("checkbox-required-indicator",{color:ut.colors.destructive}),children:"*"})]}),e.description&&Re("div",{className:pt.create("checkbox-field-description",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:xs(e.description)}})]})]})}),Re(vs,{errors:o})]})}return Re("div",{className:xt(s,bs(e.width),r),children:[Re(ws,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Re("div",{className:pt.create("field-description",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,marginBottom:ut.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:xs(e.description)}}),n]}),Re(vs,{errors:o})]})}function Ss({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:ut.colors.secondary+"08",borderColor:ut.colors.secondary+"30",iconColor:ut.colors.secondary,titleColor:ut.colors.foreground},error:{backgroundColor:ut.colors.destructive+"08",borderColor:ut.colors.destructive,iconColor:ut.colors.destructive,titleColor:ut.colors.destructive},critical:{backgroundColor:ut.colors.destructive+"10",borderColor:ut.colors.destructive,iconColor:ut.colors.destructive,titleColor:ut.colors.destructive}}[e.severity],o=pt.create("error-card",{padding:ut.spacing.md,borderRadius:ut.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:ut.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=pt.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=pt.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=pt.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=pt.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=pt.create("error-card-title",{fontSize:ut.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=pt.create("error-card-message",{fontSize:ut.fontSize.small,color:ut.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=pt.create("error-card-details",{fontSize:"0.8125rem",color:ut.colors.mutedForeground,fontFamily:"monospace",backgroundColor:ut.colors.muted,padding:"0.625rem",borderRadius:ut.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=pt.create("error-card-support",{fontSize:"0.8125rem",color:ut.colors.mutedForeground,lineHeight:"1.4"}),m=pt.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:ut.colors.mutedForeground,cursor:"pointer",borderRadius:ut.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:ut.transition});return pt.pseudoElement("error-card-dismiss",":hover",{backgroundColor:ut.colors.muted,color:ut.colors.foreground}),Re("div",{className:xt(o,n),children:Re("div",{className:s,children:[Re(()=>"warning"===e.severity?Re("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Re("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"})}):Re("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Re("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"})}),{}),Re("div",{className:c,children:[Re("div",{className:l,children:[Re("div",{className:u,children:e.title}),Re("div",{className:d,children:e.message}),r&&e.details&&Re("div",{className:h,children:e.details}),Re("div",{className:f,children:ve(e)})]}),t&&Re("button",{className:m,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Re("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:[Re("path",{d:"M18 6 6 18"}),Re("path",{d:"m6 6 12 12"})]})})]})]})})}function Ns(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=Ct(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 Re(ys,{title:"Unexpected Error",description:"No page available"});const u=Qe(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)=>{const n=new Date;let r=new Date;switch(e){case"today":r=n;break;case"+1week":r.setDate(n.getDate()+7);break;case"+1month":r.setMonth(n.getMonth()+1);break;case"+1year":r.setFullYear(n.getFullYear()+1);break;default:return""}const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return t?`${i}-${o}-01`:`${i}-${o}-${s}`},f=e=>{const t=c.getFormProgress().page_data[l.id];return((null==t?void 0:t.U)||{})[e]||""},m=c.getFormProgress().page_data[l.id]||{},p=null==s?void 0:s.payment_return,g=p&&("declined"===p.paymentStatus||"cancelled"===p.paymentStatus||"error"===p.paymentStatus),y=c.getFormProgress().completed_pages||[];return Re(Ho,{title:l.title,description:l.description,hideHeader:!0,children:Re("div",{children:[g&&Re(cs,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Re(St,{children:Re("div",{className:pt.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:ut.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Re("div",{className:pt.create("form-content-wrapper",{minWidth:"0",backgroundColor:ut.colors.card,boxShadow:ut.shadow.sm,borderRadius:ut.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Re("div",{className:pt.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Re(ps,{pages:t.pages,currentPageIndex:n,completedPages:y})}),n>0&&Re("div",{className:pt.create("page-heading-container",{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},{"(max-width: 950px)":{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingTop:ut.spacing.md}}),children:[Re("div",{className:pt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ut.spacing.lg}),children:Re("div",{className:pt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Re("h1",{className:pt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ut.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&Re("p",{className:pt.create("page-template-description",{margin:"0",marginTop:ut.spacing.sm,fontSize:ut.fontSize.small,lineHeight:"1.5",color:ut.colors.foreground,opacity:"0.7"}),children:l.description})]})}),Re("hr",{className:pt.create("page-heading-border",{marginTop:ut.spacing.lg,borderColor:ut.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Re(gs,{organisation:s.organisation}),o.length>0&&o.map(e=>Re(Ss,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),Re("div",{className:pt.create("form-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:ut.spacing.lg,boxShadow:ut.shadow.sm,display:"flex",flexDirection:"column",gap:ut.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:ut.spacing.md,gap:ut.spacing.lg},"(max-width: 480px)":{padding:ut.spacing.md,gap:ut.spacing.md}}),children:[Re("form",{onSubmit:e=>e.preventDefault(),className:pt.create("form-fields-container",{flex:"1"}),children:Re("div",{className:pt.create("form-content-page",{display:"grid",gap:ut.spacing.md,rowGap:ut.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=ne(m,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),r="show"===t.visibility.action?n.matched:!n.matched;return u.current.get(t.id)!==r&&(e((t.label,t.code)),e(),u.current.set(t.id,r)),r})(t)?Re(ks,{field:t,errors:i,children:Re(fs,{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:f(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})})}),Re("hr",{className:pt.create("form-navigation-border",{borderColor:ut.colors.border})}),Re("div",{className:pt.create("form-navigation-inline",{paddingTop:ut.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Re(Go,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Re(Go,{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"})]})]})]}),Re("div",{className:pt.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Re(ms,{pages:t.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function $s(){var e,t,n;const{quoteIntent:r,fsm:i}=Ct(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;Ve(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?Ee(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Te(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=pt.create("success-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:ut.spacing.xl,boxShadow:ut.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ut.spacing.lg},"(max-width: 480px)":{padding:ut.spacing.md}}),f=pt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:ut.spacing.lg}),m=pt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=pt.create("success-header",{textAlign:"center",marginBottom:ut.spacing.xl}),g=pt.create("success-title",{margin:"0",marginBottom:ut.spacing.sm,fontSize:"2rem",fontWeight:"700",color:ut.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=pt.create("success-message",{fontSize:ut.fontSize.default,lineHeight:"1.6",color:ut.colors.foreground,opacity:"0.9",margin:"0"}),v=pt.create("success-contact-section",{borderTop:`1px solid ${ut.colors.border}`,paddingTop:ut.spacing.xl,marginTop:ut.spacing.xl}),w=pt.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:ut.colors.foreground,marginBottom:ut.spacing.md,textAlign:"center"}),b=pt.create("success-contact-details",{backgroundColor:ut.colors.accent,borderRadius:ut.radius.default,padding:ut.spacing.md,display:"flex",flexDirection:"column",gap:ut.spacing.sm,marginBottom:ut.spacing.lg}),x=pt.create("success-contact-item",{display:"flex",alignItems:"center",gap:ut.spacing.sm,fontSize:ut.fontSize.small,color:ut.colors.accentForeground}),k=pt.create("success-actions",{display:"flex",gap:ut.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=pt.create("success-reference",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,textAlign:"center",marginTop:ut.spacing.md});return Re(Ho,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re(Uo,{children:Re("div",{className:h,children:[Re("div",{className:f,children:Re("div",{className:m,children:Re("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:Re("path",{d:"M20 6 9 17l-5-5"})})})}),Re("div",{className:p,children:[Re("h1",{className:g,children:"Payment Complete!"}),Re("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&&Re("div",{className:v,children:[Re("h3",{className:w,children:"Need assistance?"}),Re("div",{className:b,children:[l&&Re("div",{className:x,children:[Re("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:[Re("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Re("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Re("span",{children:l})]}),u&&Re("div",{className:x,children:[Re("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:Re("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"})}),Re("span",{children:u})]})]}),Re("div",{className:k,children:[u&&Re(Go,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Re("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:Re("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&&Re(Go,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Re("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:[Re("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Re("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Re("div",{className:S,children:["Quote Reference: ",Re("strong",{children:r.reference})]})]})})})})}function _s({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=Je("initiating"),[a,c]=Je(null),[l,u]=Je(null),[d,h]=Je(null);Ve(()=>{e&&r&&f()},[e,r]);const f=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")}},m=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),t()};return e?Re("div",{className:pt.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:[Re("div",{className:pt.create("modal-content",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ut.colors.border}`}),children:[Re("div",{className:pt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Re("div",{className:pt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Re("h2",{className:pt.create("modal-title",{margin:"0",color:ut.colors.foreground,fontSize:ut.fontSize.large}),children:"Payment Processing"})]}),Re("div",{className:pt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Re(Vo,{className:pt.create("status-message",{fontSize:ut.fontSize.default,color:ut.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&&Re(Vo,{className:pt.create("error-message",{color:ut.colors.destructive,fontSize:ut.fontSize.small,padding:"0.75rem",backgroundColor:ut.colors.destructive+"10",borderRadius:ut.radius.default,border:`1px solid ${ut.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Re("div",{className:pt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ut.colors.border}`,borderTop:`3px solid ${ut.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Re("div",{className:pt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Re(k,{children:[Re(Go,{onClick:m,variant:"outline",children:"Close"}),"cancelled"===o&&Re(Go,{onClick:()=>{s("initiating"),c(null),f()},children:"Try Again"})]}):Re(Go,"completed"===o?{onClick:m,children:"Continue"}:{onClick:m,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Re("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}pt.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:ut.colors.muted,borderColor:ut.colors.primary,color:ut.colors.primary});class Cs{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 gt}).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)}}function Es({paymentLinkId:t,signedUrl:n}){var r,i,o,s,a,c,l;const{httpClient:u}=function(){const e=_t(),{httpClient:t,paymentLinkConfig:n}=e;if(!n||!t)throw new Error("usePaymentLink can only be used in payment link mode. If you're in quote mode, use useQuoteForm instead.");return{httpClient:t,paymentLinkId:n.paymentLinkId,signedUrl:n.signedUrl}}(),[d,h]=Je(null),[f,m]=Je([]),[p,g]=Je([]),[y,v]=Je(!0),[w,b]=Je(null),[x,S]=Je(!1),[N,$]=Je(null),[_,C]=Je(null),[E,T]=Je(null),[I,M]=Je(!1),[P,D]=Je(null),[R,O]=Je(null);Ve(()=>{z()},[t]);const z=async()=>{try{v(!0);const t=new URLSearchParams(window.location.search),r=t.get("transactionId"),i=t.get("status");r&&i&&(M(!0),D(i),O(r));const o=await u.getPaymentLinkDetails(n);if("paid"===o.status&&!I&&(!r||"completed"!==i&&"success"!==i))return void b("This payment link has already been used.");if("expired"===o.status)return void b("This payment link has expired.");if(o.organisation&&o.organisation.theme)try{await Cs.loadTheme({slug:o.organisation.slug,theme_url:o.organisation.theme.css_url})}catch(t){e()}g(o.payment_gateways||[]),m(o.payment_options||[]),h(o)}catch(e){b("Failed to load payment details. Please check your link.")}finally{v(!1)}};if(y)return Re(Ho,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re("div",{className:pt.create("payment-link-loading-card",{textAlign:"center",padding:ut.spacing.xl,backgroundColor:ut.colors.card,borderRadius:ut.radius.large,boxShadow:ut.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Re("p",{className:pt.create("loading-text",{color:ut.colors.mutedForeground,fontSize:ut.fontSize.default}),children:"Loading payment details..."})})})});if(w)return Re(Ho,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re("div",{className:pt.create("payment-link-error-card",{textAlign:"center",padding:ut.spacing.xl,backgroundColor:ut.colors.card,borderRadius:ut.radius.large,boxShadow:ut.shadow.sm,border:`2px solid ${ut.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Re("h2",{className:pt.create("error-title",{color:ut.colors.destructive,marginBottom:ut.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),Re("p",{className:pt.create("error-message",{color:ut.colors.foreground,fontSize:ut.fontSize.default,margin:"0"}),children:w})]})})});if(!d)return null;const j=new URLSearchParams(window.location.search),A=j.get("transactionId"),L=j.get("status"),W=A&&L;if("paid"===d.status&&("completed"===L||"success"===L||W||I||"completed"===P)){const e=null===(r=d.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=d.organisation)||void 0===i?void 0:i.phone,n=e||t;return Re(Ho,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re("div",{className:pt.create("payment-success-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,padding:ut.spacing.xl,boxShadow:ut.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Re("div",{className:pt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:ut.spacing.lg}),children:Re("div",{className:pt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Re("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:Re("path",{d:"M20 6 9 17l-5-5"})})})}),Re("div",{className:pt.create("success-header",{textAlign:"center",marginBottom:ut.spacing.xl}),children:[Re("h1",{className:pt.create("success-title",{margin:"0",marginBottom:ut.spacing.sm,fontSize:"2rem",fontWeight:"700",color:ut.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Re("p",{className:pt.create("success-message",{fontSize:ut.fontSize.default,lineHeight:"1.6",color:ut.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Re("div",{className:pt.create("contact-section",{borderTop:`1px solid ${ut.colors.border}`,paddingTop:ut.spacing.xl,marginTop:ut.spacing.xl}),children:[Re("h3",{className:pt.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:ut.colors.foreground,marginBottom:ut.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Re("div",{className:pt.create("contact-details",{backgroundColor:ut.colors.accent,borderRadius:ut.radius.default,padding:ut.spacing.md,display:"flex",flexDirection:"column",gap:ut.spacing.sm,marginBottom:ut.spacing.lg}),children:[e&&Re("div",{className:pt.create("contact-item",{display:"flex",alignItems:"center",gap:ut.spacing.sm,fontSize:ut.fontSize.small,color:ut.colors.accentForeground}),children:Re("span",{children:["Email: ",e]})}),t&&Re("div",{className:pt.create("contact-item",{display:"flex",alignItems:"center",gap:ut.spacing.sm,fontSize:ut.fontSize.small,color:ut.colors.accentForeground}),children:Re("span",{children:["Phone: ",t]})})]}),(R||A)&&Re("div",{className:pt.create("reference",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,textAlign:"center",marginTop:ut.spacing.md}),children:["Transaction ID: ",Re("strong",{children:null===(o=R||A)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}if(W&&("failed"===L||"cancelled"===L||"failed"===P||"cancelled"===P))return Re(Ho,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:Re(St,{children:Re("div",{className:pt.create("payment-error-card",{textAlign:"center",padding:ut.spacing.xl,backgroundColor:ut.colors.card,borderRadius:ut.radius.large,boxShadow:ut.shadow.sm,border:`2px solid ${ut.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Re("h2",{className:pt.create("error-title",{color:ut.colors.destructive,marginBottom:ut.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===L||"cancelled"===P?"Payment Cancelled":"Payment Failed"}),Re("p",{className:pt.create("error-message",{color:ut.colors.foreground,fontSize:ut.fontSize.default,margin:"0",marginBottom:ut.spacing.lg}),children:"cancelled"===L||"cancelled"===P?"Your payment was cancelled. You can try again by refreshing this page.":"There was an issue processing your payment. Please try again."}),Re(Go,{onClick:()=>window.location.reload(),children:"Try Again"})]})})});const F="quote"===d.payment_type||"renewal"===d.payment_type,q=d.snapshot_data.calculations||(d.snapshot_data.calculation?[d.snapshot_data.calculation]:[]),B=q.length>1,H=q.find(e=>(e.id||e.calculation_id)===_),U=d.snapshot_data.product_name||d.snapshot_data.description||"Payment",Z=f.find(e=>e.gateway_id===E&&e.calculation_id===_),G=(null===(s=null==Z?void 0:Z.amount)||void 0===s?void 0:s.totalRepayable)?Z.amount.totalRepayable:(null==H?void 0:H.premium_payable)||d.snapshot_data.amount||0,Y=new Date(d.expires_at);return Re(Ho,{title:"Complete Your "+("renewal"===d.payment_type?"Renewal":"Purchase"),noSubscription:!0,hideHeader:!0,children:Re(St,{children:[Re("div",{className:pt.create("payment-link-card",{backgroundColor:ut.colors.card,borderRadius:ut.radius.large,boxShadow:ut.shadow.sm,maxWidth:"900px",margin:"0 auto"}),children:[Re("div",{className:pt.create("payment-link-header",{paddingInline:ut.spacing.xl,paddingTop:ut.spacing.xl,paddingBottom:ut.spacing.lg},{"(max-width: 768px)":{paddingInline:ut.spacing.lg,paddingTop:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingTop:ut.spacing.md}}),children:[Re("h2",{className:pt.create("payment-link-title",{margin:"0",marginBottom:ut.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ut.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"renewal"===d.payment_type?"Policy Renewal":"Complete Your Purchase"}),Re("p",{className:pt.create("payment-link-subtitle",{margin:"0",fontSize:ut.fontSize.default,lineHeight:"1.6",color:ut.colors.foreground,opacity:"0.9"}),children:U}),Re("hr",{className:pt.create("payment-link-header-border",{marginTop:ut.spacing.lg,borderColor:ut.colors.border})})]}),Re("div",{className:pt.create("payment-link-content",{paddingInline:ut.spacing.xl,paddingBottom:ut.spacing.xl,display:"flex",flexDirection:"column",gap:ut.spacing.lg},{"(max-width: 768px)":{paddingInline:ut.spacing.lg,paddingBottom:ut.spacing.lg},"(max-width: 480px)":{paddingInline:ut.spacing.md,paddingBottom:ut.spacing.md}}),children:[Re("div",{className:pt.create("expiry-notice",{backgroundColor:ut.colors.accent,padding:"14px 18px",borderRadius:ut.radius.default,borderLeft:`4px solid ${ut.colors.primary}`}),children:Re("p",{className:pt.create("expiry-text",{margin:"0",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:["This payment link expires on ",Re("strong",{children:Y.toLocaleDateString()})]})}),F&&B&&Re("div",{children:[Re("h3",{className:pt.create("section-title",{marginTop:"0",marginBottom:ut.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground}),children:"Select Your Excess Amount"}),Re("div",{className:pt.create("calculation-options",{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:ut.spacing.md},{"(max-width: 480px)":{gridTemplateColumns:"1fr"}}),children:q.map(e=>{const t=e.id||e.calculation_id,n=_===t;return Re("div",{className:pt.create(`calc-option-${t}`,{padding:ut.spacing.md,border:`2px solid ${n?ut.colors.primary:ut.colors.border}`,borderRadius:ut.radius.default,cursor:"pointer",backgroundColor:n?ut.colors.accent:ut.colors.card,transition:"all 0.2s ease",position:"relative",boxShadow:n?ut.shadow.sm:"none"}),onClick:()=>C(t),children:[Re("div",{className:pt.create("excess-amount",{fontSize:"1.5rem",fontWeight:"700",color:ut.colors.primary,marginBottom:"4px"}),children:["$",Number(e.excess_amount).toFixed(0)]}),Re("div",{className:pt.create("excess-label",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,marginBottom:ut.spacing.sm}),children:"Excess"}),Re("div",{className:pt.create("premium",{fontSize:"1.125rem",fontWeight:"600",color:ut.colors.foreground}),children:["$",Number(e.premium_payable).toFixed(2)]}),Re("div",{className:pt.create("premium-label",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground}),children:"Annual Premium"}),n&&Re("div",{className:pt.create("selected-badge",{position:"absolute",top:"10px",right:"10px",width:"24px",height:"24px",borderRadius:"50%",backgroundColor:ut.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",color:ut.colors.primaryForeground}),children:Re("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"✓"})})]},t)})})]}),F&&!B&&H&&Re("div",{className:pt.create("coverage-details",{backgroundColor:ut.colors.accent,padding:ut.spacing.md,borderRadius:ut.radius.default,border:`1px solid ${ut.colors.border}`}),children:[Re("h3",{className:pt.create("section-title",{marginTop:"0",marginBottom:ut.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground}),children:"Coverage Details"}),Re("div",{className:pt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Re("span",{className:pt.create("detail-label",{fontSize:ut.fontSize.default,color:ut.colors.mutedForeground}),children:"Excess Amount:"}),Re("strong",{className:pt.create("detail-value",{fontSize:ut.fontSize.large,color:ut.colors.foreground}),children:["$",Number(H.excess_amount).toFixed(2)]})]})]}),p.length>0&&Re("div",{children:[Re("h3",{className:pt.create("section-title",{marginTop:"0",marginBottom:ut.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground}),children:"Select Payment Method"}),Re("div",{className:pt.create("gateway-options",{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:ut.spacing.md}),children:p.map(e=>{const t=E===e.id,n=f.find(t=>t.gateway_id===e.id&&t.calculation_id===_);return Re("div",{className:pt.create(`gateway-option-${e.id}`,{padding:ut.spacing.md,border:`2px solid ${t?ut.colors.primary:ut.colors.border}`,borderRadius:ut.radius.default,cursor:"pointer",backgroundColor:t?ut.colors.accent:ut.colors.card,transition:"all 0.2s ease",position:"relative",boxShadow:t?ut.shadow.sm:"none"}),onClick:()=>T(e.id),children:[Re("div",{className:pt.create("gateway-name",{fontSize:"1.125rem",fontWeight:"700",color:ut.colors.primary,marginBottom:"4px"}),children:e.name}),Re("div",{className:pt.create("gateway-description",{fontSize:ut.fontSize.small,color:ut.colors.mutedForeground,marginBottom:ut.spacing.sm}),children:["windcave"===e.code&&"Pay in full","redplanet"===e.code&&n&&`$${Number(n.amount.installmentAmount).toFixed(2)}/month`,"redplanet"===e.code&&!n&&"Monthly installments"]}),n&&"redplanet"===e.code&&Re("div",{className:pt.create("installment-details",{fontSize:ut.fontSize.small,color:ut.colors.foreground}),children:[n.amount.numberOfInstallments," payments"]}),t&&Re("div",{className:pt.create("selected-badge",{position:"absolute",top:"10px",right:"10px",width:"24px",height:"24px",borderRadius:"50%",backgroundColor:ut.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",color:ut.colors.primaryForeground}),children:Re("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"✓"})})]},e.id)})})]}),E&&_&&(()=>{const e=p.find(e=>e.id===E),t=f.find(e=>e.gateway_id===E&&e.calculation_id===_);return"redplanet"===(null==e?void 0:e.code)&&t?Re("div",{className:pt.create("payment-method-breakdown",{backgroundColor:ut.colors.accent,padding:ut.spacing.md,borderRadius:ut.radius.default,border:`1px solid ${ut.colors.border}`}),children:[Re("h3",{className:pt.create("section-title",{marginTop:"0",marginBottom:ut.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground}),children:"Payment Plan Details"}),Re("div",{className:pt.create("payment-breakdown-items",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:[Re("div",{className:pt.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{className:pt.create("breakdown-label",{color:ut.colors.mutedForeground}),children:"Due Today:"}),Re("span",{className:pt.create("breakdown-value",{fontWeight:"600",fontSize:ut.fontSize.large}),children:["$",Number(t.amount.dueToday||0).toFixed(2)]})]}),t.amount.installmentAmount&&Re("div",{className:pt.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{className:pt.create("breakdown-label",{color:ut.colors.mutedForeground}),children:"Then Monthly:"}),Re("span",{className:pt.create("breakdown-value",{fontWeight:"500"}),children:["$",Number(t.amount.installmentAmount).toFixed(2)]})]}),t.amount.numberOfInstallments&&Re("div",{className:pt.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{className:pt.create("breakdown-label",{color:ut.colors.mutedForeground}),children:"Number of Payments:"}),Re("span",{className:pt.create("breakdown-value",{fontWeight:"500"}),children:t.amount.numberOfInstallments})]}),t.amount.totalRepayable&&Re("div",{className:pt.create("breakdown-row",{display:"flex",justifyContent:"space-between",fontSize:ut.fontSize.default,color:ut.colors.foreground,paddingTop:ut.spacing.sm,marginTop:ut.spacing.sm,borderTop:`1px solid ${ut.colors.border}`}),children:[Re("span",{className:pt.create("breakdown-label",{fontWeight:"600"}),children:"Total Payable:"}),Re("span",{className:pt.create("breakdown-value",{fontWeight:"600",color:ut.colors.primary}),children:["$",Number(t.amount.totalRepayable).toFixed(2)]})]})]})]}):null})(),Re("div",{className:pt.create("amount-breakdown",{backgroundColor:ut.colors.accent,padding:ut.spacing.md,borderRadius:ut.radius.default,border:`1px solid ${ut.colors.border}`}),children:[Re("h3",{className:pt.create("section-title",{marginTop:"0",marginBottom:ut.spacing.md,fontSize:"1.25rem",fontWeight:"600",color:ut.colors.foreground}),children:F?"Premium Breakdown":"Payment Details"}),Re(k,F&&H?{children:[Re("div",{className:pt.create("detail-row",{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{children:"Premium (excluding fees):"}),Re("span",{children:["$",Number(H.premium_subtotal).toFixed(2)]})]}),null===(c=null===(a=H.result)||void 0===a?void 0:a.fees)||void 0===c?void 0:c.map((e,t)=>Re("div",{className:pt.create(`fee-row-${t}`,{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{children:[e.name,":"]}),Re("span",{children:["$",Number(e.amount).toFixed(2)]})]},t))]}:{children:null===(l=d.snapshot_data.line_items)||void 0===l?void 0:l.map((e,t)=>Re("div",{className:pt.create(`line-item-${t}`,{display:"flex",justifyContent:"space-between",marginBottom:"10px",fontSize:ut.fontSize.default,color:ut.colors.foreground}),children:[Re("span",{children:[e.name,":"]}),Re("span",{children:["$",Number(e.amount).toFixed(2)]})]},t))}),Re("div",{className:pt.create("total-row",{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:ut.spacing.md,paddingTop:ut.spacing.md,borderTop:`2px solid ${ut.colors.border}`}),children:[Re("span",{className:pt.create("total-label",{fontSize:"1.125rem",fontWeight:"600",color:ut.colors.foreground}),children:F?"Total Premium:":"Total Amount:"}),Re("span",{className:pt.create("total-amount",{fontSize:"1.5rem",fontWeight:"700",color:ut.colors.primary}),children:["$",Number(G).toFixed(2)]})]})]}),Re("div",{className:pt.create("important-notice",{backgroundColor:ut.colors.accent,padding:ut.spacing.md,borderRadius:ut.radius.default,borderLeft:`4px solid ${ut.colors.primary}`}),children:Re("p",{className:pt.create("notice-text",{margin:"0",fontSize:ut.fontSize.default,color:ut.colors.foreground,lineHeight:"1.6"}),children:[Re("strong",{children:"Please note:"})," The amounts shown are fixed at the time the quote was generated. If you need to make changes to your coverage, please request a new quote."]})}),Re(Go,{onClick:()=>{if(!d)return;if(!_)return void alert("Please select an excess amount before proceeding.");if(!E)return void alert("Please select a payment method before proceeding.");const e="quote"===d.payment_type||"renewal"===d.payment_type;let t=null;if(d.snapshot_data.calculations&&(t=d.snapshot_data.calculations.find(e=>(e.id||e.calculation_id)===_)),e&&!t)return void alert("Payment configuration error. Please try again.");const n=p.find(e=>e.id===E);if(!n)return void alert("Payment method not available. Please try again.");const r=d.snapshot_data.form_data||{};let i="Customer";if(r.page_data)for(const e in r.page_data){const t=r.page_data[e];if(t&&"object"==typeof t){if(t.client_first_name){i=`${t.client_first_name} ${t.client_last_name||""}`.trim();break}if(t.client_name){i=t.client_name;break}if(t.full_name){i=t.full_name;break}if(t.name){i=t.name;break}if(t.first_name){i=`${t.first_name} ${t.last_name||""}`.trim();break}}}const o=d.quote_intent_id;if(!o)return void alert("No quote found.");const s=_,a={quoteIntentId:o,excessId:t.excess_id||"",gatewayId:E,calculationId:s,clientDetails:{legalName:i},metadata:{payment_link_id:d.id,payment_type:d.payment_type,gateway:n}};$(a),S(!0)},className:pt.create("payment-button",{width:"100%",padding:"18px",fontSize:"1.125rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1rem",padding:"16px"}}),children:["Proceed to Payment - $",Number(G).toFixed(2)]})]})]}),x&&N&&u&&Re(_s,{isOpen:x,onClose:()=>{S(!1),$(null)},onSuccess:()=>{S(!1),$(null),alert("Payment completed successfully!")},paymentRequest:N,httpClient:u})]})})}function Ts(){const e=_t(),{paymentLinkConfig:t}=e;if(t)return Re(Es,{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl});const n=window.location.pathname.match(/\/pay\/([a-f0-9-]+)/);if(n&&n[1])return Re(Es,{paymentLinkId:n[1],signedUrl:window.location.href});const{isCalculating:r,results:i,quoteIntent:o}=Ct(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent()})),s="paid"===(null==o?void 0:o.status)||"completed"===(null==o?void 0:o.status);return r?Re(Zo,{message:"Processing your quote, please wait..."}):s?Re($s,{}):i?Re(ds,{results:i}):Re(Ns,{})}function Is(e){return Re($t,{...e,children:Re(Ts,{})})}Cs.loadedThemes=new Set,Cs.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"};class Ms extends S{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return md}).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=de("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return ye(e)?Re(Jo,{message:e.message}):Re(Yo,{error:e})}return this.props.children}}function Ps({config:t,initializeFormContext:n}){const[r,i]=Je({type:"loading",message:"Loading application..."});return Ve(()=>{(async()=>{try{e();const r=await n(t);if("payment"!==t.mode&&(!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?de("maintenance",t):de("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),Re(Ms,{children:Re("div",{className:pt.create("root",{fontFamily:ut.fontFamily,backgroundColor:ut.colors.background,minHeight:"100vh",color:ut.colors.foreground}),children:function(){switch(r.type){case"loading":return Re(Zo,{message:r.message});case"error":return ye(r.error)?Re(Jo,{message:r.error.message}):Re(Yo,{error:r.error});case"success":return Re(Is,{...r.formContextProps});default:return Re(Yo,{})}}()})})}const Ds="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Rs=globalThis,Os="10.17.0";function zs(){return js(Rs),Rs}function js(e){const t=e.oe=e.oe||{};return t.version=t.version||Os,t[Os]=t[Os]||{}}function As(e,t,n=Rs){const r=n.oe=n.oe||{},i=r[Os]=r[Os]||{};return i[e]||(i[e]=t())}const Ls=["debug","info","warn","error","log","assert","trace"],Ws={};function Fs(e){if(!("console"in Rs))return e();const t=Rs.console,n={},r=Object.keys(Ws);r.forEach(e=>{const r=Ws[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function qs(){return Hs().enabled}function Bs(e,...t){Ds&&qs()&&Fs(()=>{Rs.console[e](`Sentry Logger [${e}]:`,...t)})}function Hs(){return Ds?As("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Us=function(){Hs().enabled=!0},Zs=function(...e){Bs("log",...e)},Gs=function(...e){Bs("warn",...e)},Ys=function(...e){Bs("error",...e)},Js="?",Vs=/\(error: (.*)\)/,Qs=/captureMessage|captureException/;function Xs(...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=Vs.test(n)?n.replace(Vs,"$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(Ks(t).function||"")&&t.pop(),t.reverse(),Qs.test(Ks(t).function||"")&&(t.pop(),Qs.test(Ks(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Ks(t).filename,function:e.function||Js}))}(i.slice(r))}}function Ks(e){return e[e.length-1]||{}}const ea="<anonymous>";function ta(e){try{return e&&"function"==typeof e&&e.name||ea}catch{return ea}}function na(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 ra={},ia={};function oa(e,t){ra[e]=ra[e]||[],ra[e].push(t)}function sa(e,t){if(!ia[e]){ia[e]=!0;try{t()}catch(t){Ds&&Ys(`Error while instrumenting ${e}`,t)}}}function aa(e,t){const n=e&&ra[e];if(n)for(const r of n)try{r(t)}catch(t){Ds&&Ys(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ta(r)}\nError:`,t)}}let ca=null;function la(){ca=Rs.onerror,Rs.onerror=function(e,t,n,r,i){return aa("error",{column:r,error:i,line:n,msg:e,url:t}),!!ca&&ca.apply(this,arguments)},Rs.onerror.se=!0}let ua=null;function da(){ua=Rs.onunhandledrejection,Rs.onunhandledrejection=function(e){return aa("unhandledrejection",e),!ua||ua.apply(this,arguments)},Rs.onunhandledrejection.se=!0}const ha={}.toString;function fa(e){switch(ha.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Sa(e,Error)}}function ma(e,t){return ha.call(e)===`[object ${t}]`}function pa(e){return ma(e,"ErrorEvent")}function ga(e){return ma(e,"DOMError")}function ya(e){return ma(e,"String")}function va(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function wa(e){return null===e||va(e)||"object"!=typeof e&&"function"!=typeof e}function ba(e){return ma(e,"Object")}function xa(e){return"undefined"!=typeof Event&&Sa(e,Event)}function ka(e){return Boolean(e?.then&&"function"==typeof e.then)}function Sa(e,t){try{return e instanceof t}catch{return!1}}function Na(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const $a=Rs;function _a(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=Ca(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 Ca(e,t){const n=e,r=[];if(!n?.tagName)return"";if($a.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&ya(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}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 Ea(){try{return $a.document.location.href}catch{return""}}function Ta(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ia(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Na(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ma(e,t,n=!1){return!!ya(e)&&(ma(t,"RegExp")?t.test(e):!!ya(t)&&(n?e===t:e.includes(t)))}function Pa(e,t=[],n=!1){return t.some(t=>Ma(e,t,n))}function Da(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Oa(i,r);try{e[t]=i}catch{Ds&&Zs(`Failed to replace method "${t}" in object`,e)}}function Ra(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Ds&&Zs(`Failed to add non-enumerable property "${t}" to object`,e)}}function Oa(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ra(e,"__sentry_original__",t)}catch{}}function za(e){return e.de}function ja(e){if(fa(e))return{message:e.message,name:e.name,stack:e.stack,...La(e)};if(xa(e)){const t={type:e.type,target:Aa(e.target),currentTarget:Aa(e.currentTarget),...La(e)};return"undefined"!=typeof CustomEvent&&Sa(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Aa(e){try{return"undefined"!=typeof Element&&Sa(e,Element)?_a(e):{}.toString.call(e)}catch{return"<unknown>"}}function La(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 Wa(e=function(){const e=Rs;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 Fa(e){return e.exception?.values?.[0]}function qa(e){const{message:t,event_id:n}=e;if(t)return t;const r=Fa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ba(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 Ha(e,t){const n=Fa(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 Ua(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Ra(e,"__sentry_captured__",!0)}catch{}return!1}function Za(){return Date.now()/1e3}let Ga;function Ya(){return(Ga??(Ga=function(){const{performance:e}=Rs;if(!e?.now||!e.timeOrigin)return Za;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function Ja(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||Ya(),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:Wa()),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 Va(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]=Va(r[e],t[e],n-1));return r}function Qa(){return Wa()}function Xa(){return Wa().substring(16)}const Ka="_sentrySpan";function ec(e,t){t?Ra(e,Ka,t):delete e[Ka]}function tc(e){return e[Ka]}class nc{constructor(){this.fe=!1,this.me=[],this.pe=[],this.ge=[],this.ye=[],this.ve={},this.we={},this.be={},this.xe={},this.ke={},this.Se={traceId:Qa(),sampleRand:Math.random()}}clone(){const e=new nc;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.Ee=this.Ee,e.Te=this.Te,ec(e,tc(this)),e}setClient(e){this.Ee=e}setLastEventId(e){this.Te=e}getClient(){return this.Ee}lastEventId(){return this.Te}addScopeListener(e){this.me.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&&Ja(this.$e,{user:e}),this.Ie(),this}getUser(){return this.ve}setTags(e){return this.we={...this.we,...e},this.Ie(),this}setTag(e,t){return this.we={...this.we,[e]:t},this.Ie(),this}setExtras(e){return this.be={...this.be,...e},this.Ie(),this}setExtra(e,t){return this.be={...this.be,[e]:t},this.Ie(),this}setFingerprint(e){return this.Ce=e,this.Ie(),this}setLevel(e){return this.Ne=e,this.Ie(),this}setTransactionName(e){return this._e=e,this.Ie(),this}setContext(e,t){return null===t?delete this.xe[e]:this.xe[e]=t,this.Ie(),this}setSession(e){return e?this.$e=e:delete this.$e,this.Ie(),this}getSession(){return this.$e}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof nc?t.getScopeData():ba(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,ec(this,void 0),this.ye=[],this.setPropagationContext({traceId:Qa(),sampleRand:Math.random()}),this.Ie(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Za(),...e,message:e.message?Ta(e.message,2048):e.message};return this.ge.push(r),this.ge.length>n&&(this.ge=this.ge.slice(-n),this.Ee?.recordDroppedEvent("buffer_overflow","log_item")),this.Ie(),this}getLastBreadcrumb(){return this.ge[this.ge.length-1]}clearBreadcrumbs(){return this.ge=[],this.Ie(),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:tc(this)}}setSDKProcessingMetadata(e){return this.ke=Va(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||Wa();if(!this.Ee)return Ds&&Gs("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ee.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Wa();if(!this.Ee)return Ds&&Gs("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this.Ee.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||Wa();return this.Ee?(this.Ee.captureEvent(e,{...t,event_id:n},this),n):(Ds&&Gs("No client configured on scope - will not capture event!"),n)}Ie(){this.fe||(this.fe=!0,this.me.forEach(e=>{e(this)}),this.fe=!1)}}class rc{constructor(e,t){let n,r;n=e||new nc,r=t||new nc,this.Me=[{scope:n}],this.Pe=r}withScope(e){const t=this.De();let n;try{n=e(t)}catch(e){throw this.Re(),e}return ka(n)?n.then(e=>(this.Re(),e),e=>{throw this.Re(),e}):(this.Re(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Pe}getStackTop(){return this.Me[this.Me.length-1]}De(){const e=this.getScope().clone();return this.Me.push({client:this.getClient(),scope:e}),e}Re(){return!(this.Me.length<=1||!this.Me.pop())}}function ic(){const e=js(zs());return e.stack=e.stack||new rc(As("defaultCurrentScope",()=>new nc),As("defaultIsolationScope",()=>new nc))}function oc(e){return ic().withScope(e)}function sc(e,t){const n=ic();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function ac(e){return ic().withScope(()=>e(ic().getIsolationScope()))}function cc(e){const t=js(e);return t.acs?t.acs:{withIsolationScope:ac,withScope:oc,withSetScope:sc,withSetIsolationScope:(e,t)=>ac(t),getCurrentScope:()=>ic().getScope(),getIsolationScope:()=>ic().getIsolationScope()}}function lc(){return cc(zs()).getCurrentScope()}function uc(){return cc(zs()).getIsolationScope()}function dc(...e){const t=cc(zs());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function hc(){return lc().getClient()}function fc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||Xa()};return r&&(o.parent_span_id=r),o}const mc="sentry.profile_id",pc="sentry.exclusive_time";function gc(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function yc(e){const t=e;return{scope:t.Oe,isolationScope:gc(t.ze)}}const vc=/^sentry-/;function wc(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 bc=/^o(\d+)\./,xc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function kc(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 Sc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Nc(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(bc);return t?.[1]}(n)),r}let $c=!1;function _c(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Ic(e).parent_span_id,o=yc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||Xa():t,trace_id:n}}function Cc(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:1===n,attributes:i,...r})):void 0}function Ec(e){return"number"==typeof e?Tc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Tc(e.getTime()):Ya()}function Tc(e){return e>9999999999?e/1e3:e}function Ic(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:Ec(i),timestamp:Ec(s)||void 0,status:Mc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Cc(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Mc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Pc(e){return e.je||e}function Dc(){$c||(Fs(()=>{}),$c=!0)}function Rc(e){Zs(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Oc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(jc(n)){if(Ma(e.description,n))return Ds&&Rc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Ma(e.description,n.name),r=!n.op||e.op&&Ma(e.op,n.op);if(t&&r)return Ds&&Rc(e),!0}return!1}function zc(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function jc(e){return"string"==typeof e||e instanceof RegExp}const Ac="production";function Lc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Ac,release:n.release,public_key:r,trace_id:e,org_id:Nc(t)};return t.emit("createDsc",i),i}function Wc(e){const t=hc();if(!t)return{};const n=Pc(e),r=Ic(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&&(ya(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=wc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):wc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(vc)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Lc(e.spanContext().traceId,t),h=i["sentry.source"],f=r.description;return"url"!==h&&f&&(d.transaction=f),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=hc()?.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")??yc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function Fc(e,t=100,n=1/0){try{return Bc("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function qc(e,t=3,n=102400){const r=Fc(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?qc(e,t-1,n):r;var i}function Bc(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.Le)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(Na(t))return"[VueViewModel]";if(ba(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${ta(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.We)return t;const c="number"==typeof t.Fe?t.Fe:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const l=t;if(l&&"function"==typeof l.toJSON)try{return Bc("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=ja(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]=Bc(e,t,c-1,r,i),d++}return s(t),u}function Hc(e,t=[]){return[e,t]}function Uc(e,t){const[n,r]=e;return[n,[...r,t]]}function Zc(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function Gc(e){const t=js(Rs);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function Yc(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[Gc(r),e]:r.push("string"==typeof e?Gc(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(Fc(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 Jc(e){const t="string"==typeof e.data?Gc(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Vc={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 Qc(e){return Vc[e]}function Xc(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Kc(e){return new tl(t=>{t(e)})}function el(e){return new tl((t,n)=>{n(e)})}class tl{constructor(e){this.qe=0,this.Be=[],this.He(e)}then(e,t){return new tl((n,r)=>{this.Be.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 tl((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.qe)return;const e=this.Be.slice();this.Be=[],e.forEach(e=>{e[0]||(1===this.qe&&e[1](this.Ze),2===this.qe&&e[2](this.Ze),e[0]=!0)})}He(e){const t=(e,t)=>{0===this.qe&&(ka(t)?t.then(n,r):(this.qe=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 nl(e,t,n,r=0){try{const i=rl(t,n,e,r);return ka(i)?i:Kc(i)}catch(e){return el(e)}}function rl(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Ds&&null===o&&Zs(`Event processor "${i.id||"?"}" dropped event`),ka(o)?o.then(e=>rl(e,t,n,r+1)):rl(o,t,n,r+1)}function il(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:f,span:m}=t;ol(e,"extra",n),ol(e,"tags",r),ol(e,"user",i),ol(e,"contexts",o),e.sdkProcessingMetadata=Va(e.sdkProcessingMetadata,a,2),s&&(e.level=s),f&&(e.transactionName=f),m&&(e.span=m),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 ol(e,t,n){e[t]=Va(e[t],n,1)}let sl,al,cl;function ll(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Wa(),timestamp:t.timestamp||Za()},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||Ac,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=Ta(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=Rs.Ge;if(!t)return{};const n=Object.keys(t);return cl&&n.length===al||(al=n.length,cl=n.reduce((n,r)=>{sl||(sl={});const i=sl[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,sl[r]=[s,a];break}}}return n},{})),cl}(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 nc;return n.update(t),n}(r,n.captureContext);n.mechanism&&Ha(c,n.mechanism);const d=i?i.getEventProcessors():[],h=As("globalScope",()=>new nc).getScopeData();o&&il(h,o.getScopeData()),u&&il(h,u.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),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:_c(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Wc(t),...e.sdkProcessingMetadata};const n=Ic(Pc(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(c,h),nl([...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:Fc(e.data,t,n)}}))},...e.user&&{user:Fc(e.user,t,n)},...e.contexts&&{contexts:Fc(e.contexts,t,n)},...e.extra&&{extra:Fc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Fc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Fc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Fc(e.contexts.flags,3,n)),r}(e,s,a):e))}function ul(e){return lc().captureException(e,void 0)}function dl(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return lc().captureMessage(e,n,r)}function hl(e,t){return lc().captureEvent(e,t)}function fl(e){const t=uc(),n=lc(),{userAgent:r}=Rs.navigator||{},i=function(e){const t=Ya(),n={sid:Wa(),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&&Ja(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&Ja(o,{status:"exited"}),ml(),t.setSession(i),i}function ml(){const e=uc(),t=lc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),Ja(e,t)}(t),pl(),e.setSession()}function pl(){const e=uc(),t=hc(),n=e.getSession();n&&t&&t.captureSession(n)}function gl(e=!1){e?ml():pl()}const yl=[];function vl(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 wl(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function bl(e,t,n){if(n[t.name])Ds&&Zs(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===yl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),yl.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)}Ds&&Zs(`Integration installed: ${t.name}`)}}function xl(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 kl="Not capturing exception because it's already been captured.",Sl="Discarded session because of missing or non-string release",Nl=Symbol.for("SentryInternalError"),$l=Symbol.for("SentryDoNotSendEventError");function _l(e){return{message:e,[Nl]:!0}}function Cl(e){return{message:e,[$l]:!0}}function El(e){return!!e&&"object"==typeof e&&Nl in e}function Tl(e){return!!e&&"object"==typeof e&&$l in e}class Il{constructor(e){if(this.Ye=e,this.Je={},this.Ve=0,this.Qe={},this.Xe={},this.pe=[],e.dsn?this.Ke=function(e){const t="string"==typeof e?function(e){const t=xc.exec(e);if(!t)return void Fs(()=>{});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 Sc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):Sc(e);if(t&&function(e){if(!Ds)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Ys(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Ys(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Ys(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Ys(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Ds&&Gs("No DSN provided, client will not send events."),this.Ke){const i=(t=this.Ke,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.Ye.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r}captureException(e,t,n){const r=Wa();if(Ua(e))return Ds&&Zs(kl),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:Wa(),...n},o=va(e)?e:String(e),s=wa(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=Wa();if(t?.originalException&&Ua(t.originalException))return Ds&&Zs(kl),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),Ja(e,{init:!1})}getDsn(){return this.Ke}getOptions(){return this.Ye}getSdkMetadata(){return this.Ye.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.Ye.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.ct()}getIntegrationByName(e){return this.Je[e]}addIntegration(e){const t=this.Je[e.name];bl(this,e,this.Je),t||wl(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=Xc(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:kc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,Hc(s,[[{type:o},e]])}(e,this.Ke,this.Ye.et,this.Ye.tunnel);for(const e of t.attachments||[])n=Uc(n,Jc(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Ac}=this.Ye;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Ds&&Gs(Sl));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Ds&&Gs(Sl));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=Xc(n);return Hc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:kc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.Ke,this.Ye.et,this.Ye.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ye.sendClientReports){const r=`${e}:${t}`;Ds&&Zs(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.Qe[r]=(this.Qe[r]||0)+n}}on(e,t){const n=this.Xe[e]=this.Xe[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.Xe[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 Ds&&Ys("Error while sending envelope:",e),{}}return Ds&&Ys("Transport disabled"),{}}ct(){const{integrations:e}=this.Ye;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&bl(e,t,n)}),n}(this,e),wl(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)&&(Ja(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.Ve)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),ll(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:fc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Lc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=lc(),r=uc()){return Ds&&Ml(e)&&Zs(`Captured error event \`${xl(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{Ds&&(Tl(e)?Zs(e.message):El(e)?Gs(e.message):Gs(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Pl(e),a=Ml(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"),el(Cl(`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),Cl("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(Ml(c)&&i)return i(c,r);if(Pl(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?.[mc],exclusive_time:s?.[pc],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Oc(t,a))return null;if(s){const e=s(t);e?c=Va(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&&{[mc]:l.profile_id},...l.exclusive_time&&{[pc]:l.exclusive_time}}}},measurements:l.measurements}):Dc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Oc(e,a))zc(n,e);else if(s){const n=s(e);n?t.push(n):(Dc(),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(ka(e))return e.then(e=>{if(!ba(e)&&null!==e)throw _l(n);return e},e=>{throw _l(`${t} rejected with ${e}`)});if(!ba(e)&&null!==e)throw _l(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 Cl(`${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(Tl(e)||El(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),_l(`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.Ve++,e.then(e=>(this.Ve--,e),e=>(this.Ve--,e))}gt(){const e=this.Qe;return this.Qe={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}yt(){Ds&&Zs("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(Ds&&Zs("No outcomes to send"));if(!this.Ke)return void(Ds&&Zs("No dsn provided, will not send outcomes"));Ds&&Zs("Sending outcomes:",e);const t=(n=e,Hc((r=this.Ye.tunnel&&kc(this.Ke))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Za(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Ml(e){return void 0===e.type}function Pl(e){return"transaction"===e.type}function Dl(e){const t=function(e){return Rl().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=kc(r)),Hc(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());Rl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Rl(){return As("clientToLogBufferMap",()=>new WeakMap)}const Ol=Symbol.for("SentryBufferFullError");function zl(e,t,n=function(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return el(Ol);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return Kc(!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(Zc(i,(t,n)=>{const i=Qc(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=Hc(i[0],o),a=t=>{Zc(s,(n,r)=>{e.recordDroppedEvent(t,Qc(r))})};return n.add(()=>t({body:Yc(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ds&&Gs(`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"),Ds&&Ys("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Ol)return Ds&&Ys("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function jl(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 Al(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 Ll=100;function Wl(e,t){const n=hc(),r=uc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Ll}=n.getOptions();if(o<=0)return;const s={timestamp:Za(),...e},a=i?Fs(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let Fl;const ql=new WeakMap,Bl=()=>({name:"FunctionToString",setupOnce(){Fl=function(){}.toString;try{Function.prototype.toString=function(...e){const t=za(this),n=ql.has(hc())&&void 0!==t?t:this;return Fl.apply(n,e)}}catch{}},setup(e){ql.set(e,!0)}}),Hl=[/^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$/],Ul=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=Gl(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=Gl(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&&Pa(n,t)}(e,t.ignoreTransactions))return Ds&&Gs(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${qa(e)}`),!0}else{if(function(e,t){return!!t?.length&&xl(e).some(e=>Pa(e,t))}(e,t.ignoreErrors))return Ds&&Gs(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${qa(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 Ds&&Gs(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${qa(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Yl(e);return!!n&&Pa(n,t)}(e,t.denyUrls))return Ds&&Gs(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${qa(e)}.\nUrl: ${Yl(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Yl(e);return!n||Pa(n,t)}(e,t.allowUrls))return Ds&&Gs(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${qa(e)}.\nUrl: ${Yl(e)}`),!0}return!1}(n,t)?null:n}}},Zl=(e={})=>({...Ul(e),name:"InboundFilters"});function Gl(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Hl],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Yl(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 Ds&&Ys(`Cannot extract url for event ${qa(e)}`),null}}function Jl(e,t,n,r,i,o){if(!i.exception?.values||!o||!Sa(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=Vl(e,t,r,o.originalException,n,i.exception.values,s,0))}function Vl(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Sa(r[i],Error)){Ql(s,a);const o=e(t,r[i]),l=c.length;Xl(o,i,l,a),c=Vl(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Sa(r,Error)){Ql(s,a);const l=e(t,r),u=c.length;Xl(l,`errors[${o}]`,u,a),c=Vl(e,t,n,r,i,[l,...c],l,u)}}),c}function Ql(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Xl(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Kl(){"console"in Rs&&Ls.forEach(function(e){e in Rs.console&&Da(Rs.console,e,function(t){return Ws[e]=t,function(...t){aa("console",{args:t,level:e});const n=Ws[e];n?.apply(Rs.console,t)}})})}const eu=()=>{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&&(!!nu(e,t)&&!!tu(e,t))))}(e,t)||!!function(e,t){const n=ru(t),r=ru(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!nu(e,t)&&!!tu(e,t)))}(e,t))}(t,e))return Ds&&Gs("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function tu(e,t){let n=na(e),r=na(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 nu(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 ru(e){return e.exception?.values?.[0]}function iu(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const ou=Rs;function su(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function au(e,t){const n="fetch";oa(n,e),sa(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in ou))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(su(ou.fetch))return!0;let e=!1;const t=ou.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=su(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Ds&&Gs("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Da(Rs,"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:lu(t),method:cu(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:lu(t),method:cu(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*Ya(),virtualError:n,headers:uu(t)};return aa("fetch",{...o}),e.apply(Rs,t).then(async e=>(aa("fetch",{...o,endTimestamp:1e3*Ya(),response:e}),e),e=>{if(aa("fetch",{...o,endTimestamp:1e3*Ya(),error:e}),fa(e)&&void 0===e.stack&&(e.stack=n.stack,Ra(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 cu(e,t){return!!e&&"object"==typeof e&&!!e[t]}function lu(e){return"string"==typeof e?e:e?cu(e,"url")?e.url:e.toString?e.toString():"":""}function uu(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&&Sa(t,Request))return new Headers(t.headers)}catch{}}const du=Rs;let hu=0;function fu(){return hu>0}function mu(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.vt;if(t)return"function"==typeof t?t:e;if(za(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>mu(e,t));return e.apply(this,r)}catch(e){throw hu++,setTimeout(()=>{hu--}),dc(r=>{r.addEventProcessor(e=>(t.mechanism&&(Ba(e,void 0),Ha(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),ul(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Oa(n,e),Ra(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function pu(e,t){const n=yu(e,t),r={type:bu(t),value:xu(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function gu(e,t){return{exception:{values:[pu(e,t)]}}}function yu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&vu.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 vu=/Minified React error #\d+;/i;function wu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function bu(e){const t=e?.name;return!t&&wu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function xu(e){const t=e?.message;return wu(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 ku(e,t,n,r,i){let o;if(pa(t)&&t.error)return gu(e,t.error);if(ga(t)||ma(t,"DOMException")){const i=t;if("stack"in t)o=gu(e,t);else{const t=i.name||(ga(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=Su(e,s,n,r),Ba(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return fa(t)?gu(e,t):ba(t)||xa(t)?(o=function(e,t,n,r){const i=hc(),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:qc(t,o)};if(s)return{exception:{values:[pu(e,s)]},extra:a};const c={exception:{values:[{type:xa(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Nu(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=yu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),Ha(o,{synthetic:!0}),o):(o=Su(e,t,n,r),Ba(o,`${t}`),Ha(o,{synthetic:!0}),o)}function Su(e,t,n,r){const i={};if(r&&n){const r=yu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),Ha(i,{synthetic:!0})}if(va(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Nu(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(ja(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return Ta(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:Ta(r,t)}return""}(e),r=t?"promise rejection":"exception";return pa(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:xa(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 $u extends Il{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:du.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:Os})),version:Os}),e.et=i}(t,"browser",["browser"],du.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.Ye;du.document&&(i||o)&&du.document.addEventListener("visibilitychange",()=>{"hidden"===du.document.visibilityState&&(i&&this.yt(),o&&Dl(this))}),o&&(this.on("flush",()=>{Dl(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{Dl(this)},5e3)})),r&&this.on("beforeSendSession",Al)}eventFromException(e,t){return function(e,t,n,r){const i=ku(e,t,n?.syntheticException||void 0,r);return Ha(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Kc(i)}(this.Ye.stackParser,e,t,this.Ye.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Su(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Kc(o)}(this.Ye.stackParser,e,t,n,this.Ye.attachStacktrace)}ut(e,t,n,r){return e.platform=e.platform||"javascript",super.ut(e,t,n,r)}}const _u="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Cu=Rs;let Eu,Tu,Iu,Mu;function Pu(){if(!Cu.document)return;const e=aa.bind(null,"dom"),t=Du(e,!0);Cu.document.addEventListener("click",t,!1),Cu.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=Cu,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Da(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=Du(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Da(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 Du(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;Ra(n,"_sentryCaptured",!0),r&&!r.St&&Ra(r,"_sentryId",Wa());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Tu)return!1;try{if(!e.target||e.target.St!==Iu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Tu=n.type,Iu=r?r.St:void 0),clearTimeout(Eu),Eu=Cu.setTimeout(()=>{Iu=void 0,Tu=void 0},1e3)}}function Ru(e){const t="history";oa(t,e),sa(t,Ou)}function Ou(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Mu,i=function(e){try{return new URL(e,Cu.location.origin).toString()}catch{return e}}(String(n));if(Mu=i,r===i)return e.apply(this,t);aa("history",{from:r,to:i})}return e.apply(this,t)}}Cu.addEventListener("popstate",()=>{const e=Cu.location.href,t=Mu;Mu=e,t!==e&&aa("history",{from:t,to:e})}),"history"in ou&&ou.history&&(Da(Cu.history,"pushState",e),Da(Cu.history,"replaceState",e))}const zu={},ju="__sentry_xhr_v3__";function Au(){if(!Cu.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*Ya(),o=ya(n[0])?n[0].toUpperCase():void 0,s=function(e){if(ya(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[ju]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[ju];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}aa("xhr",{endTimestamp:1e3*Ya(),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[ju];return o&&ya(r)&&ya(i)&&(o.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[ju];return r?(void 0!==n[0]&&(r.body=n[0]),aa("xhr",{startTimestamp:1e3*Ya(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Lu(e,t=function(e){const t=zu[e];if(t)return t;let n=Cu[e];if(su(n))return zu[e]=n.bind(Cu);const r=Cu.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){_u&&Gs(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?zu[e]=n.bind(Cu):n}("fetch")){let n=0,r=0;return zl(e,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw zu.fetch=void 0,e}finally{n-=o,r--}})}function Wu(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?Js:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Fu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Bu=/\((\S*)(?::(\d+))(?::(\d+))\)/,Hu=/at (.+?) ?\(data:(.+?),/,Uu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Gu=Xs([30,e=>{const t=e.match(Hu);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Fu.exec(e);if(n){const[,e,t,r]=n;return Wu(e,Js,+t,+r)}const r=qu.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=Bu.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Yu(r[1]||Js,r[2]);return Wu(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=Uu.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Zu.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]||Js;return[n,e]=Yu(n,e),Wu(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Yu=(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]:Js,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Ju="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Vu=(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";oa(t,e),sa(t,Kl)}(function(e){return function(t){if(hc()!==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:Ia(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ia(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Wl(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(hc()!==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&&(Ju&&Gs(`\`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=_a(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!$a.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}),Wl(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),oa("dom",n),sa("dom",Pu)),t.xhr&&function(e){oa("xhr",e),sa("xhr",Au)}(function(e){return function(t){if(hc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[ju];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:iu(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Wl(d,u)}}(e)),t.fetch&&au(function(e){return function(t){if(hc()!==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),Wl(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:iu(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Wl(a,s)}}}(e)),t.history&&Ru(function(e){return function(t){if(hc()!==e)return;let n=t.from,r=t.to;const i=jl(du.location.href);let o=n?jl(n):void 0;const s=jl(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),Wl({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){hc()===e&&Wl({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:qa(t)},{event:t})}}(e))}}},Qu=["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"],Xu=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Da(du,"setTimeout",Ku),t.setInterval&&Da(du,"setInterval",Ku),t.requestAnimationFrame&&Da(du,"requestAnimationFrame",ed),t.XMLHttpRequest&&"XMLHttpRequest"in du&&Da(XMLHttpRequest.prototype,"send",td);const e=t.eventTarget;e&&(Array.isArray(e)?e:Qu).forEach(e=>function(e,t){const n=du,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Da(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=mu(i.handleEvent,{mechanism:{data:{handler:ta(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,mu(i,{mechanism:{data:{handler:ta(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Da(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 Ku(e){return function(...t){const n=t[0];return t[0]=mu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ta(e)}`}}),e.apply(this,t)}}function ed(e){return function(t){return e.apply(this,[mu(t,{mechanism:{data:{handler:ta(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function td(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Da(n,e,function(t){const n={mechanism:{data:{handler:ta(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=za(t);return r&&(n.mechanism.data.handler=ta(r)),mu(t,n)})}),e.apply(this,t)}}const nd=(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";oa(t,t=>{const{stackParser:n,attachStacktrace:r}=id();if(hc()!==e||fu())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(ya(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)??Ea();return 0===c.length&&c.push({colno:l,filename:d,function:Js,in_app:!0,lineno:u}),e}(ku(n,c||i,void 0,r,!1),o,s,a);l.level="error",hl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),sa(t,la)}()}(e),rd("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";oa(t,t=>{const{stackParser:n,attachStacktrace:r}=id();if(hc()!==e||fu())return;const i=function(e){if(wa(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=wa(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:ku(n,i,void 0,r,!0);o.level="error",hl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),sa(t,da)}()}(e),rd("onunhandledrejection"))}}};function rd(e){Ju&&Zs(`Global Handler attached: ${e}`)}function id(){const e=hc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const od=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){Jl(pu,i.getOptions().stackParser,n,t,e,r)}}};let sd=!1;function ad(t){if(sd)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===du.window)return!1;const e=du;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Ea();return!(du===du.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(Ju&&Fs(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||Gu,Array.isArray(r)?Xs(...r):r),integrations:vl({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[Zl(),Bl(),Xu(),Vu(),nd(),od(),eu(),{name:"HttpContext",preprocessEvent(e){if(!du.navigator&&!du.location&&!du.document)return;const t=function(){const e=Ea(),{referrer:t}=du.document||{},{userAgent:n}=du.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!==du.document?(fl({ignoreDuration:!0}),gl(),Ru(({from:e,to:t})=>{void 0!==e&&e!==t&&(fl({ignoreDuration:!0}),gl())})):Ju&&Gs("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||Lu};var r;!function(e,t){!0===t.debug&&(Ds?Us():Fs(()=>{})),lc().update(t.initialScope);const n=new e(t);(function(e){lc().setClient(e)})(n),n.init()}($u,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:[Vu({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),eu()],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"]}),sd=!0,e()}catch(e){}else e()}function cd(t,n){if(sd)try{n?dc(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),ul(t)}):ul(t)}catch(t){e()}}function ld(t,n="info",r){if(sd)try{r?dc(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),dl(t,n)}):dl(t,n)}catch(t){e()}}function ud(t){if(sd)try{!function(e){uc().setUser(e)}(t)}catch(t){e()}}function dd(t){if(sd)try{Wl(t)}catch(t){e()}}function hd(t,n){if(sd)try{!function(e,t){uc().setTag(e,t)}(t,n)}catch(t){e()}}function fd(){return sd}var md=Object.freeze({__proto__:null,addBreadcrumb:dd,captureException:cd,captureMessage:ld,initializeSentry:ad,isSentryInitialized:fd,setTag:hd,setUser:ud});const pd="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",gd="production",yd="insureos-scripts",vd=!0,wd=1,bd=.1;class xd{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 kd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{ad({dsn:pd,environment:gd,release:yd,enabled:vd,sampleRate:wd,tracesSampleRate:bd}),this.sentryInitialized=!0,e()}catch(t){e()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode){if(!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'");if(!e.signedUrl)throw new Error("signedUrl is required when mode is 'payment'")}else if(!e.product)throw new Error("product is required when mode is 'quote' or undefined")}initializeAnalyticsOnce(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new xd({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}),be(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=[],R(r,e=r.i=b(k,null,[e]),i||m,m,r.namespaceURI,i?null:r.firstChild?t.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),z(o,e,s)}(b(Ps,{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 H({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 Pe(t)}async initializeFormContext(t){const n=this.createHttpClient(t);if("payment"===t.mode)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl}};const r="sessionStorage"===t.storageType?new Z:new U;r.isAvailable()?e(r.constructor.name):e();const i=new Y(r),o=new J(i),s=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent(t.product);return e(),{id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_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}},a=async e=>{var r;const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id")||o.get("transactionId"),a=await n.getQuoteIntent(e);let c;const l=o.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,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,cached_result:a.cached_result};return c&&i.saveQuoteIntent(t.orgId,u),u},c=new URLSearchParams(window.location.search);c.get("transactionId")||c.get("transaction_id")||c.get("payment_id"),c.get("status");let l=null,u=!1;try{const e=i.getQuoteIntent(t.orgId),n=await o.getOrCreateQuoteIntent(t.orgId,s,a);n.payment_return&&i.saveQuoteIntent(t.orgId,n),l=n,u=!e}catch(e){if(!(e instanceof q&&404===e.statusCode))throw e;o.clearQuoteIntent(t.orgId),l=await o.getOrCreateQuoteIntent(t.orgId,s,a),u=!0}if(u&&l&&ke(l),!l)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(e(),localStorage.clear()),e(),e(l.payment_return),l.payment_return&&e(l.payment_return);const d=new Ie(l,n,o,{autoSave:l.form_definition.settings.autoSave,autoSaveInterval:l.form_definition.settings.autoSaveInterval});if(l.form_data&&d.restoreFormProgress(l.form_data),e(l.cached_result),l.cached_result?(e(l.cached_result),d.restoreCalculationResult(l.cached_result),e(),e(d.hasCalculationResponse())):e(),l.organisation&&l.organisation.theme)try{await Cs.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:l,quoteIntentStore:o,formStateManager:d}}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 Sd=new kd;"undefined"!=typeof window&&(window.InsureOS=Sd,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");if(n&&r){const t=e.searchParams.get("container"),i=t?document.getElementById(t):document.body;if(i){const e={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await Sd.mount(i,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Nd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Nd.instance)return Nd.instance;Nd.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 Nd).startMeasurement(e)}static endMeasurement(e){return(new Nd).endMeasurement(e)}static measureMemoryUsage(){return(new Nd).measureMemoryUsage()}static async measureApiCall(e,t){return(new Nd).measureApiCall(e,t)}static getMetrics(){return(new Nd).getMetrics()}static generateReport(){return(new Nd).generateReport()}}var $d;exports.VersionStrategy=void 0,($d=exports.VersionStrategy||(exports.VersionStrategy={})).FIXED="fixed",$d.LATEST="latest";let _d=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)}},Cd=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new _d(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 _d(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)}},Ed=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new _d(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 Td=Object.freeze({__proto__:null,Headers:_d,Request:Cd,Response:Ed,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new Cd(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 _d;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Ed(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 Id{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 Id((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Id?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Id?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 Id(t=>t(e))}static reject(e){return new Id((t,n)=>n(e))}static all(e){return new Id((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 Md=Object.freeze({__proto__:null,PromisePolyfill:Id});class Pd{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 Dd=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 Pd(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:Pd});exports.DataLayerManager=xd,exports.EnhancedHttpClient=H,exports.ErrorHandlingStrategy=class{handleNetworkError(e){return new q(exports.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new q(exports.ErrorType.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 q(exports.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new q(exports.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new q(exports.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new q(exports.ErrorType.API_ERROR,`Request failed: ${e.statusText}`,t,e.status)}handleStorageError(e){return new q(exports.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(e){switch(e.type){case exports.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case exports.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case exports.ErrorType.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 exports.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case exports.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case exports.ErrorType.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."}}},exports.FormStateManager=Ie,exports.InsureOS=Sd,exports.InsureOSClient=kd,exports.InsureOSError=q,exports.LocalStateManager=Y,exports.LocalStorageAdapter=U,exports.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},exports.PerformanceMonitor=Nd,exports.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(e){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return Td});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 Md});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 Dd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},exports.RetryStrategy=B,exports.SessionStorageAdapter=Z,exports.ThemeLoader=Cs,exports.addBreadcrumb=dd,exports.captureException=cd,exports.captureMessage=ld,exports.createAppError=de,exports.getAnalytics=function(){return we},exports.getSupportMessage=ve,exports.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},exports.initializeAnalytics=be,exports.initializeSentry=ad,exports.isSentryInitialized=fd,exports.parseServerValidationErrors=ae,exports.setTag=hd,exports.setUser=ud,exports.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},exports.shouldShowMaintenancePage=ye,exports.trackFormProgress=Se,exports.trackPaymentCompleted=Ee,exports.trackPaymentFailed=Te,exports.trackPaymentInitiated=Ce,exports.trackQuoteAtCheckout=$e,exports.trackQuoteCalculated=Ne,exports.trackQuoteReferred=_e,exports.trackQuoteStarted=ke,exports.validateField=oe,exports.validatePage=se;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|