@insure-os/client 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- const t=()=>{globalThis.insureOSDebug};var e,n,r,i,o,s,a,c,u,l,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(t,e){for(var n in e)t[n]=e[n];return t}function w(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function b(t,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?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return x(t,a,i,o,null)}function x(t,e,i,o,s){var a={type:t,props:e,key:i,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:null==s?++r:s,N:-1,C:0};return null==s&&null!=n.vnode&&n.vnode(a),a}function S(t){return t.children}function k(t,e){this.props=t,this.context=e}function _(t,e){if(null==e)return t.m?_(t.m,t.N+1):null;for(var n;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v)return n.v;return"function"==typeof t.type?_(t):null}function $(t){var e,n;if(null!=(t=t.m)&&null!=t.k){for(t.v=t.k.base=null,e=0;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v){t.v=t.k.base=n.v;break}return $(t)}}function N(t){(!t.I&&(t.I=!0)&&i.push(t)&&!E.O++||o!=n.debounceRendering)&&((o=n.debounceRendering)||s)(E)}function E(){for(var t,e,r,o,s,c,u,l=1;i.length;)i.length>l&&i.sort(a),t=i.shift(),l=i.length,t.I&&(r=void 0,s=(o=(e=t)._).v,c=[],u=[],e.P&&((r=v({},o))._=o._+1,n.vnode&&n.vnode(r),P(e.P,r,o,e.R,e.P.namespaceURI,32&o.C?[s]:null,c,null==s?_(o):s,!!(32&o.C),u),r._=o._,r.m.i[r.N]=r,j(c,r,u),r.v!=s&&$(r)));E.O=0}function T(t,e,n,r,i,o,s,a,c,u,l){var d,h,f,g,v,w,b,k=r&&r.i||p,$=e.length;for(c=function(t,e,n,r,i){var o,s,a,c,u,l=n.length,d=l,h=0;for(t.i=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+h,(s=t.i[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?x(null,s,null,null,null):y(s)?x(S,{children:s},null,null,null):null==s.constructor&&s.p>0?x(s.type,s.props,s.key,s.ref?s.ref:null,s._):s).m=t,s.p=t.p+1,a=null,-1!=(u=s.N=I(s,n,c,d))&&(d--,(a=n[u])&&(a.C|=2)),null==a||null==a._?(-1==u&&(i>l?h--:i<l&&h++),"function"!=typeof s.type&&(s.C|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,s.C|=4))):t.i[o]=null;if(d)for(o=0;o<l;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=_(a)),W(a,a));return r}(n,e,k,c,$),d=0;d<$;d++)null!=(f=n.i[d])&&(h=-1==f.N?m:k[f.N]||m,f.N=d,w=P(t,f,h,i,o,s,a,c,u,l),g=f.v,f.ref&&h.ref!=f.ref&&(h.ref&&F(h.ref,null,f),l.push(f.ref,f.k||g,f)),null==v&&null!=g&&(v=g),(b=!!(4&f.C))||h.i===f.i?c=C(f,c,t,b):"function"==typeof f.type&&void 0!==w?c=w:g&&(c=g.nextSibling),f.C&=-7);return n.v=v,c}function C(t,e,n,r){var i,o;if("function"==typeof t.type){for(i=t.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=t,e=C(i[o],e,n,r));return e}t.v!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=_(t)),n.insertBefore(t.v,e||null)),e=t.v);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function I(t,e,n,r){var i,o,s,a=t.key,c=t.type,u=e[n],l=null!=u&&!(2&u.C);if(null===u&&null==t.key||l&&a==u.key&&c==u.type)return n;if(r>(l?1:0))for(i=n-1,o=n+1;i>=0||o<e.length;)if(null!=(u=e[s=i>=0?i--:o++])&&!(2&u.C)&&a==u.key&&c==u.type)return s;return-1}function M(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||g.test(e)?n:n+"px"}function D(t,e,n,r,i){var o,s;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||M(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||M(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(c,"$1")),s=e.toLowerCase(),e=s in t||"onFocusOut"==e||"onFocusIn"==e?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=u,t.addEventListener(e,o?d:l,o)):t.removeEventListener(e,o?d:l,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function O(t){return function(e){if(this.l){var r=this.l[e.type+t];if(null==e.t)e.t=u++;else if(e.t<r.u)return;return r(n.event?n.event(e):e)}}}function P(t,e,r,i,o,s,a,c,u,l){var d,h,f,m,p,g,b,x,_,$,N,E,C,I,M,D,O,P=e.type;if(null!=e.constructor)return null;128&r.C&&(u=!!(32&r.C),s=[c=e.v=r.v]),(d=n.p)&&d(e);t:if("function"==typeof P)try{if(x=e.props,_="prototype"in P&&P.prototype.render,$=(d=P.contextType)&&i[d.k],N=d?$?$.props.value:d.m:i,r.k?b=(h=e.k=r.k).m=h.j:(_?e.k=h=new P(x,N):(e.k=h=new k(x,N),h.constructor=P,h.render=L),$&&$.sub(h),h.props=x,h.state||(h.state={}),h.context=N,h.R=i,f=h.I=!0,h.A=[],h.W=[]),_&&null==h.L&&(h.L=h.state),_&&null!=P.getDerivedStateFromProps&&(h.L==h.state&&(h.L=v({},h.L)),v(h.L,P.getDerivedStateFromProps(x,h.L))),m=h.props,p=h.state,h._=e,f)_&&null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),_&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(_&&null==P.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,N),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,N)||e._==r._){for(e._!=r._&&(h.props=x,h.state=h.L,h.I=!1),e.v=r.v,e.i=r.i,e.i.some(function(t){t&&(t.m=e)}),E=0;E<h.W.length;E++)h.A.push(h.W[E]);h.W=[],h.A.length&&a.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.L,N),_&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=N,h.props=x,h.P=t,h.v=!1,C=n.O,I=0,_){for(h.state=h.L,h.I=!1,C&&C(e),d=h.render(h.props,h.state,h.context),M=0;M<h.W.length;M++)h.A.push(h.W[M]);h.W=[]}else do{h.I=!1,C&&C(e),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.I&&++I<25);h.state=h.L,null!=h.getChildContext&&(i=v(v({},i),h.getChildContext())),_&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),D=d,null!=d&&d.type===S&&null==d.key&&(D=A(d.props.children)),c=T(t,y(D)?D:[D],e,r,i,o,s,a,c,u,l),h.base=e.v,e.C&=-161,h.A.length&&a.push(h),b&&(h.j=h.m=null)}catch(t){if(e._=null,u||null!=s)if(t.then){for(e.C|=u?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.v=c}else{for(O=s.length;O--;)w(s[O]);R(e)}else e.v=r.v,e.i=r.i,t.then||R(e);n.v(t,e,r)}else null==s&&e._==r._?(e.i=r.i,e.v=r.v):c=e.v=z(r.v,e,r,i,o,s,a,u,l);return(d=n.diffed)&&d(e),128&e.C?void 0:c}function R(t){t&&t.k&&(t.k.v=!0),t&&t.i&&t.i.forEach(R)}function j(t,e,r){for(var i=0;i<r.length;i++)F(r[i],r[++i],r[++i]);n.k&&n.k(e,t),t.some(function(e){try{t=e.A,e.A=[],t.some(function(t){t.call(e)})}catch(t){n.v(t,e._)}})}function A(t){return"object"!=typeof t||null==t||t.p&&t.p>0?t:y(t)?t.map(A):v({},t)}function z(t,r,i,o,s,a,c,u,l){var d,h,f,p,g,v,b,x=i.props,S=r.props,k=r.type;if("svg"==k?s="http://www.w3.org/2000/svg":"math"==k?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((g=a[d])&&"setAttribute"in g==!!k&&(k?g.localName==k:3==g.nodeType)){t=g,a[d]=null;break}if(null==t){if(null==k)return document.createTextNode(S);t=document.createElementNS(s,k,S.is&&S),u&&(n.B&&n.B(r,a),u=!1),a=null}if(null==k)x===S||u&&t.data==S||(t.data=S);else{if(a=a&&e.call(t.childNodes),x=i.props||m,!u&&null!=a)for(x={},d=0;d<t.attributes.length;d++)x[(g=t.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 S)){if("value"==d&&"defaultValue"in S||"checked"==d&&"defaultChecked"in S)continue;D(t,d,null,g,s)}for(d in S)g=S[d],"children"==d?p=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?v=g:"checked"==d?b=g:u&&"function"!=typeof g||x[d]===g||D(t,d,g,x[d],s);if(h)u||f&&(h.H==f.H||h.H==t.innerHTML)||(t.innerHTML=h.H),r.i=[];else if(f&&(t.innerHTML=""),T("template"==r.type?t.content:t,y(p)?p:[p],r,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&_(i,0),u,l),null!=a)for(d=a.length;d--;)w(a[d]);u||(d="value","progress"==k&&null==v?t.removeAttribute("value"):null!=v&&(v!==t[d]||"progress"==k&&!v||"option"==k&&v!=x[d])&&D(t,d,v,x[d],s),d="checked",null!=b&&b!=t[d]&&D(t,d,b,x[d],s))}return t}function F(t,e,r){try{if("function"==typeof t){var i="function"==typeof t.C;i&&t.C(),i&&null==e||(t.C=t(e))}else t.current=e}catch(t){n.v(t,r)}}function W(t,e,r){var i,o;if(n.unmount&&n.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.v||F(i,null,e)),null!=(i=t.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){n.v(t,e)}i.base=i.P=null}if(i=t.i)for(o=0;o<i.length;o++)i[o]&&W(i[o],e,r||"function"!=typeof t.type);r||w(t.v),t.k=t.m=t.v=void 0}function L(t,e,n){return this.constructor(t,n)}e=p.slice,n={v:function(t,e,n,r){for(var i,o,s;e=e.m;)if((i=e.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.I),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.I),s)return i.j=i}catch(e){t=e}throw t}},r=0,k.prototype.setState=function(t,e){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=v({},this.state),"function"==typeof t&&(t=t(v({},n),this.props)),t&&v(n,t),null!=t&&this._&&(e&&this.W.push(e),N(this))},k.prototype.forceUpdate=function(t){this._&&(this.v=!0,t&&this.A.push(t),N(this))},k.prototype.render=S,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t._.p-e._.p},E.O=0,c=/(PointerCapture)$|Capture$/i,u=0,l=O(!1),d=O(!0),h=0,function(t){t.NETWORK_ERROR="NETWORK_ERROR",t.API_ERROR="API_ERROR",t.VALIDATION_ERROR="VALIDATION_ERROR",t.STORAGE_ERROR="STORAGE_ERROR",t.TIMEOUT_ERROR="TIMEOUT_ERROR",t.MAINTENANCE_ERROR="MAINTENANCE_ERROR"}(f||(f={}));class q extends Error{constructor(t,e,n=!1,r,i,o){super(e),this.type=t,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class B{handleNetworkError(t){return new q(f.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new q(f.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const e=t.status>=500||429===t.status;return 429===t.status?new q(f.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new q(f.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new q(f.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new q(f.API_ERROR,`Request failed: ${t.statusText}`,e,t.status)}handleStorageError(t){return new q(f.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(t){return t.retryable}getUserFriendlyMessage(t){switch(t.type){case f.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case f.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case f.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case f.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case f.TIMEOUT_ERROR:return"Request timed out. Please try again.";case f.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}}class H{constructor(t){this.config=t}shouldRetry(t,e){return!(e>=this.config.maxRetries)&&this.isRetryableError(t)}getDelay(t,e){if(e){const t=parseInt(e,10);if(!isNaN(t))return 1e3*t}const n=this.config.baseDelay*Math.pow(2,t);return Math.min(n,this.config.maxDelay)}isRetryableError(t){return t instanceof q?t.retryable:!("TypeError"!==t.name||!t.message.includes("fetch"))||"AbortError"===t.name}}class U{constructor(t){this.config=t,this.retryStrategy=new H(t.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:e,body:n}){return this.executeWithRetry(async()=>{const r=new AbortController,i=setTimeout(()=>r.abort(),this.config.timeout);try{const o={method:e,headers:{"Content-Type":"application/json","X-Organisation-ID":this.config.orgId},signal:r.signal};n&&(o.body=JSON.stringify(n));const s=await fetch(t,o);if(clearTimeout(i),!s.ok)throw await this.handleApiError(s);const a=await s.json();return a.data||a}catch(t){if(clearTimeout(i),t instanceof q)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new q(f.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new q(f.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}getQuoteIntent(t){return this.makeRequest({url:t,method:"GET"})}createQuoteIntent(t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:t})}updateQuoteIntent(t,e){return this.makeRequest({url:t,method:"PUT",body:e})}deleteQuoteIntent(t){return this.makeRequest({url:t,method:"DELETE"})}calculateQuoteIntent(t){return this.makeRequest({url:t,method:"POST"})}initiatePayment(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/initiate`,method:"POST",body:t})}getPaymentStatus(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/status/${t}`,method:"GET"})}async executeWithRetry(e){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return t(this.config.retryConfig.maxRetries),await e()}catch(e){n=e;const i=this.retryStrategy.shouldRetry(n,r);if(t(e instanceof q&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof q?e.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);t(),await new Promise(t=>setTimeout(t,s))}throw n}async handleApiError(e){var n;const r=e.headers.get("retry-after"),i=await e.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(e,i),503===e.status)return new q(f.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);if(429===e.status)return new q(f.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,e.status,r||void 0);if(e.status>=500){const t=i.message||"Service temporarily unavailable. Please try again in a moment.";return new q(f.API_ERROR,t,!1,e.status)}if(422===e.status)try{const t=i;return t.error&&t.error.details&&t.error.details.form_data?new q(f.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,e.status,void 0,t.error.details):new q(f.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,e.status,void 0,null===(n=t.error)||void 0===n?void 0:n.details)}catch(t){return new q(f.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,e.status)}if(400===e.status)try{const t=i;return t.errors?new q(f.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,e.status,void 0,t.errors):new q(f.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,e.status)}catch(t){return new q(f.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status)}if(e.status>=400&&e.status<500){const t=i.message||"Invalid request. Please refresh the page and try again.";return new q(f.API_ERROR,t,!1,e.status)}return new q(f.API_ERROR,`Request failed: ${e.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(e.status),e.status)}captureApiErrorToSentry(t,e){try{(t.status>=500||429===t.status)&&Promise.resolve().then(function(){return yd}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${t.status} ${t.statusText}`,category:"http",level:"error",data:{url:t.url,status:t.status,statusText:t.statusText}}),n(`API Error: ${t.status} - ${t.url}`,"error",{http:{status_code:t.status,url:t.url,method:"Unknown"},response:e}))}).catch(()=>{})}catch(t){}}}class Z{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return localStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{localStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{localStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{localStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const t="__insure_os_storage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch(t){return!1}}}class G{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return sessionStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{sessionStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{sessionStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{sessionStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const t="__insure_os_storage_test__";return sessionStorage.setItem(t,"test"),sessionStorage.removeItem(t),!0}catch(t){return!1}}}class Y{constructor(){this.storage=new Map}get(t){return this.storage.get(t)||null}set(t,e){this.storage.set(t,e)}remove(t){this.storage.delete(t)}clear(){this.storage.clear()}isAvailable(){return!0}}class J{static generateKey(t,e,n){const r=[this.KEY_PREFIX+t,e];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(t){try{return JSON.stringify({data:t,timestamp:Date.now(),version:"1.0"})}catch(t){throw new Error(`Failed to serialize data: ${t}`)}}static deserialize(t){try{const e=JSON.parse(t);return e&&"object"==typeof e&&e.data?e.data:null}catch(t){return null}}static getTimestamp(t){try{return JSON.parse(t).timestamp||null}catch(t){return null}}static isExpired(t,e){const n=this.getTimestamp(t);return!n||Date.now()-n>e}}J.KEY_PREFIX="insure_os_",J.SEPARATOR="_";class V{constructor(t,e={}){this.storageAdapter=t,this.config={defaultExpirationMs:e.defaultExpirationMs||V.DEFAULT_EXPIRATION_MS,namespace:e.namespace||V.DEFAULT_NAMESPACE}}saveQuoteIntent(t,e){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(t),r=J.serialize(e);this.storageAdapter.set(n,r)}catch(t){}}getQuoteIntent(t){if(!this.storageAdapter.isAvailable())return null;try{const e=this.generateStorageKey(t),n=this.storageAdapter.get(e);if(!n)return null;const r=J.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(t),null)}catch(t){return null}}removeQuoteIntent(t){if(this.storageAdapter.isAvailable())try{const e=this.generateStorageKey(t);this.storageAdapter.remove(e)}catch(t){}}isQuoteIntentValid(t){if(!t||"object"!=typeof t)return!1;if(!t.id||!t.url||!t.org_id)return!1;const e=Date.now();return!(t.expires_at&&e>t.expires_at||t.created_at&&e-t.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(t){return J.generateKey(this.config.namespace,t)}}V.DEFAULT_EXPIRATION_MS=864e5,V.DEFAULT_NAMESPACE="quote_intent";class Q{constructor(t){this.stateManager=t}async getOrCreateQuoteIntent(t,e,n){const r=this.stateManager.getQuoteIntent(t);if(r&&this.stateManager.isQuoteIntentValid(r)){const e=await n(r.url);return this.stateManager.saveQuoteIntent(t,e),e}try{const n=await e();return this.stateManager.saveQuoteIntent(t,n),n}catch(e){throw r&&this.stateManager.removeQuoteIntent(t),e}}updateQuoteIntent(t,e){const n=this.stateManager.getQuoteIntent(t);if(!n)return null;const r={...n,...e};return this.stateManager.saveQuoteIntent(t,r),r}clearQuoteIntent(t){this.stateManager.removeQuoteIntent(t)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(t){const e=this.stateManager.getQuoteIntent(t);return null!==e&&this.stateManager.isQuoteIntentValid(e)}getQuoteIntentUrl(t){const e=this.stateManager.getQuoteIntent(t);return(null==e?void 0:e.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class X{constructor(t,e){this.saveCallback=e,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=t}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,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 0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1)}handleSaveError(t){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(t))}dispatchErrorEvent(t){if("undefined"!=typeof window){const e=new CustomEvent("form-autosave-error",{detail:{error:t,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(e)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function K(t,e){var n;const r=[];if("checkbox"===t.type&&t.required&&!0!==e&&"true"!==e)return r.push({field:t.code||t.id,message:`${t.label} must be accepted`}),r;"boolean"===t.type&&(null===(n=t.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===t.boolean_config.show_details_on&&(!0===e||"true"===e)||t.boolean_config.show_details_on);const i="boolean"===t.type?null==e:null==e||""===e;if(t.required&&i)return r.push({field:t.code||t.id,message:`${t.label} is required`}),r;if(!t.required&&i)return r;const o=t.validation;if(!o)return r;const s=String(e),a="number"==typeof e?e:parseFloat(s);return o.pattern&&"text"===t.type&&(new RegExp(o.pattern).test(s)||r.push({field:t.code||t.id,message:`${t.label} format is invalid`})),o.minLength&&s.length<o.minLength&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.maxLength} characters`}),"number"!==t.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:t.code||t.id,message:`${t.label} must be in increments of ${o.step}`})),r}function tt(t,e){var n,r;const i=[];for(const r of t.fields){const t=r.code||r.id,o=e[t],s=K(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=(e.U||{})[t];n&&""!==n.trim()||i.push({field:t,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=t.validation)||void 0===r?void 0:r.required_fields)for(const n of t.validation.required_fields){const r=t.fields.find(t=>(t.code||t.id)===n),o=e[n];if(r){const t=r.code||r.id,e=i.find(e=>e.field===t);if(e)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:t,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&i.push({field:t,message:`${r.label} is required`})}}return{isValid:0===i.length,errors:i}}function et(t){const e=[];let n;if("object"==typeof t&&null!==t&&("validation_errors"in t&&t.validation_errors&&"object"==typeof t.validation_errors?n=t.validation_errors:"errors"in t&&t.errors&&"object"==typeof t.errors?n=t.errors:"message"in t||"validation_errors"in t||"errors"in t||(n=t)),n)for(const[t,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)e.push({field:t,message:n});return e}function nt(t){return t.reduce((t,e)=>(t[e.field]||(t[e.field]=[]),t[e.field].push(e),t),{})}class rt{constructor(t,e,n){this.httpClient=t,this.definition=e,this.quoteIntentStore=n}async load(t,e){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(t)){const t=await this.httpClient.getQuoteIntent(e);if(t.quote_intent.form_data)return t.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(e)).quote_intent.form_data||this.createEmptyFormData()}async save(t,e,n,r){try{const t=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(e,t),{success:!0}}catch(t){if(t&&"object"==typeof t&&"validationErrors"in t){const e=t.validationErrors;if(e&&"object"==typeof e)return{success:!1,validationErrors:et(e)}}throw t}}prepareSavePayload(t,e){const n=this.getCurrentPageId(t);return{current_page_index:t.current_page,current_page_id:n,page_data:t.page_data,save_type:e.saveType}}getCurrentPageId(t){const e=this.definition;if(!e||!t.page_data)return;const n=t.current_page;if(n<0||n>=e.pages.length)return;const r=e.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 it{constructor(t,e,n,r){this.formDefinition=t,this.getFormData=e,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(t){const e=this.getFormData().current_page;if(t<=e)return!0;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<t;r++)if(r!==e&&!n.includes(r))return!1;return!0}async navigateToPage(t){if(t<0||t>=this.getTotalPages())return!1;if(!this.canNavigateToPage(t))return!1;const e=this.getFormData().current_page;if(t>e)try{await this.saveCallback(!0,"page")}catch(t){return t&&"object"==typeof t&&t.isValidationError,!1}return t>e&&this.markPageCompleted(e),this.updateFormData({current_page:t,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const t=this.getFormData().current_page;return this.navigateToPage(t+1)}navigateToPrevious(){const t=this.getFormData().current_page;return this.navigateToPage(t-1)}markPageCompleted(t){const e=this.getFormData();if(!e.completed_pages.includes(t)){const n=[...e.completed_pages,t].sort((t,e)=>t-e);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const t=this.getFormData(),e=this.getTotalPages(),n=[...t.completed_pages];return{totalPages:e,currentPage:t.current_page,completedPages:n,percentComplete:n.length/e*100}}isStagingEnvironment(){const t=window.location.hostname;return"localhost"===t||t.endsWith(".test")||t.includes("staging")}}class ot{constructor(t){this.httpClient=t}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}function st(t,e,n){var r,i,o,s;const a=Date.now(),c=`${t}-${a}`;if(function(t,e,n){try{Promise.resolve().then(function(){return yd}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${e}`,category:"error",level:"error",data:{errorType:e,customMessage:n}}),r(t,{errorType:e,customMessage:n}))}).catch(()=>{})}catch(t){}}(e,t,n),e&&"object"==typeof e){if("statusCode"in e||"status"in e)return at(c,t,e.statusCode||e.status||500,e.message||(null===(r=e.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in e)return at(c,t,(null===(i=e.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||e.message||"Network error occurred",n,a);if(e.message)return{id:c,type:t,severity:ut(t),title:ct(t),message:n||e.message,retryable:dt(t,0),timestamp:a,trackingId:c}}const u="string"==typeof e?e:"An unexpected error occurred";return{id:c,type:t,severity:ut(t),title:ct(t),message:n||u,retryable:dt(t,0),timestamp:a,trackingId:c}}function at(t,e,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=dt(e,n);return{id:t,type:e,severity:s,statusCode:n,title:ct(e,n),message:i||lt(e,n,r),details:r,retryable:a,timestamp:o}}function ct(t,e){if(e){if(404===e)return"Not Found";if(503===e)return"Service Unavailable";if(e>=500)return"Server Error";if(e>=400)return"Validation Error"}switch(t){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 ut(t){switch(t){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function lt(t,e,n){return"calculation"===t&&(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===e?"initialization"===t?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===e?"We're performing scheduled maintenance. Please check back in a few minutes.":e>=500?"calculation"===t?"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===e?"Too many requests. Please wait a moment and try again.":e>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function dt(t,e){return"validation"!==t&&"maintenance"!==t&&404!==e&&503!==e&&!(e>=400&&e<500&&429!==e)&&("network"===t||"calculation"===t||e>=500&&503!==e||429===e)}function ht(t){return"initialization"===t.type&&"critical"===t.severity}function ft(t){return"maintenance"===t.type||503===t.statusCode}function mt(t){return t.trackingId?`If this problem persists, please contact support and reference error ID: ${t.trackingId.slice(0,8).toUpperCase()}`:"critical"===t.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let pt=null;function gt(t){pt=t}function yt(){return pt}function vt(t,e){var n,r;return{event:e,quote_id:t.id,organisation_slug:null===(n=t.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=t.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function wt(t){var e,n;if(!(null==pt?void 0:pt.isEnabled()))return;const r={...vt(t,"quote_started"),quote_status:t.status,total_pages:null===(n=null===(e=t.form_definition)||void 0===e?void 0:e.pages)||void 0===n?void 0:n.length};pt.push(r)}function bt(t,e,n,r){var i,o;if(!(null==pt?void 0:pt.isEnabled()))return;const s=(null===(o=null===(i=t.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={...vt(t,"quote_form_progress"),current_page:e,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};pt.push(c)}function xt(t,e){if(!(null==pt?void 0:pt.isEnabled()))return;const n=e.calculations||[],r=e.payment_options||[],i=n.find(t=>t.id===e.default_excess_id),o=n.map(t=>t.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,c=r.some(t=>"monthly"===t.amount.frequency),u={...vt(t,"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};pt.push(u)}function St(t,e,n,r,i){if(!(null==pt?void 0:pt.isEnabled()))return;const o={...vt(t,"quote_at_checkout"),excess_id:e.id,excess_amount:e.excess_amount,premium_subtotal:e.premium_subtotal,premium_total:e.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:e.fees};pt.push(o)}function kt(t,e){if(!(null==pt?void 0:pt.isEnabled()))return;const n=e.referrals||[],r={...vt(t,"quote_referred"),referral_reason:e.referral_reason,referrals_count:n.length,referral_ids:n.map(t=>t.id)};pt.push(r)}function _t(t,e,n,r){if(!(null==pt?void 0:pt.isEnabled()))return;const i={...vt(t,"payment_initiated"),payment_amount:e.amount.dueToday,payment_gateway:e.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:e.amount.frequency,amount_due_today:e.amount.dueToday,installments_count:e.amount.numberOfInstallments};pt.push(i)}function $t(t,e,n,r,i,o){if(!(null==pt?void 0:pt.isEnabled()))return;const s={...vt(t,"payment_completed"),transaction_id:e,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};pt.push(s)}function Nt(t,e,n,r,i,o){if(!(null==pt?void 0:pt.isEnabled()))return;const s={...vt(t,"payment_failed"),transaction_id:e,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};pt.push(s)}class Et{constructor(t,e,n,r={}){this.quoteIntent=t,this.httpClient=e,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=t.form_definition;this.persistenceManager=new rt(e,i,n),this.autoSaveManager=new X(this.config,this.saveFormData.bind(this)),this.navigationManager=new it(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ot(e),this.config.autoSave&&this.autoSaveManager.start()}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}async loadFormProgress(){var t,e;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(e=null===(t=this.formData.page_data)||void 0===t?void 0:t.Y)||void 0===e?void 0:e.lastCalculationFailed),this.notify(),this.formData}updatePageData(t,e){this.pendingChanges[t]={...this.pendingChanges[t],...e},this.formData.page_data={...this.formData.page_data,[t]:{...this.formData.page_data[t],...e}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(t,e,n){this.autoSaveManager.startTyping(),this.pendingChanges[t]||(this.pendingChanges[t]={}),this.pendingChanges[t][e]=n,this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t][e]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(t,e,n),this.notify()}updateFieldAnswer(t,e,n){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[e]=n,this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){this.isUserTyping()||(this.formData=t,this.notify())}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,e.default_excess_id&&(this.selectedExcessId=e.default_excess_id),t(),this.notify(),t()}processRatingFactorMappings(t){const e=this.getFormDefinition(),n={};return e.pages.forEach(e=>{const r=t.page_data[e.id]||{};e.fields.forEach(t=>{const e=r[t.code||t.id];null!=e&&""!==e&&t.rating_factor_mappings&&t.rating_factor_mappings.length>0&&t.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(e,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${t.code||t.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){return t(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(e,r):null}calculateAge(t,e){try{const n=new Date(t),r="current_date"===(null==e?void 0:e.reference_date)?new Date:new Date((null==e?void 0:e.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(t){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const t=this.formData;r.current_page===t.current_page?this.formData=o:this.formData={...o,current_page:t.current_page,completed_pages:t.completed_pages,last_updated:t.last_updated},this.notify()}}catch(t){if(t&&"object"==typeof t&&"type"in t&&"message"in t){const e=t;if(!e.validationErrors||0===Object.keys(e.validationErrors).length){const t=st("validation",e);this.addGeneralError(t),this.notify()}}throw t}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(t){return this.navigationManager.canNavigateToPage(t)}navigateToPage(t){return this.navigationManager.navigateToPage(t)}async navigateToNextPage(){var t,e;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(e=null===(t=this.quoteIntent.form_definition)||void 0===t?void 0:t.pages[n-1])||void 0===e?void 0:e.title;bt(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(t){this.selectedExcessId=t,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(t){this.selectedPaymentOption=t,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const t=this.getCurrentPageIndex(),e=this.getFormDefinition().pages[t];if(!e)return[];const n=tt(e,this.formData.page_data[e.id]||{});return this.validationErrors=n.errors,this.notify(),n.errors}validateField(t,e,n){const r=this.getFormDefinition().pages.find(e=>e.id===t),i=null==r?void 0:r.fields.find(t=>(t.code||t.id)===e);if(!i)return[];const o=K(i,n);return this.validationErrors=this.validationErrors.filter(t=>t.field!==e),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(t){return this.getValidationErrors().filter(e=>e.field===t)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(t){return this.getFieldErrors(t).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(t){this.serverValidationErrors=t,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const t=this.generalErrors.filter(t=>!t.dismissed);return t.length>0?[t[t.length-1]]:[]}addGeneralError(t){this.generalErrors.push(t),this.notify()}dismissGeneralError(t){const e=this.generalErrors.find(e=>e.id===t);e&&(e.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 t=this.getFormDefinition(),e={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return Ts});t.pages.forEach(t=>{const r=this.formData.page_data[t.id]||{},i={};t.fields.forEach(t=>{const e=t.code||t.id,o=r[e];let s=!0;if(t.visibility){const e=n(r,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions});s="show"===t.visibility.action?e.matched:!e.matched}s&&void 0!==o&&(i[e]=o)}),e.page_data[t.id]=i});const r=this.processRatingFactorMappings(e),i={...e,page_data:{...e.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[];for(const r of e.pages){const e=tt(r,this.formData.page_data[r.id]||{});t(r.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{this.isCalculating=!0,this.notify();const t=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=t,this.selectedExcessId=t.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const e=this.generalErrors.filter(t=>"calculation"===t.type);return e.forEach(t=>this.dismissGeneralError(t.id)),"calculation"===t.outcome_type?xt(this.quoteIntent,t):"referral"===t.outcome_type&&kt(this.quoteIntent,t),t}catch(t){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const e={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=e,e}finally{this.isCalculating=!1,this.notify()}}notify(){this.subscribers.forEach(t=>t(this))}updateFormDataInternal(t){if(this.isUserTyping()&&t.page_data){const e={...t};delete e.page_data,this.formData={...this.formData,...e}}else this.formData={...this.formData,...t};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var t,e,n;return!!(null===(n=null===(e=null===(t=this.quoteIntent.form_data)||void 0===t?void 0:t.page_data)||void 0===e?void 0:e.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 t=new URL(window.location.href);t.searchParams.delete("url"),window.history.replaceState({},document.title,t.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(t){if(this.quoteIntentStore){const e=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,t);e&&(this.quoteIntent=e,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return s&&_t(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),t}catch(t){throw t}}async getPaymentStatus(t){var e;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(e=this.calculationResult)||void 0===e?void 0:e.payment_gateways)||[]).find(t=>t.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const e=await this.httpClient.getPaymentStatus(t,r);return this.notify(),e}catch(t){throw t}}startPaymentStatusPolling(t,e,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(t);e(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(t){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Tt{constructor(t,e){this.httpClient=t,this.response=e}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(t){const e=this.response.product.form_definition,n={...this.response.quote_intent.form_data};for(const r of e.pages){const e=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;t.hasOwnProperty(r)?e[r]=t[r]:("text"===n.type&&(e[r]="sample"),"number"===n.type&&(e[r]=1),"checkbox"===n.type&&(e[r]=!0))}n.page_data[r.id]=e}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class Ct{constructor(t){this.httpClient=t}async createQuoteIntent(t,e){const n=await this.httpClient.createQuoteIntent({code:t,...e});return new Tt(this.httpClient,n)}}var It=0;function Mt(t,e,r,i,o,s){e||(e={});var a,c,u=e;if("ref"in u)for(c in u={},e)"ref"==c?a=e[c]:u[c]=e[c];var l={type:t,props:u,key:r,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:--It,N:-1,C:0,V:o,X:s};if("function"==typeof t&&(a=t.defaultProps))for(c in a)void 0===u[c]&&(u[c]=a[c]);return n.vnode&&n.vnode(l),l}var Dt,Ot,Pt,Rt,jt=0,At=[],zt=n,Ft=zt.p,Wt=zt.O,Lt=zt.diffed,qt=zt.k,Bt=zt.unmount,Ht=zt.m;function Ut(t,e){zt.A&&zt.A(Ot,t,jt||e),jt=0;var n=Ot.K||(Ot.K={m:[],A:[]});return t>=n.m.length&&n.m.push({}),n.m[t]}function Zt(t){return jt=1,function(t,e){var n=Ut(Dt++,2);if(n.t=t,!n.k&&(n.m=[ne(void 0,e),function(t){var e=n.et?n.et[0]:n.m[0],r=n.t(e,t);e!==r&&(n.et=[r,n.m[1]],n.k.setState({}))}],n.k=Ot,!Ot.nt)){var r=function(t,e,r){if(!n.k.K)return!0;var o=n.k.K.m.filter(function(t){return!!t.k});if(o.every(function(t){return!t.et}))return!i||i.call(this,t,e,r);var s=n.k.props!==t;return o.forEach(function(t){if(t.et){var e=t.m[0];t.m=t.et,t.et=void 0,e!==t.m[0]&&(s=!0)}}),i&&i.call(this,t,e,r)||s};Ot.nt=!0;var i=Ot.shouldComponentUpdate,o=Ot.componentWillUpdate;Ot.componentWillUpdate=function(t,e,n){if(this.v){var s=i;i=void 0,r(t,e,n),i=s}o&&o.call(this,t,e,n)},Ot.shouldComponentUpdate=r}return n.et||n.m}(ne,t)}function Gt(t,e){var n=Ut(Dt++,3);!zt.L&&ee(n.K,e)&&(n.m=t,n.u=e,Ot.K.A.push(n))}function Yt(t){return jt=5,Jt(function(){return{current:t}},[])}function Jt(t,e){var n=Ut(Dt++,7);return ee(n.K,e)&&(n.m=t(),n.K=e,n.A=t),n.m}function Vt(){for(var t;t=At.shift();)if(t.P&&t.K)try{t.K.A.forEach(Kt),t.K.A.forEach(te),t.K.A=[]}catch(e){t.K.A=[],zt.v(e,t._)}}zt.p=function(t){Ot=null,Ft&&Ft(t)},zt.m=function(t,e){t&&e.i&&e.i.B&&(t.B=e.i.B),Ht&&Ht(t,e)},zt.O=function(t){Wt&&Wt(t),Dt=0;var e=(Ot=t.k).K;e&&(Pt===Ot?(e.A=[],Ot.A=[],e.m.forEach(function(t){t.et&&(t.m=t.et),t.u=t.et=void 0})):(e.A.forEach(Kt),e.A.forEach(te),e.A=[],Dt=0)),Pt=Ot},zt.diffed=function(t){Lt&&Lt(t);var e=t.k;e&&e.K&&(e.K.A.length&&(1!==At.push(e)&&Rt===zt.requestAnimationFrame||((Rt=zt.requestAnimationFrame)||Xt)(Vt)),e.K.m.forEach(function(t){t.u&&(t.K=t.u),t.u=void 0})),Pt=Ot=null},zt.k=function(t,e){e.some(function(t){try{t.A.forEach(Kt),t.A=t.A.filter(function(t){return!t.m||te(t)})}catch(n){e.some(function(t){t.A&&(t.A=[])}),e=[],zt.v(n,t._)}}),qt&&qt(t,e)},zt.unmount=function(t){Bt&&Bt(t);var e,n=t.k;n&&n.K&&(n.K.m.forEach(function(t){try{Kt(t)}catch(t){e=t}}),n.K=void 0,e&&zt.v(e,n._))};var Qt="function"==typeof requestAnimationFrame;function Xt(t){var e,n=function(){clearTimeout(r),Qt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Qt&&(e=requestAnimationFrame(n))}function Kt(t){var e=Ot,n=t.k;"function"==typeof n&&(t.k=void 0,n()),Ot=e}function te(t){var e=Ot;t.k=t.m(),Ot=e}function ee(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function ne(t,e){return"function"==typeof e?e(t):e}const re="insure-os";let ie=!1;const oe=new Map,se={[`--${re}-radius`]:"0.75rem",[`--${re}-radius-sm`]:"0.5rem",[`--${re}-radius-lg`]:"1rem",[`--${re}-background`]:"oklch(0.955 0 0)",[`--${re}-foreground`]:"oklch(0.145 0 0)",[`--${re}-card`]:"oklch(1 0 0)",[`--${re}-card-foreground`]:"oklch(0.145 0 0)",[`--${re}-popover`]:"oklch(1 0 0)",[`--${re}-popover-foreground`]:"oklch(0.145 0 0)",[`--${re}-primary`]:"oklch(0.205 0 0)",[`--${re}-primary-foreground`]:"oklch(0.985 0 0)",[`--${re}-secondary`]:"oklch(0.97 0 0)",[`--${re}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${re}-muted`]:"oklch(0.97 0 0)",[`--${re}-muted-foreground`]:"oklch(0.556 0 0)",[`--${re}-accent`]:"oklch(0.97 0 0)",[`--${re}-accent-foreground`]:"oklch(0.205 0 0)",[`--${re}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${re}-border`]:"oklch(0.9 0 0)",[`--${re}-input`]:"oklch(0.9 0 0)",[`--${re}-ring`]:"oklch(0.708 0 0)",[`--${re}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${re}-font-size-large`]:"18px",[`--${re}-font-size-small`]:"14px",[`--${re}-font-size`]:"16px",[`--${re}-border-width`]:"1px",[`--${re}-transition-duration`]:"200ms",[`--${re}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${re}-shadow-sm`]:"0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)",[`--${re}-shadow`]:"0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.12)",[`--${re}-shadow-md`]:"0 4px 8px -1px rgba(0, 0, 0, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.14)",[`--${re}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${re}-spacing-sm`]:"0.75rem",[`--${re}-spacing`]:"1rem",[`--${re}-spacing-md`]:"1.5rem",[`--${re}-spacing-lg`]:"2rem",[`--${re}-spacing-xl`]:"3rem"},ae={colors:{background:`var(--${re}-background)`,foreground:`var(--${re}-foreground)`,card:`var(--${re}-card)`,popover:`var(--${re}-popover)`,popoverForeground:`var(--${re}-popover-foreground)`,primary:`var(--${re}-primary)`,primaryForeground:`var(--${re}-primary-foreground)`,secondary:`var(--${re}-secondary)`,muted:`var(--${re}-muted)`,mutedForeground:`var(--${re}-muted-foreground)`,accent:`var(--${re}-accent)`,accentForeground:`var(--${re}-accent-foreground)`,destructive:`var(--${re}-destructive)`,border:`var(--${re}-border)`,input:`var(--${re}-input)`,ring:`var(--${re}-ring)`},fontSize:{small:`var(--${re}-font-size-small)`,default:`var(--${re}-font-size)`,large:`var(--${re}-font-size-large)`},radius:{small:`var(--${re}-radius-sm)`,default:`var(--${re}-radius)`,large:`var(--${re}-radius-lg)`},shadow:{sm:`var(--${re}-shadow-sm)`,md:`var(--${re}-shadow-md)`},spacing:{sm:`var(--${re}-spacing-sm)`,md:`var(--${re}-spacing-md)`,lg:`var(--${re}-spacing-lg)`,xl:`var(--${re}-spacing-xl)`},fontFamily:`var(--${re}-font-family)`,borderWidth:`var(--${re}-border-width)`,transition:`var(--${re}-transition-duration) var(--${re}-transition-timing-function)`},ce=new Set;function ue(t){if(!document.getElementById(`${re}-styles`)){const t=document.createElement("style");t.id=`${re}-styles`,document.head.appendChild(t)}document.getElementById(`${re}-styles`).textContent+=t+"\n"}function le(t){return Object.entries(t).map(([t,e])=>{return`${n=t,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${e}`;var n}).join("; ")}function de(){ie||(ue(`:root {\n${Object.entries(se).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`),ie=!0)}const he={name:t=>`${re}-${t}`,selector(t){return`.${this.name(t)}`},create(t,e,n){de();const r=le(e),i=function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e).toString(36)}(`${t}:${r}:${n?JSON.stringify(n):""}`),o=`${t}-${i}`,s=oe.get(o);if(s)return s.fullClassName;let a=t;const c=this.name(a);return ce.has(a)||(ue(`.${c} { ${r} }`),ce.add(a)),oe.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([t,e])=>{this.media(t,{[a]:e})}),c},keyframes(t,e){const n=`${re}-${t}`;return ce.has(`keyframes-${t}`)||(ue(`@keyframes ${n} {\n${Object.entries(e).map(([t,e])=>` ${t} { ${le(e)} }`).join("\n")}\n}`),ce.add(`keyframes-${t}`)),n},media(t,e){const n=`media-${t}`;ue(`@media ${t} {\n${Object.entries(e).map(([t,e])=>` .${re}-${t} { ${le(e)} }`).join("\n")}\n}`),ce.add(n)},pseudoElement(t,e,n){const r=`${re}-${t}`,i=`${t}-${e}`;return ce.has(i)||(ue(`.${r}${e} { ${le(n)} }`),ce.add(i)),r}};var fe=Object.freeze({__proto__:null,baseVariables:se,styles:he,theme:ae,updateBaseVariables:function(e){t(),Object.assign(se,e);const n=document.getElementById(`${re}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(se).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else de()}});function me(t){return t&&t.rt&&{}.hasOwnProperty.call(t,"default")?t.default:t}var pe,ge={exports:{}};function ye(){return pe||(pe=1,t=ge,function(){var e={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=i(t,r(n)))}return t}function r(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!=={}.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var o in t)e.call(t,o)&&t[o]&&(r=i(r,o));return r}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(n.default=n,t.exports=n):window.classNames=n}()),ge.exports;var t}var ve=me(ye());function we({size:t="small"}){const e=he.create("spinner-small",{width:"16px",height:"16px"}),n=he.create("spinner-large",{width:"64px",height:"64px"}),r="small"===t?e:n;return he.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Mt("div",{className:he.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Mt("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:ve(r),children:Mt("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function be({className:t,children:e,size:n="md"}){const r={sm:ae.spacing.sm,md:ae.spacing.md,lg:ae.spacing.lg,xl:ae.spacing.xl},i=he.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?ae.spacing.lg:"lg"===n?ae.spacing.md:r[n]},"(max-width: 480px)":{padding:ae.spacing.sm}});return Mt("div",{className:ve(i,t),children:e})}const xe=function(){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&n.forEach(function(t){t.v=!0,N(t)})},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),e.children}return t.k="__cC"+h++,t.m=null,t.Provider=t.it=(t.Consumer=function(t,e){return t.children(e)}).contextType=t,t}();function Se({children:t,httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i}){return Mt(xe.Provider,{value:{httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i,currentRetryAttempt:0,maxRetryAttempts:3},children:t})}function ke(t){const e=function(){const t=function(t){var e=Ot.context[t.k],n=Ut(Dt++,9);return n.c=t,e?(null==n.m&&(n.m=!0,e.sub(Ot)),e.props.value):t.m}(xe);if(!t)throw new Error("useFormContext must be used within a FormContext provider");return t}(),{formStateManager:n}=e;if(!n||"function"!=typeof n.subscribe)throw new Error("FormStateManager is not properly initialized. This component should not render during initialization errors.");const[r,i]=Zt(()=>t(n));return Gt(()=>n.subscribe(()=>{i(t(n))}),[n,t]),{...r,fsm:n}}class _e extends Error{}class $e extends _e{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Ne extends _e{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class Ee extends _e{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Te extends _e{}class Ce extends _e{constructor(t){super(`Invalid unit ${t}`)}}class Ie extends _e{}class Me extends _e{constructor(){super("Zone is an abstract class")}}const De="numeric",Oe="short",Pe="long",Re={year:De,month:De,day:De},je={year:De,month:Oe,day:De},Ae={year:De,month:Oe,day:De,weekday:Oe},ze={year:De,month:Pe,day:De},Fe={year:De,month:Pe,day:De,weekday:Pe},We={hour:De,minute:De},Le={hour:De,minute:De,second:De},qe={hour:De,minute:De,second:De,timeZoneName:Oe},Be={hour:De,minute:De,second:De,timeZoneName:Pe},He={hour:De,minute:De,hourCycle:"h23"},Ue={hour:De,minute:De,second:De,hourCycle:"h23"},Ze={hour:De,minute:De,second:De,hourCycle:"h23",timeZoneName:Oe},Ge={hour:De,minute:De,second:De,hourCycle:"h23",timeZoneName:Pe},Ye={year:De,month:De,day:De,hour:De,minute:De},Je={year:De,month:De,day:De,hour:De,minute:De,second:De},Ve={year:De,month:Oe,day:De,hour:De,minute:De},Qe={year:De,month:Oe,day:De,hour:De,minute:De,second:De},Xe={year:De,month:Oe,day:De,weekday:Oe,hour:De,minute:De},Ke={year:De,month:Pe,day:De,hour:De,minute:De,timeZoneName:Oe},tn={year:De,month:Pe,day:De,hour:De,minute:De,second:De,timeZoneName:Oe},en={year:De,month:Pe,day:De,weekday:Pe,hour:De,minute:De,timeZoneName:Pe},nn={year:De,month:Pe,day:De,weekday:Pe,hour:De,minute:De,second:De,timeZoneName:Pe};class rn{get type(){throw new Me}get name(){throw new Me}get ianaName(){return this.name}get isUniversal(){throw new Me}offsetName(t,e){throw new Me}formatOffset(t,e){throw new Me}offset(t){throw new Me}equals(t){throw new Me}get isValid(){throw new Me}}let on=null;class sn extends rn{static get instance(){return null===on&&(on=new sn),on}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Nr(t,e,n)}formatOffset(t,e){return Ir(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}const an=new Map,cn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},un=new Map;class ln extends rn{static create(t){let e=un.get(t);return void 0===e&&un.set(t,e=new ln(t)),e}static resetCache(){un.clear(),an.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=ln.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Nr(t,e,n,this.name)}formatOffset(t,e){return Ir(this.offset(t),e)}offset(t){if(!this.valid)return NaN;const e=new Date(t);if(isNaN(e))return NaN;const n=function(t){let e=an.get(t);return void 0===e&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),an.set(t,e)),e}(this.name);let[r,i,o,s,a,c,u]=n.formatToParts?function(t,e){const n=t.formatToParts(e),r=[];for(let t=0;t<n.length;t++){const{type:e,value:i}=n[t],o=cn[e];"era"===e?r[o]=i:or(o)||(r[o]=parseInt(i,10))}return r}(n,e):function(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,c,u,l]=r;return[s,i,o,a,c,u,l]}(n,e);"BC"===s&&(r=1-Math.abs(r));let l=+e;const d=l%1e3;return l-=d>=0?d:1e3+d,(Sr({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:u,millisecond:0})-l)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let dn={};const hn=new Map;function fn(t,e={}){const n=JSON.stringify([t,e]);let r=hn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(t,e),hn.set(n,r)),r}const mn=new Map,pn=new Map;let gn=null;const yn=new Map;function vn(t){let e=yn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),yn.set(t,e)),e}const wn=new Map;function bn(t,e,n,r){const i=t.listingMode();return"error"===i?null:"en"===i?n(e):r(e)}class xn{constructor(t,e,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!e||Object.keys(o).length>0){const e={useGrouping:!1,...n};n.padTo>0&&(e.minimumIntegerDigits=n.padTo),this.inf=function(t,e={}){const n=JSON.stringify([t,e]);let r=mn.get(n);return void 0===r&&(r=new Intl.NumberFormat(t,e),mn.set(n,r)),r}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return mr(this.floor?Math.floor(t):vr(t,3),this.padTo)}}class Sn{constructor(t,e,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,n=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&ln.create(n).valid?(r=n,this.dt=t):(r="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,r=t.zone.name):(r="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=fn(e,i)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t}):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class kn{constructor(t,e,n){this.opts={style:"long",...n},!e&&cr()&&(this.rtf=function(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let o=pn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(t,e),pn.set(i,o)),o}(t,n))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,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(t);if("auto"===n&&o){const n="days"===t;switch(e){case 1:return n?"tomorrow":`next ${i[t][0]}`;case-1:return n?"yesterday":`last ${i[t][0]}`;case 0:return n?"today":`this ${i[t][0]}`}}const s=Object.is(e,-0)||e<0,a=Math.abs(e),c=1===a,u=i[t],l=r?c?u[1]:u[2]||u[1]:c?i[t][0]:t;return s?`${a} ${l} ago`:`in ${a} ${l}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const _n={firstDay:1,minimalDays:4,weekend:[6,7]};class $n{static fromOpts(t){return $n.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,n,r,i=!1){const o=t||Bn.defaultLocale,s=o||(i?"en-US":gn||(gn=(new Intl.DateTimeFormat).resolvedOptions().locale,gn)),a=e||Bn.defaultNumberingSystem,c=n||Bn.defaultOutputCalendar,u=hr(r)||Bn.defaultWeekSettings;return new $n(s,a,c,u,o)}static resetCache(){gn=null,hn.clear(),mn.clear(),pn.clear(),yn.clear(),wn.clear()}static fromObject({locale:t,numberingSystem:e,outputCalendar:n,weekSettings:r}={}){return $n.create(t,e,n,r)}constructor(t,e,n,r,i){const[o,s,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(-1===n)return[t];{let e,r;try{e=fn(t).resolvedOptions(),r=t}catch(i){const o=t.substring(0,n);e=fn(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=e;return[r,i,o]}}(t);this.locale=o,this.numberingSystem=e||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(t,e,n){return n||e?(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`),t):t}(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 t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===vn(t.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?$n.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,hr(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return bn(this,t,Rr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(e&=!n)?{month:t,day:"numeric"}:{month:t},i=e?"format":"standalone";if(!this.monthsCache[i][t]){const e=n?t=>this.dtFormatter(t,r).format():t=>this.extract(t,r,"month");this.monthsCache[i][t]=function(t){const e=[];for(let n=1;n<=12;n++){const r=zo.utc(2009,n,1);e.push(t(r))}return e}(e)}return this.monthsCache[i][t]})}weekdays(t,e=!1){return bn(this,t,Fr,()=>{const n=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},r=e?"format":"standalone";return this.weekdaysCache[r][t]||(this.weekdaysCache[r][t]=function(t){const e=[];for(let n=1;n<=7;n++){const r=zo.utc(2016,11,13+n);e.push(t(r))}return e}(t=>this.extract(t,n,"weekday"))),this.weekdaysCache[r][t]})}meridiems(){return bn(this,void 0,()=>Wr,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[zo.utc(2016,11,13,9),zo.utc(2016,11,13,19)].map(e=>this.extract(e,t,"dayperiod"))}return this.meridiemCache})}eras(t){return bn(this,t,Hr,()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[zo.utc(-40,1,1),zo.utc(2017,1,1)].map(t=>this.extract(t,e,"era"))),this.eraCache[t]})}extract(t,e,n){const r=this.dtFormatter(t,e).formatToParts().find(t=>t.type.toLowerCase()===n);return r?r.value:null}numberFormatter(t={}){return new xn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new Sn(t,this.intl,e)}relFormatter(t={}){return new kn(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const n=JSON.stringify([t,e]);let r=dn[n];return r||(r=new Intl.ListFormat(t,e),dn[n]=r),r}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||vn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ur()?function(t){let e=wn.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={..._n,...e}),wn.set(t,e)}return e}(this.locale):_n}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Nn=null;class En extends rn{static get utcInstance(){return null===Nn&&(Nn=new En(0)),Nn}static instance(t){return 0===t?En.utcInstance:new En(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new En(Er(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Ir(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Ir(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Ir(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class Tn extends rn{constructor(t){super(),this.zoneName=t}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 Cn(t,e){if(or(t)||null===t)return e;if(t instanceof rn)return t;if(function(t){return"string"==typeof t}(t)){const n=t.toLowerCase();return"default"===n?e:"local"===n||"system"===n?sn.instance:"utc"===n||"gmt"===n?En.utcInstance:En.parseSpecifier(n)||ln.create(t)}return sr(t)?En.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new Tn(t)}const In={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Mn={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]},Dn=In.hanidec.replace(/[\[|\]]/g,"").split(""),On=new Map;function Pn({numberingSystem:t},e=""){const n=t||"latn";let r=On.get(n);void 0===r&&(r=new Map,On.set(n,r));let i=r.get(e);return void 0===i&&(i=new RegExp(`${In[n]}${e}`),r.set(e,i)),i}let Rn,jn=()=>Date.now(),An="system",zn=null,Fn=null,Wn=null,Ln=60,qn=null;class Bn{static get now(){return jn}static set now(t){jn=t}static set defaultZone(t){An=t}static get defaultZone(){return Cn(An,sn.instance)}static get defaultLocale(){return zn}static set defaultLocale(t){zn=t}static get defaultNumberingSystem(){return Fn}static set defaultNumberingSystem(t){Fn=t}static get defaultOutputCalendar(){return Wn}static set defaultOutputCalendar(t){Wn=t}static get defaultWeekSettings(){return qn}static set defaultWeekSettings(t){qn=hr(t)}static get twoDigitCutoffYear(){return Ln}static set twoDigitCutoffYear(t){Ln=t%100}static get throwOnInvalid(){return Rn}static set throwOnInvalid(t){Rn=t}static resetCaches(){$n.resetCache(),ln.resetCache(),zo.resetCache(),On.clear()}}class Hn{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Un=[0,31,59,90,120,151,181,212,243,273,304,334],Zn=[0,31,60,91,121,152,182,213,244,274,305,335];function Gn(t,e){return new Hn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Yn(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function Jn(t,e,n){return n+(wr(t)?Zn:Un)[e-1]}function Vn(t,e){const n=wr(t)?Zn:Un,r=n.findIndex(t=>t<e);return{month:r+1,day:e-n[r]}}function Qn(t,e){return(t-e+7)%7+1}function Xn(t,e=4,n=1){const{year:r,month:i,day:o}=t,s=Jn(r,i,o),a=Qn(Yn(r,i,o),n);let c,u=Math.floor((s-a+14-e)/7);return u<1?(c=r-1,u=_r(c,e,n)):u>_r(r,e,n)?(c=r+1,u=1):c=r,{weekYear:c,weekNumber:u,weekday:a,...Mr(t)}}function Kn(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=t,s=Qn(Yn(r,1,e),n),a=br(r);let c,u=7*i+o-s-7+e;u<1?(c=r-1,u+=br(c)):u>a?(c=r+1,u-=br(r)):c=r;const{month:l,day:d}=Vn(c,u);return{year:c,month:l,day:d,...Mr(t)}}function tr(t){const{year:e,month:n,day:r}=t;return{year:e,ordinal:Jn(e,n,r),...Mr(t)}}function er(t){const{year:e,ordinal:n}=t,{month:r,day:i}=Vn(e,n);return{year:e,month:r,day:i,...Mr(t)}}function nr(t,e){if(!or(t.localWeekday)||!or(t.localWeekNumber)||!or(t.localWeekYear)){if(!or(t.weekday)||!or(t.weekNumber)||!or(t.weekYear))throw new Te("Cannot mix locale-based week fields with ISO-based week fields");return or(t.localWeekday)||(t.weekday=t.localWeekday),or(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),or(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function rr(t){const e=ar(t.year),n=fr(t.month,1,12),r=fr(t.day,1,xr(t.year,t.month));return e?n?!r&&Gn("day",t.day):Gn("month",t.month):Gn("year",t.year)}function ir(t){const{hour:e,minute:n,second:r,millisecond:i}=t,o=fr(e,0,23)||24===e&&0===n&&0===r&&0===i,s=fr(n,0,59),a=fr(r,0,59),c=fr(i,0,999);return o?s?a?!c&&Gn("millisecond",i):Gn("second",r):Gn("minute",n):Gn("hour",e)}function or(t){return void 0===t}function sr(t){return"number"==typeof t}function ar(t){return"number"==typeof t&&t%1==0}function cr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function ur(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function lr(t,e,n){if(0!==t.length)return t.reduce((t,r)=>{const i=[e(r),r];return t&&n(t[0],i[0])===t[0]?t:i},null)[1]}function dr(t,e){return{}.hasOwnProperty.call(t,e)}function hr(t){if(null==t)return null;if("object"!=typeof t)throw new Ie("Week settings must be an object");if(!fr(t.firstDay,1,7)||!fr(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(t=>!fr(t,1,7)))throw new Ie("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function fr(t,e,n){return ar(t)&&t>=e&&t<=n}function mr(t,e=2){let n;return n=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),n}function pr(t){return or(t)||null===t||""===t?void 0:parseInt(t,10)}function gr(t){return or(t)||null===t||""===t?void 0:parseFloat(t)}function yr(t){if(!or(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function vr(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function wr(t){return t%4==0&&(t%100!=0||t%400==0)}function br(t){return wr(t)?366:365}function xr(t,e){const n=(r=e-1)-12*Math.floor(r/12)+1;var r;return 2===n?wr(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Sr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function kr(t,e,n){return-Qn(Yn(t,1,e),n)+e-1}function _r(t,e=4,n=1){const r=kr(t,e,n),i=kr(t+1,e,n);return(br(t)-r+i)/7}function $r(t){return t>99?t:t>Bn.twoDigitCutoffYear?1900+t:2e3+t}function Nr(t,e,n,r=null){const i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(t=>"timezonename"===t.type.toLowerCase());return a?a.value:null}function Er(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Tr(t){const e=Number(t);if("boolean"==typeof t||""===t||!Number.isFinite(e))throw new Ie(`Invalid unit value ${t}`);return e}function Cr(t,e){const n={};for(const r in t)if(dr(t,r)){const i=t[r];if(null==i)continue;n[e(r)]=Tr(i)}return n}function Ir(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${mr(n,2)}:${mr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${mr(n,2)}${mr(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Mr(t){return function(t){return["hour","minute","second","millisecond"].reduce((e,n)=>(e[n]=t[n],e),{})}(t)}const Dr=["January","February","March","April","May","June","July","August","September","October","November","December"],Or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Pr=["J","F","M","A","M","J","J","A","S","O","N","D"];function Rr(t){switch(t){case"narrow":return[...Pr];case"short":return[...Or];case"long":return[...Dr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const jr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ar=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],zr=["M","T","W","T","F","S","S"];function Fr(t){switch(t){case"narrow":return[...zr];case"short":return[...Ar];case"long":return[...jr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Wr=["AM","PM"],Lr=["Before Christ","Anno Domini"],qr=["BC","AD"],Br=["B","A"];function Hr(t){switch(t){case"narrow":return[...Br];case"short":return[...qr];case"long":return[...Lr];default:return null}}function Ur(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const Zr={D:Re,DD:je,DDD:ze,DDDD:Fe,t:We,tt:Le,ttt:qe,tttt:Be,T:He,TT:Ue,TTT:Ze,TTTT:Ge,f:Ye,ff:Ve,fff:Ke,ffff:en,F:Je,FF:Qe,FFF:tn,FFFF:nn};class Gr{static create(t,e={}){return new Gr(t,e)}static parseFormat(t){let e=null,n="",r=!1;const i=[];for(let o=0;o<t.length;o++){const s=t.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),e=null,n="",r=!r):r||s===e?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,e=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(t){return Zr[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0,n){if(this.opts.forceSimple)return mr(t,e);const r={...this.opts};return e>0&&(r.padTo=e),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,e){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",s=(e,r)=>n?function(t,e){return Rr(e)[t.month-1]}(t,e):i(r?{month:e}:{month:e,day:"numeric"},"month"),a=(e,r)=>n?function(t,e){return Fr(e)[t.weekday-1]}(t,e):i(r?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),c=e=>{const n=Gr.macroTokenToFormatOpts(e);return n?this.formatWithSystemDefault(t,n):e},u=e=>n?function(t,e){return Hr(e)[t.year<0?0:1]}(t,e):i({era:e},"era");return Ur(Gr.parseFormat(e),e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.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 t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return n?function(t){return Wr[t.hour<12?0:1]}(t):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(t.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.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(t.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(t.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(t.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(t.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(t.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(t.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(e)}})}formatDurationFromString(t,e){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=t=>{switch(t[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=Gr.parseFormat(e),o=i.reduce((t,{literal:e,val:n})=>e?t:t.concat(n),[]),s=t.shiftTo(...o.map(r).filter(t=>t));return Ur(i,((t,e)=>i=>{const o=r(i);if(o){const r=e.isNegativeDuration&&o!==e.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==e.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(t.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const Yr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Jr(...t){const e=t.reduce((t,e)=>t+e.source,"");return RegExp(`^${e}$`)}function Vr(...t){return e=>t.reduce(([t,n,r],i)=>{const[o,s,a]=i(e,r);return[{...t,...o},s||n,a]},[{},null,1]).slice(0,2)}function Qr(t,...e){if(null==t)return[null,null];for(const[n,r]of e){const e=n.exec(t);if(e)return r(e)}return[null,null]}function Xr(...t){return(e,n)=>{const r={};let i;for(i=0;i<t.length;i++)r[t[i]]=pr(e[n+i]);return[r,null,n+i]}}const Kr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ti=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ei=RegExp(`${ti.source}(?:${Kr.source}?(?:\\[(${Yr.source})\\])?)?`),ni=RegExp(`(?:[Tt]${ei.source})?`),ri=Xr("weekYear","weekNumber","weekDay"),ii=Xr("year","ordinal"),oi=RegExp(`${ti.source} ?(?:${Kr.source}|(${Yr.source}))?`),si=RegExp(`(?: ${oi.source})?`);function ai(t,e,n){const r=t[e];return or(r)?n:pr(r)}function ci(t,e){return[{hours:ai(t,e,0),minutes:ai(t,e+1,0),seconds:ai(t,e+2,0),milliseconds:yr(t[e+3])},null,e+4]}function ui(t,e){const n=!t[e]&&!t[e+1],r=Er(t[e+1],t[e+2]);return[{},n?null:En.instance(r),e+3]}function li(t,e){return[{},t[e]?ln.create(t[e]):null,e+1]}const di=RegExp(`^T?${ti.source}$`),hi=/^-?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 fi(t){const[e,n,r,i,o,s,a,c,u]=t,l="-"===e[0],d=c&&"-"===c[0],h=(t,e=!1)=>void 0!==t&&(e||t&&l)?-t:t;return[{years:h(gr(n)),months:h(gr(r)),weeks:h(gr(i)),days:h(gr(o)),hours:h(gr(s)),minutes:h(gr(a)),seconds:h(gr(c),"-0"===c),milliseconds:h(yr(u),d)}]}const mi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function pi(t,e,n,r,i,o,s){const a={year:2===e.length?$r(pr(e)):pr(e),month:Or.indexOf(n)+1,day:pr(r),hour:pr(i),minute:pr(o)};return s&&(a.second=pr(s)),t&&(a.weekday=t.length>3?jr.indexOf(t)+1:Ar.indexOf(t)+1),a}const gi=/^(?:(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 yi(t){const[,e,n,r,i,o,s,a,c,u,l,d]=t,h=pi(e,i,r,n,o,s,a);let f;return f=c?mi[c]:u?0:Er(l,d),[h,new En(f)]}const vi=/^(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$/,wi=/^(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$/,bi=/^(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 xi(t){const[,e,n,r,i,o,s,a]=t;return[pi(e,i,r,n,o,s,a),En.utcInstance]}function Si(t){const[,e,n,r,i,o,s,a]=t;return[pi(e,a,n,r,i,o,s),En.utcInstance]}const ki=Jr(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ni),_i=Jr(/(\d{4})-?W(\d\d)(?:-?(\d))?/,ni),$i=Jr(/(\d{4})-?(\d{3})/,ni),Ni=Jr(ei),Ei=Vr(function(t,e){return[{year:ai(t,e),month:ai(t,e+1,1),day:ai(t,e+2,1)},null,e+3]},ci,ui,li),Ti=Vr(ri,ci,ui,li),Ci=Vr(ii,ci,ui,li),Ii=Vr(ci,ui,li),Mi=Vr(ci),Di=Jr(/(\d{4})-(\d\d)-(\d\d)/,si),Oi=Jr(oi),Pi=Vr(ci,ui,li),Ri="Invalid Duration",ji={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Ai={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...ji},zi={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...ji},Fi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wi=Fi.slice(0).reverse();function Li(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Ui(r)}function qi(t,e){let n=e.milliseconds??0;for(const r of Wi.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function Bi(t,e){const n=qi(t,e)<0?-1:1;Fi.reduceRight((r,i)=>{if(or(e[i]))return r;if(r){const o=e[r]*n,s=t[i][r],a=Math.floor(o/s);e[i]+=a*n,e[r]-=a*s*n}return i},null),Fi.reduce((n,r)=>{if(or(e[r]))return n;if(n){const i=e[n]%1;e[n]-=i,e[r]+=i*t[n][r]}return r},null)}function Hi(t){const e={};for(const[n,r]of Object.entries(t))0!==r&&(e[n]=r);return e}class Ui{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let n=e?zi:Ai;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||$n.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,e){return Ui.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new Ie("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new Ui({values:Cr(t,Ui.normalizeUnit),loc:$n.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(sr(t))return Ui.fromMillis(t);if(Ui.isDuration(t))return t;if("object"==typeof t)return Ui.fromObject(t);throw new Ie(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[n]=function(t){return Qr(t,[hi,fi])}(t);return n?Ui.fromObject(n,e):Ui.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[n]=function(t){return Qr(t,[di,Mi])}(t);return n?Ui.fromObject(n,e):Ui.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new Ie("need to specify a reason the Duration is invalid");const n=t instanceof Hn?t:new Hn(t,e);if(Bn.throwOnInvalid)throw new Ee(n);return new Ui({invalid:n})}static normalizeUnit(t){const e={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"}[t?t.toLowerCase():t];if(!e)throw new Ce(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const n={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?Gr.create(this.loc,n).formatDurationFromString(this,t):Ri}toHuman(t={}){if(!this.isValid)return Ri;const e=!1!==t.showZeros,n=Fi.map(n=>{const r=this.values[n];return or(r)||0===r&&!e?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(r)}).filter(t=>t);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=vr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();return e<0||e>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},zo.fromMillis(e,{zone:"UTC"}).toISOTime(t))}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?qi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=Ui.fromDurationLike(t),n={};for(const t of Fi)(dr(e.values,t)||dr(this.values,t))&&(n[t]=e.get(t)+this.get(t));return Li(this,{values:n},!0)}minus(t){if(!this.isValid)return this;const e=Ui.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=Tr(t(this.values[n],n));return Li(this,{values:e},!0)}get(t){return this[Ui.normalizeUnit(t)]}set(t){return this.isValid?Li(this,{values:{...this.values,...Cr(t,Ui.normalizeUnit)}}):this}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:n,matrix:r}={}){return Li(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:r,conversionAccuracy:n})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return Bi(this.matrix,t),Li(this,{values:t},!0)}rescale(){return this.isValid?Li(this,{values:Hi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map(t=>Ui.normalizeUnit(t));const e={},n={},r=this.toObject();let i;for(const o of Fi)if(t.indexOf(o)>=0){i=o;let t=0;for(const e in n)t+=this.matrix[e][o]*n[e],n[e]=0;sr(r[o])&&(t+=r[o]);const s=Math.trunc(t);e[o]=s,n[o]=(1e3*t-1e3*s)/1e3}else sr(r[o])&&(n[o]=r[o]);for(const t in n)0!==n[t]&&(e[i]+=t===i?n[t]:n[t]/this.matrix[i][t]);return Bi(this.matrix,e),Li(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Li(this,{values:t},!0)}removeZeros(){return this.isValid?Li(this,{values:Hi(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(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;function e(t,e){return void 0===t||0===t?void 0===e||0===e:t===e}for(const n of Fi)if(!e(this.values[n],t.values[n]))return!1;return!0}}const Zi="Invalid Interval";class Gi{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new Ie("need to specify a reason the Interval is invalid");const n=t instanceof Hn?t:new Hn(t,e);if(Bn.throwOnInvalid)throw new Ne(n);return new Gi({invalid:n})}static fromDateTimes(t,e){const n=Fo(t),r=Fo(e),i=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?Gi.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:Gi.invalid("missing or invalid end"):Gi.invalid("missing or invalid start")}(n,r);return null==i?new Gi({start:n,end:r}):i}static after(t,e){const n=Ui.fromDurationLike(e),r=Fo(t);return Gi.fromDateTimes(r,r.plus(n))}static before(t,e){const n=Ui.fromDurationLike(e),r=Fo(t);return Gi.fromDateTimes(r.minus(n),r)}static fromISO(t,e){const[n,r]=(t||"").split("/",2);if(n&&r){let t,i,o,s;try{t=zo.fromISO(n,e),i=t.isValid}catch(r){i=!1}try{o=zo.fromISO(r,e),s=o.isValid}catch(r){s=!1}if(i&&s)return Gi.fromDateTimes(t,o);if(i){const n=Ui.fromISO(r,e);if(n.isValid)return Gi.after(t,n)}else if(s){const t=Ui.fromISO(n,e);if(t.isValid)return Gi.before(o,t)}}return Gi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.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(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const n=this.start.startOf(t,e);let r;return r=e?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(t,e),Math.floor(r.diff(n,t).get(t))+(r.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&this.s<=t&&this.e>t}set({start:t,end:e}={}){return this.isValid?Gi.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Fo).filter(t=>this.contains(t)).sort((t,e)=>t.toMillis()-e.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const t=e[i]||this.e,o=+t>+this.e?this.e:t;n.push(Gi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(t){const e=Ui.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const t=this.start.plus(e.mapUnits(t=>t*i));n=+t>+this.e?this.e:t,o.push(Gi.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e===+t.s}abutsEnd(t){return!!this.isValid&&+t.e===+this.s}engulfs(t){return!!this.isValid&&this.s<=t.s&&this.e>=t.e}equals(t){return!(!this.isValid||!t.isValid)&&this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return e>=n?null:Gi.fromDateTimes(e,n)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return Gi.fromDateTimes(e,n)}static merge(t){const[e,n]=t.sort((t,e)=>t.s-e.s).reduce(([t,e],n)=>e?e.overlaps(n)||e.abutsStart(n)?[t,e.union(n)]:[t.concat([e]),n]:[t,n],[[],null]);return n&&e.push(n),e}static xor(t){let e=null,n=0;const r=[],i=t.map(t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}]),o=[].concat(...i).sort((t,e)=>t.time-e.time);for(const t of o)n+="s"===t.type?1:-1,1===n?e=t.time:(e&&+e!==+t.time&&r.push(Gi.fromDateTimes(e,t.time)),e=null);return Gi.merge(r)}difference(...t){return Gi.xor([this].concat(t)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Zi}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Re,e={}){return this.isValid?Gr.create(this.s.loc.clone(e),t).formatInterval(this):Zi}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:Zi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Zi}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:Zi}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:Zi}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):Ui.invalid(this.invalidReason)}mapEndpoints(t){return Gi.fromDateTimes(t(this.s),t(this.e))}}class Yi{static hasDST(t=Bn.defaultZone){const e=zo.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return ln.isValidZone(t)}static normalizeZone(t){return Cn(t,Bn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||$n.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||$n.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||$n.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||$n.create(e,n,i)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||$n.create(e,n,i)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||$n.create(e,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||$n.create(e,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return $n.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return $n.create(e,null,"gregory").eras(t)}static features(){return{relative:cr(),localeWeek:ur()}}}function Ji(t,e){const n=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(Ui.fromMillis(r).as("days"))}function Vi(t,e=t=>t){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(-1!==t[n].search(In.hanidec))e+=Dn.indexOf(t[n]);else for(const t in Mn){const[n,i]=Mn[t];r>=n&&r<=i&&(e+=r-n)}}return parseInt(e,10)}return e}(t))}}const Qi=`[ ${String.fromCharCode(160)}]`,Xi=new RegExp(Qi,"g");function Ki(t){return t.replace(/\./g,"\\.?").replace(Xi,Qi)}function to(t){return t.replace(/\./g,"").replace(Xi," ").toLowerCase()}function eo(t,e){return null===t?null:{regex:RegExp(t.map(Ki).join("|")),deser:([n])=>t.findIndex(t=>to(n)===to(t))+e}}function no(t,e){return{regex:t,deser:([,t,e])=>Er(t,e),groups:e}}function ro(t){return{regex:t,deser:([t])=>t}}const io={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 oo=null;function so(t,e){return[].concat(...t.map(t=>function(t,e){if(t.literal)return t;const n=uo(Gr.macroTokenToFormatOpts(t.val),e);return null==n||n.includes(void 0)?t:n}(t,e)))}class ao{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=so(Gr.parseFormat(e),t),this.units=this.tokens.map(e=>function(t,e){const n=Pn(e),r=Pn(e,"{2}"),i=Pn(e,"{3}"),o=Pn(e,"{4}"),s=Pn(e,"{6}"),a=Pn(e,"{1,2}"),c=Pn(e,"{1,3}"),u=Pn(e,"{1,6}"),l=Pn(e,"{1,9}"),d=Pn(e,"{2,4}"),h=Pn(e,"{4,6}"),f=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return f(m);switch(m.val){case"G":return eo(e.eras("short"),0);case"GG":return eo(e.eras("long"),0);case"y":return Vi(u);case"yy":case"kk":return Vi(d,$r);case"yyyy":case"kkkk":return Vi(o);case"yyyyy":return Vi(h);case"yyyyyy":return Vi(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Vi(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Vi(r);case"MMM":return eo(e.months("short",!0),1);case"MMMM":return eo(e.months("long",!0),1);case"LLL":return eo(e.months("short",!1),1);case"LLLL":return eo(e.months("long",!1),1);case"o":case"S":return Vi(c);case"ooo":case"SSS":return Vi(i);case"u":return ro(l);case"uu":return ro(a);case"uuu":case"E":case"c":return Vi(n);case"a":return eo(e.meridiems(),0);case"EEE":return eo(e.weekdays("short",!1),1);case"EEEE":return eo(e.weekdays("long",!1),1);case"ccc":return eo(e.weekdays("short",!0),1);case"cccc":return eo(e.weekdays("long",!0),1);case"Z":case"ZZ":return no(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return no(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return ro(/[a-z_+-/]{1,256}?/i);case" ":return ro(/[^\S\n\r]/);default:return f(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t)),this.disqualifyingUnit=this.units.find(t=>t.invalidReason),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map(t=>t.regex).reduce((t,e)=>`${t}(${e.source})`,"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,n]=function(t,e,n){const r=t.match(e);if(r){const t={};let e=1;for(const i in n)if(dr(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(t[o.token.val[0]]=o.deser(r.slice(e,e+s))),e+=s}return[r,t]}return[r,{}]}(t,this.regex,this.handlers),[r,i,o]=n?function(t){let e,n=null;or(t.z)||(n=ln.create(t.z)),or(t.Z)||(n||(n=new En(t.Z)),e=t.Z),or(t.q)||(t.M=3*(t.q-1)+1),or(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),or(t.u)||(t.S=yr(t.u));const r=Object.keys(t).reduce((e,n)=>{const r=(t=>{switch(t){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&&(e[r]=t[n]),e},{});return[r,n,e]}(n):[null,null,void 0];if(dr(n,"a")&&dr(n,"H"))throw new Te("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:n,result:r,zone:i,specificOffset:o}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function co(t,e,n){return new ao(t,n).explainFromTokens(e)}function uo(t,e){if(!t)return null;const n=Gr.create(e,t).dtFormatter((oo||(oo=zo.fromMillis(1555555555555)),oo)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(e=>function(t,e,n){const{type:r,value:i}=t;if("literal"===r){const t=/^\s+$/.test(i);return{literal:!t,val:t?" ":i}}const o=e[r];let s=r;"hour"===r&&(s=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=io[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(e,t,i))}const lo="Invalid DateTime",ho=864e13;function fo(t){return new Hn("unsupported zone",`the zone "${t.name}" is not supported`)}function mo(t){return null===t.weekData&&(t.weekData=Xn(t.c)),t.weekData}function po(t){return null===t.localWeekData&&(t.localWeekData=Xn(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function go(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new zo({...n,...e,old:n})}function yo(t,e,n){let r=t-60*e*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=60*(i-e)*1e3;const o=n.offset(r);return i===o?[r,i]:[t-60*Math.min(i,o)*1e3,Math.max(i,o)]}function vo(t,e){const n=new Date(t+=60*e*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 wo(t,e,n){return yo(Sr(t),e,n)}function bo(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),o={...t.c,year:r,month:i,day:Math.min(t.c.day,xr(r,i))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},s=Ui.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Sr(o);let[c,u]=yo(a,n,t.zone);return 0!==s&&(c+=s,u=t.zone.offset(c)),{ts:c,o:u}}function xo(t,e,n,r,i,o){const{setZone:s,zone:a}=n;if(t&&0!==Object.keys(t).length||e){const r=e||a,i=zo.fromObject(t,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return zo.invalid(new Hn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function So(t,e,n=!0){return t.isValid?Gr.create($n.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function ko(t,e,n){const r=t.c.year>9999||t.c.year<0;let i="";if(r&&t.c.year>=0&&(i+="+"),i+=mr(t.c.year,r?6:4),"year"===n)return i;if(e){if(i+="-",i+=mr(t.c.month),"month"===n)return i;i+="-"}else if(i+=mr(t.c.month),"month"===n)return i;return i+=mr(t.c.day),i}function _o(t,e,n,r,i,o,s){let a=!n||0!==t.c.millisecond||0!==t.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=mr(t.c.hour),"hour"===s)break;if(e){if(c+=":",c+=mr(t.c.minute),"minute"===s)break;a&&(c+=":",c+=mr(t.c.second))}else{if(c+=mr(t.c.minute),"minute"===s)break;a&&(c+=mr(t.c.second))}if("second"===s)break;!a||r&&0===t.c.millisecond||(c+=".",c+=mr(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&0===t.offset&&!o?c+="Z":t.o<0?(c+="-",c+=mr(Math.trunc(-t.o/60)),c+=":",c+=mr(Math.trunc(-t.o%60))):(c+="+",c+=mr(Math.trunc(t.o/60)),c+=":",c+=mr(Math.trunc(t.o%60)))),o&&(c+="["+t.zone.ianaName+"]"),c}const $o={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},No={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Eo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},To=["year","month","day","hour","minute","second","millisecond"],Co=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Io=["year","ordinal","hour","minute","second","millisecond"];function Mo(t){const e={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"}[t.toLowerCase()];if(!e)throw new Ce(t);return e}function Do(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Mo(t)}}function Oo(t,e){const n=Cn(e.zone,Bn.defaultZone);if(!n.isValid)return zo.invalid(fo(n));const r=$n.fromObject(e);let i,o;if(or(t.year))i=Bn.now();else{for(const e of To)or(t[e])&&(t[e]=$o[e]);const e=rr(t)||ir(t);if(e)return zo.invalid(e);const r=function(t){if(void 0===jo&&(jo=Bn.now()),"iana"!==t.type)return t.offset(jo);const e=t.name;let n=Ao.get(e);return void 0===n&&(n=t.offset(jo),Ao.set(e,n)),n}(n);[i,o]=wo(t,r,n)}return new zo({ts:i,zone:n,loc:r,o:o})}function Po(t,e,n){const r=!!or(n.round)||n.round,i=or(n.rounding)?"trunc":n.rounding,o=(t,o)=>(t=vr(t,r||n.calendary?0:2,n.calendary?"round":i),e.loc.clone(n).relFormatter(n).format(t,o)),s=r=>n.calendary?e.hasSame(t,r)?0:e.startOf(r).diff(t.startOf(r),r).get(r):e.diff(t,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const t of n.units){const e=s(t);if(Math.abs(e)>=1)return o(e,t)}return o(t>e?-0:0,n.units[n.units.length-1])}function Ro(t){let e,n={};return t.length>0&&"object"==typeof t[t.length-1]?(n=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[n,e]}let jo;const Ao=new Map;class zo{constructor(t){const e=t.zone||Bn.defaultZone;let n=t.invalid||(Number.isNaN(t.ts)?new Hn("invalid input"):null)||(e.isValid?null:fo(e));this.ts=or(t.ts)?Bn.now():t.ts;let r=null,i=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[r,i]=[t.old.c,t.old.o];else{const o=sr(t.o)&&!t.old?t.o:e.offset(this.ts);r=vo(this.ts,o),n=Number.isNaN(r.year)?new Hn("invalid input"):null,r=n?null:r,i=n?null:o}this.ot=e,this.loc=t.loc||$n.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new zo({})}static local(){const[t,e]=Ro(arguments),[n,r,i,o,s,a,c]=e;return Oo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static utc(){const[t,e]=Ro(arguments),[n,r,i,o,s,a,c]=e;return t.zone=En.utcInstance,Oo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static fromJSDate(t,e={}){const n=function(t){return"[object Date]"==={}.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(n))return zo.invalid("invalid input");const r=Cn(e.zone,Bn.defaultZone);return r.isValid?new zo({ts:n,zone:r,loc:$n.fromObject(e)}):zo.invalid(fo(r))}static fromMillis(t,e={}){if(sr(t))return t<-ho||t>ho?zo.invalid("Timestamp out of range"):new zo({ts:t,zone:Cn(e.zone,Bn.defaultZone),loc:$n.fromObject(e)});throw new Ie(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(sr(t))return new zo({ts:1e3*t,zone:Cn(e.zone,Bn.defaultZone),loc:$n.fromObject(e)});throw new Ie("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const n=Cn(e.zone,Bn.defaultZone);if(!n.isValid)return zo.invalid(fo(n));const r=$n.fromObject(e),i=Cr(t,Do),{minDaysInFirstWeek:o,startOfWeek:s}=nr(i,r),a=Bn.now(),c=or(e.specificOffset)?n.offset(a):e.specificOffset,u=!or(i.ordinal),l=!or(i.year),d=!or(i.month)||!or(i.day),h=l||d,f=i.weekYear||i.weekNumber;if((h||u)&&f)throw new Te("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Te("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=vo(a,c);m?(p=Co,g=No,y=Xn(y,o,s)):u?(p=Io,g=Eo,y=tr(y)):(p=To,g=$o);let v=!1;for(const t of p)or(i[t])?i[t]=v?g[t]:y[t]:v=!0;const w=m?function(t,e=4,n=1){const r=ar(t.weekYear),i=fr(t.weekNumber,1,_r(t.weekYear,e,n)),o=fr(t.weekday,1,7);return r?i?!o&&Gn("weekday",t.weekday):Gn("week",t.weekNumber):Gn("weekYear",t.weekYear)}(i,o,s):u?function(t){const e=ar(t.year),n=fr(t.ordinal,1,br(t.year));return e?!n&&Gn("ordinal",t.ordinal):Gn("year",t.year)}(i):rr(i),b=w||ir(i);if(b)return zo.invalid(b);const x=m?Kn(i,o,s):u?er(i):i,[S,k]=wo(x,c,n),_=new zo({ts:S,zone:n,o:k,loc:r});return i.weekday&&h&&t.weekday!==_.weekday?zo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${_.toISO()}`):_.isValid?_:zo.invalid(_.invalid)}static fromISO(t,e={}){const[n,r]=function(t){return Qr(t,[ki,Ei],[_i,Ti],[$i,Ci],[Ni,Ii])}(t);return xo(n,r,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[n,r]=function(t){return Qr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[gi,yi])}(t);return xo(n,r,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[n,r]=function(t){return Qr(t,[vi,xi],[wi,xi],[bi,Si])}(t);return xo(n,r,e,"HTTP",e)}static fromFormat(t,e,n={}){if(or(t)||or(e))throw new Ie("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=$n.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,u]=function(t,e,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=co(t,e,n);return[r,i,o,s]}(o,t,e);return u?zo.invalid(u):xo(s,a,n,`format ${e}`,t,c)}static fromString(t,e,n={}){return zo.fromFormat(t,e,n)}static fromSQL(t,e={}){const[n,r]=function(t){return Qr(t,[Di,Ei],[Oi,Pi])}(t);return xo(n,r,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new Ie("need to specify a reason the DateTime is invalid");const n=t instanceof Hn?t:new Hn(t,e);if(Bn.throwOnInvalid)throw new $e(n);return new zo({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const n=uo(t,$n.fromObject(e));return n?n.map(t=>t?t.val:null).join(""):null}static expandFormat(t,e={}){return so(Gr.parseFormat(t),$n.fromObject(e)).map(t=>t.val).join("")}static resetCache(){jo=void 0,Ao.clear()}get(t){return this[t]}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.ot}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?mo(this).weekYear:NaN}get weekNumber(){return this.isValid?mo(this).weekNumber:NaN}get weekday(){return this.isValid?mo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?po(this).weekday:NaN}get localWeekNumber(){return this.isValid?po(this).weekNumber:NaN}get localWeekYear(){return this.isValid?po(this).weekYear:NaN}get ordinal(){return this.isValid?tr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Yi.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Yi.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Yi.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Yi.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 t=864e5,e=6e4,n=Sr(this.c),r=this.zone.offset(n-t),i=this.zone.offset(n+t),o=this.zone.offset(n-r*e),s=this.zone.offset(n-i*e);if(o===s)return[this];const a=n-o*e,c=n-s*e,u=vo(a,o),l=vo(c,s);return u.hour===l.hour&&u.minute===l.minute&&u.second===l.second&&u.millisecond===l.millisecond?[go(this,{ts:a}),go(this,{ts:c})]:[this]}get isInLeapYear(){return wr(this.year)}get daysInMonth(){return xr(this.year,this.month)}get daysInYear(){return this.isValid?br(this.year):NaN}get weeksInWeekYear(){return this.isValid?_r(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?_r(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:n,calendar:r}=Gr.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:n,outputCalendar:r}}toUTC(t=0,e={}){return this.setZone(En.instance(t),e)}toLocal(){return this.setZone(Bn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:n=!1}={}){if((t=Cn(t,Bn.defaultZone)).equals(this.zone))return this;if(t.isValid){let r=this.ts;if(e||n){const e=t.offset(this.ts),n=this.toObject();[r]=wo(n,e,t)}return go(this,{ts:r,zone:t})}return zo.invalid(fo(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:n}={}){return go(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:n})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=Cr(t,Do),{minDaysInFirstWeek:n,startOfWeek:r}=nr(e,this.loc),i=!or(e.weekYear)||!or(e.weekNumber)||!or(e.weekday),o=!or(e.ordinal),s=!or(e.year),a=!or(e.month)||!or(e.day),c=s||a,u=e.weekYear||e.weekNumber;if((c||o)&&u)throw new Te("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Te("Can't mix ordinal dates with month/day");let l;i?l=Kn({...Xn(this.c,n,r),...e},n,r):or(e.ordinal)?(l={...this.toObject(),...e},or(e.day)&&(l.day=Math.min(xr(l.year,l.month),l.day))):l=er({...tr(this.c),...e});const[d,h]=wo(l,this.o,this.zone);return go(this,{ts:d,o:h})}plus(t){return this.isValid?go(this,bo(this,Ui.fromDurationLike(t))):this}minus(t){return this.isValid?go(this,bo(this,Ui.fromDurationLike(t).negate())):this}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const n={},r=Ui.normalizeUnit(t);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(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(n.weekNumber=this.weekNumber-1),n.weekday=t}else n.weekday=1;if("quarters"===r){const t=Math.ceil(this.month/3);n.month=3*(t-1)+1}return this.set(n)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?Gr.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):lo}toLocaleString(t=Re,e={}){return this.isValid?Gr.create(this.loc.clone(e),t).formatDateTime(this):lo}toLocaleParts(t={}){return this.isValid?Gr.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===t;let a=ko(this,s,o=Mo(o));return To.indexOf(o)>=3&&(a+="T"),a+=_o(this,s,e,n,r,i,o),a}toISODate({format:t="extended",precision:e="day"}={}){return this.isValid?ko(this,"extended"===t,Mo(e)):null}toISOWeekDate(){return So(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Mo(s),(r&&To.indexOf(s)>=3?"T":"")+_o(this,"extended"===o,e,t,n,i,s)):null}toRFC2822(){return So(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return So(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ko(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(e||t)&&(n&&(r+=" "),e?r+="z":t&&(r+="ZZ")),So(this,r,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():lo}[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(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",n={}){if(!this.isValid||!t.isValid)return Ui.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=e,Array.isArray(a)?a:[a]).map(Ui.normalizeUnit),o=t.valueOf()>this.valueOf(),s=function(t,e,n,r){let[i,o,s,a]=function(t,e,n){const r=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const n=Ji(t,e);return(n-n%7)/7}],["days",Ji]],i={},o=t;let s,a;for(const[c,u]of r)n.indexOf(c)>=0&&(s=c,i[c]=u(t,e),a=o.plus(i),a>e?(i[c]--,(t=o.plus(i))>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}(t,e,n);const c=e-i,u=n.filter(t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0);0===u.length&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const l=Ui.fromObject(o,r);return u.length>0?Ui.fromMillis(c,r).shiftTo(...u).plus(l):l}(o?this:t,o?t:this,i,r);var a;return o?s.negate():s}diffNow(t="milliseconds",e={}){return this.diff(zo.now(),t,e)}until(t){return this.isValid?Gi.fromDateTimes(this,t):this}hasSame(t,e,n){if(!this.isValid)return!1;const r=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(e,n)<=r&&r<=i.endOf(e,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||zo.fromObject({},{zone:this.zone}),n=t.padding?this<e?-t.padding:t.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=t.unit;return Array.isArray(t.unit)&&(r=t.unit,i=void 0),Po(e,this.plus(n),{...t,numeric:"always",units:r,unit:i})}toRelativeCalendar(t={}){return this.isValid?Po(t.base||zo.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(zo.isDateTime))throw new Ie("min requires all arguments be DateTimes");return lr(t,t=>t.valueOf(),Math.min)}static max(...t){if(!t.every(zo.isDateTime))throw new Ie("max requires all arguments be DateTimes");return lr(t,t=>t.valueOf(),Math.max)}static fromFormatExplain(t,e,n={}){const{locale:r=null,numberingSystem:i=null}=n;return co($n.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,n={}){return zo.fromFormatExplain(t,e,n)}static buildFormatParser(t,e={}){const{locale:n=null,numberingSystem:r=null}=e,i=$n.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new ao(i,t)}static fromFormatParser(t,e,n={}){if(or(t)||or(e))throw new Ie("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=$n.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(e.locale))throw new Ie(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${e.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:u}=e.explainFromTokens(t);return u?zo.invalid(u):xo(s,a,n,`format ${e.format}`,t,c)}static get DATE_SHORT(){return Re}static get DATE_MED(){return je}static get DATE_MED_WITH_WEEKDAY(){return Ae}static get DATE_FULL(){return ze}static get DATE_HUGE(){return Fe}static get TIME_SIMPLE(){return We}static get TIME_WITH_SECONDS(){return Le}static get TIME_WITH_SHORT_OFFSET(){return qe}static get TIME_WITH_LONG_OFFSET(){return Be}static get TIME_24_SIMPLE(){return He}static get TIME_24_WITH_SECONDS(){return Ue}static get TIME_24_WITH_SHORT_OFFSET(){return Ze}static get TIME_24_WITH_LONG_OFFSET(){return Ge}static get DATETIME_SHORT(){return Ye}static get DATETIME_SHORT_WITH_SECONDS(){return Je}static get DATETIME_MED(){return Ve}static get DATETIME_MED_WITH_SECONDS(){return Qe}static get DATETIME_MED_WITH_WEEKDAY(){return Xe}static get DATETIME_FULL(){return Ke}static get DATETIME_FULL_WITH_SECONDS(){return tn}static get DATETIME_HUGE(){return en}static get DATETIME_HUGE_WITH_SECONDS(){return nn}}function Fo(t){if(zo.isDateTime(t))return t;if(t&&t.valueOf&&sr(t.valueOf()))return zo.fromJSDate(t);if(t&&"object"==typeof t)return zo.fromObject(t);throw new Ie(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function Wo({title:t,description:e,children:n,noSubscription:r,hideHeader:i}){return Mt("div",{className:he.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:ae.colors.accent}),children:Mt("div",{className:he.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Mt("div",{className:he.create("page-heading-wrapper",{width:"100%",marginBottom:ae.spacing.lg}),children:Mt(be,{children:Mt("div",{className:he.create("page-heading-container",{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,borderRadius:ae.radius.large,padding:`${ae.spacing.lg} ${ae.spacing.xl}`,boxShadow:ae.shadow.md}),children:Mt("div",{className:he.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ae.spacing.lg}),children:Mt("div",{className:he.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Mt("h1",{className:he.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ae.colors.primaryForeground,letterSpacing:"-0.025em"}),children:t}),e&&Mt("p",{className:he.create("page-template-description",{margin:"0",marginTop:ae.spacing.sm,fontSize:ae.fontSize.small,lineHeight:"1.5",color:ae.colors.primaryForeground,opacity:"0.85"}),children:e})]})})})})}),n]})})}function Lo({className:t,children:e}){const n=he.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Mt("div",{className:ve(n,t),children:e})}function qo({message:t}){return Mt(Wo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Mt(be,{children:Mt(Lo,{className:he.name("loading-container"),children:Mt(we,{size:"large"})})})})}function Bo({variant:t="primary",type:e="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,boxShadow:ae.shadow.sm},outline:{border:`${ae.borderWidth} solid ${ae.colors.primary}`,backgroundColor:ae.colors.card,color:ae.colors.primary,boxShadow:ae.shadow.sm}},u=he.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:ae.radius.default,cursor:"pointer",fontSize:ae.fontSize.default,fontWeight:"500",transition:ae.transition,fontFamily:ae.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});he.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),he.pseudoElement(`button-${t}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:ae.shadow.md}),he.pseudoElement(`button-${t}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:ae.shadow.sm});const l=he.create(`button-${t}`,{...c[t]});return Mt("button",{type:e,className:ve(u,l,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Mt(we,{size:"small"}),o]})}function Ho({error:t}){he.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:ae.colors.background,textAlign:"center"});const e=he.create("error-fallback-icon",{width:"4rem",height:"4rem",color:ae.colors.destructive,marginBottom:"1.5rem"}),n=he.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:ae.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});he.create("error-fallback-message",{fontSize:ae.fontSize.large,color:ae.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=he.create("error-fallback-details",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,backgroundColor:ae.colors.muted,padding:"1rem",borderRadius:ae.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=he.create("error-fallback-support",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=he.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=t||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return Mt(Wo,{title:s.title,description:s.message,noSubscription:!0,children:Mt(be,{children:Mt(Lo,{className:he.name("loading-container"),children:[Mt(()=>Mt("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}),{}),Mt("h1",{className:n,children:s.title}),s.details&&Mt("div",{className:r,children:[Mt("strong",{children:"Error Details:"}),Mt("br",{}),s.details,s.statusCode&&Mt(S,{children:[Mt("br",{}),Mt("strong",{children:"Status Code:"})," ",s.statusCode]})]}),Mt("p",{className:i,children:mt(s)}),Mt("div",{className:o,children:Mt(Bo,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function Uo({message:t,estimatedTime:e}){const n=he.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=he.create("maintenance-icon",{width:"4rem",height:"4rem",color:ae.colors.primary,marginBottom:"1.5rem"}),i=he.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:ae.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=he.create("maintenance-message",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=he.create("maintenance-info-box",{backgroundColor:ae.colors.muted,borderRadius:ae.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=he.create("maintenance-info-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,marginBottom:"0.5rem"}),c=he.create("maintenance-info-text",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.4"}),u=he.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Mt(Wo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Mt(be,{children:Mt(Lo,{children:Mt("div",{className:n,children:[Mt(()=>Mt("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:Mt("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"})}),{}),Mt("h1",{className:i,children:"We'll be right back"}),Mt("p",{className:o,children:t||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Mt("div",{className:s,children:[Mt("p",{className:a,children:"What's happening?"}),Mt("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),e&&Mt("p",{className:c,style:{marginTop:"0.5rem"},children:[Mt("strong",{children:"Estimated time:"})," ",e]})]}),Mt("div",{className:u,children:Mt(Bo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Zo({children:t}){return Mt("div",{className:he.create("column",{display:"flex",flexDirection:"column",alignItems:"start",gap:"2rem"}),children:t})}function Go({size:t="default",style:e="normal",className:n,children:r}){const i=he.create("text",{marginTop:"0",marginBottom:"0"}),o=he.create("text-small",{fontSize:ae.fontSize.small}),s=he.create("text-default",{fontSize:ae.fontSize.default}),a=he.create("text-italic",{fontStyle:"italic"}),c=he.create("text-bold",{fontWeight:"bold"}),u=he.create("text-underline",{textDecoration:"underline"}),l=ve({[a]:"italic"===e,[c]:"bold"===e,[u]:"underline"===e}),d=ve({[o]:"small"===t,[s]:"default"===t});return Mt("p",{className:ve(i,d,l,n),children:r})}function Yo({title:t,description:e}){return Mt("div",{className:he.create("section-header",{}),children:[Mt("p",{className:he.create("section-title",{fontSize:ae.fontSize.large,margin:"0",color:ae.colors.foreground}),children:t}),e&&Mt(Go,{className:he.create("section-description",{color:ae.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 Jo({selected:t}){return Mt("div",{className:ve(he.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${ae.borderWidth} solid transparent`}),t?he.create("selected-indicator-selected",{backgroundColor:ae.colors.primary}):he.create("selected-indicator-unselected",{border:`${ae.borderWidth} solid ${ae.colors.border}`}))})}function Vo({excessOptions:t,selectedExcessId:e,onExcessSelect:n}){const r=[...t].sort((t,e)=>t.excess_amount-e.excess_amount);return Mt("div",{className:he.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Mt(Yo,{title:"Excess Options"}),Mt("div",{className:he.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(t=>{const r=t.id===e;return Mt("div",{className:ve(he.create("excess-option-card",{borderRadius:ae.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?he.create("excess-option-card-selected",{border:`2px solid ${ae.colors.primary}`,backgroundColor:ae.colors.accent}):he.create("excess-option-card-unselected",{border:`2px solid ${ae.colors.border}`,backgroundColor:ae.colors.card})),onClick:()=>n(t.id),children:[Mt(Jo,{selected:r}),Mt("div",{className:he.create("excess-amount",{color:ae.colors.foreground}),children:["$",Number(t.excess_amount).toFixed(0)]})]},t.id)})})]})}function Qo(t,e="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}function Xo(t){switch(t){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)} Installments`}}function Ko({paymentOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=Jt(()=>{if(!n)return[];const r=t.filter(t=>t.excess_id===n&&t.amount.success).map(t=>{const n=e.find(e=>e.id===t.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${t.gateway_id}`);return{...t,gateway:n}});return r.sort((t,e)=>("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0)-("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0))},[t,e,n]);return n?Mt(ts,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Mt("div",{className:he.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Mt(ts,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function ts({sortedOptions:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=t.length>0;return Mt("div",{className:he.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Mt(Yo,{title:"Payment Options"}),Mt("div",r?{className:he.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:t.map(t=>Mt(es,{option:t,selectedPaymentOption:e,onPaymentSelect:n},`${t.gateway_id}-${t.excess_id}`))}:{className:he.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${ae.colors.border}`,borderRadius:ae.radius.default,backgroundColor:ae.colors.muted}),children:Mt(Go,{className:he.create("placeholder-text",{color:ae.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function es({option:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=(null==e?void 0:e.gateway_id)===t.gateway_id&&(null==e?void 0:e.excess_id)===t.excess_id;return Mt("div",{className:ve(he.create("payment-option-row",{borderRadius:ae.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?he.create("payment-option-row-selected",{border:`2px solid ${ae.colors.primary}`,backgroundColor:ae.colors.accent}):he.create("payment-option-row-unselected",{border:`2px solid ${ae.colors.border}`,backgroundColor:ae.colors.card})),onClick:()=>n(t),children:[Mt(Jo,{selected:r}),Mt("div",{className:he.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[Mt("div",{className:he.create("frequency-title",{fontSize:ae.fontSize.default,fontWeight:"500",color:ae.colors.foreground}),children:Xo(t.amount.frequency)}),Mt("div",{className:he.create("gateway-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground}),children:["via ",t.gateway.name]})]}),Mt("div",{className:he.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[Mt(Go,{className:he.create("amount-text",{textAlign:"right"}),children:"one-time"===t.amount.frequency?Qo(t.amount.dueToday):`${Qo(t.amount.installmentAmount||0)} x ${t.amount.numberOfInstallments}`}),Mt(Go,{size:"small",className:he.create("gateway-fee-text",{textAlign:"right",color:ae.colors.mutedForeground}),children:[Qo(t.amount.gatewayFee)," fee"]})]})]})}function ns({label:t,value:e,isTotal:n=!1,className:r}){return Mt("div",{className:ve(he.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Mt("span",{className:he.create("summary-label",{color:ae.colors.mutedForeground,fontSize:ae.fontSize.small}),children:t}),Mt("span",{className:he.create("summary-value",{fontWeight:n?"600":"500",color:ae.colors.foreground,fontSize:n?ae.fontSize.large:"inherit"}),children:e})]})}function rs({excessOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o}){const s=Jt(()=>n?t.find(t=>t.id===n):null,[t,n]),a=Jt(()=>r?e.find(t=>t.id===r.gateway_id):null,[e,r]);return Mt("div",{className:he.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Mt(Yo,{title:"Payment Summary"}),Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Excess Amount"}),s?Mt(ns,{label:`$${Number(s.excess_amount).toFixed(0)} excess`,value:Qo(s.premium_total)}):Mt(Go,{className:he.create("summary-placeholder",{color:ae.colors.mutedForeground,margin:"0",fontSize:ae.fontSize.small}),children:"No excess selected"})]}),Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Payment Method"}),r&&a?Mt("div",{className:he.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:Mt("div",{className:he.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[Mt("span",{className:he.create("gateway-name",{fontWeight:"500",color:ae.colors.foreground}),children:Xo(r.amount.frequency)}),Mt("span",{className:he.create("gateway-provider",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground}),children:["via ",a.name]})]})}):Mt(Go,{className:he.create("summary-placeholder",{color:ae.colors.mutedForeground,margin:"0",fontSize:ae.fontSize.small}),children:"No payment method selected"})]}),r&&Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Payment Details"}),Mt("div",{className:he.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Mt(S,{children:[Mt(ns,{label:"Total Due Today:",value:Qo(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Mt(ns,{label:"Gateway Fee:",value:Qo(r.amount.gatewayFee)})]}):Mt(S,{children:[Mt(ns,{label:"Due Today:",value:Qo(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Mt(ns,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:Qo(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Mt(ns,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Mt(S,{children:Mt(ns,{label:"Total Payable:",value:Qo(r.amount.totalRepayable),className:he.create("total-item",{})})})]})})]}),Mt(Bo,{onClick:i,disabled:!o,className:he.create("purchase-button",{width:"100%",height:"3rem",fontSize:ae.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function is({isOpen:t,onClose:e,onSuccess:n,onError:r,paymentRequest:i}){const{fsm:o}=ke(()=>({})),[s,a]=Zt("initiating"),[c,u]=Zt(null),[l,d]=Zt(null),[h,f]=Zt(null);Gt(()=>{t&&i&&m()},[t,i]);const m=async()=>{if(i)try{a("initiating"),u(null);const t={...i,returnUrl:window.location.href},e=await o.initiatePayment(t);f(e.transaction_id),a("redirecting"),window.location.href=e.gateway_acceptance_url}catch(t){u(t.message||"Failed to initiate payment"),a("failed")}},p=()=>{l&&!l.closed&&l.close(),a("initiating"),u(null),f(null),d(null),e()};return t?Mt("div",{className:he.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:[Mt("div",{className:he.create("modal-content",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Mt("div",{className:he.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(s){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Mt("h2",{className:he.create("modal-title",{margin:"0",color:ae.colors.foreground,fontSize:ae.fontSize.large}),children:"Payment Processing"})]}),Mt("div",{className:he.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Mt(Go,{className:he.create("status-message",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(s){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"}})()}),c&&Mt(Go,{className:he.create("error-message",{color:ae.colors.destructive,fontSize:ae.fontSize.small,padding:"0.75rem",backgroundColor:ae.colors.destructive+"10",borderRadius:ae.radius.default,border:`1px solid ${ae.colors.destructive}30`}),children:c}),("redirecting"===s||"initiating"===s)&&Mt("div",{className:he.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ae.colors.border}`,borderTop:`3px solid ${ae.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Mt("div",{className:he.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===s||"cancelled"===s?Mt(S,{children:[Mt(Bo,{onClick:p,variant:"outline",children:"Close"}),"cancelled"===s&&Mt(Bo,{onClick:()=>{a("initiating"),u(null),m()},children:"Try Again"})]}):Mt(Bo,"completed"===s?{onClick:p,children:"Continue"}:{onClick:p,variant:"outline",disabled:"initiating"===s,children:"Cancel"})})]}),Mt("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function os({type:t,transactionId:e,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(t){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Mt("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:ae.colors.primary||"#10b981"},children:Mt("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:Mt("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:ae.colors.destructive},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"m15 9-6 6"}),Mt("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:Mt("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:ae.colors.secondary},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"m15 9-6 6"}),Mt("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:Mt("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:ae.colors.destructive},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"M12 8v4"}),Mt("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=he.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=he.create("modal-content",{backgroundColor:ae.colors.background,borderRadius:ae.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${ae.borderWidth} solid ${ae.colors.border}`}),a=he.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=he.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:ae.colors.foreground,margin:"0"}),u=he.create("modal-message",{color:ae.colors.foreground,lineHeight:"1.5",margin:"0"});he.create("transaction-info",{backgroundColor:ae.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:ae.radius.small,border:`${ae.borderWidth} solid ${ae.colors.border}`,fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,wordBreak:"break-all"});const l=he.create("modal-button",{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,border:"none",borderRadius:ae.radius.default,padding:"0.75rem 1.5rem",fontSize:ae.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=he.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Mt("div",{className:o,onClick:r,children:Mt("div",{className:s,onClick:t=>t.stopPropagation(),children:Mt("div",{className:a,children:[i.icon,Mt("div",{className:d,children:[Mt("h2",{className:c,children:i.title}),Mt("p",{className:u,children:i.message})]}),Mt("button",{className:l,onClick:r,children:i.buttonText})]})})})}function ss({results:t}){const{fsm:e,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i}=ke(t=>({selectedExcessId:t.getSelectedExcessId(),selectedPaymentOption:t.getSelectedPaymentOption(),quoteIntent:t.getQuoteIntent()})),[o,s]=Zt(!1),[a,c]=Zt(null),u=t.calculations,l=t.payment_options,d=t.payment_gateways;Gt(()=>{const t=u.find(t=>t.id===n);if(t&&i){const n=l.some(t=>"monthly"===t.amount.frequency),r=e.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);St(i,t,l.length,n,o)}},[]);const h=Boolean(n&&r),f=null==i?void 0:i.payment_return,m=f&&("declined"===f.paymentStatus||"cancelled"===f.paymentStatus||"error"===f.paymentStatus);return he.media("(max-width: 767px)",{"checkout-sidebar":{display:"none"}}),he.media("(min-width: 768px)",{"checkout-actions-mobile":{display:"none"}}),Mt(Wo,{title:"Checkout",description:"Complete your insurance purchase",children:Mt("div",{children:[Mt("div",{className:he.create("checkout-container",{display:"flex",flexDirection:"row",gap:"2rem",width:"100%",alignItems:"flex-start"},{"(max-width: 700px)":{flexDirection:"column"}}),children:[Mt("div",{className:he.create("checkout-main",{flex:"1",minWidth:"0"}),children:Mt(Zo,{children:[Mt(Vo,{excessOptions:u,selectedExcessId:n,onExcessSelect:t=>e.setSelectedExcessId(t)}),Mt(Ko,{paymentOptions:l,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:t=>e.setSelectedPaymentOption(t)})]})}),Mt("div",{className:he.create("checkout-sidebar",{width:"300px",flexShrink:"0",position:"sticky",display:"flex",flexDirection:"column",top:"2rem",height:"100%"},{"(max-width: 700px)":{position:"static",width:"100%"}}),children:Mt(rs,{excessOptions:u,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPurchase:()=>{if(!n||!r)return void alert("Please select both an excess amount and payment option");const e={quoteIntentId:t.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};c(e),s(!0)},canPurchase:h})})]}),m&&Mt(os,{type:f.paymentStatus,transactionId:f.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{e.updateQuoteIntent({payment_return:void 0})}}),Mt(is,{isOpen:o,onClose:()=>{s(!1),c(null)},onSuccess:()=>{s(!1),c(null),alert("Payment completed successfully!")},onError:t=>{alert("Payment failed: "+t)},paymentRequest:a})]})})}function as({results:t}){var e,n,r;const{quoteIntent:i}=ke(t=>({quoteIntent:t.getQuoteIntent()})),o=null===(e=null==i?void 0:i.organisation)||void 0===e?void 0:e.admin_email,s=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,a=he.create("referral-container",{display:"flex",flexDirection:"column",alignItems:"center",maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),c=he.create("referral-icon",{width:"4rem",height:"4rem",color:ae.colors.primary,marginBottom:"1.5rem"}),u=he.create("referral-title",{fontSize:"1.875rem",fontWeight:"bold",color:ae.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),l=he.create("referral-subtitle",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"1rem",lineHeight:"1.5"});he.create("referral-reason-box",{backgroundColor:ae.colors.primary+"20",border:`1px solid ${ae.colors.primary}40`,borderRadius:ae.radius.default,padding:"1rem",marginBottom:"1.5rem",textAlign:"left"}),he.create("referral-reason-title",{fontSize:ae.fontSize.small,fontWeight:"600",color:ae.colors.foreground,marginBottom:"0.5rem"}),he.create("referral-reason-text",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.4"});const d=he.create("referral-process-box",{backgroundColor:ae.colors.muted,borderRadius:ae.radius.default,padding:"1rem",marginBottom:"3rem",marginTop:"3rem",textAlign:"left"}),h=he.create("referral-process-title",{fontSize:ae.fontSize.large,fontWeight:"600",color:ae.colors.foreground,marginBottom:"0.75rem",marginTop:"0.25rem"}),f=he.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0"}),m=he.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.4",marginBottom:"0.5rem"}),p=he.create("referral-bullet",{width:"0.5rem",height:"0.5rem",backgroundColor:ae.colors.primary,borderRadius:"50%",marginRight:"0.75rem",marginTop:"0.5rem",flexShrink:"0"}),g=he.create("referral-contact-text",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,marginBottom:"1rem"});he.create("referral-contact-box",{backgroundColor:ae.colors.muted,borderRadius:ae.radius.default,padding:"1.5rem",marginBottom:"2rem",textAlign:"left"}),he.create("referral-contact-box-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,marginBottom:"1rem"}),he.create("referral-contact-item",{display:"flex",alignItems:"center",fontSize:ae.fontSize.small,color:ae.colors.foreground,marginBottom:"0.75rem"}),he.create("referral-contact-label",{fontWeight:"600",marginRight:"0.5rem",minWidth:"4rem"}),he.create("referral-contact-value",{color:ae.colors.mutedForeground});const y=he.create("referral-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center",marginBottom:"2rem"}),v=he.create("referral-reference",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,borderTop:`1px solid ${ae.colors.border}`,paddingTop:"1rem"});return Mt(Wo,{title:"Quote Under Review",description:"We'll get back to you",children:Mt(be,{children:Mt(Lo,{children:Mt("div",{className:a,children:[Mt(()=>Mt("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:c,children:[Mt("path",{d:"M7 10v12"}),Mt("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"})]}),{}),Mt("h1",{className:u,children:"Thank you for your submission"}),Mt("p",{className:l,children:"Our team is reviewing your quote request."}),Mt("div",{className:d,children:[Mt("h3",{className:h,children:"What happens next?"}),Mt("ul",{className:f,children:[Mt("li",{className:m,children:[Mt("span",{className:p}),"Our team will review your application within 1-2 business days"]}),Mt("li",{className:m,children:[Mt("span",{className:p}),"We'll contact you with either approval or additional requirements"]}),Mt("li",{className:m,children:[Mt("span",{className:p}),"If approved, we'll provide you with payment options to complete your purchase"]})]})]}),Mt("p",{className:g,children:"Need to speak with someone about your quote?"}),Mt("div",{className:y,children:[s&&Mt(Bo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:"Call Us"}),o&&Mt(Bo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:"Email Us"})]}),(null===(r=t.quote_intent)||void 0===r?void 0:r.id)&&Mt("div",{className:v,children:["Quote Reference: ",t.quote_intent.id.slice(0,8).toUpperCase()]})]})})})})}function cs({results:t}){return"referral"===t.outcome_type?Mt(as,{results:t}):Mt(ss,{results:t})}function us({value:t,onChange:e,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:u="$"}){const l=Yt(null),[d,h]=Zt("");function f(t){if(!t)return"";const e=t.replace(/[^\d.]/g,"");if(!e)return"";const n=e.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}Gt(()=>{h(null!=t&&""!==t?f(t):"")},[t]);const m=he.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=he.create("money-input-prefix",{position:"absolute",left:"1rem",color:ae.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=he.create("money-input-with-prefix",{paddingLeft:u?"2rem":"1rem"});return Mt("div",{className:m,children:[u&&Mt("span",{className:p,children:u}),Mt("input",{ref:l,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(t){const n=t.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=f(o);h(s),e(o),requestAnimationFrame(()=>{if(l.current){const t=function(t,e,n){let r=n+(e.length-t.length);return r=Math.max(0,Math.min(r,e.length)),r}(i,s,r);l.current.setSelectionRange(t,t)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:ve(a,u&&g)})]})}function ls(t){var e,n,r,i;const o=he.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,fontSize:ae.fontSize.default,backgroundColor:ae.colors.card,color:ae.colors.foreground,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none"});he.pseudoElement("input",":focus",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const s=he.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${ae.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:ae.fontSize.default,backgroundColor:"transparent",color:ae.colors.foreground}),a=he.create("select-wrapper",{border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,backgroundColor:ae.colors.card,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none",overflow:"hidden"});he.pseudoElement("select-wrapper",":focus-within",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const{onChange:c,className:u,validation:l,errors:d,...h}=t;function f(t){c(t.currentTarget.value)}function m(t){c(t.currentTarget.value)}if("select"===t.type)return Mt("div",{className:a,children:Mt("select",{...h,onChange:f,className:s,children:[Mt("option",{value:"",children:"Select an option"}),null===(n=null===(e=t.validation)||void 0===e?void 0:e.options)||void 0===n?void 0:n.map(t=>Mt("option",{value:t.value,children:t.label},t.value))]})});if("date"===t.type)return Mt("input",{...h,type:"date",min:null===(r=t.validation)||void 0===r?void 0:r.minDate,max:null===(i=t.validation)||void 0===i?void 0:i.maxDate,onInput:m,onChange:f,className:ve(o,u)});if("monthyear"===t.type){function p(t){const e=t.currentTarget.value;c(e?`${e}-01`:"")}const g=t.value?t.value.substring(0,7):"";return Mt("input",{...h,type:"month",value:g,onInput:p,onChange:p,className:ve(o,u)})}if("year"===t.type){const y=(new Date).getFullYear();return Mt("input",{...h,type:"number",min:y-100,max:y,placeholder:"YYYY",onInput:m,onChange:f,className:ve(o,u)})}if("money"===t.type)return Mt(us,{value:t.value,onChange:c,name:t.name,id:t.id,placeholder:t.placeholder,required:t.required,disabled:t.disabled,className:ve(o,u),hasError:t.hasError});if("checkbox"===t.type){const v=!0===t.value||"true"===t.value||"true"===t.value,w=he.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),b=he.create("checkbox-"+(v?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${v?ae.colors.primary:t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:v?ae.colors.primary:ae.colors.card,transition:ae.transition,position:"absolute"});function x(t){t.preventDefault(),c(v?"false":"true")}return he.pseudoElement("checkbox-"+(v?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px ${ae.colors.ring}20`}),Mt("div",{className:w,children:[Mt("input",{type:"checkbox",id:t.id,name:t.name,checked:v,onClick:x,className:ve(b,u),required:t.required,readOnly:!0}),v&&Mt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:ae.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Mt("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===t.type){const S=he.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),k=he.create("boolean-radio-group",{display:"flex",gap:"1rem"}),_=he.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),$=he.create("boolean-radio",{accentColor:ae.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),N=he.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,fontSize:ae.fontSize.default,backgroundColor:ae.colors.card,color:ae.colors.foreground,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none",resize:"vertical",fontFamily:ae.fontFamily});he.pseudoElement("boolean-textarea",":focus",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const E=!0===t.value||"true"===t.value,T=!1===t.value||"false"===t.value,C=t.answer||"",I=t.booleanConfig,M=(null==I?void 0:I.enable_details_textbox)&&("yes"===I.show_details_on&&E||"no"===I.show_details_on&&T);function D(e){c(e),(!(null==I?void 0:I.enable_details_textbox)||!("yes"===I.show_details_on&&"true"===e||"no"===I.show_details_on&&"false"===e))&&t.onAnswerChange&&t.onAnswerChange("")}return Mt("div",{className:ve(S,u),children:[Mt("div",{className:k,children:[Mt("label",{className:_,children:[Mt("input",{type:"radio",name:t.name,checked:E,onChange:()=>D("true"),className:$}),Mt("span",{children:"Yes"})]}),Mt("label",{className:_,children:[Mt("input",{type:"radio",name:t.name,checked:T,onChange:()=>D("false"),className:$}),Mt("span",{children:"No"})]})]}),M&&Mt("textarea",{placeholder:(null==I?void 0:I.details_placeholder)||"Please provide details",value:C,required:!0,onInput:e=>{return n=e.target.value,void(t.onAnswerChange&&t.onAnswerChange(n));var n},className:N})]})}return Mt("input",{...h,onInput:m,onChange:f,className:ve(o,u)})}function ds({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,lastUpdated:i,isSaving:o}=ke(t=>{var e,n;return{lastUpdated:null!==(n=null===(e=t.getFormProgress())||void 0===e?void 0:e.last_updated)&&void 0!==n?n:null,isSaving:t.getIsSaving()}}),s=Yt(null),a=Yt(null);Gt(()=>{if(s.current&&a.current){const t=a.current,e=s.current,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]);const c=Math.round((e+1)/t.length*100);return Mt("div",{className:he.create("sidebar-navigation",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.lg,boxShadow:ae.shadow.sm,position:"sticky",top:ae.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:ae.spacing.lg}),children:[Mt("div",{className:he.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:ae.spacing.sm}),children:[Mt("span",{className:he.create("sidebar-progress-text",{fontSize:ae.fontSize.small,fontWeight:"600",color:ae.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Mt("div",{className:he.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ae.colors.muted,borderRadius:ae.radius.small,overflow:"hidden"}),children:Mt("div",{className:he.create("sidebar-progress-fill",{height:"100%",backgroundColor:ae.colors.primary,borderRadius:ae.radius.small,transition:ae.transition,width:`${c}%`})})})]}),Mt("hr",{className:he.create("sidebar-divider",{borderColor:ae.colors.border})}),Mt("nav",{ref:a,className:he.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:ae.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:ae.spacing.sm}),children:t.map((t,i)=>{const a=i===e,c=n.includes(i),u=r.canNavigateToPage(i),l=he.create(`sidebar-nav-item-${i}`,{display:"flex",alignItems:"flex-start",gap:ae.spacing.sm,padding:`${ae.spacing.sm} ${ae.spacing.sm}`,borderRadius:ae.radius.default,border:"none",backgroundColor:a?ae.colors.accent:"transparent",color:a?ae.colors.accentForeground:ae.colors.foreground,cursor:u&&!o?"pointer":"not-allowed",transition:ae.transition,textAlign:"left",width:"100%",fontFamily:ae.fontFamily,fontSize:ae.fontSize.small,opacity:u&&!o?"1":"0.5"});return u&&!a&&he.pseudoElement(`sidebar-nav-item-${i}`,":hover",{backgroundColor:ae.colors.muted}),Mt("button",{ref:a?s:null,onClick:()=>{return t=i,void(r.canNavigateToPage(t)&&r.navigateToPage(t));var t},disabled:!u||o,className:l,children:[Mt("div",{className:he.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?ae.colors.primary:a?ae.colors.accentForeground:ae.colors.muted,color:c?ae.colors.primaryForeground:a?ae.colors.accent:ae.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Mt("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:Mt("path",{d:"M20 6 9 17l-5-5"})}):i+1}),Mt("div",{className:he.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:[Mt("span",{className:he.create("sidebar-page-title",{fontWeight:a?"600":"500",fontSize:"0.875rem",lineHeight:"1.4",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.title}),t.description&&Mt("span",{className:he.create("sidebar-page-description",{fontSize:"0.75rem",opacity:"0.7",lineHeight:"1.3",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.description})]})]},t.id)})}),Mt("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&r.reset()},className:he.create("sidebar-reset-button",{padding:`${ae.spacing.sm} ${ae.spacing.md}`,border:`${ae.borderWidth} solid ${ae.colors.border}`,borderRadius:ae.radius.default,backgroundColor:"transparent",color:ae.colors.mutedForeground,fontSize:ae.fontSize.small,fontFamily:ae.fontFamily,cursor:"pointer",transition:ae.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),i&&Mt("div",{className:he.create("sidebar-last-saved",{fontSize:"0.6875rem",color:ae.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",zo.fromJSDate(new Date(i)).toFormat("T")]})]})}function hs({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,isSaving:i}=ke(t=>({fsm:t,isSaving:t.getIsSaving()})),[o,s]=Zt(!1),a=Math.round((e+1)/t.length*100);return Mt("div",{className:he.create("mobile-sidebar",{overflow:"hidden"}),children:[Mt("button",{onClick:()=>s(!o),className:he.create("mobile-sidebar-header",{width:"100%",padding:ae.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:ae.spacing.sm}),children:[Mt("div",{className:he.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Mt("span",{className:he.create("mobile-sidebar-step-text",{fontSize:ae.fontSize.small,fontWeight:"600",color:ae.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Mt("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:he.create("mobile-sidebar-chevron",{transition:ae.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:ae.colors.mutedForeground}),children:Mt("path",{d:"m6 9 6 6 6-6"})})]}),Mt("div",{className:he.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ae.colors.muted,borderRadius:ae.radius.small,overflow:"hidden"}),children:Mt("div",{className:he.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:ae.colors.primary,borderRadius:ae.radius.small,transition:ae.transition,width:`${a}%`})})})]}),Mt("hr",{className:he.create("mobile-sidebar-border",{borderColor:ae.colors.border})}),o&&Mt("div",{className:he.create("mobile-sidebar-content",{padding:ae.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:t.map((t,o)=>{const a=o===e,c=n.includes(o),u=r.canNavigateToPage(o);return Mt("button",{onClick:()=>{return t=o,void(r.canNavigateToPage(t)&&(r.navigateToPage(t),s(!1)));var t},disabled:!u||i,className:he.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:ae.spacing.sm,padding:ae.spacing.sm,border:"none",borderRadius:ae.radius.default,backgroundColor:a?ae.colors.accent:"transparent",color:a?ae.colors.accentForeground:ae.colors.foreground,cursor:u&&!i?"pointer":"not-allowed",opacity:u&&!i?"1":"0.5",transition:ae.transition,width:"100%",textAlign:"left",fontFamily:ae.fontFamily}),children:[Mt("div",{className:he.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?ae.colors.primary:a?ae.colors.accentForeground:ae.colors.muted,color:c?ae.colors.primaryForeground:a?ae.colors.accent:ae.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Mt("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:Mt("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Mt("span",{className:he.create("mobile-sidebar-page-title",{fontSize:ae.fontSize.small,fontWeight:a?"600":"500"}),children:t.title})]},t.id)})})]})}function fs({organisation:t}){return Mt("div",{className:he.create("welcome-card",{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},{"(max-width: 950px)":{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingTop:ae.spacing.md}}),children:[Mt("h2",{className:he.create("welcome-title",{margin:"0",marginBottom:ae.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:ae.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:ae.spacing.sm}}),children:["Thank you for choosing ",t.name,"."]}),Mt("p",{className:he.create("welcome-text",{margin:"0",fontSize:ae.fontSize.default,lineHeight:"1.6",color:ae.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."}),Mt("hr",{className:he.create("welcome-border",{marginTop:ae.spacing.lg,borderColor:ae.colors.border})})]})}function ms({title:t,description:e}){return Mt(Wo,{title:t,description:e,children:Mt(be,{children:Mt(Lo,{className:he.name("error-container"),children:Mt("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:[Mt("path",{d:"M4.929 4.929 19.07 19.071"}),Mt("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function ps({errors:t,className:e}){return t&&0!==t.length?Mt("div",{className:he.create("field-error",{color:ae.colors.destructive,fontSize:ae.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:t.map((t,e)=>Mt("span",{className:he.create("field-error-message",{lineHeight:"1.4"}),children:t.message},e))}):null}function gs({htmlFor:t,label:e,children:n,required:r,tooltip:i,...o}){const[s,a]=Zt(!1);return Mt("label",{for:t,className:he.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Mt("span",{className:he.create("label-text",{marginBottom:ae.spacing.sm,fontSize:ae.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:ae.spacing.sm,color:ae.colors.foreground}),children:[Mt("span",{children:[e,r&&Mt("span",{className:he.create("label-required-indicator",{color:ae.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Mt("span",{className:he.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Mt("svg",{className:he.create("tooltip-icon",{width:"1rem",height:"1rem",color:ae.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Mt("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Mt("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Mt("span",{className:he.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:ae.colors.popover,color:ae.colors.popoverForeground,fontSize:"0.875rem",borderRadius:ae.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Mt("span",{className:he.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 ${ae.colors.popover}`})})]})]})]}),n]})}function ys(t){switch(null!=t?t:100){case 25:return he.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return he.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return he.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return he.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return he.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return he.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function vs(t){return t?t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,e,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">${e}</a>`:t}):""}function ws({field:t,errors:e,children:n,className:r}){const i=t.code||t.id,o=(null==e?void 0:e.filter(t=>t.field===i))||[],s=he.create("validated-field",{display:"flex",flexDirection:"column",gap:ae.spacing.sm});if("checkbox"===t.type){const e=he.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:ae.spacing.sm}),a=he.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=he.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),u=he.create("checkbox-label-text",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Mt("div",{className:ve(s,ys(t.width),r),children:[Mt("div",{className:e,children:Mt("div",{className:a,children:[Mt("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Mt("label",{htmlFor:i,className:c,children:[Mt("span",{className:u,children:[t.label,t.required&&Mt("span",{className:he.create("checkbox-required-indicator",{color:ae.colors.destructive}),children:"*"})]}),t.description&&Mt("div",{className:he.create("checkbox-field-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:vs(t.description)}})]})]})}),Mt(ps,{errors:o})]})}return Mt("div",{className:ve(s,ys(t.width),r),children:[Mt(gs,{htmlFor:i,label:t.label,required:t.required,tooltip:t.tooltip,children:[t.description&&Mt("div",{className:he.create("field-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,marginBottom:ae.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:vs(t.description)}}),n]}),Mt(ps,{errors:o})]})}function bs({error:t,onDismiss:e,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:ae.colors.secondary+"08",borderColor:ae.colors.secondary+"30",iconColor:ae.colors.secondary,titleColor:ae.colors.foreground},error:{backgroundColor:ae.colors.destructive+"08",borderColor:ae.colors.destructive,iconColor:ae.colors.destructive,titleColor:ae.colors.destructive},critical:{backgroundColor:ae.colors.destructive+"10",borderColor:ae.colors.destructive,iconColor:ae.colors.destructive,titleColor:ae.colors.destructive}}[t.severity],o=he.create("error-card",{padding:ae.spacing.md,borderRadius:ae.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:ae.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=he.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=he.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=he.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),u=he.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),l=he.create("error-card-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=he.create("error-card-message",{fontSize:ae.fontSize.small,color:ae.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=he.create("error-card-details",{fontSize:"0.8125rem",color:ae.colors.mutedForeground,fontFamily:"monospace",backgroundColor:ae.colors.muted,padding:"0.625rem",borderRadius:ae.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=he.create("error-card-support",{fontSize:"0.8125rem",color:ae.colors.mutedForeground,lineHeight:"1.4"}),m=he.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:ae.colors.mutedForeground,cursor:"pointer",borderRadius:ae.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:ae.transition});return he.pseudoElement("error-card-dismiss",":hover",{backgroundColor:ae.colors.muted,color:ae.colors.foreground}),Mt("div",{className:ve(o,n),children:Mt("div",{className:s,children:[Mt(()=>"warning"===t.severity?Mt("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}):Mt("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}),{}),Mt("div",{className:c,children:[Mt("div",{className:u,children:[Mt("div",{className:l,children:t.title}),Mt("div",{className:d,children:t.message}),r&&t.details&&Mt("div",{className:h,children:t.details}),Mt("div",{className:f,children:mt(t)})]}),e&&Mt("button",{className:m,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Mt("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:[Mt("path",{d:"M18 6 6 18"}),Mt("path",{d:"m6 6 12 12"})]})})]})]})})}function xs(t,e){const n=e.operator,r=e.value,i=null==r?"":String(r),o=null==t?"":String(t);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===t||null==t||""===t||""===t.trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function Ss(t,e){const n=e.operator,r=null==e.value?0:Number(e.value),i=null==t?0:Number(t.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===t||null==t||""===t||""===t.toString().trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function ks(t,e){const n=e.operator;switch(e.operator){case"true":return!0===t||"true"===t||1===t;case"false":return!1===t||"false"===t||0===t||void 0===t;case"=":return Boolean(t);case"!=":return!Boolean(t);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function _s(t,e){const n=e.operator,r=e.value,i=null==r?0:Number(e.value);if(null==t||""===t.toString().trim())return"is_empty"===n;const o=t.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}`)}}he.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:ae.colors.muted,borderColor:ae.colors.primary,color:ae.colors.primary});class $s{static create(t){switch(t){case"string":case"text":case"select":return xs;case"numeric":return Ss;case"boolean":return ks;case"date":return _s;default:throw new Error(`Unsupported condition type: ${t}`)}}}function Ns(t,e){const n=e.condition_type||"and";if(!e.conditions||0===e.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:e.conditions.map(e=>{const n={...e,matched:Es(t,e),string:`${e.field} ${e.operator}`};return e.value&&(n.string+=` ${e.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(t=>t.matched)),"or"===n&&(r.matched=r.conditions.some(t=>t.matched)),"not"===n&&(r.matched=r.conditions.every(t=>!t.matched)),r}function Es(t,e){const n=t[e.field],r=$s.create(e.type);if(!r)throw new Error(`Unsupported condition type: ${e.type}`);return r(n,e)}var Ts=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:$s,booleanMatchesCondition:ks,checkSimpleConditions:Ns,dateMatchesCondition:_s,numericMatchesCondition:Ss,textMatchesCondition:xs});function Cs(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=ke(t=>({definition:t.getFormDefinition(),currentPageIndex:t.getCurrentPageIndex(),totalPages:t.getTotalPages(),results:t.getCalculationResult(),validationErrors:t.getValidationErrors(),generalErrors:t.getGeneralErrors(),quoteIntent:t.getQuoteIntent(),isSaving:t.getIsSaving()})),u=e.pages[n];if(!u)return Mt(ms,{title:"Unexpected Error",description:"No page available"});const l=Yt(new Map),d=(t,e)=>{var n;const r=c.getFormProgress().page_data[u.id],i=null==r?void 0:r[t];if(null!=i&&""!==i)return i;if(e&&("date"===e.type||"monthyear"===e.type)&&(null===(n=e.validation)||void 0===n?void 0:n.defaultDate)){const n=h(e.validation.defaultDate,"monthyear"===e.type);if(n)return c.updateFieldValue(u.id,t,n),n}return""},h=(t,e)=>{const n=new Date;let r=new Date;switch(t){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 e?`${i}-${o}-01`:`${i}-${o}-${s}`},f=t=>{const e=c.getFormProgress().page_data[u.id];return((null==e?void 0:e.U)||{})[t]||""},m=c.getFormProgress().page_data[u.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 Mt(Wo,{title:u.title,description:u.description,hideHeader:!0,children:Mt("div",{children:[g&&Mt(os,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Mt(be,{children:Mt("div",{className:he.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:ae.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Mt("div",{className:he.create("form-content-wrapper",{minWidth:"0",backgroundColor:ae.colors.card,boxShadow:ae.shadow.sm,borderRadius:ae.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Mt("div",{className:he.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Mt(hs,{pages:e.pages,currentPageIndex:n,completedPages:y})}),n>0&&Mt("div",{className:he.create("page-heading-container",{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},{"(max-width: 950px)":{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingTop:ae.spacing.md}}),children:[Mt("div",{className:he.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ae.spacing.lg}),children:Mt("div",{className:he.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Mt("h1",{className:he.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ae.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:u.title}),u.description&&Mt("p",{className:he.create("page-template-description",{margin:"0",marginTop:ae.spacing.sm,fontSize:ae.fontSize.small,lineHeight:"1.5",color:ae.colors.foreground,opacity:"0.7"}),children:u.description})]})}),Mt("hr",{className:he.create("page-heading-border",{marginTop:ae.spacing.lg,borderColor:ae.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Mt(fs,{organisation:s.organisation}),o.length>0&&o.map(t=>Mt(bs,{error:t,onDismiss:()=>c.dismissGeneralError(t.id)},t.id)),Mt("div",{className:he.create("form-card",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.lg,boxShadow:ae.shadow.sm,display:"flex",flexDirection:"column",gap:ae.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:ae.spacing.md,gap:ae.spacing.lg},"(max-width: 480px)":{padding:ae.spacing.md,gap:ae.spacing.md}}),children:[Mt("form",{onSubmit:t=>t.preventDefault(),className:he.create("form-fields-container",{flex:"1"}),children:Mt("div",{className:he.create("form-content-page",{display:"grid",gap:ae.spacing.md,rowGap:ae.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:u.fields.map(e=>{const n=e.code||e.id;return(e=>{if(!e.visibility)return!0;const n=Ns(m,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),r="show"===e.visibility.action?n.matched:!n.matched;return l.current.get(e.id)!==r&&(t((e.label,e.code)),t(),l.current.set(e.id,r)),r})(e)?Mt(ws,{field:e,errors:i,children:Mt(ls,{value:d(n,e).toString(),onChange:t=>{let r=t;"boolean"!==e.type&&"checkbox"!==e.type||(r="true"===t),c.updateFieldValue(u.id,n,r)},answer:f(n),onAnswerChange:t=>{c.updateFieldAnswer(u.id,n,t)},id:n,name:n,type:e.type,placeholder:e.placeholder,validation:e.validation,booleanConfig:e.boolean_config,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},e.id):null})})}),Mt("hr",{className:he.create("form-navigation-border",{borderColor:ae.colors.border})}),Mt("div",{className:he.create("form-navigation-inline",{paddingTop:ae.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Mt(Bo,{onClick:()=>c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Mt(Bo,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await c.calculateQuote():await c.navigateToNextPage())},disabled:n>=r-1||a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Mt("div",{className:he.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Mt(ds,{pages:e.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function Is(){var t,e,n;const{quoteIntent:r,fsm:i}=ke(t=>({quoteIntent:t.getQuoteIntent(),fsm:t})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.name,u=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.admin_email,l=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=u||l;Gt(()=>{if(s&&r){const t=null==o?void 0:o.paymentStatus,e=null==a?void 0:a.amount;"success"===t&&a?$t(r,s,e||0,a.gateway_code,e,void 0):t&&["declined","cancelled","error"].includes(t)&&Nt(r,s,e,null==a?void 0:a.gateway_code,t,null==a?void 0:a.status)}const t=setTimeout(()=>{i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(t)},[i,s,o,r]);const h=he.create("referral-reference",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,borderTop:`1px solid ${ae.colors.border}`,marginTop:"1rem",paddingTop:"1rem"}),f=he.create("contact-box",{backgroundColor:ae.colors.muted,borderRadius:ae.radius.default,padding:"1.5rem",marginTop:"2rem",textAlign:"left"}),m=he.create("contact-box-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,marginBottom:"1rem"}),p=he.create("contact-item",{display:"flex",alignItems:"center",fontSize:ae.fontSize.small,color:ae.colors.foreground,marginBottom:"0.75rem"}),g=he.create("contact-label",{fontWeight:"600",marginRight:"0.5rem",minWidth:"4rem"}),y=he.create("contact-value",{color:ae.colors.mutedForeground});return he.create("actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center",marginTop:"1rem"}),Mt(Wo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,children:Mt(be,{children:Mt("div",{className:he.create("payment-success-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"2rem",textAlign:"center",maxWidth:"600px",margin:"0 auto"}),children:[Mt("div",{className:he.create("success-icon",{display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"80px",borderRadius:"50%",backgroundColor:"#10b981",color:"white"}),children:Mt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Mt("path",{d:"M20 6 9 17l-5-5"})})}),Mt("div",{className:he.create("success-content",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Mt(Go,{size:"default",style:"bold",children:"Payment Complete!"}),Mt(Go,{children:["Your payment has been processed successfully and your policy is being setup. You will receive your policy documentation by email.",Mt("br",{}),"For now, you can relax knowing you're ",c?`covered by ${c}`:"covered","."]}),d&&Mt("div",{className:f,children:[Mt("h3",{className:m,children:"If you need to contact us at all:"}),u&&Mt("div",{className:p,children:[Mt("span",{className:g,children:"Email:"}),Mt("span",{className:y,children:u})]}),l&&Mt("div",{className:p,children:[Mt("span",{className:g,children:"Phone:"}),Mt("span",{className:y,children:l})]})]}),Mt("div",{className:h,children:["Quote Reference: ",r.id.slice(0,8).toUpperCase()]})]})]})})})}function Ms(){const{isCalculating:t,results:e,quoteIntent:n}=ke(t=>({isCalculating:t.getIsCalculating(),results:t.getCalculationResult(),quoteIntent:t.getQuoteIntent()})),r="paid"===(null==n?void 0:n.status)||"completed"===(null==n?void 0:n.status);return t?Mt(qo,{message:"Processing your quote, please wait..."}):r?Mt(Is,{}):e?Mt(cs,{results:e}):Mt(Cs,{})}function Ds(t){return Mt(Se,{...t,children:Mt(Ms,{})})}class Os extends k{constructor(t){super(t),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return yd}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(t){}const r=st("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const t=this.state.error;return ft(t)?Mt(Uo,{message:t.message}):Mt(Ho,{error:t})}return this.props.children}}function Ps({config:e,initializeFormContext:n}){const[r,i]=Zt({type:"loading",message:"Loading application..."});return Gt(()=>{(async()=>{try{t();const r=await n(e);if(!r.formStateManager||"function"!=typeof r.formStateManager.getFormProgress)throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:r})}catch(e){let n;t(),n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?st("maintenance",e):st("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[e,n]),Mt(Os,{children:Mt("div",{className:he.create("root",{fontFamily:ae.fontFamily,backgroundColor:ae.colors.background,minHeight:"100vh",color:ae.colors.foreground}),children:function(){switch(r.type){case"loading":return Mt(qo,{message:r.message});case"error":return ft(r.error)?Mt(Uo,{message:r.error.message}):Mt(Ho,{error:r.error});case"success":return Mt(Ds,{...r.formContextProps});default:return Mt(Ho,{})}}()})})}class Rs{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(e));){const e=`--${s[1]}`,i=s[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return fe}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[t,e]of Object.entries(n.variables))this.variableMapping[t]||(i[t]=e);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(t=>{const e=document.getElementById(t);e&&(e.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(t){return this.loadedThemes.has(t)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}Rs.loadedThemes=new Set,Rs.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"};const js="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,As=globalThis,zs="10.17.0";function Fs(){return Ws(As),As}function Ws(t){const e=t.st=t.st||{};return e.version=e.version||zs,e[zs]=e[zs]||{}}function Ls(t,e,n=As){const r=n.st=n.st||{},i=r[zs]=r[zs]||{};return i[t]||(i[t]=e())}const qs=["debug","info","warn","error","log","assert","trace"],Bs={};function Hs(t){if(!("console"in As))return t();const e=As.console,n={},r=Object.keys(Bs);r.forEach(t=>{const r=Bs[t];n[t]=e[t],e[t]=r});try{return t()}finally{r.forEach(t=>{e[t]=n[t]})}}function Us(){return Gs().enabled}function Zs(t,...e){js&&Us()&&Hs(()=>{As.console[t](`Sentry Logger [${t}]:`,...e)})}function Gs(){return js?Ls("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Ys=function(){Gs().enabled=!0},Js=function(...t){Zs("log",...t)},Vs=function(...t){Zs("warn",...t)},Qs=function(...t){Zs("error",...t)},Xs="?",Ks=/\(error: (.*)\)/,ta=/captureMessage|captureException/;function ea(...t){const e=t.sort((t,e)=>t[0]-e[0]).map(t=>t[1]);return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){let n=o[t];n.length>1024&&(n=n.slice(0,1024));const s=Ks.test(n)?n.replace(Ks,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(na(e).function||"")&&e.pop(),e.reverse(),ta.test(na(e).function||"")&&(e.pop(),ta.test(na(e).function||"")&&e.pop()),e.slice(0,50).map(t=>({...t,filename:t.filename||na(e).filename,function:t.function||Xs}))}(i.slice(r))}}function na(t){return t[t.length-1]||{}}const ra="<anonymous>";function ia(t){try{return t&&"function"==typeof t&&t.name||ra}catch{return ra}}function oa(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach(e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)}),t}catch{return}}}const sa={},aa={};function ca(t,e){sa[t]=sa[t]||[],sa[t].push(e)}function ua(t,e){if(!aa[t]){aa[t]=!0;try{e()}catch(e){js&&Qs(`Error while instrumenting ${t}`,e)}}}function la(t,e){const n=t&&sa[t];if(n)for(const r of n)try{r(e)}catch(e){js&&Qs(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${ia(r)}\nError:`,e)}}let da=null;function ha(){da=As.onerror,As.onerror=function(t,e,n,r,i){return la("error",{column:r,error:i,line:n,msg:t,url:e}),!!da&&da.apply(this,arguments)},As.onerror.ct=!0}let fa=null;function ma(){fa=As.onunhandledrejection,As.onunhandledrejection=function(t){return la("unhandledrejection",t),!fa||fa.apply(this,arguments)},As.onunhandledrejection.ct=!0}const pa={}.toString;function ga(t){switch(pa.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Na(t,Error)}}function ya(t,e){return pa.call(t)===`[object ${e}]`}function va(t){return ya(t,"ErrorEvent")}function wa(t){return ya(t,"DOMError")}function ba(t){return ya(t,"String")}function xa(t){return"object"==typeof t&&null!==t&&"ut"in t&&"lt"in t}function Sa(t){return null===t||xa(t)||"object"!=typeof t&&"function"!=typeof t}function ka(t){return ya(t,"Object")}function _a(t){return"undefined"!=typeof Event&&Na(t,Event)}function $a(t){return Boolean(t?.then&&"function"==typeof t.then)}function Na(t,e){try{return t instanceof e}catch{return!1}}function Ea(t){return!("object"!=typeof t||null===t||!t.ht&&!t.ft)}const Ta=As;function Ca(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let u;const l=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(u=Ia(n,l),!("html"===u||o>1&&s+i.length*c+u.length>=d));)i.push(u),s+=u.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Ia(t,e){const n=t,r=[];if(!n?.tagName)return"";if(Ta.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=e?.length?e.filter(t=>n.getAttribute(t)).map(t=>[t,n.getAttribute(t)]):null;if(i?.length)i.forEach(t=>{r.push(`[${t[0]}="${t[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&ba(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}function Ma(){try{return Ta.document.location.href}catch{return""}}function Da(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function Oa(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{Ea(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Pa(t,e,n=!1){return!!ba(t)&&(ya(e,"RegExp")?e.test(t):!!ba(e)&&(n?t===e:t.includes(e)))}function Ra(t,e=[],n=!1){return e.some(e=>Pa(t,e,n))}function ja(t,e,n){if(!(e in t))return;const r=t[e];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&za(i,r);try{t[e]=i}catch{js&&Js(`Failed to replace method "${e}" in object`,t)}}function Aa(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{js&&Js(`Failed to add non-enumerable property "${e}" to object`,t)}}function za(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Aa(t,"__sentry_original__",e)}catch{}}function Fa(t){return t.gt}function Wa(t){if(ga(t))return{message:t.message,name:t.name,stack:t.stack,...qa(t)};if(_a(t)){const e={type:t.type,target:La(t.target),currentTarget:La(t.currentTarget),...qa(t)};return"undefined"!=typeof CustomEvent&&Na(t,CustomEvent)&&(e.detail=t.detail),e}return t}function La(t){try{return"undefined"!=typeof Element&&Na(t,Element)?Ca(t):{}.toString.call(t)}catch{return"<unknown>"}}function qa(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ba(t=function(){const t=As;return t.crypto||t.msCrypto}()){let e=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(15&e())>>t/4).toString(16))}function Ha(t){return t.exception?.values?.[0]}function Ua(t){const{message:e,event_id:n}=t;if(e)return e;const r=Ha(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Za(t,e){const n=t.exception=t.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Ga(t,e){const n=Ha(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r?.data,...e.data};n.mechanism.data=t}}function Ya(t){if(function(t){try{return t.yt}catch{}}(t))return!0;try{Aa(t,"__sentry_captured__",!0)}catch{}return!1}function Ja(){return Date.now()/1e3}let Va;function Qa(){return(Va??(Va=function(){const{performance:t}=As;if(!t?.now||!t.timeOrigin)return Ja;const e=t.timeOrigin;return()=>(e+t.now())/1e3}()))()}function Xa(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Qa(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Ba()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ka(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)({}).hasOwnProperty.call(e,t)&&(r[t]=Ka(r[t],e[t],n-1));return r}function tc(){return Ba()}function ec(){return Ba().substring(16)}const nc="_sentrySpan";function rc(t,e){e?Aa(t,nc,e):delete t[nc]}function ic(t){return t[nc]}class oc{constructor(){this.vt=!1,this.wt=[],this.bt=[],this.xt=[],this.St=[],this.kt={},this._t={},this.$t={},this.Nt={},this.Et={},this.Tt={traceId:tc(),sampleRand:Math.random()}}clone(){const t=new oc;return t.xt=[...this.xt],t._t={...this._t},t.$t={...this.$t},t.Nt={...this.Nt},this.Nt.flags&&(t.Nt.flags={values:[...this.Nt.flags.values]}),t.kt=this.kt,t.Ct=this.Ct,t.It=this.It,t.Mt=this.Mt,t.Dt=this.Dt,t.bt=[...this.bt],t.St=[...this.St],t.Et={...this.Et},t.Tt={...this.Tt},t.Ot=this.Ot,t.Pt=this.Pt,rc(t,ic(this)),t}setClient(t){this.Ot=t}setLastEventId(t){this.Pt=t}getClient(){return this.Ot}lastEventId(){return this.Pt}addScopeListener(t){this.wt.push(t)}addEventProcessor(t){return this.bt.push(t),this}setUser(t){return this.kt=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.It&&Xa(this.It,{user:t}),this.Rt(),this}getUser(){return this.kt}setTags(t){return this._t={...this._t,...t},this.Rt(),this}setTag(t,e){return this._t={...this._t,[t]:e},this.Rt(),this}setExtras(t){return this.$t={...this.$t,...t},this.Rt(),this}setExtra(t,e){return this.$t={...this.$t,[t]:e},this.Rt(),this}setFingerprint(t){return this.Dt=t,this.Rt(),this}setLevel(t){return this.Ct=t,this.Rt(),this}setTransactionName(t){return this.Mt=t,this.Rt(),this}setContext(t,e){return null===e?delete this.Nt[t]:this.Nt[t]=e,this.Rt(),this}setSession(t){return t?this.It=t:delete this.It,this.Rt(),this}getSession(){return this.It}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,n=e instanceof oc?e.getScopeData():ka(e)?t:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:u}=n||{};return this._t={...this._t,...r},this.$t={...this.$t,...i},this.Nt={...this.Nt,...s},o&&Object.keys(o).length&&(this.kt=o),a&&(this.Ct=a),c.length&&(this.Dt=c),u&&(this.Tt=u),this}clear(){return this.xt=[],this._t={},this.$t={},this.kt={},this.Nt={},this.Ct=void 0,this.Mt=void 0,this.Dt=void 0,this.It=void 0,rc(this,void 0),this.St=[],this.setPropagationContext({traceId:tc(),sampleRand:Math.random()}),this.Rt(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:Ja(),...t,message:t.message?Da(t.message,2048):t.message};return this.xt.push(r),this.xt.length>n&&(this.xt=this.xt.slice(-n),this.Ot?.recordDroppedEvent("buffer_overflow","log_item")),this.Rt(),this}getLastBreadcrumb(){return this.xt[this.xt.length-1]}clearBreadcrumbs(){return this.xt=[],this.Rt(),this}addAttachment(t){return this.St.push(t),this}clearAttachments(){return this.St=[],this}getScopeData(){return{breadcrumbs:this.xt,attachments:this.St,contexts:this.Nt,tags:this._t,extra:this.$t,user:this.kt,level:this.Ct,fingerprint:this.Dt||[],eventProcessors:this.bt,propagationContext:this.Tt,sdkProcessingMetadata:this.Et,transactionName:this.Mt,span:ic(this)}}setSDKProcessingMetadata(t){return this.Et=Ka(this.Et,t,2),this}setPropagationContext(t){return this.Tt=t,this}getPropagationContext(){return this.Tt}captureException(t,e){const n=e?.event_id||Ba();if(!this.Ot)return js&&Vs("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ot.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n?.event_id||Ba();if(!this.Ot)return js&&Vs("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this.Ot.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e?.event_id||Ba();return this.Ot?(this.Ot.captureEvent(t,{...e,event_id:n},this),n):(js&&Vs("No client configured on scope - will not capture event!"),n)}Rt(){this.vt||(this.vt=!0,this.wt.forEach(t=>{t(this)}),this.vt=!1)}}class sc{constructor(t,e){let n,r;n=t||new oc,r=e||new oc,this.jt=[{scope:n}],this.At=r}withScope(t){const e=this.zt();let n;try{n=t(e)}catch(t){throw this.Ft(),t}return $a(n)?n.then(t=>(this.Ft(),t),t=>{throw this.Ft(),t}):(this.Ft(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.At}getStackTop(){return this.jt[this.jt.length-1]}zt(){const t=this.getScope().clone();return this.jt.push({client:this.getClient(),scope:t}),t}Ft(){return!(this.jt.length<=1||!this.jt.pop())}}function ac(){const t=Ws(Fs());return t.stack=t.stack||new sc(Ls("defaultCurrentScope",()=>new oc),Ls("defaultIsolationScope",()=>new oc))}function cc(t){return ac().withScope(t)}function uc(t,e){const n=ac();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function lc(t){return ac().withScope(()=>t(ac().getIsolationScope()))}function dc(t){const e=Ws(t);return e.acs?e.acs:{withIsolationScope:lc,withScope:cc,withSetScope:uc,withSetIsolationScope:(t,e)=>lc(e),getCurrentScope:()=>ac().getScope(),getIsolationScope:()=>ac().getIsolationScope()}}function hc(){return dc(Fs()).getCurrentScope()}function fc(){return dc(Fs()).getIsolationScope()}function mc(...t){const e=dc(Fs());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}function pc(){return hc().getClient()}function gc(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,o={trace_id:n,span_id:i||ec()};return r&&(o.parent_span_id=r),o}const yc="sentry.profile_id",vc="sentry.exclusive_time";function wc(t){if(t){if("object"==typeof t&&"deref"in t&&"function"==typeof t.deref)try{return t.deref()}catch{return}return t}}function bc(t){const e=t;return{scope:e.Wt,isolationScope:wc(e.Lt)}}const xc=/^sentry-/;function Sc(t){return t.split(",").map(t=>t.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((t,[e,n])=>(e&&n&&(t[e]=n),t),{})}const kc=/^o(\d+)\./,_c=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function $c(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Nc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Ec(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=function(t){const e=t.match(kc);return e?.[1]}(n)),r}let Tc=!1;function Cc(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:Oc(t).parent_span_id,o=bc(t).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||ec():e,trace_id:n}}function Ic(t){return t&&t.length>0?t.map(({context:{spanId:t,traceId:e,traceFlags:n,...r},attributes:i})=>({span_id:t,trace_id:e,sampled:1===n,attributes:i,...r})):void 0}function Mc(t){return"number"==typeof t?Dc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Dc(t.getTime()):Qa()}function Dc(t){return t>9999999999?t/1e3:t}function Oc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:Mc(i),timestamp:Mc(s)||void 0,status:Pc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Ic(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Pc(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Rc(t){return t.qt||t}function jc(){Tc||(Hs(()=>{}),Tc=!0)}function Ac(t){Js(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function zc(t,e){if(!e?.length||!t.description)return!1;for(const n of e){if(Wc(n)){if(Pa(t.description,n))return js&&Ac(t),!0;continue}if(!n.name&&!n.op)continue;const e=!n.name||Pa(t.description,n.name),r=!n.op||t.op&&Pa(t.op,n.op);if(e&&r)return js&&Ac(t),!0}return!1}function Fc(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const e of t)e.parent_span_id===r&&(e.parent_span_id=n)}function Wc(t){return"string"==typeof t||t instanceof RegExp}const Lc="production";function qc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||Lc,release:n.release,public_key:r,trace_id:t,org_id:Ec(e)};return e.emit("createDsc",i),i}function Bc(t){const e=pc();if(!e)return{};const n=Rc(t),r=Oc(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(t){return"number"!=typeof s&&"string"!=typeof s||(t.sample_rate=`${s}`),t}const c=n.Bt;if(c)return a(c);const u=o?.get("sentry.dsc"),l=u&&function(t){const e=function(t){if(t&&(ba(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce((t,e)=>{const n=Sc(e);return Object.entries(n).forEach(([e,n])=>{t[e]=n}),t},{}):Sc(t)}(t);if(!e)return;const n=Object.entries(e).reduce((t,[e,n])=>(e.match(xc)&&(t[e.slice(7)]=n),t),{});return Object.keys(n).length>0?n:void 0}(u);if(l)return a(l);const d=qc(t.spanContext().traceId,e),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 t=pc()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(n)),d.sample_rand=o?.get("sentry.sample_rand")??bc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function Hc(t,e=100,n=1/0){try{return Zc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Uc(t,e=3,n=102400){const r=Hc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?Uc(t,e-1,n):r;var i}function Zc(t,e,n=1/0,r=1/0,i=function(){const t=new WeakSet;return[function(e){return!!t.has(e)||(t.add(e),!1)},function(e){t.delete(e)}]}()){const[o,s]=i;if(null==e||["boolean","string"].includes(typeof e)||"number"==typeof e&&Number.isFinite(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.Ht)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(Ea(e))return"[VueViewModel]";if(ka(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&!Number.isFinite(e))return`[${e}]`;if("function"==typeof e)return`[Function: ${ia(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.Ut)return e;const c="number"==typeof e.Zt?e.Zt:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const u=e;if(u&&"function"==typeof u.toJSON)try{return Zc("",u.toJSON(),c-1,r,i)}catch{}const l=Array.isArray(e)?[]:{};let d=0;const h=Wa(e);for(const t in h){if(!{}.hasOwnProperty.call(h,t))continue;if(d>=r){l[t]="[MaxProperties ~]";break}const e=h[t];l[t]=Zc(t,e,c-1,r,i),d++}return s(e),l}function Gc(t,e=[]){return[t,e]}function Yc(t,e){const[n,r]=t;return[n,[...r,e]]}function Jc(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Vc(t){const e=Ws(As);return e.encodePolyfill?e.encodePolyfill(t):(new TextEncoder).encode(t)}function Qc(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Vc(r),t]:r.push("string"==typeof t?Vc(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch{t=JSON.stringify(Hc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function Xc(t){const e="string"==typeof t.data?Vc(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const Kc={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 tu(t){return Kc[t]}function eu(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function nu(t){return new iu(e=>{e(t)})}function ru(t){return new iu((e,n)=>{n(t)})}class iu{constructor(t){this.Gt=0,this.Yt=[],this.Jt(t)}then(t,e){return new iu((n,r)=>{this.Yt.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.Vt()})}catch(t){return this.then(t=>t,t)}finally(t){return new iu((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{i?n(r):e(r)})})}Vt(){if(0===this.Gt)return;const t=this.Yt.slice();this.Yt=[],t.forEach(t=>{t[0]||(1===this.Gt&&t[1](this.Qt),2===this.Gt&&t[2](this.Qt),t[0]=!0)})}Jt(t){const e=(t,e)=>{0===this.Gt&&($a(e)?e.then(n,r):(this.Gt=t,this.Qt=e,this.Vt()))},n=t=>{e(1,t)},r=t=>{e(2,t)};try{t(n,r)}catch(t){r(t)}}}function ou(t,e,n,r=0){try{const i=su(e,n,t,r);return $a(i)?i:nu(i)}catch(t){return ru(t)}}function su(t,e,n,r){const i=n[r];if(!t||!i)return t;const o=i({...t},e);return js&&null===o&&Js(`Event processor "${i.id||"?"}" dropped event`),$a(o)?o.then(t=>su(t,e,n,r+1)):su(o,e,n,r+1)}function au(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:h,transactionName:f,span:m}=e;cu(t,"extra",n),cu(t,"tags",r),cu(t,"user",i),cu(t,"contexts",o),t.sdkProcessingMetadata=Ka(t.sdkProcessingMetadata,a,2),s&&(t.level=s),f&&(t.transactionName=f),m&&(t.span=m),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function cu(t,e,n){t[e]=Ka(t[e],n,1)}let uu,lu,du;function hu(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||Ba(),timestamp:e.timestamp||Ja()},u=n.integrations||t.integrations.map(t=>t.name);!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||n||Lc,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const s=t.request;s?.url&&(s.url=Da(s.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,u),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=function(t){const e=As.Xt;if(!e)return{};const n=Object.keys(e);return du&&n.length===lu||(lu=n.length,du=n.reduce((n,r)=>{uu||(uu={});const i=uu[r];if(i)n[i[0]]=i[1];else{const i=t(r);for(let t=i.length-1;t>=0;t--){const o=i[t],s=o?.filename,a=e[r];if(s&&a){n[s]=a,uu[r]=[s,a];break}}}return n},{})),du}(e);t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.filename&&(t.debug_id=n[t.filename])})})}(c,t.stackParser);const l=function(t,e){if(!e)return t;const n=t?t.clone():new oc;return n.update(e),n}(r,n.captureContext);n.mechanism&&Ga(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Ls("globalScope",()=>new oc).getScopeData();o&&au(h,o.getScopeData()),l&&au(h,l.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(o).length&&(t.contexts={...o,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:Cc(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Bc(e),...t.sdkProcessingMetadata};const n=Oc(Rc(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,h),ou([...d,...h.eventProcessors],c,n).then(t=>(t&&function(t){const e={};if(t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)})}),0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})})}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>({...t,...t.data&&{data:Hc(t.data,e,n)}}))},...t.user&&{user:Hc(t.user,e,n)},...t.contexts&&{contexts:Hc(t.contexts,e,n)},...t.extra&&{extra:Hc(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Hc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(t=>({...t,...t.data&&{data:Hc(t.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Hc(t.contexts.flags,3,n)),r}(t,s,a):t))}function fu(t){return hc().captureException(t,void 0)}function mu(t,e){const n="string"==typeof e?e:void 0,r="string"!=typeof e?{captureContext:e}:void 0;return hc().captureMessage(t,n,r)}function pu(t,e){return hc().captureEvent(t,e)}function gu(t){const e=fc(),n=hc(),{userAgent:r}=As.navigator||{},i=function(t){const e=Qa(),n={sid:Ba(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(n)};return t&&Xa(n,t),n}({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),o=e.getSession();return"ok"===o?.status&&Xa(o,{status:"exited"}),yu(),e.setSession(i),i}function yu(){const t=fc(),e=hc().getSession()||t.getSession();e&&function(t){let e={};"ok"===t.status&&(e={status:"exited"}),Xa(t,e)}(e),vu(),t.setSession()}function vu(){const t=fc(),e=pc(),n=t.getSession();n&&e&&e.captureSession(n)}function wu(t=!1){t?yu():vu()}const bu=[];function xu(t){const e=t.defaultIntegrations||[],n=t.integrations;let r;if(e.forEach(t=>{t.isDefaultInstance=!0}),Array.isArray(n))r=[...e,...n];else if("function"==typeof n){const t=n(e);r=Array.isArray(t)?t:[t]}else r=e;return function(t){const e={};return t.forEach(t=>{const{name:n}=t,r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)}),Object.values(e)}(r)}function Su(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function ku(t,e,n){if(n[e.name])js&&Js(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===bu.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),bu.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(e,r)=>n(e,r,t))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign((e,r)=>n(e,r,t),{id:e.name});t.addEventProcessor(r)}js&&Js(`Integration installed: ${e.name}`)}}function _u(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}const $u="Not capturing exception because it's already been captured.",Nu="Discarded session because of missing or non-string release",Eu=Symbol.for("SentryInternalError"),Tu=Symbol.for("SentryDoNotSendEventError");function Cu(t){return{message:t,[Eu]:!0}}function Iu(t){return{message:t,[Tu]:!0}}function Mu(t){return!!t&&"object"==typeof t&&Eu in t}function Du(t){return!!t&&"object"==typeof t&&Tu in t}class Ou{constructor(t){if(this.Kt=t,this.te={},this.ee=0,this.ne={},this.re={},this.bt=[],t.dsn?this.ie=function(t){const e="string"==typeof t?function(t){const e=_c.exec(t);if(!e)return void Hs(()=>{});const[n,r,i="",o="",s="",a=""]=e.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const t=u.match(/^\d+/);t&&(u=t[0])}return Nc({host:o,pass:i,path:c,projectId:u,port:s,protocol:n,publicKey:r})}(t):Nc(t);if(e&&function(t){if(!js)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find(e=>!t[e]&&(Qs(`Invalid Sentry Dsn: ${e} missing`),!0))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(Qs(`Invalid Sentry Dsn: Invalid port ${e}`),1):(Qs(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Qs(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):js&&Vs("No DSN provided, client will not send events."),this.ie){const i=(e=this.ie,n=t.tunnel,r=t.oe?t.oe.sdk:void 0,n||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(e)}?${function(t,e){const n={sentry_version:"7"};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}(e,r)}`);this.se=t.transport({tunnel:this.Kt.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}var e,n,r}captureException(t,e,n){const r=Ba();if(Ya(t))return js&&Js($u),r;const i={event_id:r,...e};return this.ae(this.eventFromException(t,i).then(t=>this.ce(t,i,n))),i.event_id}captureMessage(t,e,n,r){const i={event_id:Ba(),...n},o=xa(t)?t:String(t),s=Sa(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this.ae(s.then(t=>this.ce(t,i,r))),i.event_id}captureEvent(t,e,n){const r=Ba();if(e?.originalException&&Ya(e.originalException))return js&&Js($u),r;const i={event_id:r,...e},o=t.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.ae(this.ce(t,i,s||n,a)),i.event_id}captureSession(t){this.sendSession(t),Xa(t,{init:!1})}getDsn(){return this.ie}getOptions(){return this.Kt}getSdkMetadata(){return this.Kt.oe}getTransport(){return this.se}async flush(t){const e=this.se;if(!e)return!0;this.emit("flush");const n=await this.ue(t),r=await e.flush(t);return n&&r}async close(t){const e=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),e}getEventProcessors(){return this.bt}addEventProcessor(t){this.bt.push(t)}init(){(this.le()||this.Kt.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this.de()}getIntegrationByName(t){return this.te[t]}addIntegration(t){const e=this.te[t.name];ku(this,t,this.te),e||Su(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=eu(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){if(!e)return t;const n=t.sdk||{};t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0}}(t,n?.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:$c(r)},...i&&{trace:i}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Gc(s,[[{type:o},t]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);for(const t of e.attachments||[])n=Yc(n,Xc(t));this.sendEnvelope(n).then(e=>this.emit("afterSendEvent",t,e))}sendSession(t){const{release:e,environment:n=Lc}=this.Kt;if("aggregates"in t){const r=t.attrs||{};if(!r.release&&!e)return void(js&&Vs(Nu));r.release=r.release||e,r.environment=r.environment||n,t.attrs=r}else{if(!t.release&&!e)return void(js&&Vs(Nu));t.release=t.release||e,t.environment=t.environment||n}this.emit("beforeSendSession",t);const r=function(t,e,n,r){const i=eu(n);return Gc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:$c(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);this.sendEnvelope(r)}recordDroppedEvent(t,e,n=1){if(this.Kt.sendClientReports){const r=`${t}:${e}`;js&&Js(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.ne[r]=(this.ne[r]||0)+n}}on(t,e){const n=this.re[t]=this.re[t]||new Set,r=(...t)=>e(...t);return n.add(r),()=>{n.delete(r)}}emit(t,...e){const n=this.re[t];n&&n.forEach(t=>t(...e))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this.le()&&this.se)try{return await this.se.send(t)}catch(t){return js&&Qs("Error while sending envelope:",t),{}}return js&&Qs("Transport disabled"),{}}de(){const{integrations:t}=this.Kt;this.te=function(t,e){const n={};return e.forEach(e=>{e&&ku(t,e,n)}),n}(this,t),Su(this,t)}he(t,e){let n="fatal"===e.level,r=!1;const i=e.exception?.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(!1===e?.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(Xa(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}async ue(t){let e=0;for(;!t||e<t;){if(await new Promise(t=>setTimeout(t,1)),!this.ee)return!0;e++}return!1}le(){return!1!==this.getOptions().enabled&&void 0!==this.se}fe(t,e,n,r){const i=this.getOptions(),o=Object.keys(this.te);return!e.integrations&&o?.length&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),hu(i,t,e,n,this,r).then(t=>{if(null===t)return t;this.emit("postprocessEvent",t,e),t.contexts={trace:gc(n),...t.contexts};const r=function(t,e){const n=e.getPropagationContext();return n.dsc||qc(n.traceId,t)}(this,n);return t.sdkProcessingMetadata={dynamicSamplingContext:r,...t.sdkProcessingMetadata},t})}ce(t,e={},n=hc(),r=fc()){return js&&Pu(t)&&Js(`Captured error event \`${_u(t)[0]||"<unknown>"}\``),this.me(t,e,n,r).then(t=>t.event_id,t=>{js&&(Du(t)?Js(t.message):Mu(t)?Vs(t.message):Vs(t))})}me(t,e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Ru(t),a=Pu(t),c=t.type||"error",u=`before send for type \`${c}\``,l=void 0===o?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;return"number"!=typeof e||isNaN(e)||e<0||e>1?void 0:e}(o);if(a&&"number"==typeof l&&Math.random()>l)return this.recordDroppedEvent("sample_rate","error"),ru(Iu(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.fe(t,e,n,r).then(t=>{if(null===t)throw this.recordDroppedEvent("event_processor",d),Iu("An event processor returned `null`, will not send event.");if(e.data&&!0===e.data.pe)return t;const n=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=e;let c=n;if(Pu(c)&&i)return i(c,r);if(Ru(c)){if(s||a){const e=function(t){const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[yc],exclusive_time:s?.[vc],measurements:t.measurements,is_segment:!0}}(c);if(a?.length&&zc(e,a))return null;if(s){const t=s(e);t?c=Ka(n,{type:"transaction",timestamp:(u=t).timestamp,start_timestamp:u.start_timestamp,transaction:u.description,contexts:{trace:{trace_id:u.trace_id,span_id:u.span_id,parent_span_id:u.parent_span_id,op:u.op,status:u.status,origin:u.origin,data:{...u.data,...u.profile_id&&{[yc]:u.profile_id},...u.exclusive_time&&{[vc]:u.exclusive_time}}}},measurements:u.measurements}):jc()}if(c.spans){const e=[],n=c.spans;for(const t of n)if(a?.length&&zc(t,a))Fc(n,t);else if(s){const n=s(t);n?e.push(n):(jc(),e.push(t))}else e.push(t);const r=c.spans.length-e.length;r&&t.recordDroppedEvent("before_send","span",r),c.spans=e}}if(o){if(c.spans){const t=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:t}}return o(c,r)}}var u;return c}(this,i,t,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if($a(t))return t.then(t=>{if(!ka(t)&&null!==t)throw Cu(n);return t},t=>{throw Cu(`${e} rejected with ${t}`)});if(!ka(t)&&null!==t)throw Cu(n);return t}(n,u)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const e=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",e)}throw Iu(`${u} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.he(o,i),s){const t=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);t>0&&this.recordDroppedEvent("before_send","span",t)}const c=i.transaction_info;if(s&&c&&i.transaction!==t.transaction){const t="custom";i.transaction_info={...c,source:t}}return this.sendEvent(i,e),i}).then(null,t=>{if(Du(t)||Mu(t))throw t;throw this.captureException(t,{mechanism:{handled:!1,type:"internal"},data:{pe:!0},originalException:t}),Cu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)})}ae(t){this.ee++,t.then(t=>(this.ee--,t),t=>(this.ee--,t))}ge(){const t=this.ne;return this.ne={},Object.entries(t).map(([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}})}ye(){js&&Js("Flushing outcomes...");const t=this.ge();if(0===t.length)return void(js&&Js("No outcomes to send"));if(!this.ie)return void(js&&Js("No dsn provided, will not send outcomes"));js&&Js("Sending outcomes:",t);const e=(n=t,Gc((r=this.Kt.tunnel&&$c(this.ie))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Ja(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}function Pu(t){return void 0===t.type}function Ru(t){return"transaction"===t.type}function ju(t){const e=function(t){return Au().get(t)}(t)??[];if(0===e.length)return;const n=t.getOptions(),r=function(t,e,n,r){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=$c(r)),Gc(i,[(o=t,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(e,n.oe,n.tunnel,t.getDsn());Au().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(r)}function Au(){return Ls("clientToLogBufferMap",()=>new WeakMap)}const zu=Symbol.for("SentryBufferFullError");function Fu(t,e,n=function(t=100){const e=new Set;function n(t){e.delete(t)}return{get $(){return Array.from(e)},add:function(r){if(!(e.size<t))return ru(zu);const i=r();return e.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(t){if(!e.size)return nu(!0);const n=Promise.allSettled(Array.from(e)).then(()=>!0);if(!t)return n;const r=[n,new Promise(e=>setTimeout(()=>e(!1),t))];return Promise.race(r)}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Jc(i,(e,n)=>{const i=tu(n);!function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)?o.push(e):t.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=Gc(i[0],o),a=e=>{Jc(s,(n,r)=>{t.recordDroppedEvent(e,tu(r))})};return n.add(()=>e({body:Qc(s)}).then(t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&js&&Vs(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t),t=>{throw a("network_error"),js&&Qs("Encountered error running transport request:",t),t})).then(t=>t,t=>{if(t===zu)return js&&Qs("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw t})},flush:t=>n.drain(t)}}function Wu(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Lu(t){"aggregates"in t?void 0===t.attrs?.ip_address&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):void 0===t.ipAddress&&(t.ipAddress="{{auto}}")}const qu=100;function Bu(t,e){const n=pc(),r=fc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=qu}=n.getOptions();if(o<=0)return;const s={timestamp:Ja(),...t},a=i?Hs(()=>i(s,e)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let Hu;const Uu=new WeakMap,Zu=()=>({name:"FunctionToString",setupOnce(){Hu=function(){}.toString;try{Function.prototype.toString=function(...t){const e=Fa(this),n=Uu.has(pc())&&void 0!==e?e:this;return Hu.apply(n,t)}}catch{}},setup(t){Uu.set(t,!0)}}),Gu=[/^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$/],Yu=(t={})=>{let e;return{name:"EventFilters",setup(n){const r=n.getOptions();e=Vu(t,r)},processEvent(n,r,i){if(!e){const n=i.getOptions();e=Vu(t,n)}return function(t,e){if(t.type){if("transaction"===t.type&&function(t,e){if(!e?.length)return!1;const n=t.transaction;return!!n&&Ra(n,e)}(t,e.ignoreTransactions))return js&&Vs(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ua(t)}`),!0}else{if(function(t,e){return!!e?.length&&_u(t).some(t=>Ra(t,e))}(t,e.ignoreErrors))return js&&Vs(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ua(t)}`),!0;if(function(t){return!!t.exception?.values?.length&&(!t.message&&!t.exception.values.some(t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))}(t))return js&&Vs(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Ua(t)}`),!0;if(function(t,e){if(!e?.length)return!1;const n=Qu(t);return!!n&&Ra(n,e)}(t,e.denyUrls))return js&&Vs(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ua(t)}.\nUrl: ${Qu(t)}`),!0;if(!function(t,e){if(!e?.length)return!0;const n=Qu(t);return!n||Ra(n,e)}(t,e.allowUrls))return js&&Vs(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ua(t)}.\nUrl: ${Qu(t)}`),!0}return!1}(n,e)?null:n}}},Ju=(t={})=>({...Yu(t),name:"InboundFilters"});function Vu(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Gu],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Qu(t){try{const e=[...t.exception?.values??[]].reverse().find(t=>void 0===t.mechanism?.parent_id&&t.stacktrace?.frames?.length),n=e?.stacktrace?.frames;return n?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return js&&Qs(`Cannot extract url for event ${Ua(t)}`),null}}function Xu(t,e,n,r,i,o){if(!i.exception?.values||!o||!Na(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=Ku(t,e,r,o.originalException,n,i.exception.values,s,0))}function Ku(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Na(r[i],Error)){tl(s,a);const o=t(e,r[i]),u=c.length;el(o,i,u,a),c=Ku(t,e,n,r[i],i,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Na(r,Error)){tl(s,a);const u=t(e,r),l=c.length;el(u,`errors[${o}]`,l,a),c=Ku(t,e,n,r,i,[u,...c],u,l)}}),c}function tl(t,e){t.mechanism={handled:!0,type:"auto.core.linked_errors",...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function el(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function nl(){"console"in As&&qs.forEach(function(t){t in As.console&&ja(As.console,t,function(e){return Bs[t]=e,function(...e){la("console",{args:e,level:t});const n=Bs[t];n?.apply(As.console,e)}})})}const rl=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!ol(t,e)&&!!il(t,e))))}(t,e)||!!function(t,e){const n=sl(e),r=sl(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!ol(t,e)&&!!il(t,e)))}(t,e))}(e,t))return js&&Vs("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function il(t,e){let n=oa(t),r=oa(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function ol(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function sl(t){return t.exception?.values?.[0]}function al(t){return void 0===t?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const cl=As;function ul(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ll(t,e){const n="fetch";ca(n,t),ua(n,()=>function(t,e=!1){e&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in cl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(ul(cl.fetch))return!0;let t=!1;const e=cl.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=ul(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){js&&Vs("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t}()||ja(As,"fetch",function(t){return function(...e){const n=new Error,{method:r,url:i}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:hl(e),method:dl(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:hl(e),method:dl(e,"method")?String(e.method).toUpperCase():"GET"}}(e),o={args:e,fetchData:{method:r,url:i},startTimestamp:1e3*Qa(),virtualError:n,headers:fl(e)};return la("fetch",{...o}),t.apply(As,e).then(async t=>(la("fetch",{...o,endTimestamp:1e3*Qa(),response:t}),t),t=>{if(la("fetch",{...o,endTimestamp:1e3*Qa(),error:t}),ga(t)&&void 0===t.stack&&(t.stack=n.stack,Aa(t,"framesToPop",1)),t instanceof TypeError&&("Failed to fetch"===t.message||"Load failed"===t.message||"NetworkError when attempting to fetch resource."===t.message))try{const e=new URL(o.fetchData.url);t.message=`${t.message} (${e.host})`}catch{}throw t})}})}(0,e))}function dl(t,e){return!!t&&"object"==typeof t&&!!t[e]}function hl(t){return"string"==typeof t?t:t?dl(t,"url")?t.url:t.toString?t.toString():"":""}function fl(t){const[e,n]=t;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&Na(e,Request))return new Headers(e.headers)}catch{}}const ml=As;let pl=0;function gl(){return pl>0}function yl(t,e={}){if(!function(t){return"function"==typeof t}(t))return t;try{const e=t.ve;if(e)return"function"==typeof e?e:t;if(Fa(t))return t}catch{return t}const n=function(...n){try{const r=n.map(t=>yl(t,e));return t.apply(this,r)}catch(t){throw pl++,setTimeout(()=>{pl--}),mc(r=>{r.addEventProcessor(t=>(e.mechanism&&(Za(t,void 0),Ga(t,e.mechanism)),t.extra={...t.extra,arguments:n},t)),fu(t)}),t}};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}catch{}za(n,t),Aa(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}function vl(t,e){const n=bl(t,e),r={type:kl(e),value:_l(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function wl(t,e){return{exception:{values:[vl(t,e)]}}}function bl(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&xl.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const xl=/Minified React error #\d+;/i;function Sl(t){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&t instanceof WebAssembly.Exception}function kl(t){const e=t?.name;return!e&&Sl(t)?t.message&&Array.isArray(t.message)&&2==t.message.length?t.message[0]:"WebAssembly.Exception":e}function _l(t){const e=t?.message;return Sl(t)?Array.isArray(t.message)&&2==t.message.length?t.message[1]:"wasm exception":e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function $l(t,e,n,r,i){let o;if(va(e)&&e.error)return wl(t,e.error);if(wa(e)||ya(e,"DOMException")){const i=e;if("stack"in e)o=wl(t,e);else{const e=i.name||(wa(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=Nl(t,s,n,r),Za(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ga(e)?wl(t,e):ka(e)||_a(e)?(o=function(t,e,n,r){const i=pc(),o=i?.getOptions().normalizeDepth,s=function(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={we:Uc(e,o)};if(s)return{exception:{values:[vl(t,s)]},extra:a};const c={exception:{values:[{type:_a(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:El(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=bl(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),Ga(o,{synthetic:!0}),o):(o=Nl(t,e,n,r),Za(o,`${e}`),Ga(o,{synthetic:!0}),o)}function Nl(t,e,n,r){const i={};if(r&&n){const r=bl(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),Ga(i,{synthetic:!0})}if(xa(e)){const{ut:t,lt:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function El(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(Wa(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Da(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Da(r,e)}return""}(t),r=e?"promise rejection":"exception";return va(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:_a(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Tl extends Ou{constructor(t){const e=(n=t,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:ml.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(t,e,n=[e],r="npm"){const i=t.oe||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(t=>({name:`${r}:@sentry/${t}`,version:zs})),version:zs}),t.oe=i}(e,"browser",["browser"],ml.SENTRY_SDK_SOURCE||"npm"),e.oe?.sdk&&(e.oe.sdk.settings={infer_ip:e.sendDefaultPii?"auto":"never",...e.oe.sdk.settings}),super(e);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Kt;ml.document&&(i||o)&&ml.document.addEventListener("visibilitychange",()=>{"hidden"===ml.document.visibilityState&&(i&&this.ye(),o&&ju(this))}),o&&(this.on("flush",()=>{ju(this)}),this.on("afterCaptureLog",()=>{this.be&&clearTimeout(this.be),this.be=setTimeout(()=>{ju(this)},5e3)})),r&&this.on("beforeSendSession",Lu)}eventFromException(t,e){return function(t,e,n,r){const i=$l(t,e,n?.syntheticException||void 0,r);return Ga(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),nu(i)}(this.Kt.stackParser,t,e,this.Kt.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=Nl(t,e,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),nu(o)}(this.Kt.stackParser,t,e,n,this.Kt.attachStacktrace)}fe(t,e,n,r){return t.platform=t.platform||"javascript",super.fe(t,e,n,r)}}const Cl="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Il=As;let Ml,Dl,Ol,Pl;function Rl(){if(!Il.document)return;const t=la.bind(null,"dom"),e=jl(t,!0);Il.document.addEventListener("click",e,!1),Il.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(e=>{const n=Il,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(ja(r,"addEventListener",function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xe=this.xe||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=jl(t);o.handler=r,e.call(this,n,r,i)}o.refCount++}catch{}return e.call(this,n,r,i)}}),ja(r,"removeEventListener",function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this.xe||{},i=n[e];i&&(i.refCount--,i.refCount<=0&&(t.call(this,e,i.handler,r),i.handler=void 0,delete n[e]),0===Object.keys(n).length&&delete this.xe)}catch{}return t.call(this,e,n,r)}}))})}function jl(t,e=!1){return n=>{if(!n||n.Se)return;const r=function(t){try{return t.target}catch{return null}}(n);if(function(t,e){return"keypress"===t&&(!e?.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;Aa(n,"_sentryCaptured",!0),r&&!r.ke&&Aa(r,"_sentryId",Ba());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Dl)return!1;try{if(!t.target||t.target.ke!==Ol)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Dl=n.type,Ol=r?r.ke:void 0),clearTimeout(Ml),Ml=Il.setTimeout(()=>{Ol=void 0,Dl=void 0},1e3)}}function Al(t){const e="history";ca(e,t),ua(e,zl)}function zl(){function t(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const r=Pl,i=function(t){try{return new URL(t,Il.location.origin).toString()}catch{return t}}(String(n));if(Pl=i,r===i)return t.apply(this,e);la("history",{from:r,to:i})}return t.apply(this,e)}}Il.addEventListener("popstate",()=>{const t=Il.location.href,e=Pl;Pl=t,e!==t&&la("history",{from:e,to:t})}),"history"in cl&&cl.history&&(ja(Il.history,"pushState",t),ja(Il.history,"replaceState",t))}const Fl={},Wl="__sentry_xhr_v3__";function Ll(){if(!Il.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(t,e,n){const r=new Error,i=1e3*Qa(),o=ba(n[0])?n[0].toUpperCase():void 0,s=function(t){if(ba(t))return t;try{return t.toString()}catch{}}(n[1]);if(!o||!s)return t.apply(e,n);e[Wl]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(e._e=!0);const a=()=>{const t=e[Wl];if(t&&4===e.readyState){try{t.status_code=e.status}catch{}la("xhr",{endTimestamp:1e3*Qa(),startTimestamp:i,xhr:e,virtualError:r})}};return"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?e.onreadystatechange=new Proxy(e.onreadystatechange,{apply:(t,e,n)=>(a(),t.apply(e,n))}):e.addEventListener("readystatechange",a),e.setRequestHeader=new Proxy(e.setRequestHeader,{apply(t,e,n){const[r,i]=n,o=e[Wl];return o&&ba(r)&&ba(i)&&(o.request_headers[r.toLowerCase()]=i),t.apply(e,n)}}),t.apply(e,n)}}),t.send=new Proxy(t.send,{apply(t,e,n){const r=e[Wl];return r?(void 0!==n[0]&&(r.body=n[0]),la("xhr",{startTimestamp:1e3*Qa(),xhr:e}),t.apply(e,n)):t.apply(e,n)}})}function ql(t,e=function(t){const e=Fl[t];if(e)return e;let n=Il[t];if(ul(n))return Fl[t]=n.bind(Il);const r=Il.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){Cl&&Vs(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?Fl[t]=n.bind(Il):n}("fetch")){let n=0,r=0;return Fu(t,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const n=await e(t.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(t){throw Fl.fetch=void 0,t}finally{n-=o,r--}})}function Bl(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?Xs:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Hl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ul=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Gl=/at (.+?) ?\(data:(.+?),/,Yl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Jl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vl=ea([30,t=>{const e=t.match(Gl);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=Hl.exec(t);if(n){const[,t,e,r]=n;return Bl(t,Xs,+e,+r)}const r=Ul.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){const t=Zl.exec(r[2]);t&&(r[2]=t[1],r[3]=t[2],r[4]=t[3])}const[t,e]=Ql(r[1]||Xs,r[2]);return Bl(e,t,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,t=>{const e=Yl.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Jl.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||Xs;return[n,t]=Ql(n,t),Bl(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Ql=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:Xs,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Xl="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Kl=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";ca(e,t),ua(e,nl)}(function(t){return function(e){if(pc()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Oa(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${Oa(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}Bu(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(pc()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(Xl&&Vs(`\`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 t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=Ca(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!Ta.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Bu(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),ca("dom",n),ua("dom",Rl)),e.xhr&&function(t){ca("xhr",t),ua("xhr",Ll)}(function(t){return function(e){if(pc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[Wl];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i,u={method:o,url:s,status_code:a},l={xhr:e.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:u,type:"http",level:al(a)};t.emit("beforeOutgoingRequestBreadcrumb",d,l),Bu(d,l)}}(t)),e.fetch&&ll(function(t){return function(e){if(pc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error){const i=e.fetchData,o={data:e.error,input:e.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",s,o),Bu(s,o)}else{const i=e.response,o={...e.fetchData,status_code:i?.status},s={input:e.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:al(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Bu(a,s)}}}(t)),e.history&&Al(function(t){return function(e){if(pc()!==t)return;let n=e.from,r=e.to;const i=Wu(ml.location.href);let o=n?Wu(n):void 0;const s=Wu(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),Bu({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){pc()===t&&Bu({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:Ua(e)},{event:e})}}(t))}}},td=["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"],ed=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&ja(ml,"setTimeout",nd),e.setInterval&&ja(ml,"setInterval",nd),e.requestAnimationFrame&&ja(ml,"requestAnimationFrame",rd),e.XMLHttpRequest&&"XMLHttpRequest"in ml&&ja(XMLHttpRequest.prototype,"send",id);const t=e.eventTarget;t&&(Array.isArray(t)?t:td).forEach(t=>function(t,e){const n=ml,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(ja(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=yl(i.handleEvent,{mechanism:{data:{handler:ia(i),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&function(t,e,n){t&&"object"==typeof t&&"removeEventListener"in t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n)}(this,r,i),n.apply(this,[r,yl(i,{mechanism:{data:{handler:ia(i),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),ja(r,"removeEventListener",function(t){return function(e,n,r){try{const i=n.ve;i&&t.call(this,e,i,r)}catch{}return t.call(this,e,n,r)}}))}(t,e))}}};function nd(t){return function(...e){const n=e[0];return e[0]=yl(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ia(t)}`}}),t.apply(this,e)}}function rd(t){return function(e){return t.apply(this,[yl(e,{mechanism:{data:{handler:ia(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function id(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&ja(n,t,function(e){const n={mechanism:{data:{handler:ia(e)},handled:!1,type:`auto.browser.browserapierrors.xhr.${t}`}},r=Fa(e);return r&&(n.mechanism.data.handler=ia(r)),yl(e,n)})}),t.apply(this,e)}}const od=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";ca(e,e=>{const{stackParser:n,attachStacktrace:r}=ad();if(pc()!==t||gl())return;const{msg:i,url:o,line:s,column:a,error:c}=e,u=function(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=r,l=n,d=function(t){if(ba(t)&&0!==t.length){if(t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);return`<data:${e?e[1]:"text/javascript"}${t.includes("base64,")?",base64":""}>`}return t.slice(0,1024)}}(e)??Ma();return 0===c.length&&c.push({colno:u,filename:d,function:Xs,in_app:!0,lineno:l}),t}($l(n,c||i,void 0,r,!1),o,s,a);u.level="error",pu(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ua(e,ha)}()}(t),sd("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";ca(e,e=>{const{stackParser:n,attachStacktrace:r}=ad();if(pc()!==t||gl())return;const i=function(t){if(Sa(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}(e),o=Sa(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:$l(n,i,void 0,r,!0);o.level="error",pu(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ua(e,ma)}()}(t),sd("onunhandledrejection"))}}};function sd(t){Xl&&Js(`Global Handler attached: ${t}`)}function ad(){const t=pc();return t?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const cd=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){Xu(vl,i.getOptions().stackParser,n,e,t,r)}}};let ud=!1;function ld(e){if(ud)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];!function(t={}){const e=!t.skipBrowserExtensionCheck&&!!function(){if(void 0===ml.window)return!1;const t=ml;if(t.nw)return!1;const e=t.chrome||t.browser;if(!e?.runtime?.id)return!1;const n=Ma();return!(ml===ml.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(t=>n.startsWith(`${t}://`)))}()&&(Xl&&Hs(()=>{}),!0),n={...t,enabled:!e&&t.enabled,stackParser:(r=t.stackParser||Vl,Array.isArray(r)?ea(...r):r),integrations:xu({integrations:t.integrations,defaultIntegrations:null==t.defaultIntegrations?[Ju(),Zu(),ed(),Kl(),od(),cd(),rl(),{name:"HttpContext",preprocessEvent(t){if(!ml.navigator&&!ml.location&&!ml.document)return;const e=function(){const t=Ma(),{referrer:e}=ml.document||{},{userAgent:n}=ml.navigator||{};return{url:t,headers:{...e&&{Referer:e},...n&&{"User-Agent":n}}}}(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}},{name:"BrowserSession",setupOnce(){void 0!==ml.document?(gu({ignoreDuration:!0}),wu(),Al(({from:t,to:e})=>{void 0!==t&&t!==e&&(gu({ignoreDuration:!0}),wu())})):Xl&&Vs("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:t.defaultIntegrations}),transport:t.transport||ql};var r;!function(t,e){!0===e.debug&&(js?Ys():Hs(()=>{})),hc().update(e.initialScope);const n=new t(e);(function(t){hc().setClient(t)})(n),n.init()}(Tl,n)}({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(t,e){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=t.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(t=>!!t.filename&&e.some(e=>e.test(t.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[Kl({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),rl()],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"]}),ud=!0,t()}catch(t){}else t()}function dd(e,n){if(ud)try{n?mc(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),fu(e)}):fu(e)}catch(e){t()}}function hd(e,n="info",r){if(ud)try{r?mc(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),mu(e,n)}):mu(e,n)}catch(e){t()}}function fd(e){if(ud)try{!function(t){fc().setUser(t)}(e)}catch(e){t()}}function md(e){if(ud)try{Bu(e)}catch(e){t()}}function pd(e,n){if(ud)try{!function(t,e){fc().setTag(t,e)}(e,n)}catch(e){t()}}function gd(){return ud}var yd=Object.freeze({__proto__:null,addBreadcrumb:md,captureException:dd,captureMessage:hd,initializeSentry:ld,isSentryInitialized:gd,setTag:pd,setUser:fd});const vd="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",wd="production",bd="insureos-scripts",xd=!0,Sd=1,kd=.1;class _d{constructor(t={}){var e,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(e=t.enabled)||void 0===e||e,customDataLayer:null!==(n=t.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=t.includePersonalData)&&void 0!==r&&r,debug:null!==(i=t.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const t=this.config.customDataLayer;window[t]||(window[t]=[],this.logDebug(`Created new ${t} array`)),Array.isArray(window[t])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${t}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${t}' exists but is not an array`))}catch(t){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",t)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const t=window[this.config.customDataLayer];return Array.isArray(t)?t:null}catch(t){return this.logDebug("Failed to get data layer:",t),null}}push(t){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",t.event);const e=this.getDataLayer();if(e)try{const n=this.config.includePersonalData?t:this.removePII(t);e.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(t){this.logDebug("❌ Failed to push event to data layer:",t)}else this.logDebug("⚠️ Data layer not available, skipping event:",t.event)}removePII(t){const e={...t},n=["email","phone","name","address","client_name","client_email"];for(const t of n)t in e&&delete e[t];return e}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(t){this.logDebug("Failed to clear data layer:",t)}}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},(t.customDataLayer||void 0!==t.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class $d{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{ld({dsn:vd,environment:wd,release:bd,enabled:xd,sampleRate:Sd,tracesSampleRate:kd}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(t){if(!t.orgId)throw new Error("orgId is required")}initializeAnalyticsOnce(e){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new _d({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:e.debug}),gt(this.analyticsManager),t()}catch(e){t()}}async mount(t,r){r.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(r),this.initializeSentryOnce(),this.initializeAnalyticsOnce(r),function(t,r){var i,o,s;r==document&&(r=document.documentElement),n.m&&n.m(t,r),i=r.i,o=[],s=[],P(r,t=r.i=b(S,null,[t]),i||m,m,r.namespaceURI,i?null:r.firstChild?e.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),j(o,t,s)}(b(Ps,{config:r,initializeFormContext:this.initializeFormContext.bind(this)}),t)}createHttpClient(t){var e,n,r,i,o,s,a,c,u,l;this.validateConfig(t);const d=t.apiBaseUrl||"https://api.os.insure";return new U({orgId:t.orgId,apiBaseUrl:d,timeout:(null===(e=t.httpConfig)||void 0===e?void 0:e.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=t.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=t.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=t.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(u=null===(c=t.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===u?void 0:u.retryableStatusCodes)||[429,500,502,503,504],...null===(l=t.httpConfig)||void 0===l?void 0:l.retryConfig}})}createClient(t){const e=this.createHttpClient(t);return new Ct(e)}async initializeFormContext(e){const n=this.createHttpClient(e),r="sessionStorage"===e.storageType?new G:new Z;r.isAvailable()?t(r.constructor.name):t();const i=new V(r),o=new Q(i),s=async()=>{t();const r=e.quoteIntentUrl?await n.getQuoteIntent(e.quoteIntentUrl):await n.createQuoteIntent(e.product);return t(),{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:e.orgId,product_id:r.product.id,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,organisation:r.organisation,cached_result:r.cached_result}},a=async r=>{t();const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id"),a=await n.getQuoteIntent(r);let c;if(t(),t(a.cached_result),a.cached_result?(t(),t(a.cached_result.outcome_type)):t(),s&&a.payment_transactions){t();const e=a.payment_transactions.find(t=>t.id===s);if(e){t();let n="unknown";switch(e.status){case"completed":n="success";break;case"failed":n="declined";break;case"cancelled":n="cancelled";break;default:n="error"}c={paymentTransactionId:e.id,paymentStatus:n,transactionStatus:e};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 t()}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:e.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,organisation:a.organisation,payment_return:c,cached_result:a.cached_result};return t(),c&&i.saveQuoteIntent(e.orgId,u),u};t();const c=`insure_os_quote_intent_${e.orgId}`;localStorage.getItem(c),t(),i.getQuoteIntent(e.orgId),t(),t();let u=null,l=!1;try{const n=i.getQuoteIntent(e.orgId),r=await o.getOrCreateQuoteIntent(e.orgId,s,a);t(),t(r.cached_result),r.cached_result&&t(r.cached_result.outcome_type),u=r,l=!n}catch(n){if(t(),!(n instanceof q&&404===n.statusCode))throw n;t(),o.clearQuoteIntent(e.orgId),u=await o.getOrCreateQuoteIntent(e.orgId,s,a),l=!0}if(l&&u&&wt(u),!u)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(t(),localStorage.clear());const d=new Et(u,n,o,{autoSave:u.form_definition.settings.autoSave,autoSaveInterval:u.form_definition.settings.autoSaveInterval});if(u.form_data&&d.restoreFormProgress(u.form_data),t(u.cached_result),u.cached_result?(t(u.cached_result),d.restoreCalculationResult(u.cached_result),t(),t(d.hasCalculationResponse())):t(),u.organisation&&u.organisation.theme)try{await Rs.loadTheme({slug:u.organisation.slug,theme_url:u.organisation.theme.css_url})}catch(e){t()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:u,quoteIntentStore:o,formStateManager:d}}async handleAutoCalculationIfComplete(e){try{const n=e.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const r=e.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;t((o.length,e.getIsCalculating(),e.hasLastCalculationFailed())),s&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const Nd=new $d;"undefined"!=typeof window&&(window.InsureOS=Nd,function(){const t=document.querySelectorAll('script[src*="insureos"]'),e=t[t.length-1];if(e&&e.src){const t=new URL(e.src),n=t.searchParams.get("orgId"),r=t.searchParams.get("productCode");if(n&&r){const e=t.searchParams.get("container"),i=e?document.getElementById(e):document.body;if(i){const t={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(t);const e=async()=>{try{await Nd.mount(i,t)}catch(t){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}}}}());class Ed{constructor(t={}){var e,n,r;this.detectionResults=null,this.config={fetch:null===(e=t.fetch)||void 0===e||e,promise:null===(n=t.promise)||void 0===n||n,url:null===(r=t.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(t){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 t=Promise.resolve(42);return"function"!=typeof t.then||"function"!=typeof t.catch}catch(t){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const t=new URL("http://example.com/path?param=value#hash");if("string"!=typeof t.protocol||"string"!=typeof t.hostname||"string"!=typeof t.pathname||"string"!=typeof t.search||"string"!=typeof t.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const e=new URLSearchParams("param=value");return"function"!=typeof e.get||"function"!=typeof e.set}catch(t){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:t,Headers:e,Request:n,Response:r}=await Promise.resolve().then(function(){return Od});void 0===globalThis.fetch&&(globalThis.fetch=t),void 0===globalThis.Headers&&(globalThis.Headers=e),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(t){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:t}=await Promise.resolve().then(function(){return Rd});void 0===globalThis.Promise&&(globalThis.Promise=t)}catch(t){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:t,URLSearchParamsPolyfill:e}=await Promise.resolve().then(function(){return Ad});void 0===globalThis.URL&&(globalThis.URL=t),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=e)}catch(t){}}}class Td{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Td.instance)return Td.instance;Td.instance=this}startMeasurement(t){this.measurements.set(t,this.now())}endMeasurement(t){const e=this.measurements.get(t);if(void 0===e)throw new Error(`No measurement started for: ${t}`);const n=this.now()-e;return this.measurements.delete(t),this.completedMeasurements.has(t)||this.completedMeasurements.set(t,[]),this.completedMeasurements.get(t).push(n),"initialization"===t&&(this.initializationTime=n),n}async measureApiCall(t,e){const n=this.now();let r,i=!1;try{const t=await e();return i=!0,t}catch(t){throw i=!1,r=t instanceof Error?t.message:"Unknown error",t}finally{const e=this.now()-n;this.apiCallMetrics.push({operation:t,duration:e,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 t=performance.memory;return{usedJSHeapSize:t.usedJSHeapSize||0,totalJSHeapSize:t.totalJSHeapSize||0,jsHeapSizeLimit:t.jsHeapSizeLimit||0}}return null}getMetrics(){var t;const e=this.apiCallMetrics.filter(t=>t.success).map(t=>t.duration),n=e.length>0?e.reduce((t,e)=>t+e,0)/e.length:0,r={};return this.completedMeasurements.forEach((t,e)=>{r[e]=[...t]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:e.length>0&&null!==(t=e[e.length-1])&&void 0!==t?t: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 t=this.getMetrics(),e=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${t.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${t.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${t.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(t.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,e&&(n+="Memory Details:\n",n+=` Used Heap: ${(e.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(e.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(e.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const t=new Map;this.apiCallMetrics.forEach(e=>{t.has(e.operation)||t.set(e.operation,{count:0,totalTime:0,errors:0});const n=t.get(e.operation);n.count++,n.totalTime+=e.duration,e.success||n.errors++}),t.forEach((t,e)=>{const r=t.totalTime/t.count,i=(t.errors/t.count*100).toFixed(1);n+=` ${e}: ${t.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(t){(new Td).startMeasurement(t)}static endMeasurement(t){return(new Td).endMeasurement(t)}static measureMemoryUsage(){return(new Td).measureMemoryUsage()}static async measureApiCall(t,e){return(new Td).measureApiCall(t,e)}static getMetrics(){return(new Td).getMetrics()}static generateReport(){return(new Td).generateReport()}}var Cd;!function(t){t.FIXED="fixed",t.LATEST="latest"}(Cd||(Cd={}));let Id=class t{constructor(e){this.headers=new Map,e&&(Array.isArray(e)?e.forEach(([t,e])=>this.set(t,e)):e instanceof t?e.forEach((t,e)=>this.set(e,t)):Object.entries(e).forEach(([t,e])=>this.set(t,e)))}append(t,e){const n=this.get(t);this.set(t,n?`${n}, ${e}`:e)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())||null}has(t){return this.headers.has(t.toLowerCase())}set(t,e){this.headers.set(t.toLowerCase(),e)}forEach(t){this.headers.forEach(t)}},Md=class{constructor(t,e={}){var n;"string"==typeof t?(this.url=t,this.method=e.method||"GET",this.headers=new Id(e.headers),this.body=e.body||null,this.signal=e.signal||void 0):(this.url=t.url,this.method=e.method||t.method,this.headers=new Id(e.headers||t.headers),this.body=void 0!==e.body?e.body:t.body,this.signal=void 0!==e.signal?null!==(n=e.signal)&&void 0!==n?n:void 0:t.signal)}},Dd=class{constructor(t="",e={}){this.status=e.status||200,this.statusText=e.statusText||"OK",this.headers=new Id(e.headers),this.ok=this.status>=200&&this.status<300,this.$e=t}async text(){return this.$e}async json(){return JSON.parse(this.$e)}};var Od=Object.freeze({__proto__:null,Headers:Id,Request:Md,Response:Dd,fetch:async function(t,e={}){return new Promise((n,r)=>{const i=new Md(t,e),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((t,e)=>{o.setRequestHeader(e,t)}),o.onload=()=>{const t=new Id;o.getAllResponseHeaders().split("\r\n").forEach(e=>{const[n,r]=e.split(": ");n&&r&&t.set(n,r)});const e=new Dd(o.responseText,{status:o.status,statusText:o.statusText,headers:t});n(e)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class Pd{constructor(t){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{t(this.resolve.bind(this),this.reject.bind(this))}catch(t){this.reject(t)}}resolve(t){"pending"===this.state&&(this.state="fulfilled",this.value=t,this.onFulfilledCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}reject(t){"pending"===this.state&&(this.state="rejected",this.reason=t,this.onRejectedCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}then(t,e){return new Pd((n,r)=>{const i=e=>{try{if(t){const i=t(e);i instanceof Pd?i.then(n,r):n(i)}else n(e)}catch(t){r(t)}},o=t=>{try{if(e){const i=e(t);i instanceof Pd?i.then(n,r):n(i)}else r(t)}catch(t){r(t)}};"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(t){return this.then(void 0,t)}static resolve(t){return new Pd(e=>e(t))}static reject(t){return new Pd((e,n)=>n(t))}static all(t){return new Pd((e,n)=>{if(0===t.length)return void e([]);const r=[];let i=0;t.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===t.length&&e(r)},n)})})}}var Rd=Object.freeze({__proto__:null,PromisePolyfill:Pd});class jd{constructor(t){this.params=new Map,"string"==typeof t?this.parseString(t):t&&"object"==typeof t&&"forEach"in t&&"function"==typeof t.forEach?t.forEach((t,e)=>this.append(e,t)):t&&"object"==typeof t&&Object.entries(t).forEach(([t,e])=>this.set(t,e))}parseString(t){const e=t.startsWith("?")?t.slice(1):t;e&&e.split("&").forEach(t=>{if(!t)return;const e=t.indexOf("=");let n,r;-1===e?(n=t,r=""):(n=t.substring(0,e),r=t.substring(e+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(t,e){const n=this.params.get(t)||[];n.push(e),this.params.set(t,n)}delete(t){this.params.delete(t)}get(t){var e;const n=this.params.get(t);return n&&n.length>0&&null!==(e=n[0])&&void 0!==e?e:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}forEach(t){this.params.forEach((e,n)=>{e.forEach(e=>t(e,n))})}toString(){const t=[];return this.params.forEach((e,n)=>{e.forEach(e=>{t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`)})}),t.join("&")}}var Ad=Object.freeze({__proto__:null,URLPolyfill:class{constructor(t,e){const n=this.parseUrl(t,e);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 jd(this.search)}parseUrl(t,e){const n=document.createElement("a");if(e){const r=document.createElement("a");r.href=e,n.href=this.resolveUrl(t,r.href)}else n.href=t;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(t,e){if(t.includes("://"))return t;if(t.startsWith("/")){const n=document.createElement("a");return n.href=e,`${n.protocol}//${n.host}${t}`}return`${e.split("/").slice(0,-1).join("/")}/${t}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:jd});export{_d as DataLayerManager,U as EnhancedHttpClient,B as ErrorHandlingStrategy,f as ErrorType,Et as FormStateManager,Nd as InsureOS,$d as InsureOSClient,q as InsureOSError,V as LocalStateManager,Z as LocalStorageAdapter,Y as MemoryStorageAdapter,Td as PerformanceMonitor,Ed as PolyfillManager,H as RetryStrategy,G as SessionStorageAdapter,Rs as ThemeLoader,Cd as VersionStrategy,md as addBreadcrumb,dd as captureException,hd as captureMessage,st as createAppError,yt as getAnalytics,mt as getSupportMessage,nt as groupErrorsByField,gt as initializeAnalytics,ld as initializeSentry,gd as isSentryInitialized,et as parseServerValidationErrors,pd as setTag,fd as setUser,ht as shouldShowErrorPage,ft as shouldShowMaintenancePage,bt as trackFormProgress,$t as trackPaymentCompleted,Nt as trackPaymentFailed,_t as trackPaymentInitiated,St as trackQuoteAtCheckout,xt as trackQuoteCalculated,kt as trackQuoteReferred,wt as trackQuoteStarted,K as validateField,tt as validatePage};
1
+ const t=()=>{globalThis.insureOSDebug};var e,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(t,e){for(var n in e)t[n]=e[n];return t}function w(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function b(t,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?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return x(t,a,i,o,null)}function x(t,e,i,o,s){var a={type:t,props:e,key:i,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:null==s?++r:s,N:-1,C:0};return null==s&&null!=n.vnode&&n.vnode(a),a}function k(t){return t.children}function S(t,e){this.props=t,this.context=e}function $(t,e){if(null==e)return t.m?$(t.m,t.N+1):null;for(var n;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v)return n.v;return"function"==typeof t.type?$(t):null}function _(t){var e,n;if(null!=(t=t.m)&&null!=t.k){for(t.v=t.k.base=null,e=0;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v){t.v=t.k.base=n.v;break}return _(t)}}function N(t){(!t.I&&(t.I=!0)&&i.push(t)&&!E.P++||o!=n.debounceRendering)&&((o=n.debounceRendering)||s)(E)}function E(){for(var t,e,r,o,s,c,l,u=1;i.length;)i.length>u&&i.sort(a),t=i.shift(),u=i.length,t.I&&(r=void 0,s=(o=(e=t)._).v,c=[],l=[],e.O&&((r=v({},o))._=o._+1,n.vnode&&n.vnode(r),O(e.O,r,o,e.R,e.O.namespaceURI,32&o.C?[s]:null,c,null==s?$(o):s,!!(32&o.C),l),r._=o._,r.m.i[r.N]=r,j(c,r,l),r.v!=s&&_(r)));E.P=0}function T(t,e,n,r,i,o,s,a,c,l,u){var d,h,f,g,v,w,b,S=r&&r.i||p,_=e.length;for(c=function(t,e,n,r,i){var o,s,a,c,l,u=n.length,d=u,h=0;for(t.i=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+h,(s=t.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._):s).m=t,s.p=t.p+1,a=null,-1!=(l=s.N=I(s,n,c,d))&&(d--,(a=n[l])&&(a.C|=2)),null==a||null==a._?(-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))):t.i[o]=null;if(d)for(o=0;o<u;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=$(a)),W(a,a));return r}(n,e,S,c,_),d=0;d<_;d++)null!=(f=n.i[d])&&(h=-1==f.N?m:S[f.N]||m,f.N=d,w=O(t,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=C(f,c,t,b):"function"==typeof f.type&&void 0!==w?c=w:g&&(c=g.nextSibling),f.C&=-7);return n.v=v,c}function C(t,e,n,r){var i,o;if("function"==typeof t.type){for(i=t.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=t,e=C(i[o],e,n,r));return e}t.v!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=$(t)),n.insertBefore(t.v,e||null)),e=t.v);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function I(t,e,n,r){var i,o,s,a=t.key,c=t.type,l=e[n],u=null!=l&&!(2&l.C);if(null===l&&null==t.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<e.length;)if(null!=(l=e[s=i>=0?i--:o++])&&!(2&l.C)&&a==l.key&&c==l.type)return s;return-1}function M(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||g.test(e)?n:n+"px"}function D(t,e,n,r,i){var o,s;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||M(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||M(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(c,"$1")),s=e.toLowerCase(),e=s in t||"onFocusOut"==e||"onFocusIn"==e?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=l,t.addEventListener(e,o?d:u,o)):t.removeEventListener(e,o?d:u,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function P(t){return function(e){if(this.l){var r=this.l[e.type+t];if(null==e.t)e.t=l++;else if(e.t<r.u)return;return r(n.event?n.event(e):e)}}}function O(t,e,r,i,o,s,a,c,l,u){var d,h,f,m,p,g,b,x,$,_,N,E,C,I,M,D,P,O=e.type;if(null!=e.constructor)return null;128&r.C&&(l=!!(32&r.C),s=[c=e.v=r.v]),(d=n.p)&&d(e);t:if("function"==typeof O)try{if(x=e.props,$="prototype"in O&&O.prototype.render,_=(d=O.contextType)&&i[d.k],N=d?_?_.props.value:d.m:i,r.k?b=(h=e.k=r.k).m=h.j:($?e.k=h=new O(x,N):(e.k=h=new S(x,N),h.constructor=O,h.render=F),_&&_.sub(h),h.props=x,h.state||(h.state={}),h.context=N,h.R=i,f=h.I=!0,h.A=[],h.L=[]),$&&null==h.W&&(h.W=h.state),$&&null!=O.getDerivedStateFromProps&&(h.W==h.state&&(h.W=v({},h.W)),v(h.W,O.getDerivedStateFromProps(x,h.W))),m=h.props,p=h.state,h._=e,f)$&&null==O.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),$&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if($&&null==O.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,N),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.W,N)||e._==r._){for(e._!=r._&&(h.props=x,h.state=h.W,h.I=!1),e.v=r.v,e.i=r.i,e.i.some(function(t){t&&(t.m=e)}),E=0;E<h.L.length;E++)h.A.push(h.L[E]);h.L=[],h.A.length&&a.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.W,N),$&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=N,h.props=x,h.O=t,h.v=!1,C=n.P,I=0,$){for(h.state=h.W,h.I=!1,C&&C(e),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,C&&C(e),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())),$&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),D=d,null!=d&&d.type===k&&null==d.key&&(D=A(d.props.children)),c=T(t,y(D)?D:[D],e,r,i,o,s,a,c,l,u),h.base=e.v,e.C&=-161,h.A.length&&a.push(h),b&&(h.j=h.m=null)}catch(t){if(e._=null,l||null!=s)if(t.then){for(e.C|=l?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.v=c}else{for(P=s.length;P--;)w(s[P]);R(e)}else e.v=r.v,e.i=r.i,t.then||R(e);n.v(t,e,r)}else null==s&&e._==r._?(e.i=r.i,e.v=r.v):c=e.v=z(r.v,e,r,i,o,s,a,l,u);return(d=n.diffed)&&d(e),128&e.C?void 0:c}function R(t){t&&t.k&&(t.k.v=!0),t&&t.i&&t.i.forEach(R)}function j(t,e,r){for(var i=0;i<r.length;i++)L(r[i],r[++i],r[++i]);n.k&&n.k(e,t),t.some(function(e){try{t=e.A,e.A=[],t.some(function(t){t.call(e)})}catch(t){n.v(t,e._)}})}function A(t){return"object"!=typeof t||null==t||t.p&&t.p>0?t:y(t)?t.map(A):v({},t)}function z(t,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)){t=g,a[d]=null;break}if(null==t){if(null==S)return document.createTextNode(k);t=document.createElementNS(s,S,k.is&&k),l&&(n.B&&n.B(r,a),l=!1),a=null}if(null==S)x===k||l&&t.data==k||(t.data=k);else{if(a=a&&e.call(t.childNodes),x=i.props||m,!l&&null!=a)for(x={},d=0;d<t.attributes.length;d++)x[(g=t.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;D(t,d,null,g,s)}for(d in k)g=k[d],"children"==d?p=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?v=g:"checked"==d?b=g:l&&"function"!=typeof g||x[d]===g||D(t,d,g,x[d],s);if(h)l||f&&(h.H==f.H||h.H==t.innerHTML)||(t.innerHTML=h.H),r.i=[];else if(f&&(t.innerHTML=""),T("template"==r.type?t.content:t,y(p)?p:[p],r,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&$(i,0),l,u),null!=a)for(d=a.length;d--;)w(a[d]);l||(d="value","progress"==S&&null==v?t.removeAttribute("value"):null!=v&&(v!==t[d]||"progress"==S&&!v||"option"==S&&v!=x[d])&&D(t,d,v,x[d],s),d="checked",null!=b&&b!=t[d]&&D(t,d,b,x[d],s))}return t}function L(t,e,r){try{if("function"==typeof t){var i="function"==typeof t.C;i&&t.C(),i&&null==e||(t.C=t(e))}else t.current=e}catch(t){n.v(t,r)}}function W(t,e,r){var i,o;if(n.unmount&&n.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.v||L(i,null,e)),null!=(i=t.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){n.v(t,e)}i.base=i.O=null}if(i=t.i)for(o=0;o<i.length;o++)i[o]&&W(i[o],e,r||"function"!=typeof t.type);r||w(t.v),t.k=t.m=t.v=void 0}function F(t,e,n){return this.constructor(t,n)}e=p.slice,n={v:function(t,e,n,r){for(var i,o,s;e=e.m;)if((i=e.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.I),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.I),s)return i.j=i}catch(e){t=e}throw t}},r=0,S.prototype.setState=function(t,e){var n;n=null!=this.W&&this.W!=this.state?this.W:this.W=v({},this.state),"function"==typeof t&&(t=t(v({},n),this.props)),t&&v(n,t),null!=t&&this._&&(e&&this.L.push(e),N(this))},S.prototype.forceUpdate=function(t){this._&&(this.v=!0,t&&this.A.push(t),N(this))},S.prototype.render=k,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t._.p-e._.p},E.P=0,c=/(PointerCapture)$|Capture$/i,l=0,u=P(!1),d=P(!0),h=0,function(t){t.NETWORK_ERROR="NETWORK_ERROR",t.API_ERROR="API_ERROR",t.VALIDATION_ERROR="VALIDATION_ERROR",t.STORAGE_ERROR="STORAGE_ERROR",t.TIMEOUT_ERROR="TIMEOUT_ERROR",t.MAINTENANCE_ERROR="MAINTENANCE_ERROR"}(f||(f={}));class q extends Error{constructor(t,e,n=!1,r,i,o){super(e),this.type=t,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class B{handleNetworkError(t){return new q(f.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new q(f.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const e=t.status>=500||429===t.status;return 429===t.status?new q(f.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new q(f.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new q(f.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new q(f.API_ERROR,`Request failed: ${t.statusText}`,e,t.status)}handleStorageError(t){return new q(f.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(t){return t.retryable}getUserFriendlyMessage(t){switch(t.type){case f.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case f.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case f.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case f.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case f.TIMEOUT_ERROR:return"Request timed out. Please try again.";case f.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}}class H{constructor(t){this.config=t}shouldRetry(t,e){return!(e>=this.config.maxRetries)&&this.isRetryableError(t)}getDelay(t,e){if(e){const t=parseInt(e,10);if(!isNaN(t))return 1e3*t}const n=this.config.baseDelay*Math.pow(2,t);return Math.min(n,this.config.maxDelay)}isRetryableError(t){return t instanceof q?t.retryable:!("TypeError"!==t.name||!t.message.includes("fetch"))||"AbortError"===t.name}}class U{constructor(t){this.config=t,this.retryStrategy=new H(t.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:e,body:n}){return this.executeWithRetry(async()=>{const r=new AbortController,i=setTimeout(()=>r.abort(),this.config.timeout);try{const o={method:e,headers:{"Content-Type":"application/json","X-Organisation-ID":this.config.orgId},signal:r.signal};n&&(o.body=JSON.stringify(n));const s=await fetch(t,o);if(clearTimeout(i),!s.ok)throw await this.handleApiError(s);const a=await s.json();return a.data||a}catch(t){if(clearTimeout(i),t instanceof q)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new q(f.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new q(f.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}getQuoteIntent(t){return this.makeRequest({url:t,method:"GET"})}createQuoteIntent(t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:t})}updateQuoteIntent(t,e){return this.makeRequest({url:t,method:"PUT",body:e})}deleteQuoteIntent(t){return this.makeRequest({url:t,method:"DELETE"})}calculateQuoteIntent(t){return this.makeRequest({url:t,method:"POST"})}initiatePayment(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/initiate`,method:"POST",body:t})}getPaymentStatus(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/status/${t}`,method:"GET"})}createPaymentLink(t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links`,method:"POST",body:t})}getPaymentLinkDetails(t){return this.makeRequest({url:t,method:"GET"})}async executeWithRetry(e){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return t(this.config.retryConfig.maxRetries),await e()}catch(e){n=e;const i=this.retryStrategy.shouldRetry(n,r);if(t(e instanceof q&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof q?e.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);t(),await new Promise(t=>setTimeout(t,s))}throw n}async handleApiError(e){var n;const r=e.headers.get("retry-after"),i=await e.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(e,i),503===e.status)return new q(f.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);if(429===e.status)return new q(f.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,e.status,r||void 0);if(e.status>=500){const t=i.message||"Service temporarily unavailable. Please try again in a moment.";return new q(f.API_ERROR,t,!1,e.status)}if(422===e.status)try{const t=i;return t.error&&t.error.details&&t.error.details.form_data?new q(f.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,e.status,void 0,t.error.details):new q(f.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,e.status,void 0,null===(n=t.error)||void 0===n?void 0:n.details)}catch(t){return new q(f.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,e.status)}if(400===e.status)try{const t=i;return t.errors?new q(f.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,e.status,void 0,t.errors):new q(f.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,e.status)}catch(t){return new q(f.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status)}if(e.status>=400&&e.status<500){const t=i.message||"Invalid request. Please refresh the page and try again.";return new q(f.API_ERROR,t,!1,e.status)}return new q(f.API_ERROR,`Request failed: ${e.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(e.status),e.status)}captureApiErrorToSentry(t,e){try{(t.status>=500||429===t.status)&&Promise.resolve().then(function(){return wd}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${t.status} ${t.statusText}`,category:"http",level:"error",data:{url:t.url,status:t.status,statusText:t.statusText}}),n(`API Error: ${t.status} - ${t.url}`,"error",{http:{status_code:t.status,url:t.url,method:"Unknown"},response:e}))}).catch(()=>{})}catch(t){}}}class Z{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return localStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{localStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{localStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{localStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const t="__insure_os_storage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch(t){return!1}}}class G{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return sessionStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{sessionStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{sessionStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{sessionStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const t="__insure_os_storage_test__";return sessionStorage.setItem(t,"test"),sessionStorage.removeItem(t),!0}catch(t){return!1}}}class Y{constructor(){this.storage=new Map}get(t){return this.storage.get(t)||null}set(t,e){this.storage.set(t,e)}remove(t){this.storage.delete(t)}clear(){this.storage.clear()}isAvailable(){return!0}}class J{static generateKey(t,e,n){const r=[this.KEY_PREFIX+t,e];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(t){try{return JSON.stringify({data:t,timestamp:Date.now(),version:"1.0"})}catch(t){throw new Error(`Failed to serialize data: ${t}`)}}static deserialize(t){try{const e=JSON.parse(t);return e&&"object"==typeof e&&e.data?e.data:null}catch(t){return null}}static getTimestamp(t){try{return JSON.parse(t).timestamp||null}catch(t){return null}}static isExpired(t,e){const n=this.getTimestamp(t);return!n||Date.now()-n>e}}J.KEY_PREFIX="insure_os_",J.SEPARATOR="_";class V{constructor(t,e={}){this.storageAdapter=t,this.config={defaultExpirationMs:e.defaultExpirationMs||V.DEFAULT_EXPIRATION_MS,namespace:e.namespace||V.DEFAULT_NAMESPACE}}saveQuoteIntent(t,e){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(t),r=J.serialize(e);this.storageAdapter.set(n,r)}catch(t){}}getQuoteIntent(t){if(!this.storageAdapter.isAvailable())return null;try{const e=this.generateStorageKey(t),n=this.storageAdapter.get(e);if(!n)return null;const r=J.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(t),null)}catch(t){return null}}removeQuoteIntent(t){if(this.storageAdapter.isAvailable())try{const e=this.generateStorageKey(t);this.storageAdapter.remove(e)}catch(t){}}isQuoteIntentValid(t){if(!t||"object"!=typeof t)return!1;if(!t.id||!t.url||!t.org_id)return!1;const e=Date.now();return!(t.expires_at&&e>t.expires_at||t.created_at&&e-t.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(t){return J.generateKey(this.config.namespace,t)}}V.DEFAULT_EXPIRATION_MS=864e5,V.DEFAULT_NAMESPACE="quote_intent";class Q{constructor(t){this.stateManager=t}async getOrCreateQuoteIntent(t,e,n){const r=this.stateManager.getQuoteIntent(t);if(r&&this.stateManager.isQuoteIntentValid(r)){const e=await n(r.url);return this.stateManager.saveQuoteIntent(t,e),e}try{const n=await e();return this.stateManager.saveQuoteIntent(t,n),n}catch(e){throw r&&this.stateManager.removeQuoteIntent(t),e}}updateQuoteIntent(t,e){const n=this.stateManager.getQuoteIntent(t);if(!n)return null;const r={...n,...e};return this.stateManager.saveQuoteIntent(t,r),r}clearQuoteIntent(t){this.stateManager.removeQuoteIntent(t)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(t){const e=this.stateManager.getQuoteIntent(t);return null!==e&&this.stateManager.isQuoteIntentValid(e)}getQuoteIntentUrl(t){const e=this.stateManager.getQuoteIntent(t);return(null==e?void 0:e.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class X{constructor(t,e){this.saveCallback=e,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=t}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,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 0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1)}handleSaveError(t){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(t))}dispatchErrorEvent(t){if("undefined"!=typeof window){const e=new CustomEvent("form-autosave-error",{detail:{error:t,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(e)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function K(t,e){var n;const r=[];if("checkbox"===t.type&&t.required&&!0!==e&&"true"!==e)return r.push({field:t.code||t.id,message:`${t.label} must be accepted`}),r;"boolean"===t.type&&(null===(n=t.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===t.boolean_config.show_details_on&&(!0===e||"true"===e)||t.boolean_config.show_details_on);const i="boolean"===t.type?null==e:null==e||""===e;if(t.required&&i)return r.push({field:t.code||t.id,message:`${t.label} is required`}),r;if(!t.required&&i)return r;const o=t.validation;if(!o)return r;const s=String(e),a="number"==typeof e?e:parseFloat(s);return o.pattern&&"text"===t.type&&(new RegExp(o.pattern).test(s)||r.push({field:t.code||t.id,message:`${t.label} format is invalid`})),o.minLength&&s.length<o.minLength&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.maxLength} characters`}),"number"!==t.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:t.code||t.id,message:`${t.label} must be in increments of ${o.step}`})),r}function tt(t,e){var n,r;const i=[];for(const r of t.fields){const t=r.code||r.id,o=e[t],s=K(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=(e.U||{})[t];n&&""!==n.trim()||i.push({field:t,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=t.validation)||void 0===r?void 0:r.required_fields)for(const n of t.validation.required_fields){const r=t.fields.find(t=>(t.code||t.id)===n),o=e[n];if(r){const t=r.code||r.id,e=i.find(e=>e.field===t);if(e)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:t,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&i.push({field:t,message:`${r.label} is required`})}}return{isValid:0===i.length,errors:i}}function et(t){const e=[];let n;if("object"==typeof t&&null!==t&&("validation_errors"in t&&t.validation_errors&&"object"==typeof t.validation_errors?n=t.validation_errors:"errors"in t&&t.errors&&"object"==typeof t.errors?n=t.errors:"message"in t||"validation_errors"in t||"errors"in t||(n=t)),n)for(const[t,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)e.push({field:t,message:n});return e}function nt(t){return t.reduce((t,e)=>(t[e.field]||(t[e.field]=[]),t[e.field].push(e),t),{})}class rt{constructor(t,e,n){this.httpClient=t,this.definition=e,this.quoteIntentStore=n}async load(t,e){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(t)){const t=await this.httpClient.getQuoteIntent(e);if(t.quote_intent.form_data)return t.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(e)).quote_intent.form_data||this.createEmptyFormData()}async save(t,e,n,r){try{const t=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(e,t),{success:!0}}catch(t){if(t&&"object"==typeof t&&"validationErrors"in t){const e=t.validationErrors;if(e&&"object"==typeof e)return{success:!1,validationErrors:et(e)}}throw t}}prepareSavePayload(t,e){const n=this.getCurrentPageId(t);return{current_page_index:t.current_page,current_page_id:n,page_data:t.page_data,save_type:e.saveType}}getCurrentPageId(t){const e=this.definition;if(!e||!t.page_data)return;const n=t.current_page;if(n<0||n>=e.pages.length)return;const r=e.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 it{constructor(t,e,n,r){this.formDefinition=t,this.getFormData=e,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(t){const e=this.getFormData().current_page;if(t<=e)return!0;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<t;r++)if(r!==e&&!n.includes(r))return!1;return!0}async navigateToPage(t){if(t<0||t>=this.getTotalPages())return!1;if(!this.canNavigateToPage(t))return!1;const e=this.getFormData().current_page;if(t>e)try{await this.saveCallback(!0,"page")}catch(t){return t&&"object"==typeof t&&t.isValidationError,!1}return t>e&&this.markPageCompleted(e),this.updateFormData({current_page:t,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const t=this.getFormData().current_page;return this.navigateToPage(t+1)}navigateToPrevious(){const t=this.getFormData().current_page;return this.navigateToPage(t-1)}markPageCompleted(t){const e=this.getFormData();if(!e.completed_pages.includes(t)){const n=[...e.completed_pages,t].sort((t,e)=>t-e);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const t=this.getFormData(),e=this.getTotalPages(),n=[...t.completed_pages];return{totalPages:e,currentPage:t.current_page,completedPages:n,percentComplete:n.length/e*100}}isStagingEnvironment(){const t=window.location.hostname;return"localhost"===t||t.endsWith(".test")||t.includes("staging")}}class ot{constructor(t){this.httpClient=t}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}function st(t,e,n){var r,i,o,s;const a=Date.now(),c=`${t}-${a}`;if(function(t,e,n){try{Promise.resolve().then(function(){return wd}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${e}`,category:"error",level:"error",data:{errorType:e,customMessage:n}}),r(t,{errorType:e,customMessage:n}))}).catch(()=>{})}catch(t){}}(e,t,n),e&&"object"==typeof e){if("statusCode"in e||"status"in e)return at(c,t,e.statusCode||e.status||500,e.message||(null===(r=e.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in e)return at(c,t,(null===(i=e.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||e.message||"Network error occurred",n,a);if(e.message)return{id:c,type:t,severity:lt(t),title:ct(t),message:n||e.message,retryable:dt(t,0),timestamp:a,trackingId:c}}const l="string"==typeof e?e:"An unexpected error occurred";return{id:c,type:t,severity:lt(t),title:ct(t),message:n||l,retryable:dt(t,0),timestamp:a,trackingId:c}}function at(t,e,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=dt(e,n);return{id:t,type:e,severity:s,statusCode:n,title:ct(e,n),message:i||ut(e,n,r),details:r,retryable:a,timestamp:o}}function ct(t,e){if(e){if(404===e)return"Not Found";if(503===e)return"Service Unavailable";if(e>=500)return"Server Error";if(e>=400)return"Validation Error"}switch(t){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 lt(t){switch(t){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ut(t,e,n){return"calculation"===t&&(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===e?"initialization"===t?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===e?"We're performing scheduled maintenance. Please check back in a few minutes.":e>=500?"calculation"===t?"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===e?"Too many requests. Please wait a moment and try again.":e>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function dt(t,e){return"validation"!==t&&"maintenance"!==t&&404!==e&&503!==e&&!(e>=400&&e<500&&429!==e)&&("network"===t||"calculation"===t||e>=500&&503!==e||429===e)}function ht(t){return"initialization"===t.type&&"critical"===t.severity}function ft(t){return"maintenance"===t.type||503===t.statusCode}function mt(t){return t.trackingId?`If this problem persists, please contact support and reference error ID: ${t.trackingId.slice(0,8).toUpperCase()}`:"critical"===t.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let pt=null;function gt(t){pt=t}function yt(){return pt}function vt(t,e){var n,r;return{event:e,quote_id:t.id,organisation_slug:null===(n=t.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=t.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function wt(t){var e,n;if(!(null==pt?void 0:pt.isEnabled()))return;const r={...vt(t,"quote_started"),quote_status:t.status,total_pages:null===(n=null===(e=t.form_definition)||void 0===e?void 0:e.pages)||void 0===n?void 0:n.length};pt.push(r)}function bt(t,e,n,r){var i,o;if(!(null==pt?void 0:pt.isEnabled()))return;const s=(null===(o=null===(i=t.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={...vt(t,"quote_form_progress"),current_page:e,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};pt.push(c)}function xt(t,e){if(!(null==pt?void 0:pt.isEnabled()))return;const n=e.calculations||[],r=e.payment_options||[],i=n.find(t=>t.id===e.default_excess_id),o=n.map(t=>t.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,c=r.some(t=>"monthly"===t.amount.frequency),l={...vt(t,"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};pt.push(l)}function kt(t,e,n,r,i){if(!(null==pt?void 0:pt.isEnabled()))return;const o={...vt(t,"quote_at_checkout"),excess_id:e.id,excess_amount:e.excess_amount,premium_subtotal:e.premium_subtotal,premium_total:e.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:e.fees};pt.push(o)}function St(t,e){if(!(null==pt?void 0:pt.isEnabled()))return;const n=e.referrals||[],r={...vt(t,"quote_referred"),referral_reason:e.referral_reason,referrals_count:n.length,referral_ids:n.map(t=>t.id)};pt.push(r)}function $t(t,e,n,r){if(!(null==pt?void 0:pt.isEnabled()))return;const i={...vt(t,"payment_initiated"),payment_amount:e.amount.dueToday,payment_gateway:e.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:e.amount.frequency,amount_due_today:e.amount.dueToday,installments_count:e.amount.numberOfInstallments};pt.push(i)}function _t(t,e,n,r,i,o){if(!(null==pt?void 0:pt.isEnabled()))return;const s={...vt(t,"payment_completed"),transaction_id:e,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};pt.push(s)}function Nt(t,e,n,r,i,o){if(!(null==pt?void 0:pt.isEnabled()))return;const s={...vt(t,"payment_failed"),transaction_id:e,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};pt.push(s)}class Et{constructor(t,e,n,r={}){this.quoteIntent=t,this.httpClient=e,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=t.form_definition;this.persistenceManager=new rt(e,i,n),this.autoSaveManager=new X(this.config,this.saveFormData.bind(this)),this.navigationManager=new it(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ot(e),this.config.autoSave&&this.autoSaveManager.start()}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}async loadFormProgress(){var t,e;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(e=null===(t=this.formData.page_data)||void 0===t?void 0:t.Y)||void 0===e?void 0:e.lastCalculationFailed),this.notify(),this.formData}updatePageData(t,e){this.pendingChanges[t]={...this.pendingChanges[t],...e},this.formData.page_data={...this.formData.page_data,[t]:{...this.formData.page_data[t],...e}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(t,e,n){this.autoSaveManager.startTyping(),this.pendingChanges[t]||(this.pendingChanges[t]={}),this.pendingChanges[t][e]=n,this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t][e]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(t,e,n),this.notify()}updateFieldAnswer(t,e,n){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[e]=n,this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){this.isUserTyping()||(this.formData=t,this.notify())}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,e.default_excess_id&&(this.selectedExcessId=e.default_excess_id),t(),this.notify(),t()}processRatingFactorMappings(t){const e=this.getFormDefinition(),n={};return e.pages.forEach(e=>{const r=t.page_data[e.id]||{};e.fields.forEach(t=>{const e=r[t.code||t.id];null!=e&&""!==e&&t.rating_factor_mappings&&t.rating_factor_mappings.length>0&&t.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(e,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${t.code||t.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){return t(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(e,r):null}calculateAge(t,e){try{const n=new Date(t),r="current_date"===(null==e?void 0:e.reference_date)?new Date:new Date((null==e?void 0:e.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(t){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const t=this.formData;r.current_page===t.current_page?this.formData=o:this.formData={...o,current_page:t.current_page,completed_pages:t.completed_pages,last_updated:t.last_updated},this.notify()}}catch(t){if(t&&"object"==typeof t&&"type"in t&&"message"in t){const e=t;if(!e.validationErrors||0===Object.keys(e.validationErrors).length){const t=st("validation",e);this.addGeneralError(t),this.notify()}}throw t}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(t){return this.navigationManager.canNavigateToPage(t)}navigateToPage(t){return this.navigationManager.navigateToPage(t)}async navigateToNextPage(){var t,e;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(e=null===(t=this.quoteIntent.form_definition)||void 0===t?void 0:t.pages[n-1])||void 0===e?void 0:e.title;bt(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(t){this.selectedExcessId=t,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(t){this.selectedPaymentOption=t,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const t=this.getCurrentPageIndex(),e=this.getFormDefinition().pages[t];if(!e)return[];const n=tt(e,this.formData.page_data[e.id]||{});return this.validationErrors=n.errors,this.notify(),n.errors}validateField(t,e,n){const r=this.getFormDefinition().pages.find(e=>e.id===t),i=null==r?void 0:r.fields.find(t=>(t.code||t.id)===e);if(!i)return[];const o=K(i,n);return this.validationErrors=this.validationErrors.filter(t=>t.field!==e),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(t){return this.getValidationErrors().filter(e=>e.field===t)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(t){return this.getFieldErrors(t).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(t){this.serverValidationErrors=t,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const t=this.generalErrors.filter(t=>!t.dismissed);return t.length>0?[t[t.length-1]]:[]}addGeneralError(t){this.generalErrors.push(t),this.notify()}dismissGeneralError(t){const e=this.generalErrors.find(e=>e.id===t);e&&(e.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 t=this.getFormDefinition(),e={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return Ts});t.pages.forEach(t=>{const r=this.formData.page_data[t.id]||{},i={};t.fields.forEach(t=>{const e=t.code||t.id,o=r[e];let s=!0;if(t.visibility){const e=n(r,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions});s="show"===t.visibility.action?e.matched:!e.matched}s&&void 0!==o&&(i[e]=o)}),e.page_data[t.id]=i});const r=this.processRatingFactorMappings(e),i={...e,page_data:{...e.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[];for(const r of e.pages){const e=tt(r,this.formData.page_data[r.id]||{});t(r.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{this.isCalculating=!0,this.notify();const t=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=t,this.selectedExcessId=t.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const e=this.generalErrors.filter(t=>"calculation"===t.type);return e.forEach(t=>this.dismissGeneralError(t.id)),"calculation"===t.outcome_type?xt(this.quoteIntent,t):"referral"===t.outcome_type&&St(this.quoteIntent,t),t}catch(t){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const e={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=e,e}finally{this.isCalculating=!1,this.notify()}}notify(){this.subscribers.forEach(t=>t(this))}updateFormDataInternal(t){if(this.isUserTyping()&&t.page_data){const e={...t};delete e.page_data,this.formData={...this.formData,...e}}else this.formData={...this.formData,...t};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var t,e,n;return!!(null===(n=null===(e=null===(t=this.quoteIntent.form_data)||void 0===t?void 0:t.page_data)||void 0===e?void 0:e.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 t=new URL(window.location.href);t.searchParams.delete("url"),window.history.replaceState({},document.title,t.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(t){if(this.quoteIntentStore){const e=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,t);e&&(this.quoteIntent=e,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return s&&$t(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),t}catch(t){throw t}}async getPaymentStatus(t){var e;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(e=this.calculationResult)||void 0===e?void 0:e.payment_gateways)||[]).find(t=>t.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const e=await this.httpClient.getPaymentStatus(t,r);return this.notify(),e}catch(t){throw t}}startPaymentStatusPolling(t,e,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(t);e(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(t){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Tt{constructor(t,e){this.httpClient=t,this.response=e}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(t){const e=this.response.product.form_definition,n={...this.response.quote_intent.form_data};for(const r of e.pages){const e=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;t.hasOwnProperty(r)?e[r]=t[r]:("text"===n.type&&(e[r]="sample"),"number"===n.type&&(e[r]=1),"checkbox"===n.type&&(e[r]=!0))}n.page_data[r.id]=e}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class Ct{constructor(t){this.httpClient=t}async createQuoteIntent(t,e){const n=await this.httpClient.createQuoteIntent({code:t,...e});return new Tt(this.httpClient,n)}}var It=0;function Mt(t,e,r,i,o,s){e||(e={});var a,c,l=e;if("ref"in l)for(c in l={},e)"ref"==c?a=e[c]:l[c]=e[c];var u={type:t,props:l,key:r,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:--It,N:-1,C:0,V:o,X:s};if("function"==typeof t&&(a=t.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return n.vnode&&n.vnode(u),u}var Dt,Pt,Ot,Rt,jt=0,At=[],zt=n,Lt=zt.p,Wt=zt.P,Ft=zt.diffed,qt=zt.k,Bt=zt.unmount,Ht=zt.m;function Ut(t,e){zt.A&&zt.A(Pt,t,jt||e),jt=0;var n=Pt.K||(Pt.K={m:[],A:[]});return t>=n.m.length&&n.m.push({}),n.m[t]}function Zt(t){return jt=1,function(t,e){var n=Ut(Dt++,2);if(n.t=t,!n.k&&(n.m=[ne(void 0,e),function(t){var e=n.et?n.et[0]:n.m[0],r=n.t(e,t);e!==r&&(n.et=[r,n.m[1]],n.k.setState({}))}],n.k=Pt,!Pt.nt)){var r=function(t,e,r){if(!n.k.K)return!0;var o=n.k.K.m.filter(function(t){return!!t.k});if(o.every(function(t){return!t.et}))return!i||i.call(this,t,e,r);var s=n.k.props!==t;return o.forEach(function(t){if(t.et){var e=t.m[0];t.m=t.et,t.et=void 0,e!==t.m[0]&&(s=!0)}}),i&&i.call(this,t,e,r)||s};Pt.nt=!0;var i=Pt.shouldComponentUpdate,o=Pt.componentWillUpdate;Pt.componentWillUpdate=function(t,e,n){if(this.v){var s=i;i=void 0,r(t,e,n),i=s}o&&o.call(this,t,e,n)},Pt.shouldComponentUpdate=r}return n.et||n.m}(ne,t)}function Gt(t,e){var n=Ut(Dt++,3);!zt.W&&ee(n.K,e)&&(n.m=t,n.u=e,Pt.K.A.push(n))}function Yt(t){return jt=5,Jt(function(){return{current:t}},[])}function Jt(t,e){var n=Ut(Dt++,7);return ee(n.K,e)&&(n.m=t(),n.K=e,n.A=t),n.m}function Vt(){for(var t;t=At.shift();)if(t.O&&t.K)try{t.K.A.forEach(Kt),t.K.A.forEach(te),t.K.A=[]}catch(e){t.K.A=[],zt.v(e,t._)}}zt.p=function(t){Pt=null,Lt&&Lt(t)},zt.m=function(t,e){t&&e.i&&e.i.B&&(t.B=e.i.B),Ht&&Ht(t,e)},zt.P=function(t){Wt&&Wt(t),Dt=0;var e=(Pt=t.k).K;e&&(Ot===Pt?(e.A=[],Pt.A=[],e.m.forEach(function(t){t.et&&(t.m=t.et),t.u=t.et=void 0})):(e.A.forEach(Kt),e.A.forEach(te),e.A=[],Dt=0)),Ot=Pt},zt.diffed=function(t){Ft&&Ft(t);var e=t.k;e&&e.K&&(e.K.A.length&&(1!==At.push(e)&&Rt===zt.requestAnimationFrame||((Rt=zt.requestAnimationFrame)||Xt)(Vt)),e.K.m.forEach(function(t){t.u&&(t.K=t.u),t.u=void 0})),Ot=Pt=null},zt.k=function(t,e){e.some(function(t){try{t.A.forEach(Kt),t.A=t.A.filter(function(t){return!t.m||te(t)})}catch(n){e.some(function(t){t.A&&(t.A=[])}),e=[],zt.v(n,t._)}}),qt&&qt(t,e)},zt.unmount=function(t){Bt&&Bt(t);var e,n=t.k;n&&n.K&&(n.K.m.forEach(function(t){try{Kt(t)}catch(t){e=t}}),n.K=void 0,e&&zt.v(e,n._))};var Qt="function"==typeof requestAnimationFrame;function Xt(t){var e,n=function(){clearTimeout(r),Qt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Qt&&(e=requestAnimationFrame(n))}function Kt(t){var e=Pt,n=t.k;"function"==typeof n&&(t.k=void 0,n()),Pt=e}function te(t){var e=Pt;t.k=t.m(),Pt=e}function ee(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function ne(t,e){return"function"==typeof e?e(t):e}const re="insure-os";let ie=!1;const oe=new Map,se={[`--${re}-radius`]:"0.75rem",[`--${re}-radius-sm`]:"0.5rem",[`--${re}-radius-lg`]:"1rem",[`--${re}-background`]:"oklch(0.955 0 0)",[`--${re}-foreground`]:"oklch(0.145 0 0)",[`--${re}-card`]:"oklch(1 0 0)",[`--${re}-card-foreground`]:"oklch(0.145 0 0)",[`--${re}-popover`]:"oklch(1 0 0)",[`--${re}-popover-foreground`]:"oklch(0.145 0 0)",[`--${re}-primary`]:"oklch(0.205 0 0)",[`--${re}-primary-foreground`]:"oklch(0.985 0 0)",[`--${re}-secondary`]:"oklch(0.97 0 0)",[`--${re}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${re}-muted`]:"oklch(0.97 0 0)",[`--${re}-muted-foreground`]:"oklch(0.556 0 0)",[`--${re}-accent`]:"oklch(0.97 0 0)",[`--${re}-accent-foreground`]:"oklch(0.205 0 0)",[`--${re}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${re}-border`]:"oklch(0.9 0 0)",[`--${re}-input`]:"oklch(0.9 0 0)",[`--${re}-ring`]:"oklch(0.708 0 0)",[`--${re}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${re}-font-size-large`]:"18px",[`--${re}-font-size-small`]:"14px",[`--${re}-font-size`]:"16px",[`--${re}-border-width`]:"1px",[`--${re}-transition-duration`]:"200ms",[`--${re}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${re}-shadow-sm`]:"0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)",[`--${re}-shadow`]:"0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.12)",[`--${re}-shadow-md`]:"0 4px 8px -1px rgba(0, 0, 0, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.14)",[`--${re}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${re}-spacing-sm`]:"0.75rem",[`--${re}-spacing`]:"1rem",[`--${re}-spacing-md`]:"1.5rem",[`--${re}-spacing-lg`]:"2rem",[`--${re}-spacing-xl`]:"3rem"},ae={colors:{background:`var(--${re}-background)`,foreground:`var(--${re}-foreground)`,card:`var(--${re}-card)`,popover:`var(--${re}-popover)`,popoverForeground:`var(--${re}-popover-foreground)`,primary:`var(--${re}-primary)`,primaryForeground:`var(--${re}-primary-foreground)`,secondary:`var(--${re}-secondary)`,muted:`var(--${re}-muted)`,mutedForeground:`var(--${re}-muted-foreground)`,accent:`var(--${re}-accent)`,accentForeground:`var(--${re}-accent-foreground)`,destructive:`var(--${re}-destructive)`,border:`var(--${re}-border)`,input:`var(--${re}-input)`,ring:`var(--${re}-ring)`},fontSize:{small:`var(--${re}-font-size-small)`,default:`var(--${re}-font-size)`,large:`var(--${re}-font-size-large)`},radius:{small:`var(--${re}-radius-sm)`,default:`var(--${re}-radius)`,large:`var(--${re}-radius-lg)`},shadow:{sm:`var(--${re}-shadow-sm)`,md:`var(--${re}-shadow-md)`},spacing:{sm:`var(--${re}-spacing-sm)`,md:`var(--${re}-spacing-md)`,lg:`var(--${re}-spacing-lg)`,xl:`var(--${re}-spacing-xl)`},fontFamily:`var(--${re}-font-family)`,borderWidth:`var(--${re}-border-width)`,transition:`var(--${re}-transition-duration) var(--${re}-transition-timing-function)`},ce=new Set;function le(t){if(!document.getElementById(`${re}-styles`)){const t=document.createElement("style");t.id=`${re}-styles`,document.head.appendChild(t)}document.getElementById(`${re}-styles`).textContent+=t+"\n"}function ue(t){return Object.entries(t).map(([t,e])=>{return`${n=t,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${e}`;var n}).join("; ")}function de(){ie||(le(`:root {\n${Object.entries(se).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`),ie=!0)}const he={name:t=>`${re}-${t}`,selector(t){return`.${this.name(t)}`},create(t,e,n){de();const r=ue(e),i=function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e).toString(36)}(`${t}:${r}:${n?JSON.stringify(n):""}`),o=`${t}-${i}`,s=oe.get(o);if(s)return s.fullClassName;let a=t;const c=this.name(a);return ce.has(a)||(le(`.${c} { ${r} }`),ce.add(a)),oe.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([t,e])=>{this.media(t,{[a]:e})}),c},keyframes(t,e){const n=`${re}-${t}`;return ce.has(`keyframes-${t}`)||(le(`@keyframes ${n} {\n${Object.entries(e).map(([t,e])=>` ${t} { ${ue(e)} }`).join("\n")}\n}`),ce.add(`keyframes-${t}`)),n},media(t,e){const n=`media-${t}`;le(`@media ${t} {\n${Object.entries(e).map(([t,e])=>` .${re}-${t} { ${ue(e)} }`).join("\n")}\n}`),ce.add(n)},pseudoElement(t,e,n){const r=`${re}-${t}`,i=`${t}-${e}`;return ce.has(i)||(le(`.${r}${e} { ${ue(n)} }`),ce.add(i)),r}};var fe=Object.freeze({__proto__:null,baseVariables:se,styles:he,theme:ae,updateBaseVariables:function(e){t(),Object.assign(se,e);const n=document.getElementById(`${re}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(se).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else de()}});function me(t){return t&&t.rt&&{}.hasOwnProperty.call(t,"default")?t.default:t}var pe,ge={exports:{}};function ye(){return pe||(pe=1,t=ge,function(){var e={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=i(t,r(n)))}return t}function r(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!=={}.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var o in t)e.call(t,o)&&t[o]&&(r=i(r,o));return r}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(n.default=n,t.exports=n):window.classNames=n}()),ge.exports;var t}var ve=me(ye());function we({size:t="small"}){const e=he.create("spinner-small",{width:"16px",height:"16px"}),n=he.create("spinner-large",{width:"64px",height:"64px"}),r="small"===t?e:n;return he.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Mt("div",{className:he.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Mt("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:ve(r),children:Mt("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function be({className:t,children:e,size:n="md"}){const r={sm:ae.spacing.sm,md:ae.spacing.md,lg:ae.spacing.lg,xl:ae.spacing.xl},i=he.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?ae.spacing.lg:"lg"===n?ae.spacing.md:r[n]},"(max-width: 480px)":{padding:ae.spacing.sm}});return Mt("div",{className:ve(i,t),children:e})}const xe=function(){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&n.forEach(function(t){t.v=!0,N(t)})},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),e.children}return t.k="__cC"+h++,t.m=null,t.Provider=t.it=(t.Consumer=function(t,e){return t.children(e)}).contextType=t,t}();function ke({children:t,httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i}){return Mt(xe.Provider,{value:{httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i,currentRetryAttempt:0,maxRetryAttempts:3},children:t})}function Se(){const t=function(t){var e=Pt.context[t.k],n=Ut(Dt++,9);return n.c=t,e?(null==n.m&&(n.m=!0,e.sub(Pt)),e.props.value):t.m}(xe);if(!t)throw new Error("useFormContext must be used within a FormContext provider");return t}function $e(t){const e=Se(),{formStateManager:n}=e;if(!n||"function"!=typeof n.subscribe)throw new Error("FormStateManager is not properly initialized. This component should not render during initialization errors.");const[r,i]=Zt(()=>t(n));return Gt(()=>n.subscribe(()=>{i(t(n))}),[n,t]),{...r,fsm:n}}class _e extends Error{}class Ne extends _e{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Ee extends _e{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class Te extends _e{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Ce extends _e{}class Ie extends _e{constructor(t){super(`Invalid unit ${t}`)}}class Me extends _e{}class De extends _e{constructor(){super("Zone is an abstract class")}}const Pe="numeric",Oe="short",Re="long",je={year:Pe,month:Pe,day:Pe},Ae={year:Pe,month:Oe,day:Pe},ze={year:Pe,month:Oe,day:Pe,weekday:Oe},Le={year:Pe,month:Re,day:Pe},We={year:Pe,month:Re,day:Pe,weekday:Re},Fe={hour:Pe,minute:Pe},qe={hour:Pe,minute:Pe,second:Pe},Be={hour:Pe,minute:Pe,second:Pe,timeZoneName:Oe},He={hour:Pe,minute:Pe,second:Pe,timeZoneName:Re},Ue={hour:Pe,minute:Pe,hourCycle:"h23"},Ze={hour:Pe,minute:Pe,second:Pe,hourCycle:"h23"},Ge={hour:Pe,minute:Pe,second:Pe,hourCycle:"h23",timeZoneName:Oe},Ye={hour:Pe,minute:Pe,second:Pe,hourCycle:"h23",timeZoneName:Re},Je={year:Pe,month:Pe,day:Pe,hour:Pe,minute:Pe},Ve={year:Pe,month:Pe,day:Pe,hour:Pe,minute:Pe,second:Pe},Qe={year:Pe,month:Oe,day:Pe,hour:Pe,minute:Pe},Xe={year:Pe,month:Oe,day:Pe,hour:Pe,minute:Pe,second:Pe},Ke={year:Pe,month:Oe,day:Pe,weekday:Oe,hour:Pe,minute:Pe},tn={year:Pe,month:Re,day:Pe,hour:Pe,minute:Pe,timeZoneName:Oe},en={year:Pe,month:Re,day:Pe,hour:Pe,minute:Pe,second:Pe,timeZoneName:Oe},nn={year:Pe,month:Re,day:Pe,weekday:Re,hour:Pe,minute:Pe,timeZoneName:Re},rn={year:Pe,month:Re,day:Pe,weekday:Re,hour:Pe,minute:Pe,second:Pe,timeZoneName:Re};class on{get type(){throw new De}get name(){throw new De}get ianaName(){return this.name}get isUniversal(){throw new De}offsetName(t,e){throw new De}formatOffset(t,e){throw new De}offset(t){throw new De}equals(t){throw new De}get isValid(){throw new De}}let sn=null;class an extends on{static get instance(){return null===sn&&(sn=new an),sn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Er(t,e,n)}formatOffset(t,e){return Mr(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}const cn=new Map,ln={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},un=new Map;class dn extends on{static create(t){let e=un.get(t);return void 0===e&&un.set(t,e=new dn(t)),e}static resetCache(){un.clear(),cn.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=dn.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Er(t,e,n,this.name)}formatOffset(t,e){return Mr(this.offset(t),e)}offset(t){if(!this.valid)return NaN;const e=new Date(t);if(isNaN(e))return NaN;const n=function(t){let e=cn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),cn.set(t,e)),e}(this.name);let[r,i,o,s,a,c,l]=n.formatToParts?function(t,e){const n=t.formatToParts(e),r=[];for(let t=0;t<n.length;t++){const{type:e,value:i}=n[t],o=ln[e];"era"===e?r[o]=i:sr(o)||(r[o]=parseInt(i,10))}return r}(n,e):function(t,e){const n=t.format(e).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,e);"BC"===s&&(r=1-Math.abs(r));let u=+e;const d=u%1e3;return u-=d>=0?d:1e3+d,(Sr({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:l,millisecond:0})-u)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let hn={};const fn=new Map;function mn(t,e={}){const n=JSON.stringify([t,e]);let r=fn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(t,e),fn.set(n,r)),r}const pn=new Map,gn=new Map;let yn=null;const vn=new Map;function wn(t){let e=vn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),vn.set(t,e)),e}const bn=new Map;function xn(t,e,n,r){const i=t.listingMode();return"error"===i?null:"en"===i?n(e):r(e)}class kn{constructor(t,e,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!e||Object.keys(o).length>0){const e={useGrouping:!1,...n};n.padTo>0&&(e.minimumIntegerDigits=n.padTo),this.inf=function(t,e={}){const n=JSON.stringify([t,e]);let r=pn.get(n);return void 0===r&&(r=new Intl.NumberFormat(t,e),pn.set(n,r)),r}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return pr(this.floor?Math.floor(t):wr(t,3),this.padTo)}}class Sn{constructor(t,e,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,n=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&dn.create(n).valid?(r=n,this.dt=t):(r="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,r=t.zone.name):(r="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=mn(e,i)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t}):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class $n{constructor(t,e,n){this.opts={style:"long",...n},!e&&lr()&&(this.rtf=function(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let o=gn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(t,e),gn.set(i,o)),o}(t,n))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,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(t);if("auto"===n&&o){const n="days"===t;switch(e){case 1:return n?"tomorrow":`next ${i[t][0]}`;case-1:return n?"yesterday":`last ${i[t][0]}`;case 0:return n?"today":`this ${i[t][0]}`}}const s=Object.is(e,-0)||e<0,a=Math.abs(e),c=1===a,l=i[t],u=r?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const _n={firstDay:1,minimalDays:4,weekend:[6,7]};class Nn{static fromOpts(t){return Nn.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,n,r,i=!1){const o=t||Hn.defaultLocale,s=o||(i?"en-US":yn||(yn=(new Intl.DateTimeFormat).resolvedOptions().locale,yn)),a=e||Hn.defaultNumberingSystem,c=n||Hn.defaultOutputCalendar,l=fr(r)||Hn.defaultWeekSettings;return new Nn(s,a,c,l,o)}static resetCache(){yn=null,fn.clear(),pn.clear(),gn.clear(),vn.clear(),bn.clear()}static fromObject({locale:t,numberingSystem:e,outputCalendar:n,weekSettings:r}={}){return Nn.create(t,e,n,r)}constructor(t,e,n,r,i){const[o,s,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(-1===n)return[t];{let e,r;try{e=mn(t).resolvedOptions(),r=t}catch(i){const o=t.substring(0,n);e=mn(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=e;return[r,i,o]}}(t);this.locale=o,this.numberingSystem=e||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(t,e,n){return n||e?(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`),t):t}(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 t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===wn(t.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?Nn.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,fr(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return xn(this,t,jr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(e&=!n)?{month:t,day:"numeric"}:{month:t},i=e?"format":"standalone";if(!this.monthsCache[i][t]){const e=n?t=>this.dtFormatter(t,r).format():t=>this.extract(t,r,"month");this.monthsCache[i][t]=function(t){const e=[];for(let n=1;n<=12;n++){const r=Lo.utc(2009,n,1);e.push(t(r))}return e}(e)}return this.monthsCache[i][t]})}weekdays(t,e=!1){return xn(this,t,Wr,()=>{const n=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},r=e?"format":"standalone";return this.weekdaysCache[r][t]||(this.weekdaysCache[r][t]=function(t){const e=[];for(let n=1;n<=7;n++){const r=Lo.utc(2016,11,13+n);e.push(t(r))}return e}(t=>this.extract(t,n,"weekday"))),this.weekdaysCache[r][t]})}meridiems(){return xn(this,void 0,()=>Fr,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Lo.utc(2016,11,13,9),Lo.utc(2016,11,13,19)].map(e=>this.extract(e,t,"dayperiod"))}return this.meridiemCache})}eras(t){return xn(this,t,Ur,()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[Lo.utc(-40,1,1),Lo.utc(2017,1,1)].map(t=>this.extract(t,e,"era"))),this.eraCache[t]})}extract(t,e,n){const r=this.dtFormatter(t,e).formatToParts().find(t=>t.type.toLowerCase()===n);return r?r.value:null}numberFormatter(t={}){return new kn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new Sn(t,this.intl,e)}relFormatter(t={}){return new $n(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const n=JSON.stringify([t,e]);let r=hn[n];return r||(r=new Intl.ListFormat(t,e),hn[n]=r),r}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||wn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ur()?function(t){let e=bn.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={..._n,...e}),bn.set(t,e)}return e}(this.locale):_n}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let En=null;class Tn extends on{static get utcInstance(){return null===En&&(En=new Tn(0)),En}static instance(t){return 0===t?Tn.utcInstance:new Tn(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new Tn(Tr(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Mr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Mr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Mr(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class Cn extends on{constructor(t){super(),this.zoneName=t}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 In(t,e){if(sr(t)||null===t)return e;if(t instanceof on)return t;if(function(t){return"string"==typeof t}(t)){const n=t.toLowerCase();return"default"===n?e:"local"===n||"system"===n?an.instance:"utc"===n||"gmt"===n?Tn.utcInstance:Tn.parseSpecifier(n)||dn.create(t)}return ar(t)?Tn.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new Cn(t)}const Mn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Dn={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]},Pn=Mn.hanidec.replace(/[\[|\]]/g,"").split(""),On=new Map;function Rn({numberingSystem:t},e=""){const n=t||"latn";let r=On.get(n);void 0===r&&(r=new Map,On.set(n,r));let i=r.get(e);return void 0===i&&(i=new RegExp(`${Mn[n]}${e}`),r.set(e,i)),i}let jn,An=()=>Date.now(),zn="system",Ln=null,Wn=null,Fn=null,qn=60,Bn=null;class Hn{static get now(){return An}static set now(t){An=t}static set defaultZone(t){zn=t}static get defaultZone(){return In(zn,an.instance)}static get defaultLocale(){return Ln}static set defaultLocale(t){Ln=t}static get defaultNumberingSystem(){return Wn}static set defaultNumberingSystem(t){Wn=t}static get defaultOutputCalendar(){return Fn}static set defaultOutputCalendar(t){Fn=t}static get defaultWeekSettings(){return Bn}static set defaultWeekSettings(t){Bn=fr(t)}static get twoDigitCutoffYear(){return qn}static set twoDigitCutoffYear(t){qn=t%100}static get throwOnInvalid(){return jn}static set throwOnInvalid(t){jn=t}static resetCaches(){Nn.resetCache(),dn.resetCache(),Lo.resetCache(),On.clear()}}class Un{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Zn=[0,31,59,90,120,151,181,212,243,273,304,334],Gn=[0,31,60,91,121,152,182,213,244,274,305,335];function Yn(t,e){return new Un("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Jn(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function Vn(t,e,n){return n+(br(t)?Gn:Zn)[e-1]}function Qn(t,e){const n=br(t)?Gn:Zn,r=n.findIndex(t=>t<e);return{month:r+1,day:e-n[r]}}function Xn(t,e){return(t-e+7)%7+1}function Kn(t,e=4,n=1){const{year:r,month:i,day:o}=t,s=Vn(r,i,o),a=Xn(Jn(r,i,o),n);let c,l=Math.floor((s-a+14-e)/7);return l<1?(c=r-1,l=_r(c,e,n)):l>_r(r,e,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Dr(t)}}function tr(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=t,s=Xn(Jn(r,1,e),n),a=xr(r);let c,l=7*i+o-s-7+e;l<1?(c=r-1,l+=xr(c)):l>a?(c=r+1,l-=xr(r)):c=r;const{month:u,day:d}=Qn(c,l);return{year:c,month:u,day:d,...Dr(t)}}function er(t){const{year:e,month:n,day:r}=t;return{year:e,ordinal:Vn(e,n,r),...Dr(t)}}function nr(t){const{year:e,ordinal:n}=t,{month:r,day:i}=Qn(e,n);return{year:e,month:r,day:i,...Dr(t)}}function rr(t,e){if(!sr(t.localWeekday)||!sr(t.localWeekNumber)||!sr(t.localWeekYear)){if(!sr(t.weekday)||!sr(t.weekNumber)||!sr(t.weekYear))throw new Ce("Cannot mix locale-based week fields with ISO-based week fields");return sr(t.localWeekday)||(t.weekday=t.localWeekday),sr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),sr(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function ir(t){const e=cr(t.year),n=mr(t.month,1,12),r=mr(t.day,1,kr(t.year,t.month));return e?n?!r&&Yn("day",t.day):Yn("month",t.month):Yn("year",t.year)}function or(t){const{hour:e,minute:n,second:r,millisecond:i}=t,o=mr(e,0,23)||24===e&&0===n&&0===r&&0===i,s=mr(n,0,59),a=mr(r,0,59),c=mr(i,0,999);return o?s?a?!c&&Yn("millisecond",i):Yn("second",r):Yn("minute",n):Yn("hour",e)}function sr(t){return void 0===t}function ar(t){return"number"==typeof t}function cr(t){return"number"==typeof t&&t%1==0}function lr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function ur(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function dr(t,e,n){if(0!==t.length)return t.reduce((t,r)=>{const i=[e(r),r];return t&&n(t[0],i[0])===t[0]?t:i},null)[1]}function hr(t,e){return{}.hasOwnProperty.call(t,e)}function fr(t){if(null==t)return null;if("object"!=typeof t)throw new Me("Week settings must be an object");if(!mr(t.firstDay,1,7)||!mr(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(t=>!mr(t,1,7)))throw new Me("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function mr(t,e,n){return cr(t)&&t>=e&&t<=n}function pr(t,e=2){let n;return n=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),n}function gr(t){return sr(t)||null===t||""===t?void 0:parseInt(t,10)}function yr(t){return sr(t)||null===t||""===t?void 0:parseFloat(t)}function vr(t){if(!sr(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function wr(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function br(t){return t%4==0&&(t%100!=0||t%400==0)}function xr(t){return br(t)?366:365}function kr(t,e){const n=(r=e-1)-12*Math.floor(r/12)+1;var r;return 2===n?br(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Sr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function $r(t,e,n){return-Xn(Jn(t,1,e),n)+e-1}function _r(t,e=4,n=1){const r=$r(t,e,n),i=$r(t+1,e,n);return(xr(t)-r+i)/7}function Nr(t){return t>99?t:t>Hn.twoDigitCutoffYear?1900+t:2e3+t}function Er(t,e,n,r=null){const i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(t=>"timezonename"===t.type.toLowerCase());return a?a.value:null}function Tr(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Cr(t){const e=Number(t);if("boolean"==typeof t||""===t||!Number.isFinite(e))throw new Me(`Invalid unit value ${t}`);return e}function Ir(t,e){const n={};for(const r in t)if(hr(t,r)){const i=t[r];if(null==i)continue;n[e(r)]=Cr(i)}return n}function Mr(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${pr(n,2)}:${pr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${pr(n,2)}${pr(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Dr(t){return function(t){return["hour","minute","second","millisecond"].reduce((e,n)=>(e[n]=t[n],e),{})}(t)}const Pr=["January","February","March","April","May","June","July","August","September","October","November","December"],Or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Rr=["J","F","M","A","M","J","J","A","S","O","N","D"];function jr(t){switch(t){case"narrow":return[...Rr];case"short":return[...Or];case"long":return[...Pr];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 Ar=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Lr=["M","T","W","T","F","S","S"];function Wr(t){switch(t){case"narrow":return[...Lr];case"short":return[...zr];case"long":return[...Ar];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Fr=["AM","PM"],qr=["Before Christ","Anno Domini"],Br=["BC","AD"],Hr=["B","A"];function Ur(t){switch(t){case"narrow":return[...Hr];case"short":return[...Br];case"long":return[...qr];default:return null}}function Zr(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const Gr={D:je,DD:Ae,DDD:Le,DDDD:We,t:Fe,tt:qe,ttt:Be,tttt:He,T:Ue,TT:Ze,TTT:Ge,TTTT:Ye,f:Je,ff:Qe,fff:tn,ffff:nn,F:Ve,FF:Xe,FFF:en,FFFF:rn};class Yr{static create(t,e={}){return new Yr(t,e)}static parseFormat(t){let e=null,n="",r=!1;const i=[];for(let o=0;o<t.length;o++){const s=t.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),e=null,n="",r=!r):r||s===e?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,e=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(t){return Gr[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0,n){if(this.opts.forceSimple)return pr(t,e);const r={...this.opts};return e>0&&(r.padTo=e),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,e){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",s=(e,r)=>n?function(t,e){return jr(e)[t.month-1]}(t,e):i(r?{month:e}:{month:e,day:"numeric"},"month"),a=(e,r)=>n?function(t,e){return Wr(e)[t.weekday-1]}(t,e):i(r?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),c=e=>{const n=Yr.macroTokenToFormatOpts(e);return n?this.formatWithSystemDefault(t,n):e},l=e=>n?function(t,e){return Ur(e)[t.year<0?0:1]}(t,e):i({era:e},"era");return Zr(Yr.parseFormat(e),e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.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 t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return n?function(t){return Fr[t.hour<12?0:1]}(t):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(t.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.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(t.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(t.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(t.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(t.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(t.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(t.year,6);case"G":return l("short");case"GG":return l("long");case"GGGGG":return l("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(e)}})}formatDurationFromString(t,e){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=t=>{switch(t[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=Yr.parseFormat(e),o=i.reduce((t,{literal:e,val:n})=>e?t:t.concat(n),[]),s=t.shiftTo(...o.map(r).filter(t=>t));return Zr(i,((t,e)=>i=>{const o=r(i);if(o){const r=e.isNegativeDuration&&o!==e.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==e.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(t.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const Jr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Vr(...t){const e=t.reduce((t,e)=>t+e.source,"");return RegExp(`^${e}$`)}function Qr(...t){return e=>t.reduce(([t,n,r],i)=>{const[o,s,a]=i(e,r);return[{...t,...o},s||n,a]},[{},null,1]).slice(0,2)}function Xr(t,...e){if(null==t)return[null,null];for(const[n,r]of e){const e=n.exec(t);if(e)return r(e)}return[null,null]}function Kr(...t){return(e,n)=>{const r={};let i;for(i=0;i<t.length;i++)r[t[i]]=gr(e[n+i]);return[r,null,n+i]}}const ti=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ei=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ni=RegExp(`${ei.source}(?:${ti.source}?(?:\\[(${Jr.source})\\])?)?`),ri=RegExp(`(?:[Tt]${ni.source})?`),ii=Kr("weekYear","weekNumber","weekDay"),oi=Kr("year","ordinal"),si=RegExp(`${ei.source} ?(?:${ti.source}|(${Jr.source}))?`),ai=RegExp(`(?: ${si.source})?`);function ci(t,e,n){const r=t[e];return sr(r)?n:gr(r)}function li(t,e){return[{hours:ci(t,e,0),minutes:ci(t,e+1,0),seconds:ci(t,e+2,0),milliseconds:vr(t[e+3])},null,e+4]}function ui(t,e){const n=!t[e]&&!t[e+1],r=Tr(t[e+1],t[e+2]);return[{},n?null:Tn.instance(r),e+3]}function di(t,e){return[{},t[e]?dn.create(t[e]):null,e+1]}const hi=RegExp(`^T?${ei.source}$`),fi=/^-?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 mi(t){const[e,n,r,i,o,s,a,c,l]=t,u="-"===e[0],d=c&&"-"===c[0],h=(t,e=!1)=>void 0!==t&&(e||t&&u)?-t:t;return[{years:h(yr(n)),months:h(yr(r)),weeks:h(yr(i)),days:h(yr(o)),hours:h(yr(s)),minutes:h(yr(a)),seconds:h(yr(c),"-0"===c),milliseconds:h(vr(l),d)}]}const pi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function gi(t,e,n,r,i,o,s){const a={year:2===e.length?Nr(gr(e)):gr(e),month:Or.indexOf(n)+1,day:gr(r),hour:gr(i),minute:gr(o)};return s&&(a.second=gr(s)),t&&(a.weekday=t.length>3?Ar.indexOf(t)+1:zr.indexOf(t)+1),a}const yi=/^(?:(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 vi(t){const[,e,n,r,i,o,s,a,c,l,u,d]=t,h=gi(e,i,r,n,o,s,a);let f;return f=c?pi[c]:l?0:Tr(u,d),[h,new Tn(f)]}const wi=/^(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$/,bi=/^(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$/,xi=/^(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 ki(t){const[,e,n,r,i,o,s,a]=t;return[gi(e,i,r,n,o,s,a),Tn.utcInstance]}function Si(t){const[,e,n,r,i,o,s,a]=t;return[gi(e,a,n,r,i,o,s),Tn.utcInstance]}const $i=Vr(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ri),_i=Vr(/(\d{4})-?W(\d\d)(?:-?(\d))?/,ri),Ni=Vr(/(\d{4})-?(\d{3})/,ri),Ei=Vr(ni),Ti=Qr(function(t,e){return[{year:ci(t,e),month:ci(t,e+1,1),day:ci(t,e+2,1)},null,e+3]},li,ui,di),Ci=Qr(ii,li,ui,di),Ii=Qr(oi,li,ui,di),Mi=Qr(li,ui,di),Di=Qr(li),Pi=Vr(/(\d{4})-(\d\d)-(\d\d)/,ai),Oi=Vr(si),Ri=Qr(li,ui,di),ji="Invalid Duration",Ai={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}},zi={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},...Ai},Li={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},...Ai},Wi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Fi=Wi.slice(0).reverse();function qi(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Zi(r)}function Bi(t,e){let n=e.milliseconds??0;for(const r of Fi.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function Hi(t,e){const n=Bi(t,e)<0?-1:1;Wi.reduceRight((r,i)=>{if(sr(e[i]))return r;if(r){const o=e[r]*n,s=t[i][r],a=Math.floor(o/s);e[i]+=a*n,e[r]-=a*s*n}return i},null),Wi.reduce((n,r)=>{if(sr(e[r]))return n;if(n){const i=e[n]%1;e[n]-=i,e[r]+=i*t[n][r]}return r},null)}function Ui(t){const e={};for(const[n,r]of Object.entries(t))0!==r&&(e[n]=r);return e}class Zi{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let n=e?Li:zi;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||Nn.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,e){return Zi.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new Me("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new Zi({values:Ir(t,Zi.normalizeUnit),loc:Nn.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(ar(t))return Zi.fromMillis(t);if(Zi.isDuration(t))return t;if("object"==typeof t)return Zi.fromObject(t);throw new Me(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[n]=function(t){return Xr(t,[fi,mi])}(t);return n?Zi.fromObject(n,e):Zi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[n]=function(t){return Xr(t,[hi,Di])}(t);return n?Zi.fromObject(n,e):Zi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new Me("need to specify a reason the Duration is invalid");const n=t instanceof Un?t:new Un(t,e);if(Hn.throwOnInvalid)throw new Te(n);return new Zi({invalid:n})}static normalizeUnit(t){const e={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"}[t?t.toLowerCase():t];if(!e)throw new Ie(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const n={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?Yr.create(this.loc,n).formatDurationFromString(this,t):ji}toHuman(t={}){if(!this.isValid)return ji;const e=!1!==t.showZeros,n=Wi.map(n=>{const r=this.values[n];return sr(r)||0===r&&!e?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(r)}).filter(t=>t);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=wr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();return e<0||e>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},Lo.fromMillis(e,{zone:"UTC"}).toISOTime(t))}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?Bi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=Zi.fromDurationLike(t),n={};for(const t of Wi)(hr(e.values,t)||hr(this.values,t))&&(n[t]=e.get(t)+this.get(t));return qi(this,{values:n},!0)}minus(t){if(!this.isValid)return this;const e=Zi.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=Cr(t(this.values[n],n));return qi(this,{values:e},!0)}get(t){return this[Zi.normalizeUnit(t)]}set(t){return this.isValid?qi(this,{values:{...this.values,...Ir(t,Zi.normalizeUnit)}}):this}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:n,matrix:r}={}){return qi(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:r,conversionAccuracy:n})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return Hi(this.matrix,t),qi(this,{values:t},!0)}rescale(){return this.isValid?qi(this,{values:Ui(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map(t=>Zi.normalizeUnit(t));const e={},n={},r=this.toObject();let i;for(const o of Wi)if(t.indexOf(o)>=0){i=o;let t=0;for(const e in n)t+=this.matrix[e][o]*n[e],n[e]=0;ar(r[o])&&(t+=r[o]);const s=Math.trunc(t);e[o]=s,n[o]=(1e3*t-1e3*s)/1e3}else ar(r[o])&&(n[o]=r[o]);for(const t in n)0!==n[t]&&(e[i]+=t===i?n[t]:n[t]/this.matrix[i][t]);return Hi(this.matrix,e),qi(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return qi(this,{values:t},!0)}removeZeros(){return this.isValid?qi(this,{values:Ui(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(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;function e(t,e){return void 0===t||0===t?void 0===e||0===e:t===e}for(const n of Wi)if(!e(this.values[n],t.values[n]))return!1;return!0}}const Gi="Invalid Interval";class Yi{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new Me("need to specify a reason the Interval is invalid");const n=t instanceof Un?t:new Un(t,e);if(Hn.throwOnInvalid)throw new Ee(n);return new Yi({invalid:n})}static fromDateTimes(t,e){const n=Wo(t),r=Wo(e),i=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?Yi.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:Yi.invalid("missing or invalid end"):Yi.invalid("missing or invalid start")}(n,r);return null==i?new Yi({start:n,end:r}):i}static after(t,e){const n=Zi.fromDurationLike(e),r=Wo(t);return Yi.fromDateTimes(r,r.plus(n))}static before(t,e){const n=Zi.fromDurationLike(e),r=Wo(t);return Yi.fromDateTimes(r.minus(n),r)}static fromISO(t,e){const[n,r]=(t||"").split("/",2);if(n&&r){let t,i,o,s;try{t=Lo.fromISO(n,e),i=t.isValid}catch(r){i=!1}try{o=Lo.fromISO(r,e),s=o.isValid}catch(r){s=!1}if(i&&s)return Yi.fromDateTimes(t,o);if(i){const n=Zi.fromISO(r,e);if(n.isValid)return Yi.after(t,n)}else if(s){const t=Zi.fromISO(n,e);if(t.isValid)return Yi.before(o,t)}}return Yi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.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(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const n=this.start.startOf(t,e);let r;return r=e?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(t,e),Math.floor(r.diff(n,t).get(t))+(r.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&this.s<=t&&this.e>t}set({start:t,end:e}={}){return this.isValid?Yi.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Wo).filter(t=>this.contains(t)).sort((t,e)=>t.toMillis()-e.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const t=e[i]||this.e,o=+t>+this.e?this.e:t;n.push(Yi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(t){const e=Zi.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const t=this.start.plus(e.mapUnits(t=>t*i));n=+t>+this.e?this.e:t,o.push(Yi.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e===+t.s}abutsEnd(t){return!!this.isValid&&+t.e===+this.s}engulfs(t){return!!this.isValid&&this.s<=t.s&&this.e>=t.e}equals(t){return!(!this.isValid||!t.isValid)&&this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return e>=n?null:Yi.fromDateTimes(e,n)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return Yi.fromDateTimes(e,n)}static merge(t){const[e,n]=t.sort((t,e)=>t.s-e.s).reduce(([t,e],n)=>e?e.overlaps(n)||e.abutsStart(n)?[t,e.union(n)]:[t.concat([e]),n]:[t,n],[[],null]);return n&&e.push(n),e}static xor(t){let e=null,n=0;const r=[],i=t.map(t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}]),o=[].concat(...i).sort((t,e)=>t.time-e.time);for(const t of o)n+="s"===t.type?1:-1,1===n?e=t.time:(e&&+e!==+t.time&&r.push(Yi.fromDateTimes(e,t.time)),e=null);return Yi.merge(r)}difference(...t){return Yi.xor([this].concat(t)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Gi}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=je,e={}){return this.isValid?Yr.create(this.s.loc.clone(e),t).formatInterval(this):Gi}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:Gi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Gi}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:Gi}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:Gi}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):Zi.invalid(this.invalidReason)}mapEndpoints(t){return Yi.fromDateTimes(t(this.s),t(this.e))}}class Ji{static hasDST(t=Hn.defaultZone){const e=Lo.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return dn.isValidZone(t)}static normalizeZone(t){return In(t,Hn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||Nn.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||Nn.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||Nn.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Nn.create(e,n,i)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Nn.create(e,n,i)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Nn.create(e,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Nn.create(e,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return Nn.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return Nn.create(e,null,"gregory").eras(t)}static features(){return{relative:lr(),localeWeek:ur()}}}function Vi(t,e){const n=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(Zi.fromMillis(r).as("days"))}function Qi(t,e=t=>t){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(-1!==t[n].search(Mn.hanidec))e+=Pn.indexOf(t[n]);else for(const t in Dn){const[n,i]=Dn[t];r>=n&&r<=i&&(e+=r-n)}}return parseInt(e,10)}return e}(t))}}const Xi=`[ ${String.fromCharCode(160)}]`,Ki=new RegExp(Xi,"g");function to(t){return t.replace(/\./g,"\\.?").replace(Ki,Xi)}function eo(t){return t.replace(/\./g,"").replace(Ki," ").toLowerCase()}function no(t,e){return null===t?null:{regex:RegExp(t.map(to).join("|")),deser:([n])=>t.findIndex(t=>eo(n)===eo(t))+e}}function ro(t,e){return{regex:t,deser:([,t,e])=>Tr(t,e),groups:e}}function io(t){return{regex:t,deser:([t])=>t}}const oo={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 so=null;function ao(t,e){return[].concat(...t.map(t=>function(t,e){if(t.literal)return t;const n=uo(Yr.macroTokenToFormatOpts(t.val),e);return null==n||n.includes(void 0)?t:n}(t,e)))}class co{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=ao(Yr.parseFormat(e),t),this.units=this.tokens.map(e=>function(t,e){const n=Rn(e),r=Rn(e,"{2}"),i=Rn(e,"{3}"),o=Rn(e,"{4}"),s=Rn(e,"{6}"),a=Rn(e,"{1,2}"),c=Rn(e,"{1,3}"),l=Rn(e,"{1,6}"),u=Rn(e,"{1,9}"),d=Rn(e,"{2,4}"),h=Rn(e,"{4,6}"),f=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return f(m);switch(m.val){case"G":return no(e.eras("short"),0);case"GG":return no(e.eras("long"),0);case"y":return Qi(l);case"yy":case"kk":return Qi(d,Nr);case"yyyy":case"kkkk":return Qi(o);case"yyyyy":return Qi(h);case"yyyyyy":return Qi(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Qi(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Qi(r);case"MMM":return no(e.months("short",!0),1);case"MMMM":return no(e.months("long",!0),1);case"LLL":return no(e.months("short",!1),1);case"LLLL":return no(e.months("long",!1),1);case"o":case"S":return Qi(c);case"ooo":case"SSS":return Qi(i);case"u":return io(u);case"uu":return io(a);case"uuu":case"E":case"c":return Qi(n);case"a":return no(e.meridiems(),0);case"EEE":return no(e.weekdays("short",!1),1);case"EEEE":return no(e.weekdays("long",!1),1);case"ccc":return no(e.weekdays("short",!0),1);case"cccc":return no(e.weekdays("long",!0),1);case"Z":case"ZZ":return ro(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return ro(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return io(/[a-z_+-/]{1,256}?/i);case" ":return io(/[^\S\n\r]/);default:return f(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t)),this.disqualifyingUnit=this.units.find(t=>t.invalidReason),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map(t=>t.regex).reduce((t,e)=>`${t}(${e.source})`,"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,n]=function(t,e,n){const r=t.match(e);if(r){const t={};let e=1;for(const i in n)if(hr(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(t[o.token.val[0]]=o.deser(r.slice(e,e+s))),e+=s}return[r,t]}return[r,{}]}(t,this.regex,this.handlers),[r,i,o]=n?function(t){let e,n=null;sr(t.z)||(n=dn.create(t.z)),sr(t.Z)||(n||(n=new Tn(t.Z)),e=t.Z),sr(t.q)||(t.M=3*(t.q-1)+1),sr(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),sr(t.u)||(t.S=vr(t.u));const r=Object.keys(t).reduce((e,n)=>{const r=(t=>{switch(t){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&&(e[r]=t[n]),e},{});return[r,n,e]}(n):[null,null,void 0];if(hr(n,"a")&&hr(n,"H"))throw new Ce("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:n,result:r,zone:i,specificOffset:o}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function lo(t,e,n){return new co(t,n).explainFromTokens(e)}function uo(t,e){if(!t)return null;const n=Yr.create(e,t).dtFormatter((so||(so=Lo.fromMillis(1555555555555)),so)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(e=>function(t,e,n){const{type:r,value:i}=t;if("literal"===r){const t=/^\s+$/.test(i);return{literal:!t,val:t?" ":i}}const o=e[r];let s=r;"hour"===r&&(s=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=oo[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(e,t,i))}const ho="Invalid DateTime",fo=864e13;function mo(t){return new Un("unsupported zone",`the zone "${t.name}" is not supported`)}function po(t){return null===t.weekData&&(t.weekData=Kn(t.c)),t.weekData}function go(t){return null===t.localWeekData&&(t.localWeekData=Kn(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function yo(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Lo({...n,...e,old:n})}function vo(t,e,n){let r=t-60*e*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=60*(i-e)*1e3;const o=n.offset(r);return i===o?[r,i]:[t-60*Math.min(i,o)*1e3,Math.max(i,o)]}function wo(t,e){const n=new Date(t+=60*e*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 bo(t,e,n){return vo(Sr(t),e,n)}function xo(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),o={...t.c,year:r,month:i,day:Math.min(t.c.day,kr(r,i))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},s=Zi.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Sr(o);let[c,l]=vo(a,n,t.zone);return 0!==s&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function ko(t,e,n,r,i,o){const{setZone:s,zone:a}=n;if(t&&0!==Object.keys(t).length||e){const r=e||a,i=Lo.fromObject(t,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Lo.invalid(new Un("unparsable",`the input "${i}" can't be parsed as ${r}`))}function So(t,e,n=!0){return t.isValid?Yr.create(Nn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function $o(t,e,n){const r=t.c.year>9999||t.c.year<0;let i="";if(r&&t.c.year>=0&&(i+="+"),i+=pr(t.c.year,r?6:4),"year"===n)return i;if(e){if(i+="-",i+=pr(t.c.month),"month"===n)return i;i+="-"}else if(i+=pr(t.c.month),"month"===n)return i;return i+=pr(t.c.day),i}function _o(t,e,n,r,i,o,s){let a=!n||0!==t.c.millisecond||0!==t.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=pr(t.c.hour),"hour"===s)break;if(e){if(c+=":",c+=pr(t.c.minute),"minute"===s)break;a&&(c+=":",c+=pr(t.c.second))}else{if(c+=pr(t.c.minute),"minute"===s)break;a&&(c+=pr(t.c.second))}if("second"===s)break;!a||r&&0===t.c.millisecond||(c+=".",c+=pr(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&0===t.offset&&!o?c+="Z":t.o<0?(c+="-",c+=pr(Math.trunc(-t.o/60)),c+=":",c+=pr(Math.trunc(-t.o%60))):(c+="+",c+=pr(Math.trunc(t.o/60)),c+=":",c+=pr(Math.trunc(t.o%60)))),o&&(c+="["+t.zone.ianaName+"]"),c}const No={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Eo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},To={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Co=["year","month","day","hour","minute","second","millisecond"],Io=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Mo=["year","ordinal","hour","minute","second","millisecond"];function Do(t){const e={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"}[t.toLowerCase()];if(!e)throw new Ie(t);return e}function Po(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Do(t)}}function Oo(t,e){const n=In(e.zone,Hn.defaultZone);if(!n.isValid)return Lo.invalid(mo(n));const r=Nn.fromObject(e);let i,o;if(sr(t.year))i=Hn.now();else{for(const e of Co)sr(t[e])&&(t[e]=No[e]);const e=ir(t)||or(t);if(e)return Lo.invalid(e);const r=function(t){if(void 0===Ao&&(Ao=Hn.now()),"iana"!==t.type)return t.offset(Ao);const e=t.name;let n=zo.get(e);return void 0===n&&(n=t.offset(Ao),zo.set(e,n)),n}(n);[i,o]=bo(t,r,n)}return new Lo({ts:i,zone:n,loc:r,o:o})}function Ro(t,e,n){const r=!!sr(n.round)||n.round,i=sr(n.rounding)?"trunc":n.rounding,o=(t,o)=>(t=wr(t,r||n.calendary?0:2,n.calendary?"round":i),e.loc.clone(n).relFormatter(n).format(t,o)),s=r=>n.calendary?e.hasSame(t,r)?0:e.startOf(r).diff(t.startOf(r),r).get(r):e.diff(t,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const t of n.units){const e=s(t);if(Math.abs(e)>=1)return o(e,t)}return o(t>e?-0:0,n.units[n.units.length-1])}function jo(t){let e,n={};return t.length>0&&"object"==typeof t[t.length-1]?(n=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[n,e]}let Ao;const zo=new Map;class Lo{constructor(t){const e=t.zone||Hn.defaultZone;let n=t.invalid||(Number.isNaN(t.ts)?new Un("invalid input"):null)||(e.isValid?null:mo(e));this.ts=sr(t.ts)?Hn.now():t.ts;let r=null,i=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[r,i]=[t.old.c,t.old.o];else{const o=ar(t.o)&&!t.old?t.o:e.offset(this.ts);r=wo(this.ts,o),n=Number.isNaN(r.year)?new Un("invalid input"):null,r=n?null:r,i=n?null:o}this.ot=e,this.loc=t.loc||Nn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Lo({})}static local(){const[t,e]=jo(arguments),[n,r,i,o,s,a,c]=e;return Oo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static utc(){const[t,e]=jo(arguments),[n,r,i,o,s,a,c]=e;return t.zone=Tn.utcInstance,Oo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static fromJSDate(t,e={}){const n=function(t){return"[object Date]"==={}.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(n))return Lo.invalid("invalid input");const r=In(e.zone,Hn.defaultZone);return r.isValid?new Lo({ts:n,zone:r,loc:Nn.fromObject(e)}):Lo.invalid(mo(r))}static fromMillis(t,e={}){if(ar(t))return t<-fo||t>fo?Lo.invalid("Timestamp out of range"):new Lo({ts:t,zone:In(e.zone,Hn.defaultZone),loc:Nn.fromObject(e)});throw new Me(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(ar(t))return new Lo({ts:1e3*t,zone:In(e.zone,Hn.defaultZone),loc:Nn.fromObject(e)});throw new Me("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const n=In(e.zone,Hn.defaultZone);if(!n.isValid)return Lo.invalid(mo(n));const r=Nn.fromObject(e),i=Ir(t,Po),{minDaysInFirstWeek:o,startOfWeek:s}=rr(i,r),a=Hn.now(),c=sr(e.specificOffset)?n.offset(a):e.specificOffset,l=!sr(i.ordinal),u=!sr(i.year),d=!sr(i.month)||!sr(i.day),h=u||d,f=i.weekYear||i.weekNumber;if((h||l)&&f)throw new Ce("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new Ce("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=wo(a,c);m?(p=Io,g=Eo,y=Kn(y,o,s)):l?(p=Mo,g=To,y=er(y)):(p=Co,g=No);let v=!1;for(const t of p)sr(i[t])?i[t]=v?g[t]:y[t]:v=!0;const w=m?function(t,e=4,n=1){const r=cr(t.weekYear),i=mr(t.weekNumber,1,_r(t.weekYear,e,n)),o=mr(t.weekday,1,7);return r?i?!o&&Yn("weekday",t.weekday):Yn("week",t.weekNumber):Yn("weekYear",t.weekYear)}(i,o,s):l?function(t){const e=cr(t.year),n=mr(t.ordinal,1,xr(t.year));return e?!n&&Yn("ordinal",t.ordinal):Yn("year",t.year)}(i):ir(i),b=w||or(i);if(b)return Lo.invalid(b);const x=m?tr(i,o,s):l?nr(i):i,[k,S]=bo(x,c,n),$=new Lo({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&t.weekday!==$.weekday?Lo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${$.toISO()}`):$.isValid?$:Lo.invalid($.invalid)}static fromISO(t,e={}){const[n,r]=function(t){return Xr(t,[$i,Ti],[_i,Ci],[Ni,Ii],[Ei,Mi])}(t);return ko(n,r,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[n,r]=function(t){return Xr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[yi,vi])}(t);return ko(n,r,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[n,r]=function(t){return Xr(t,[wi,ki],[bi,ki],[xi,Si])}(t);return ko(n,r,e,"HTTP",e)}static fromFormat(t,e,n={}){if(sr(t)||sr(e))throw new Me("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Nn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(t,e,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=lo(t,e,n);return[r,i,o,s]}(o,t,e);return l?Lo.invalid(l):ko(s,a,n,`format ${e}`,t,c)}static fromString(t,e,n={}){return Lo.fromFormat(t,e,n)}static fromSQL(t,e={}){const[n,r]=function(t){return Xr(t,[Pi,Ti],[Oi,Ri])}(t);return ko(n,r,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new Me("need to specify a reason the DateTime is invalid");const n=t instanceof Un?t:new Un(t,e);if(Hn.throwOnInvalid)throw new Ne(n);return new Lo({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const n=uo(t,Nn.fromObject(e));return n?n.map(t=>t?t.val:null).join(""):null}static expandFormat(t,e={}){return ao(Yr.parseFormat(t),Nn.fromObject(e)).map(t=>t.val).join("")}static resetCache(){Ao=void 0,zo.clear()}get(t){return this[t]}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.ot}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?po(this).weekYear:NaN}get weekNumber(){return this.isValid?po(this).weekNumber:NaN}get weekday(){return this.isValid?po(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?go(this).weekday:NaN}get localWeekNumber(){return this.isValid?go(this).weekNumber:NaN}get localWeekYear(){return this.isValid?go(this).weekYear:NaN}get ordinal(){return this.isValid?er(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ji.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ji.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ji.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ji.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 t=864e5,e=6e4,n=Sr(this.c),r=this.zone.offset(n-t),i=this.zone.offset(n+t),o=this.zone.offset(n-r*e),s=this.zone.offset(n-i*e);if(o===s)return[this];const a=n-o*e,c=n-s*e,l=wo(a,o),u=wo(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[yo(this,{ts:a}),yo(this,{ts:c})]:[this]}get isInLeapYear(){return br(this.year)}get daysInMonth(){return kr(this.year,this.month)}get daysInYear(){return this.isValid?xr(this.year):NaN}get weeksInWeekYear(){return this.isValid?_r(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?_r(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:n,calendar:r}=Yr.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:n,outputCalendar:r}}toUTC(t=0,e={}){return this.setZone(Tn.instance(t),e)}toLocal(){return this.setZone(Hn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:n=!1}={}){if((t=In(t,Hn.defaultZone)).equals(this.zone))return this;if(t.isValid){let r=this.ts;if(e||n){const e=t.offset(this.ts),n=this.toObject();[r]=bo(n,e,t)}return yo(this,{ts:r,zone:t})}return Lo.invalid(mo(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:n}={}){return yo(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:n})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=Ir(t,Po),{minDaysInFirstWeek:n,startOfWeek:r}=rr(e,this.loc),i=!sr(e.weekYear)||!sr(e.weekNumber)||!sr(e.weekday),o=!sr(e.ordinal),s=!sr(e.year),a=!sr(e.month)||!sr(e.day),c=s||a,l=e.weekYear||e.weekNumber;if((c||o)&&l)throw new Ce("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Ce("Can't mix ordinal dates with month/day");let u;i?u=tr({...Kn(this.c,n,r),...e},n,r):sr(e.ordinal)?(u={...this.toObject(),...e},sr(e.day)&&(u.day=Math.min(kr(u.year,u.month),u.day))):u=nr({...er(this.c),...e});const[d,h]=bo(u,this.o,this.zone);return yo(this,{ts:d,o:h})}plus(t){return this.isValid?yo(this,xo(this,Zi.fromDurationLike(t))):this}minus(t){return this.isValid?yo(this,xo(this,Zi.fromDurationLike(t).negate())):this}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const n={},r=Zi.normalizeUnit(t);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(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(n.weekNumber=this.weekNumber-1),n.weekday=t}else n.weekday=1;if("quarters"===r){const t=Math.ceil(this.month/3);n.month=3*(t-1)+1}return this.set(n)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?Yr.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):ho}toLocaleString(t=je,e={}){return this.isValid?Yr.create(this.loc.clone(e),t).formatDateTime(this):ho}toLocaleParts(t={}){return this.isValid?Yr.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===t;let a=$o(this,s,o=Do(o));return Co.indexOf(o)>=3&&(a+="T"),a+=_o(this,s,e,n,r,i,o),a}toISODate({format:t="extended",precision:e="day"}={}){return this.isValid?$o(this,"extended"===t,Do(e)):null}toISOWeekDate(){return So(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Do(s),(r&&Co.indexOf(s)>=3?"T":"")+_o(this,"extended"===o,e,t,n,i,s)):null}toRFC2822(){return So(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return So(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?$o(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(e||t)&&(n&&(r+=" "),e?r+="z":t&&(r+="ZZ")),So(this,r,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():ho}[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(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",n={}){if(!this.isValid||!t.isValid)return Zi.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=e,Array.isArray(a)?a:[a]).map(Zi.normalizeUnit),o=t.valueOf()>this.valueOf(),s=function(t,e,n,r){let[i,o,s,a]=function(t,e,n){const r=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const n=Vi(t,e);return(n-n%7)/7}],["days",Vi]],i={},o=t;let s,a;for(const[c,l]of r)n.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,(t=o.plus(i))>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}(t,e,n);const c=e-i,l=n.filter(t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0);0===l.length&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const u=Zi.fromObject(o,r);return l.length>0?Zi.fromMillis(c,r).shiftTo(...l).plus(u):u}(o?this:t,o?t:this,i,r);var a;return o?s.negate():s}diffNow(t="milliseconds",e={}){return this.diff(Lo.now(),t,e)}until(t){return this.isValid?Yi.fromDateTimes(this,t):this}hasSame(t,e,n){if(!this.isValid)return!1;const r=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(e,n)<=r&&r<=i.endOf(e,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||Lo.fromObject({},{zone:this.zone}),n=t.padding?this<e?-t.padding:t.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=t.unit;return Array.isArray(t.unit)&&(r=t.unit,i=void 0),Ro(e,this.plus(n),{...t,numeric:"always",units:r,unit:i})}toRelativeCalendar(t={}){return this.isValid?Ro(t.base||Lo.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(Lo.isDateTime))throw new Me("min requires all arguments be DateTimes");return dr(t,t=>t.valueOf(),Math.min)}static max(...t){if(!t.every(Lo.isDateTime))throw new Me("max requires all arguments be DateTimes");return dr(t,t=>t.valueOf(),Math.max)}static fromFormatExplain(t,e,n={}){const{locale:r=null,numberingSystem:i=null}=n;return lo(Nn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,n={}){return Lo.fromFormatExplain(t,e,n)}static buildFormatParser(t,e={}){const{locale:n=null,numberingSystem:r=null}=e,i=Nn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new co(i,t)}static fromFormatParser(t,e,n={}){if(sr(t)||sr(e))throw new Me("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Nn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(e.locale))throw new Me(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${e.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:l}=e.explainFromTokens(t);return l?Lo.invalid(l):ko(s,a,n,`format ${e.format}`,t,c)}static get DATE_SHORT(){return je}static get DATE_MED(){return Ae}static get DATE_MED_WITH_WEEKDAY(){return ze}static get DATE_FULL(){return Le}static get DATE_HUGE(){return We}static get TIME_SIMPLE(){return Fe}static get TIME_WITH_SECONDS(){return qe}static get TIME_WITH_SHORT_OFFSET(){return Be}static get TIME_WITH_LONG_OFFSET(){return He}static get TIME_24_SIMPLE(){return Ue}static get TIME_24_WITH_SECONDS(){return Ze}static get TIME_24_WITH_SHORT_OFFSET(){return Ge}static get TIME_24_WITH_LONG_OFFSET(){return Ye}static get DATETIME_SHORT(){return Je}static get DATETIME_SHORT_WITH_SECONDS(){return Ve}static get DATETIME_MED(){return Qe}static get DATETIME_MED_WITH_SECONDS(){return Xe}static get DATETIME_MED_WITH_WEEKDAY(){return Ke}static get DATETIME_FULL(){return tn}static get DATETIME_FULL_WITH_SECONDS(){return en}static get DATETIME_HUGE(){return nn}static get DATETIME_HUGE_WITH_SECONDS(){return rn}}function Wo(t){if(Lo.isDateTime(t))return t;if(t&&t.valueOf&&ar(t.valueOf()))return Lo.fromJSDate(t);if(t&&"object"==typeof t)return Lo.fromObject(t);throw new Me(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function Fo({title:t,description:e,children:n,noSubscription:r,hideHeader:i}){return Mt("div",{className:he.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:ae.colors.accent}),children:Mt("div",{className:he.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Mt("div",{className:he.create("page-heading-wrapper",{width:"100%",marginBottom:ae.spacing.lg}),children:Mt(be,{children:Mt("div",{className:he.create("page-heading-container",{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,borderRadius:ae.radius.large,padding:`${ae.spacing.lg} ${ae.spacing.xl}`,boxShadow:ae.shadow.md}),children:Mt("div",{className:he.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ae.spacing.lg}),children:Mt("div",{className:he.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Mt("h1",{className:he.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ae.colors.primaryForeground,letterSpacing:"-0.025em"}),children:t}),e&&Mt("p",{className:he.create("page-template-description",{margin:"0",marginTop:ae.spacing.sm,fontSize:ae.fontSize.small,lineHeight:"1.5",color:ae.colors.primaryForeground,opacity:"0.85"}),children:e})]})})})})}),n]})})}function qo({className:t,children:e}){const n=he.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Mt("div",{className:ve(n,t),children:e})}function Bo({message:t}){return Mt(Fo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Mt(be,{children:Mt(qo,{className:he.name("loading-container"),children:Mt(we,{size:"large"})})})})}function Ho({variant:t="primary",type:e="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,boxShadow:ae.shadow.sm},outline:{border:`${ae.borderWidth} solid ${ae.colors.primary}`,backgroundColor:ae.colors.card,color:ae.colors.primary,boxShadow:ae.shadow.sm}},l=he.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:ae.radius.default,cursor:"pointer",fontSize:ae.fontSize.default,fontWeight:"500",transition:ae.transition,fontFamily:ae.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});he.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),he.pseudoElement(`button-${t}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:ae.shadow.md}),he.pseudoElement(`button-${t}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:ae.shadow.sm});const u=he.create(`button-${t}`,{...c[t]});return Mt("button",{type:e,className:ve(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Mt(we,{size:"small"}),o]})}function Uo({error:t}){he.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:ae.colors.background,textAlign:"center"});const e=he.create("error-fallback-icon",{width:"4rem",height:"4rem",color:ae.colors.destructive,marginBottom:"1.5rem"}),n=he.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:ae.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});he.create("error-fallback-message",{fontSize:ae.fontSize.large,color:ae.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=he.create("error-fallback-details",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,backgroundColor:ae.colors.muted,padding:"1rem",borderRadius:ae.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=he.create("error-fallback-support",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=he.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=t||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return Mt(Fo,{title:s.title,description:s.message,noSubscription:!0,children:Mt(be,{children:Mt(qo,{className:he.name("loading-container"),children:[Mt(()=>Mt("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}),{}),Mt("h1",{className:n,children:s.title}),s.details&&Mt("div",{className:r,children:[Mt("strong",{children:"Error Details:"}),Mt("br",{}),s.details,s.statusCode&&Mt(k,{children:[Mt("br",{}),Mt("strong",{children:"Status Code:"})," ",s.statusCode]})]}),Mt("p",{className:i,children:mt(s)}),Mt("div",{className:o,children:Mt(Ho,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function Zo({message:t,estimatedTime:e}){const n=he.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=he.create("maintenance-icon",{width:"4rem",height:"4rem",color:ae.colors.primary,marginBottom:"1.5rem"}),i=he.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:ae.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=he.create("maintenance-message",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=he.create("maintenance-info-box",{backgroundColor:ae.colors.muted,borderRadius:ae.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=he.create("maintenance-info-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,marginBottom:"0.5rem"}),c=he.create("maintenance-info-text",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.4"}),l=he.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Mt(Fo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Mt(be,{children:Mt(qo,{children:Mt("div",{className:n,children:[Mt(()=>Mt("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:Mt("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"})}),{}),Mt("h1",{className:i,children:"We'll be right back"}),Mt("p",{className:o,children:t||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Mt("div",{className:s,children:[Mt("p",{className:a,children:"What's happening?"}),Mt("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),e&&Mt("p",{className:c,style:{marginTop:"0.5rem"},children:[Mt("strong",{children:"Estimated time:"})," ",e]})]}),Mt("div",{className:l,children:Mt(Ho,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Go({size:t="default",style:e="normal",className:n,children:r}){const i=he.create("text",{marginTop:"0",marginBottom:"0"}),o=he.create("text-small",{fontSize:ae.fontSize.small}),s=he.create("text-default",{fontSize:ae.fontSize.default}),a=he.create("text-italic",{fontStyle:"italic"}),c=he.create("text-bold",{fontWeight:"bold"}),l=he.create("text-underline",{textDecoration:"underline"}),u=ve({[a]:"italic"===e,[c]:"bold"===e,[l]:"underline"===e}),d=ve({[o]:"small"===t,[s]:"default"===t});return Mt("p",{className:ve(i,d,u,n),children:r})}function Yo({title:t,description:e}){return Mt("div",{className:he.create("section-header",{}),children:[Mt("p",{className:he.create("section-title",{fontSize:ae.fontSize.large,margin:"0",color:ae.colors.foreground}),children:t}),e&&Mt(Go,{className:he.create("section-description",{color:ae.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 Jo({selected:t}){return Mt("div",{className:ve(he.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${ae.borderWidth} solid transparent`}),t?he.create("selected-indicator-selected",{backgroundColor:ae.colors.primary}):he.create("selected-indicator-unselected",{border:`${ae.borderWidth} solid ${ae.colors.border}`}))})}function Vo({excessOptions:t,selectedExcessId:e,onExcessSelect:n}){const r=[...t].sort((t,e)=>t.excess_amount-e.excess_amount);return Mt("div",{className:he.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Mt(Yo,{title:"Excess Options"}),Mt("div",{className:he.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(t=>{const r=t.id===e;return Mt("div",{className:ve(he.create("excess-option-card",{borderRadius:ae.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?he.create("excess-option-card-selected",{border:`2px solid ${ae.colors.primary}`,backgroundColor:ae.colors.accent}):he.create("excess-option-card-unselected",{border:`2px solid ${ae.colors.border}`,backgroundColor:ae.colors.card})),onClick:()=>n(t.id),children:[Mt(Jo,{selected:r}),Mt("div",{className:he.create("excess-amount",{color:ae.colors.foreground}),children:["$",Number(t.excess_amount).toFixed(0)]})]},t.id)})})]})}function Qo(t,e="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}function Xo(t){switch(t){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)} Installments`}}function Ko({paymentOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=Jt(()=>{if(!n)return[];const r=t.filter(t=>t.excess_id===n&&t.amount.success).map(t=>{const n=e.find(e=>e.id===t.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${t.gateway_id}`);return{...t,gateway:n}});return r.sort((t,e)=>("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0)-("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0))},[t,e,n]);return n?Mt(ts,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Mt("div",{className:he.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Mt(ts,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function ts({sortedOptions:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=t.length>0;return Mt("div",{className:he.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Mt(Yo,{title:"Payment Options"}),Mt("div",r?{className:he.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:t.map(t=>Mt(es,{option:t,selectedPaymentOption:e,onPaymentSelect:n},`${t.gateway_id}-${t.excess_id}`))}:{className:he.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${ae.colors.border}`,borderRadius:ae.radius.default,backgroundColor:ae.colors.muted}),children:Mt(Go,{className:he.create("placeholder-text",{color:ae.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function es({option:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=(null==e?void 0:e.gateway_id)===t.gateway_id&&(null==e?void 0:e.excess_id)===t.excess_id;return Mt("div",{className:ve(he.create("payment-option-row",{borderRadius:ae.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?he.create("payment-option-row-selected",{border:`2px solid ${ae.colors.primary}`,backgroundColor:ae.colors.accent}):he.create("payment-option-row-unselected",{border:`2px solid ${ae.colors.border}`,backgroundColor:ae.colors.card})),onClick:()=>n(t),children:[Mt(Jo,{selected:r}),Mt("div",{className:he.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[Mt("div",{className:he.create("frequency-title",{fontSize:ae.fontSize.default,fontWeight:"500",color:ae.colors.foreground}),children:Xo(t.amount.frequency)}),Mt("div",{className:he.create("gateway-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground}),children:["via ",t.gateway.name]})]}),Mt("div",{className:he.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[Mt(Go,{className:he.create("amount-text",{textAlign:"right"}),children:"one-time"===t.amount.frequency?Qo(t.amount.dueToday):`${Qo(t.amount.installmentAmount||0)} x ${t.amount.numberOfInstallments}`}),Mt(Go,{size:"small",className:he.create("gateway-fee-text",{textAlign:"right",color:ae.colors.mutedForeground}),children:[Qo(t.amount.gatewayFee)," fee"]})]})]})}function ns({label:t,value:e,isTotal:n=!1,className:r}){return Mt("div",{className:ve(he.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Mt("span",{className:he.create("summary-label",{color:ae.colors.mutedForeground,fontSize:ae.fontSize.small}),children:t}),Mt("span",{className:he.create("summary-value",{fontWeight:n?"600":"500",color:ae.colors.foreground,fontSize:n?ae.fontSize.large:"inherit"}),children:e})]})}function rs({excessOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){const l=Jt(()=>n?t.find(t=>t.id===n):null,[t,n]),u=Jt(()=>r?e.find(t=>t.id===r.gateway_id):null,[e,r]);return Mt("div",{className:he.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Mt(Yo,{title:"Payment Summary"}),Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Excess Amount"}),l?Mt(ns,{label:`$${Number(l.excess_amount).toFixed(0)} excess`,value:Qo(l.premium_total)}):Mt(Go,{className:he.create("summary-placeholder",{color:ae.colors.mutedForeground,margin:"0",fontSize:ae.fontSize.small}),children:"No excess selected"})]}),Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Payment Method"}),r&&u?Mt("div",{className:he.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:Mt("div",{className:he.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[Mt("span",{className:he.create("gateway-name",{fontWeight:"500",color:ae.colors.foreground}),children:Xo(r.amount.frequency)}),Mt("span",{className:he.create("gateway-provider",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground}),children:["via ",u.name]})]})}):Mt(Go,{className:he.create("summary-placeholder",{color:ae.colors.mutedForeground,margin:"0",fontSize:ae.fontSize.small}),children:"No payment method selected"})]}),r&&Mt("div",{className:he.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("summary-section-title",{fontSize:ae.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:ae.colors.foreground}),children:"Payment Details"}),Mt("div",{className:he.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Mt(k,{children:[Mt(ns,{label:"Total Due Today:",value:Qo(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Mt(ns,{label:"Gateway Fee:",value:Qo(r.amount.gatewayFee)})]}):Mt(k,{children:[Mt(ns,{label:"Due Today:",value:Qo(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Mt(ns,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:Qo(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Mt(ns,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Mt(k,{children:Mt(ns,{label:"Total Payable:",value:Qo(r.amount.totalRepayable),className:he.create("total-item",{})})})]})})]}),c&&Mt("div",{className:he.create("continue-later-success",{backgroundColor:`${ae.colors.accent}`,padding:"12px 16px",borderRadius:ae.radius.default,borderLeft:`4px solid ${ae.colors.primary}`}),children:[Mt("h4",{className:he.create("success-title",{margin:"0 0 4px 0",color:ae.colors.primary,fontSize:ae.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Mt("p",{className:he.create("success-text",{margin:"0",fontSize:ae.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&&Mt(Ho,{onClick:s,disabled:a,variant:"outline",className:he.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:ae.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Mt(Ho,{onClick:i,disabled:!o,className:he.create("purchase-button",{width:"100%",height:"3rem",fontSize:ae.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function is({isOpen:t,onClose:e,onSuccess:n,onError:r,paymentRequest:i}){const{fsm:o}=$e(()=>({})),[s,a]=Zt("initiating"),[c,l]=Zt(null),[u,d]=Zt(null),[h,f]=Zt(null);Gt(()=>{t&&i&&m()},[t,i]);const m=async()=>{if(i)try{a("initiating"),l(null);const t={...i,returnUrl:window.location.href},e=await o.initiatePayment(t);f(e.transaction_id),a("redirecting"),window.location.href=e.gateway_acceptance_url}catch(t){l(t.message||"Failed to initiate payment"),a("failed")}},p=()=>{u&&!u.closed&&u.close(),a("initiating"),l(null),f(null),d(null),e()};return t?Mt("div",{className:he.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:[Mt("div",{className:he.create("modal-content",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ae.colors.border}`}),children:[Mt("div",{className:he.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Mt("div",{className:he.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(s){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Mt("h2",{className:he.create("modal-title",{margin:"0",color:ae.colors.foreground,fontSize:ae.fontSize.large}),children:"Payment Processing"})]}),Mt("div",{className:he.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Mt(Go,{className:he.create("status-message",{fontSize:ae.fontSize.default,color:ae.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(s){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"}})()}),c&&Mt(Go,{className:he.create("error-message",{color:ae.colors.destructive,fontSize:ae.fontSize.small,padding:"0.75rem",backgroundColor:ae.colors.destructive+"10",borderRadius:ae.radius.default,border:`1px solid ${ae.colors.destructive}30`}),children:c}),("redirecting"===s||"initiating"===s)&&Mt("div",{className:he.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ae.colors.border}`,borderTop:`3px solid ${ae.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Mt("div",{className:he.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===s||"cancelled"===s?Mt(k,{children:[Mt(Ho,{onClick:p,variant:"outline",children:"Close"}),"cancelled"===s&&Mt(Ho,{onClick:()=>{a("initiating"),l(null),m()},children:"Try Again"})]}):Mt(Ho,"completed"===s?{onClick:p,children:"Continue"}:{onClick:p,variant:"outline",disabled:"initiating"===s,children:"Cancel"})})]}),Mt("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function os({type:t,transactionId:e,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(t){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Mt("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:ae.colors.primary||"#10b981"},children:Mt("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:Mt("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:ae.colors.destructive},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"m15 9-6 6"}),Mt("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:Mt("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:ae.colors.secondary},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"m15 9-6 6"}),Mt("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:Mt("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:ae.colors.destructive},children:[Mt("circle",{cx:"12",cy:"12",r:"10"}),Mt("path",{d:"M12 8v4"}),Mt("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=he.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=he.create("modal-content",{backgroundColor:ae.colors.background,borderRadius:ae.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${ae.borderWidth} solid ${ae.colors.border}`}),a=he.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=he.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:ae.colors.foreground,margin:"0"}),l=he.create("modal-message",{color:ae.colors.foreground,lineHeight:"1.5",margin:"0"});he.create("transaction-info",{backgroundColor:ae.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:ae.radius.small,border:`${ae.borderWidth} solid ${ae.colors.border}`,fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,wordBreak:"break-all"});const u=he.create("modal-button",{backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,border:"none",borderRadius:ae.radius.default,padding:"0.75rem 1.5rem",fontSize:ae.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=he.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Mt("div",{className:o,onClick:r,children:Mt("div",{className:s,onClick:t=>t.stopPropagation(),children:Mt("div",{className:a,children:[i.icon,Mt("div",{className:d,children:[Mt("h2",{className:c,children:i.title}),Mt("p",{className:l,children:i.message})]}),Mt("button",{className:u,onClick:r,children:i.buttonText})]})})})}function ss({results:t}){const{fsm:e,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=$e(t=>({selectedExcessId:t.getSelectedExcessId(),selectedPaymentOption:t.getSelectedPaymentOption(),quoteIntent:t.getQuoteIntent(),httpClient:t.httpClient})),[s,a]=Zt(!1),[c,l]=Zt(null),[u,d]=Zt(!1),[h,f]=Zt(!1),m=t.calculations,p=t.payment_options,g=t.payment_gateways;Gt(()=>{const t=m.find(t=>t.id===n);if(t&&i){const n=p.some(t=>"monthly"===t.amount.frequency),r=e.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);kt(i,t,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 Mt(Fo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Mt(be,{children:[Mt("div",{className:he.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:ae.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Mt("div",{className:he.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:ae.colors.card,boxShadow:ae.shadow.sm,borderRadius:ae.radius.large,display:"flex",flexDirection:"column"}),children:[Mt("div",{className:he.create("checkout-header",{paddingInline:ae.spacing.xl,paddingTop:ae.spacing.xl,paddingBottom:ae.spacing.lg},{"(max-width: 768px)":{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingTop:ae.spacing.md}}),children:[Mt("h2",{className:he.create("checkout-title",{margin:"0",marginBottom:ae.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ae.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Mt("p",{className:he.create("checkout-description",{margin:"0",fontSize:ae.fontSize.default,lineHeight:"1.6",color:ae.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Mt("hr",{className:he.create("checkout-header-border",{marginTop:ae.spacing.lg,borderColor:ae.colors.border})})]}),Mt("div",{className:he.create("checkout-sections",{paddingInline:ae.spacing.xl,paddingBottom:ae.spacing.xl,display:"flex",flexDirection:"column",gap:ae.spacing.lg},{"(max-width: 768px)":{paddingInline:ae.spacing.lg,paddingBottom:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingBottom:ae.spacing.md}}),children:[Mt(Vo,{excessOptions:m,selectedExcessId:n,onExcessSelect:t=>e.setSelectedExcessId(t)}),Mt(Ko,{paymentOptions:p,paymentGateways:g,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:t=>e.setSelectedPaymentOption(t)})]})]}),Mt("div",{className:he.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Mt("div",{className:he.create("checkout-sidebar-sticky",{position:"sticky",top:ae.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:Mt("div",{className:he.create("checkout-sidebar-card",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,boxShadow:ae.shadow.sm,padding:ae.spacing.lg},{"(max-width: 768px)":{padding:ae.spacing.md}}),children:Mt(rs,{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 e={quoteIntentId:t.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};l(e),a(!0)},canPurchase:y,onContinueLater:async()=>{var e,s;try{let e;f(!0);const s=null==i?void 0:i.form_data;if(null==s?void 0:s.page_data)for(const t in s.page_data){const n=s.page_data[t];if(n&&"object"==typeof n&&n.client_email){e=n.client_email;break}}if(!e)return void alert("Email address not found. Please try again.");const a=t.calculations.map(t=>t.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={payment_type:"quote",quote_intent_id:t.quote_intent.id,calculation_ids:a,email:e,metadata:c};await o.createPaymentLink(l),d(!0)}catch(t){let n="Failed to send payment link. ";(null===(s=null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.data)||void 0===s?void 0:s.message)?n+=t.response.data.message:(null==t?void 0:t.message)?n+=t.message:n+="Please try again.",alert(n)}finally{f(!1)}},continueLaterLoading:h,showContinueLaterSuccess:u})})})})]}),w&&Mt(os,{type:v.paymentStatus,transactionId:v.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{e.updateQuoteIntent({payment_return:void 0})}}),Mt(is,{isOpen:s,onClose:()=>{a(!1),l(null)},onSuccess:()=>{a(!1),l(null),alert("Payment completed successfully!")},onError:t=>{alert("Payment failed: "+t)},paymentRequest:c})]})})}function as({results:t}){var e,n,r;const{quoteIntent:i}=$e(t=>({quoteIntent:t.getQuoteIntent()})),o=null===(e=null==i?void 0:i.organisation)||void 0===e?void 0:e.admin_email,s=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,a=o||s,c=he.create("referral-card",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.xl,boxShadow:ae.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ae.spacing.lg},"(max-width: 480px)":{padding:ae.spacing.md}}),l=he.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:ae.spacing.lg}),u=he.create("referral-icon",{width:"4rem",height:"4rem",color:ae.colors.primary}),d=he.create("referral-header",{textAlign:"center",marginBottom:ae.spacing.xl}),h=he.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:ae.colors.primary,marginBottom:ae.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=he.create("referral-subtitle",{fontSize:ae.fontSize.default,color:ae.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),m=he.create("referral-process-box",{backgroundColor:ae.colors.accent,borderRadius:ae.radius.default,padding:ae.spacing.lg,marginBottom:ae.spacing.xl}),p=he.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:ae.colors.accentForeground,marginBottom:ae.spacing.md,marginTop:"0"}),g=he.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:ae.spacing.sm}),y=he.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:ae.fontSize.small,color:ae.colors.accentForeground,lineHeight:"1.6"}),v=he.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:ae.colors.primary,color:ae.colors.primaryForeground,borderRadius:"50%",marginRight:ae.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=he.create("referral-contact-section",{borderTop:`1px solid ${ae.colors.border}`,paddingTop:ae.spacing.xl,marginTop:ae.spacing.xl,textAlign:"center"}),b=he.create("referral-contact-text",{fontSize:ae.fontSize.default,color:ae.colors.foreground,marginBottom:ae.spacing.lg}),x=he.create("referral-actions",{display:"flex",gap:ae.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:ae.spacing.lg}),k=he.create("referral-reference",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,marginTop:ae.spacing.md});return Mt(Fo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Mt(be,{children:Mt(qo,{children:Mt("div",{className:c,children:[Mt("div",{className:l,children:Mt(()=>Mt("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:[Mt("path",{d:"M7 10v12"}),Mt("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"})]}),{})}),Mt("div",{className:d,children:[Mt("h1",{className:h,children:"Thanks for your quote request!"}),Mt("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Mt("div",{className:m,children:[Mt("h3",{className:p,children:"What happens next?"}),Mt("ul",{className:g,children:[Mt("li",{className:y,children:[Mt("span",{className:v,children:"1"}),Mt("span",{children:"Our team will review your application within 1-2 business days"})]}),Mt("li",{className:y,children:[Mt("span",{className:v,children:"2"}),Mt("span",{children:"We'll contact you with either approval or additional requirements"})]}),Mt("li",{className:y,children:[Mt("span",{className:v,children:"3"}),Mt("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&Mt("div",{className:w,children:[Mt("p",{className:b,children:"Need to speak with someone about your quote?"}),Mt("div",{className:x,children:[s&&Mt(Ho,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Mt("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:Mt("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&&Mt(Ho,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Mt("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:[Mt("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Mt("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(r=t.quote_intent)||void 0===r?void 0:r.id)&&Mt("div",{className:k,children:["Quote Reference: ",Mt("strong",{children:t.quote_intent.id.slice(0,8).toUpperCase()})]})]})]})})})})}function cs({results:t}){return"referral"===t.outcome_type?Mt(as,{results:t}):Mt(ss,{results:t})}function ls({value:t,onChange:e,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Yt(null),[d,h]=Zt("");function f(t){if(!t)return"";const e=t.replace(/[^\d.]/g,"");if(!e)return"";const n=e.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}Gt(()=>{h(null!=t&&""!==t?f(t):"")},[t]);const m=he.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=he.create("money-input-prefix",{position:"absolute",left:"1rem",color:ae.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=he.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Mt("div",{className:m,children:[l&&Mt("span",{className:p,children:l}),Mt("input",{ref:u,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(t){const n=t.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=f(o);h(s),e(o),requestAnimationFrame(()=>{if(u.current){const t=function(t,e,n){let r=n+(e.length-t.length);return r=Math.max(0,Math.min(r,e.length)),r}(i,s,r);u.current.setSelectionRange(t,t)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:ve(a,l&&g)})]})}function us(t){var e,n,r,i;const o=he.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,fontSize:ae.fontSize.default,backgroundColor:ae.colors.card,color:ae.colors.foreground,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none"});he.pseudoElement("input",":focus",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const s=he.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${ae.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:ae.fontSize.default,backgroundColor:"transparent",color:ae.colors.foreground}),a=he.create("select-wrapper",{border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,backgroundColor:ae.colors.card,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none",overflow:"hidden"});he.pseudoElement("select-wrapper",":focus-within",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const{onChange:c,className:l,validation:u,errors:d,...h}=t;function f(t){c(t.currentTarget.value)}function m(t){c(t.currentTarget.value)}if("select"===t.type)return Mt("div",{className:a,children:Mt("select",{...h,onChange:f,className:s,children:[Mt("option",{value:"",children:"Select an option"}),null===(n=null===(e=t.validation)||void 0===e?void 0:e.options)||void 0===n?void 0:n.map(t=>Mt("option",{value:t.value,children:t.label},t.value))]})});if("date"===t.type)return Mt("input",{...h,type:"date",min:null===(r=t.validation)||void 0===r?void 0:r.minDate,max:null===(i=t.validation)||void 0===i?void 0:i.maxDate,onInput:m,onChange:f,className:ve(o,l)});if("monthyear"===t.type){function p(t){const e=t.currentTarget.value;c(e?`${e}-01`:"")}const g=t.value?t.value.substring(0,7):"";return Mt("input",{...h,type:"month",value:g,onInput:p,onChange:p,className:ve(o,l)})}if("year"===t.type){const y=(new Date).getFullYear();return Mt("input",{...h,type:"number",min:y-100,max:y,placeholder:"YYYY",onInput:m,onChange:f,className:ve(o,l)})}if("money"===t.type)return Mt(ls,{value:t.value,onChange:c,name:t.name,id:t.id,placeholder:t.placeholder,required:t.required,disabled:t.disabled,className:ve(o,l),hasError:t.hasError});if("checkbox"===t.type){const v=!0===t.value||"true"===t.value||"true"===t.value,w=he.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),b=he.create("checkbox-"+(v?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${v?ae.colors.primary:t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:v?ae.colors.primary:ae.colors.card,transition:ae.transition,position:"absolute"});function x(t){t.preventDefault(),c(v?"false":"true")}return he.pseudoElement("checkbox-"+(v?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px ${ae.colors.ring}20`}),Mt("div",{className:w,children:[Mt("input",{type:"checkbox",id:t.id,name:t.name,checked:v,onClick:x,className:ve(b,l),required:t.required,readOnly:!0}),v&&Mt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:ae.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Mt("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===t.type){const k=he.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),S=he.create("boolean-radio-group",{display:"flex",gap:"1rem"}),$=he.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),_=he.create("boolean-radio",{accentColor:ae.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),N=he.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${ae.borderWidth} solid ${t.hasError?ae.colors.destructive:ae.colors.input}`,borderRadius:ae.radius.default,fontSize:ae.fontSize.default,backgroundColor:ae.colors.card,color:ae.colors.foreground,transition:ae.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${ae.colors.destructive}20`:"none",resize:"vertical",fontFamily:ae.fontFamily});he.pseudoElement("boolean-textarea",":focus",{borderColor:ae.colors.ring,boxShadow:`0 0 0 3px ${ae.colors.ring}20`});const E=!0===t.value||"true"===t.value,T=!1===t.value||"false"===t.value,C=t.answer||"",I=t.booleanConfig,M=(null==I?void 0:I.enable_details_textbox)&&("yes"===I.show_details_on&&E||"no"===I.show_details_on&&T);function D(e){c(e),(!(null==I?void 0:I.enable_details_textbox)||!("yes"===I.show_details_on&&"true"===e||"no"===I.show_details_on&&"false"===e))&&t.onAnswerChange&&t.onAnswerChange("")}return Mt("div",{className:ve(k,l),children:[Mt("div",{className:S,children:[Mt("label",{className:$,children:[Mt("input",{type:"radio",name:t.name,checked:E,onChange:()=>D("true"),className:_}),Mt("span",{children:"Yes"})]}),Mt("label",{className:$,children:[Mt("input",{type:"radio",name:t.name,checked:T,onChange:()=>D("false"),className:_}),Mt("span",{children:"No"})]})]}),M&&Mt("textarea",{placeholder:(null==I?void 0:I.details_placeholder)||"Please provide details",value:C,required:!0,onInput:e=>{return n=e.target.value,void(t.onAnswerChange&&t.onAnswerChange(n));var n},className:N})]})}return Mt("input",{...h,onInput:m,onChange:f,className:ve(o,l)})}function ds({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,lastUpdated:i,isSaving:o}=$e(t=>{var e,n;return{lastUpdated:null!==(n=null===(e=t.getFormProgress())||void 0===e?void 0:e.last_updated)&&void 0!==n?n:null,isSaving:t.getIsSaving()}}),s=Yt(null),a=Yt(null);Gt(()=>{if(s.current&&a.current){const t=a.current,e=s.current,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]);const c=Math.round((e+1)/t.length*100);return Mt("div",{className:he.create("sidebar-navigation",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.lg,boxShadow:ae.shadow.sm,position:"sticky",top:ae.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:ae.spacing.lg}),children:[Mt("div",{className:he.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:ae.spacing.sm}),children:[Mt("span",{className:he.create("sidebar-progress-text",{fontSize:ae.fontSize.small,fontWeight:"600",color:ae.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Mt("div",{className:he.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ae.colors.muted,borderRadius:ae.radius.small,overflow:"hidden"}),children:Mt("div",{className:he.create("sidebar-progress-fill",{height:"100%",backgroundColor:ae.colors.primary,borderRadius:ae.radius.small,transition:ae.transition,width:`${c}%`})})})]}),Mt("hr",{className:he.create("sidebar-divider",{borderColor:ae.colors.border})}),Mt("nav",{ref:a,className:he.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:ae.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:ae.spacing.sm}),children:t.map((t,i)=>{const a=i===e,c=n.includes(i),l=r.canNavigateToPage(i),u=he.create(`sidebar-nav-item-${i}`,{display:"flex",alignItems:"flex-start",gap:ae.spacing.sm,padding:`${ae.spacing.sm} ${ae.spacing.sm}`,borderRadius:ae.radius.default,border:"none",backgroundColor:a?ae.colors.accent:"transparent",color:a?ae.colors.accentForeground:ae.colors.foreground,cursor:l&&!o?"pointer":"not-allowed",transition:ae.transition,textAlign:"left",width:"100%",fontFamily:ae.fontFamily,fontSize:ae.fontSize.small,opacity:l&&!o?"1":"0.5"});return l&&!a&&he.pseudoElement(`sidebar-nav-item-${i}`,":hover",{backgroundColor:ae.colors.muted}),Mt("button",{ref:a?s:null,onClick:()=>{return t=i,void(r.canNavigateToPage(t)&&r.navigateToPage(t));var t},disabled:!l||o,className:u,children:[Mt("div",{className:he.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?ae.colors.primary:a?ae.colors.accentForeground:ae.colors.muted,color:c?ae.colors.primaryForeground:a?ae.colors.accent:ae.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Mt("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:Mt("path",{d:"M20 6 9 17l-5-5"})}):i+1}),Mt("div",{className:he.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:[Mt("span",{className:he.create("sidebar-page-title",{fontWeight:a?"600":"500",fontSize:"0.875rem",lineHeight:"1.4",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.title}),t.description&&Mt("span",{className:he.create("sidebar-page-description",{fontSize:"0.75rem",opacity:"0.7",lineHeight:"1.3",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.description})]})]},t.id)})}),Mt("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&r.reset()},className:he.create("sidebar-reset-button",{padding:`${ae.spacing.sm} ${ae.spacing.md}`,border:`${ae.borderWidth} solid ${ae.colors.border}`,borderRadius:ae.radius.default,backgroundColor:"transparent",color:ae.colors.mutedForeground,fontSize:ae.fontSize.small,fontFamily:ae.fontFamily,cursor:"pointer",transition:ae.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),i&&Mt("div",{className:he.create("sidebar-last-saved",{fontSize:"0.6875rem",color:ae.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Lo.fromJSDate(new Date(i)).toFormat("T")]})]})}function hs({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,isSaving:i}=$e(t=>({fsm:t,isSaving:t.getIsSaving()})),[o,s]=Zt(!1),a=Math.round((e+1)/t.length*100);return Mt("div",{className:he.create("mobile-sidebar",{overflow:"hidden"}),children:[Mt("button",{onClick:()=>s(!o),className:he.create("mobile-sidebar-header",{width:"100%",padding:ae.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:ae.spacing.sm}),children:[Mt("div",{className:he.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Mt("span",{className:he.create("mobile-sidebar-step-text",{fontSize:ae.fontSize.small,fontWeight:"600",color:ae.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Mt("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:he.create("mobile-sidebar-chevron",{transition:ae.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:ae.colors.mutedForeground}),children:Mt("path",{d:"m6 9 6 6 6-6"})})]}),Mt("div",{className:he.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ae.colors.muted,borderRadius:ae.radius.small,overflow:"hidden"}),children:Mt("div",{className:he.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:ae.colors.primary,borderRadius:ae.radius.small,transition:ae.transition,width:`${a}%`})})})]}),Mt("hr",{className:he.create("mobile-sidebar-border",{borderColor:ae.colors.border})}),o&&Mt("div",{className:he.create("mobile-sidebar-content",{padding:ae.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:t.map((t,o)=>{const a=o===e,c=n.includes(o),l=r.canNavigateToPage(o);return Mt("button",{onClick:()=>{return t=o,void(r.canNavigateToPage(t)&&(r.navigateToPage(t),s(!1)));var t},disabled:!l||i,className:he.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:ae.spacing.sm,padding:ae.spacing.sm,border:"none",borderRadius:ae.radius.default,backgroundColor:a?ae.colors.accent:"transparent",color:a?ae.colors.accentForeground:ae.colors.foreground,cursor:l&&!i?"pointer":"not-allowed",opacity:l&&!i?"1":"0.5",transition:ae.transition,width:"100%",textAlign:"left",fontFamily:ae.fontFamily}),children:[Mt("div",{className:he.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?ae.colors.primary:a?ae.colors.accentForeground:ae.colors.muted,color:c?ae.colors.primaryForeground:a?ae.colors.accent:ae.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Mt("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:Mt("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Mt("span",{className:he.create("mobile-sidebar-page-title",{fontSize:ae.fontSize.small,fontWeight:a?"600":"500"}),children:t.title})]},t.id)})})]})}function fs({organisation:t}){return Mt("div",{className:he.create("welcome-card",{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},{"(max-width: 950px)":{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingTop:ae.spacing.md}}),children:[Mt("h2",{className:he.create("welcome-title",{margin:"0",marginBottom:ae.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:ae.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:ae.spacing.sm}}),children:["Thank you for choosing ",t.name,"."]}),Mt("p",{className:he.create("welcome-text",{margin:"0",fontSize:ae.fontSize.default,lineHeight:"1.6",color:ae.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."}),Mt("hr",{className:he.create("welcome-border",{marginTop:ae.spacing.lg,borderColor:ae.colors.border})})]})}function ms({title:t,description:e}){return Mt(Fo,{title:t,description:e,children:Mt(be,{children:Mt(qo,{className:he.name("error-container"),children:Mt("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:[Mt("path",{d:"M4.929 4.929 19.07 19.071"}),Mt("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function ps({errors:t,className:e}){return t&&0!==t.length?Mt("div",{className:he.create("field-error",{color:ae.colors.destructive,fontSize:ae.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:t.map((t,e)=>Mt("span",{className:he.create("field-error-message",{lineHeight:"1.4"}),children:t.message},e))}):null}function gs({htmlFor:t,label:e,children:n,required:r,tooltip:i,...o}){const[s,a]=Zt(!1);return Mt("label",{for:t,className:he.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Mt("span",{className:he.create("label-text",{marginBottom:ae.spacing.sm,fontSize:ae.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:ae.spacing.sm,color:ae.colors.foreground}),children:[Mt("span",{children:[e,r&&Mt("span",{className:he.create("label-required-indicator",{color:ae.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Mt("span",{className:he.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Mt("svg",{className:he.create("tooltip-icon",{width:"1rem",height:"1rem",color:ae.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Mt("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Mt("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Mt("span",{className:he.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:ae.colors.popover,color:ae.colors.popoverForeground,fontSize:"0.875rem",borderRadius:ae.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Mt("span",{className:he.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 ${ae.colors.popover}`})})]})]})]}),n]})}function ys(t){switch(null!=t?t:100){case 25:return he.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return he.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return he.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return he.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return he.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return he.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function vs(t){return t?t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,e,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">${e}</a>`:t}):""}function ws({field:t,errors:e,children:n,className:r}){const i=t.code||t.id,o=(null==e?void 0:e.filter(t=>t.field===i))||[],s=he.create("validated-field",{display:"flex",flexDirection:"column",gap:ae.spacing.sm});if("checkbox"===t.type){const e=he.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:ae.spacing.sm}),a=he.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=he.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=he.create("checkbox-label-text",{fontSize:ae.fontSize.default,fontWeight:"600",color:ae.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Mt("div",{className:ve(s,ys(t.width),r),children:[Mt("div",{className:e,children:Mt("div",{className:a,children:[Mt("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Mt("label",{htmlFor:i,className:c,children:[Mt("span",{className:l,children:[t.label,t.required&&Mt("span",{className:he.create("checkbox-required-indicator",{color:ae.colors.destructive}),children:"*"})]}),t.description&&Mt("div",{className:he.create("checkbox-field-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:vs(t.description)}})]})]})}),Mt(ps,{errors:o})]})}return Mt("div",{className:ve(s,ys(t.width),r),children:[Mt(gs,{htmlFor:i,label:t.label,required:t.required,tooltip:t.tooltip,children:[t.description&&Mt("div",{className:he.create("field-description",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,marginBottom:ae.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:vs(t.description)}}),n]}),Mt(ps,{errors:o})]})}function bs({error:t,onDismiss:e,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:ae.colors.secondary+"08",borderColor:ae.colors.secondary+"30",iconColor:ae.colors.secondary,titleColor:ae.colors.foreground},error:{backgroundColor:ae.colors.destructive+"08",borderColor:ae.colors.destructive,iconColor:ae.colors.destructive,titleColor:ae.colors.destructive},critical:{backgroundColor:ae.colors.destructive+"10",borderColor:ae.colors.destructive,iconColor:ae.colors.destructive,titleColor:ae.colors.destructive}}[t.severity],o=he.create("error-card",{padding:ae.spacing.md,borderRadius:ae.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:ae.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=he.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=he.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=he.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=he.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=he.create("error-card-title",{fontSize:ae.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=he.create("error-card-message",{fontSize:ae.fontSize.small,color:ae.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=he.create("error-card-details",{fontSize:"0.8125rem",color:ae.colors.mutedForeground,fontFamily:"monospace",backgroundColor:ae.colors.muted,padding:"0.625rem",borderRadius:ae.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=he.create("error-card-support",{fontSize:"0.8125rem",color:ae.colors.mutedForeground,lineHeight:"1.4"}),m=he.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:ae.colors.mutedForeground,cursor:"pointer",borderRadius:ae.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:ae.transition});return he.pseudoElement("error-card-dismiss",":hover",{backgroundColor:ae.colors.muted,color:ae.colors.foreground}),Mt("div",{className:ve(o,n),children:Mt("div",{className:s,children:[Mt(()=>"warning"===t.severity?Mt("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}):Mt("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Mt("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"})}),{}),Mt("div",{className:c,children:[Mt("div",{className:l,children:[Mt("div",{className:u,children:t.title}),Mt("div",{className:d,children:t.message}),r&&t.details&&Mt("div",{className:h,children:t.details}),Mt("div",{className:f,children:mt(t)})]}),e&&Mt("button",{className:m,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Mt("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:[Mt("path",{d:"M18 6 6 18"}),Mt("path",{d:"m6 6 12 12"})]})})]})]})})}function xs(t,e){const n=e.operator,r=e.value,i=null==r?"":String(r),o=null==t?"":String(t);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===t||null==t||""===t||""===t.trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function ks(t,e){const n=e.operator,r=null==e.value?0:Number(e.value),i=null==t?0:Number(t.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===t||null==t||""===t||""===t.toString().trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function Ss(t,e){const n=e.operator;switch(e.operator){case"true":return!0===t||"true"===t||1===t;case"false":return!1===t||"false"===t||0===t||void 0===t;case"=":return Boolean(t);case"!=":return!Boolean(t);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function $s(t,e){const n=e.operator,r=e.value,i=null==r?0:Number(e.value);if(null==t||""===t.toString().trim())return"is_empty"===n;const o=t.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}`)}}he.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:ae.colors.muted,borderColor:ae.colors.primary,color:ae.colors.primary});class _s{static create(t){switch(t){case"string":case"text":case"select":return xs;case"numeric":return ks;case"boolean":return Ss;case"date":return $s;default:throw new Error(`Unsupported condition type: ${t}`)}}}function Ns(t,e){const n=e.condition_type||"and";if(!e.conditions||0===e.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:e.conditions.map(e=>{const n={...e,matched:Es(t,e),string:`${e.field} ${e.operator}`};return e.value&&(n.string+=` ${e.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(t=>t.matched)),"or"===n&&(r.matched=r.conditions.some(t=>t.matched)),"not"===n&&(r.matched=r.conditions.every(t=>!t.matched)),r}function Es(t,e){const n=t[e.field],r=_s.create(e.type);if(!r)throw new Error(`Unsupported condition type: ${e.type}`);return r(n,e)}var Ts=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:_s,booleanMatchesCondition:Ss,checkSimpleConditions:Ns,dateMatchesCondition:$s,numericMatchesCondition:ks,textMatchesCondition:xs});function Cs(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=$e(t=>({definition:t.getFormDefinition(),currentPageIndex:t.getCurrentPageIndex(),totalPages:t.getTotalPages(),results:t.getCalculationResult(),validationErrors:t.getValidationErrors(),generalErrors:t.getGeneralErrors(),quoteIntent:t.getQuoteIntent(),isSaving:t.getIsSaving()})),l=e.pages[n];if(!l)return Mt(ms,{title:"Unexpected Error",description:"No page available"});const u=Yt(new Map),d=(t,e)=>{var n;const r=c.getFormProgress().page_data[l.id],i=null==r?void 0:r[t];if(null!=i&&""!==i)return i;if(e&&("date"===e.type||"monthyear"===e.type)&&(null===(n=e.validation)||void 0===n?void 0:n.defaultDate)){const n=h(e.validation.defaultDate,"monthyear"===e.type);if(n)return c.updateFieldValue(l.id,t,n),n}return""},h=(t,e)=>{const n=new Date;let r=new Date;switch(t){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 e?`${i}-${o}-01`:`${i}-${o}-${s}`},f=t=>{const e=c.getFormProgress().page_data[l.id];return((null==e?void 0:e.U)||{})[t]||""},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 Mt(Fo,{title:l.title,description:l.description,hideHeader:!0,children:Mt("div",{children:[g&&Mt(os,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Mt(be,{children:Mt("div",{className:he.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:ae.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Mt("div",{className:he.create("form-content-wrapper",{minWidth:"0",backgroundColor:ae.colors.card,boxShadow:ae.shadow.sm,borderRadius:ae.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Mt("div",{className:he.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Mt(hs,{pages:e.pages,currentPageIndex:n,completedPages:y})}),n>0&&Mt("div",{className:he.create("page-heading-container",{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},{"(max-width: 950px)":{paddingInline:ae.spacing.lg,paddingTop:ae.spacing.lg},"(max-width: 480px)":{paddingInline:ae.spacing.md,paddingTop:ae.spacing.md}}),children:[Mt("div",{className:he.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ae.spacing.lg}),children:Mt("div",{className:he.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Mt("h1",{className:he.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ae.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&Mt("p",{className:he.create("page-template-description",{margin:"0",marginTop:ae.spacing.sm,fontSize:ae.fontSize.small,lineHeight:"1.5",color:ae.colors.foreground,opacity:"0.7"}),children:l.description})]})}),Mt("hr",{className:he.create("page-heading-border",{marginTop:ae.spacing.lg,borderColor:ae.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Mt(fs,{organisation:s.organisation}),o.length>0&&o.map(t=>Mt(bs,{error:t,onDismiss:()=>c.dismissGeneralError(t.id)},t.id)),Mt("div",{className:he.create("form-card",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.lg,boxShadow:ae.shadow.sm,display:"flex",flexDirection:"column",gap:ae.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:ae.spacing.md,gap:ae.spacing.lg},"(max-width: 480px)":{padding:ae.spacing.md,gap:ae.spacing.md}}),children:[Mt("form",{onSubmit:t=>t.preventDefault(),className:he.create("form-fields-container",{flex:"1"}),children:Mt("div",{className:he.create("form-content-page",{display:"grid",gap:ae.spacing.md,rowGap:ae.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:l.fields.map(e=>{const n=e.code||e.id;return(e=>{if(!e.visibility)return!0;const n=Ns(m,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),r="show"===e.visibility.action?n.matched:!n.matched;return u.current.get(e.id)!==r&&(t((e.label,e.code)),t(),u.current.set(e.id,r)),r})(e)?Mt(ws,{field:e,errors:i,children:Mt(us,{value:d(n,e).toString(),onChange:t=>{let r=t;"boolean"!==e.type&&"checkbox"!==e.type||(r="true"===t),c.updateFieldValue(l.id,n,r)},answer:f(n),onAnswerChange:t=>{c.updateFieldAnswer(l.id,n,t)},id:n,name:n,type:e.type,placeholder:e.placeholder,validation:e.validation,booleanConfig:e.boolean_config,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},e.id):null})})}),Mt("hr",{className:he.create("form-navigation-border",{borderColor:ae.colors.border})}),Mt("div",{className:he.create("form-navigation-inline",{paddingTop:ae.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Mt(Ho,{onClick:()=>c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Mt(Ho,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await c.calculateQuote():await c.navigateToNextPage())},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Mt("div",{className:he.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Mt(ds,{pages:e.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function Is(){var t,e,n;const{quoteIntent:r,fsm:i}=$e(t=>({quoteIntent:t.getQuoteIntent(),fsm:t})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.name,l=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.admin_email,u=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=l||u;Gt(()=>{if(s&&r){const t=null==o?void 0:o.paymentStatus,e=null==a?void 0:a.amount;"success"===t&&a?_t(r,s,e||0,a.gateway_code,e,void 0):t&&["declined","cancelled","error"].includes(t)&&Nt(r,s,e,null==a?void 0:a.gateway_code,t,null==a?void 0:a.status)}const t=setTimeout(()=>{i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(t)},[i,s,o,r]);const h=he.create("success-card",{backgroundColor:ae.colors.card,borderRadius:ae.radius.large,padding:ae.spacing.xl,boxShadow:ae.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ae.spacing.lg},"(max-width: 480px)":{padding:ae.spacing.md}}),f=he.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:ae.spacing.lg}),m=he.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=he.create("success-header",{textAlign:"center",marginBottom:ae.spacing.xl}),g=he.create("success-title",{margin:"0",marginBottom:ae.spacing.sm,fontSize:"2rem",fontWeight:"700",color:ae.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=he.create("success-message",{fontSize:ae.fontSize.default,lineHeight:"1.6",color:ae.colors.foreground,opacity:"0.9",margin:"0"}),v=he.create("success-contact-section",{borderTop:`1px solid ${ae.colors.border}`,paddingTop:ae.spacing.xl,marginTop:ae.spacing.xl}),w=he.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:ae.colors.foreground,marginBottom:ae.spacing.md,textAlign:"center"}),b=he.create("success-contact-details",{backgroundColor:ae.colors.accent,borderRadius:ae.radius.default,padding:ae.spacing.md,display:"flex",flexDirection:"column",gap:ae.spacing.sm,marginBottom:ae.spacing.lg}),x=he.create("success-contact-item",{display:"flex",alignItems:"center",gap:ae.spacing.sm,fontSize:ae.fontSize.small,color:ae.colors.accentForeground}),k=he.create("success-actions",{display:"flex",gap:ae.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=he.create("success-reference",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,textAlign:"center",marginTop:ae.spacing.md});return Mt(Fo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Mt(be,{children:Mt(qo,{children:Mt("div",{className:h,children:[Mt("div",{className:f,children:Mt("div",{className:m,children:Mt("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:Mt("path",{d:"M20 6 9 17l-5-5"})})})}),Mt("div",{className:p,children:[Mt("h1",{className:g,children:"Payment Complete!"}),Mt("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&&Mt("div",{className:v,children:[Mt("h3",{className:w,children:"Need assistance?"}),Mt("div",{className:b,children:[l&&Mt("div",{className:x,children:[Mt("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:[Mt("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Mt("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Mt("span",{children:l})]}),u&&Mt("div",{className:x,children:[Mt("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:Mt("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"})}),Mt("span",{children:u})]})]}),Mt("div",{className:k,children:[u&&Mt(Ho,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Mt("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:Mt("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&&Mt(Ho,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Mt("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:[Mt("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Mt("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),Mt("div",{className:S,children:["Quote Reference: ",Mt("strong",{children:r.id.slice(0,8).toUpperCase()})]})]})]})})})})}function Ms({children:t}){return Mt("div",{className:he.create("column",{display:"flex",flexDirection:"column",alignItems:"start",gap:"2rem"}),children:t})}function Ds({paymentLinkId:t,signedUrl:e}){var n,r,i;const{httpClient:o}=Se(),[s,a]=Zt(null),[c,l]=Zt(!0),[u,d]=Zt(null),[h,f]=Zt(!1),[m,p]=Zt(null),[g,y]=Zt(null);Gt(()=>{v()},[t]);const v=async()=>{var t;try{l(!0);const n=await o.getPaymentLinkDetails(e);if("paid"===n.status)return void d("This payment link has already been used.");if("expired"===n.status)return void d("This payment link has expired.");if(a(n),n.snapshot_data.calculations&&n.snapshot_data.calculations.length>0){if(null===(t=n.metadata)||void 0===t?void 0:t.selected_calculation_id){const t=n.snapshot_data.calculations.find(t=>{var e,r;return t.id===(null===(e=n.metadata)||void 0===e?void 0:e.selected_calculation_id)||t.calculation_id===(null===(r=n.metadata)||void 0===r?void 0:r.selected_calculation_id)});t&&y(t.id)}else if(1===n.snapshot_data.calculations.length){const t=n.snapshot_data.calculations[0];y(t.id||t.calculation_id)}}else if(n.snapshot_data.calculation){const t=n.snapshot_data.calculation;y(t.id||t.calculation_id)}}catch(t){d("Failed to load payment details. Please check your link.")}finally{l(!1)}};if(c)return Mt(Fo,{title:"Loading...",noSubscription:!0,children:Mt("div",{className:he.create("payment-link-loading",{textAlign:"center",padding:"40px"}),children:Mt("p",{children:"Loading payment details..."})})});if(u)return Mt(Fo,{title:"Payment Link",noSubscription:!0,children:Mt(be,{children:Mt("div",{className:he.create("payment-link-error",{textAlign:"center",padding:"40px",backgroundColor:`${ae.colors.destructive}20`,borderRadius:ae.radius.default,margin:"20px"}),children:[Mt("h2",{className:he.create("error-title",{color:ae.colors.destructive,marginBottom:ae.spacing.md}),children:"Error"}),Mt("p",{children:u})]})})});if(!s)return null;const w="quote"===s.payment_type||"renewal"===s.payment_type,b=s.snapshot_data.calculations||(s.snapshot_data.calculation?[s.snapshot_data.calculation]:[]),x=b.length>1,S=b.find(t=>(t.id||t.calculation_id)===g),$=s.snapshot_data.product_name||s.snapshot_data.description||"Payment",_=(null==S?void 0:S.premium_payable)||s.snapshot_data.amount||0,N=new Date(s.expires_at);return Mt(Fo,{title:"Complete Your "+("renewal"===s.payment_type?"Renewal":"Purchase"),noSubscription:!0,children:Mt(be,{children:Mt(Ms,{children:[Mt("div",{className:he.create("payment-link-header",{textAlign:"center"}),children:[Mt("h1",{className:he.create("payment-link-title",{marginBottom:"8px",fontSize:"2rem",fontWeight:"700"}),children:"renewal"===s.payment_type?"Policy Renewal":"Complete Your Purchase"}),Mt("p",{className:he.create("payment-link-subtitle",{color:ae.colors.mutedForeground,fontSize:ae.fontSize.large}),children:$})]}),Mt("div",{className:he.create("expiry-notice",{backgroundColor:`${ae.colors.accent}`,padding:"12px 16px",borderRadius:ae.radius.default,borderLeft:`4px solid ${ae.colors.primary}`}),children:Mt("p",{className:he.create("expiry-text",{margin:"0",fontSize:ae.fontSize.small}),children:["⏰ This payment link expires on ",N.toLocaleDateString()]})}),w&&x&&Mt("div",{className:he.create("calculation-selection",{marginBottom:ae.spacing.lg}),children:[Mt("h3",{className:he.create("section-title",{marginTop:"0",marginBottom:ae.spacing.md}),children:"Select Your Excess Amount"}),Mt("div",{className:he.create("calculation-options",{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:ae.spacing.md}),children:b.map(t=>{const e=t.id||t.calculation_id;return Mt("div",{className:he.create(`calc-option-${e}`,{padding:ae.spacing.md,border:`2px solid ${g===e?ae.colors.primary:ae.colors.border}`,borderRadius:ae.radius.default,cursor:"pointer",backgroundColor:g===e?`${ae.colors.primary}10`:"white",transition:"all 0.2s ease",position:"relative"}),onClick:()=>y(e),children:[Mt("div",{className:he.create("excess-amount",{fontSize:"20px",fontWeight:"bold",color:ae.colors.primary,marginBottom:"4px"}),children:["$",Number(t.excess_amount).toFixed(0)]}),Mt("div",{className:he.create("excess-label",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground,marginBottom:ae.spacing.sm}),children:"Excess"}),Mt("div",{className:he.create("premium",{fontSize:ae.fontSize.default,fontWeight:"600"}),children:["$",Number(t.premium_payable).toFixed(2)]}),Mt("div",{className:he.create("premium-label",{fontSize:ae.fontSize.small,color:ae.colors.mutedForeground}),children:"Annual Premium"}),g===e&&Mt("div",{className:he.create("selected-badge",{position:"absolute",top:"8px",right:"8px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:ae.colors.primary,display:"flex",alignItems:"center",justifyContent:"center"}),children:Mt("span",{style:{color:"white",fontSize:"12px"},children:"✓"})})]},e)})})]}),w&&!x&&S&&Mt("div",{className:he.create("coverage-details",{backgroundColor:ae.colors.card,padding:"20px",borderRadius:ae.radius.default,border:`1px solid ${ae.colors.border}`}),children:[Mt("h3",{className:he.create("section-title",{marginTop:"0",marginBottom:ae.spacing.md}),children:"Coverage Details"}),Mt("div",{className:he.create("detail-row",{display:"flex",justifyContent:"space-between",marginBottom:"8px"}),children:[Mt("span",{children:"Excess Amount:"}),Mt("strong",{children:["$",Number(S.excess_amount).toFixed(2)]})]})]}),Mt("div",{className:he.create("amount-breakdown",{backgroundColor:ae.colors.card,padding:"20px",borderRadius:ae.radius.default,border:`1px solid ${ae.colors.border}`}),children:[Mt("h3",{className:he.create("section-title",{marginTop:"0",marginBottom:ae.spacing.md}),children:w?"Premium Breakdown":"Payment Details"}),Mt(k,w&&S?{children:[Mt("div",{className:he.create("detail-row",{display:"flex",justifyContent:"space-between",marginBottom:"8px"}),children:[Mt("span",{children:"Premium (excluding fees):"}),Mt("span",{children:["$",Number(S.premium_subtotal).toFixed(2)]})]}),null===(r=null===(n=S.result)||void 0===n?void 0:n.fees)||void 0===r?void 0:r.map((t,e)=>Mt("div",{className:he.create(`fee-row-${e}`,{display:"flex",justifyContent:"space-between",marginBottom:"8px"}),children:[Mt("span",{children:[t.name,":"]}),Mt("span",{children:["$",Number(t.amount).toFixed(2)]})]},e))]}:{children:null===(i=s.snapshot_data.line_items)||void 0===i?void 0:i.map((t,e)=>Mt("div",{className:he.create(`line-item-${e}`,{display:"flex",justifyContent:"space-between",marginBottom:"8px"}),children:[Mt("span",{children:[t.name,":"]}),Mt("span",{children:["$",Number(t.amount).toFixed(2)]})]},e))}),Mt("div",{className:he.create("total-row",{display:"flex",justifyContent:"space-between",marginTop:"16px",paddingTop:"16px",borderTop:`2px solid ${ae.colors.border}`,fontSize:"18px",fontWeight:"bold"}),children:[Mt("span",{children:w?"Total Premium:":"Total Amount:"}),Mt("span",{className:he.create("total-amount",{color:ae.colors.primary}),children:["$",Number(_).toFixed(2)]})]})]}),Mt("div",{className:he.create("important-notice",{backgroundColor:`${ae.colors.accent}`,padding:"16px",borderRadius:ae.radius.default}),children:Mt("p",{className:he.create("notice-text",{margin:"0",fontSize:ae.fontSize.small}),children:["ℹ️ ",Mt("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."]})}),Mt(Ho,{onClick:()=>{var t;if(!s)return;if(!g)return void alert("Please select an excess amount before proceeding.");const e="quote"===s.payment_type||"renewal"===s.payment_type;let n=null;if(s.snapshot_data.calculations?n=s.snapshot_data.calculations.find(t=>(t.id||t.calculation_id)===g):s.snapshot_data.calculation&&(n=s.snapshot_data.calculation),e&&!n)return void alert("Payment configuration error. Please try again.");let r=null===(t=s.metadata)||void 0===t?void 0:t.gateway_id;r||(r="windcave");const i=s.snapshot_data.form_data||{};let o="Customer";if(i.page_data)for(const t in i.page_data){const e=i.page_data[t];if(e&&"object"==typeof e){if(e.client_first_name){o=`${e.client_first_name} ${e.client_last_name||""}`.trim();break}if(e.client_name){o=e.client_name;break}if(e.full_name){o=e.full_name;break}if(e.name){o=e.name;break}if(e.first_name){o=`${e.first_name} ${e.last_name||""}`.trim();break}}}const a=s.quote_intent_id||s.calculation_id||s.id,c=s.calculation_id||s.id,l={quoteIntentId:a,excessId:n.excess_id||"",gatewayId:r,calculationId:c,clientDetails:{legalName:o},metadata:{payment_link_id:s.id,payment_type:s.payment_type}};p(l),f(!0)},className:he.create("payment-button",{width:"100%",padding:"16px",fontSize:"16px",fontWeight:"bold"}),children:["Proceed to Payment - $",Number(_).toFixed(2)]}),h&&m&&Mt(is,{isOpen:h,onClose:()=>{f(!1),p(null)},onSuccess:()=>{f(!1),p(null),alert("Payment completed successfully!")},onError:t=>{alert("Payment failed: "+t)},paymentRequest:m})]})})})}function Ps(){const{isCalculating:t,results:e,quoteIntent:n}=$e(t=>({isCalculating:t.getIsCalculating(),results:t.getCalculationResult(),quoteIntent:t.getQuoteIntent()})),r=window.location.pathname.match(/\/pay\/([a-f0-9-]+)/);if(r&&r[1])return Mt(Ds,{paymentLinkId:r[1],signedUrl:window.location.href});const i="paid"===(null==n?void 0:n.status)||"completed"===(null==n?void 0:n.status);return t?Mt(Bo,{message:"Processing your quote, please wait..."}):i?Mt(Is,{}):e?Mt(cs,{results:e}):Mt(Cs,{})}function Os(t){return Mt(ke,{...t,children:Mt(Ps,{})})}class Rs extends S{constructor(t){super(t),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return wd}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(t){}const r=st("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const t=this.state.error;return ft(t)?Mt(Zo,{message:t.message}):Mt(Uo,{error:t})}return this.props.children}}function js({config:e,initializeFormContext:n}){const[r,i]=Zt({type:"loading",message:"Loading application..."});return Gt(()=>{(async()=>{try{t();const r=await n(e);if(!r.formStateManager||"function"!=typeof r.formStateManager.getFormProgress)throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:r})}catch(e){let n;t(),n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?st("maintenance",e):st("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[e,n]),Mt(Rs,{children:Mt("div",{className:he.create("root",{fontFamily:ae.fontFamily,backgroundColor:ae.colors.background,minHeight:"100vh",color:ae.colors.foreground}),children:function(){switch(r.type){case"loading":return Mt(Bo,{message:r.message});case"error":return ft(r.error)?Mt(Zo,{message:r.error.message}):Mt(Uo,{error:r.error});case"success":return Mt(Os,{...r.formContextProps});default:return Mt(Uo,{})}}()})})}class As{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(e));){const e=`--${s[1]}`,i=s[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return fe}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[t,e]of Object.entries(n.variables))this.variableMapping[t]||(i[t]=e);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(t=>{const e=document.getElementById(t);e&&(e.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(t){return this.loadedThemes.has(t)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}As.loadedThemes=new Set,As.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};const zs="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ls=globalThis,Ws="10.17.0";function Fs(){return qs(Ls),Ls}function qs(t){const e=t.st=t.st||{};return e.version=e.version||Ws,e[Ws]=e[Ws]||{}}function Bs(t,e,n=Ls){const r=n.st=n.st||{},i=r[Ws]=r[Ws]||{};return i[t]||(i[t]=e())}const Hs=["debug","info","warn","error","log","assert","trace"],Us={};function Zs(t){if(!("console"in Ls))return t();const e=Ls.console,n={},r=Object.keys(Us);r.forEach(t=>{const r=Us[t];n[t]=e[t],e[t]=r});try{return t()}finally{r.forEach(t=>{e[t]=n[t]})}}function Gs(){return Js().enabled}function Ys(t,...e){zs&&Gs()&&Zs(()=>{Ls.console[t](`Sentry Logger [${t}]:`,...e)})}function Js(){return zs?Bs("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Vs=function(){Js().enabled=!0},Qs=function(...t){Ys("log",...t)},Xs=function(...t){Ys("warn",...t)},Ks=function(...t){Ys("error",...t)},ta="?",ea=/\(error: (.*)\)/,na=/captureMessage|captureException/;function ra(...t){const e=t.sort((t,e)=>t[0]-e[0]).map(t=>t[1]);return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){let n=o[t];n.length>1024&&(n=n.slice(0,1024));const s=ea.test(n)?n.replace(ea,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(ia(e).function||"")&&e.pop(),e.reverse(),na.test(ia(e).function||"")&&(e.pop(),na.test(ia(e).function||"")&&e.pop()),e.slice(0,50).map(t=>({...t,filename:t.filename||ia(e).filename,function:t.function||ta}))}(i.slice(r))}}function ia(t){return t[t.length-1]||{}}const oa="<anonymous>";function sa(t){try{return t&&"function"==typeof t&&t.name||oa}catch{return oa}}function aa(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach(e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)}),t}catch{return}}}const ca={},la={};function ua(t,e){ca[t]=ca[t]||[],ca[t].push(e)}function da(t,e){if(!la[t]){la[t]=!0;try{e()}catch(e){zs&&Ks(`Error while instrumenting ${t}`,e)}}}function ha(t,e){const n=t&&ca[t];if(n)for(const r of n)try{r(e)}catch(e){zs&&Ks(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${sa(r)}\nError:`,e)}}let fa=null;function ma(){fa=Ls.onerror,Ls.onerror=function(t,e,n,r,i){return ha("error",{column:r,error:i,line:n,msg:t,url:e}),!!fa&&fa.apply(this,arguments)},Ls.onerror.ct=!0}let pa=null;function ga(){pa=Ls.onunhandledrejection,Ls.onunhandledrejection=function(t){return ha("unhandledrejection",t),!pa||pa.apply(this,arguments)},Ls.onunhandledrejection.ct=!0}const ya={}.toString;function va(t){switch(ya.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Ta(t,Error)}}function wa(t,e){return ya.call(t)===`[object ${e}]`}function ba(t){return wa(t,"ErrorEvent")}function xa(t){return wa(t,"DOMError")}function ka(t){return wa(t,"String")}function Sa(t){return"object"==typeof t&&null!==t&&"lt"in t&&"ut"in t}function $a(t){return null===t||Sa(t)||"object"!=typeof t&&"function"!=typeof t}function _a(t){return wa(t,"Object")}function Na(t){return"undefined"!=typeof Event&&Ta(t,Event)}function Ea(t){return Boolean(t?.then&&"function"==typeof t.then)}function Ta(t,e){try{return t instanceof e}catch{return!1}}function Ca(t){return!("object"!=typeof t||null===t||!t.ht&&!t.ft)}const Ia=Ls;function Ma(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let l;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(l=Da(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 Da(t,e){const n=t,r=[];if(!n?.tagName)return"";if(Ia.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=e?.length?e.filter(t=>n.getAttribute(t)).map(t=>[t,n.getAttribute(t)]):null;if(i?.length)i.forEach(t=>{r.push(`[${t[0]}="${t[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&ka(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}function Pa(){try{return Ia.document.location.href}catch{return""}}function Oa(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function Ra(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{Ca(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function ja(t,e,n=!1){return!!ka(t)&&(wa(e,"RegExp")?e.test(t):!!ka(e)&&(n?t===e:t.includes(e)))}function Aa(t,e=[],n=!1){return e.some(e=>ja(t,e,n))}function za(t,e,n){if(!(e in t))return;const r=t[e];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Wa(i,r);try{t[e]=i}catch{zs&&Qs(`Failed to replace method "${e}" in object`,t)}}function La(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{zs&&Qs(`Failed to add non-enumerable property "${e}" to object`,t)}}function Wa(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,La(t,"__sentry_original__",e)}catch{}}function Fa(t){return t.gt}function qa(t){if(va(t))return{message:t.message,name:t.name,stack:t.stack,...Ha(t)};if(Na(t)){const e={type:t.type,target:Ba(t.target),currentTarget:Ba(t.currentTarget),...Ha(t)};return"undefined"!=typeof CustomEvent&&Ta(t,CustomEvent)&&(e.detail=t.detail),e}return t}function Ba(t){try{return"undefined"!=typeof Element&&Ta(t,Element)?Ma(t):{}.toString.call(t)}catch{return"<unknown>"}}function Ha(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ua(t=function(){const t=Ls;return t.crypto||t.msCrypto}()){let e=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(15&e())>>t/4).toString(16))}function Za(t){return t.exception?.values?.[0]}function Ga(t){const{message:e,event_id:n}=t;if(e)return e;const r=Za(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ya(t,e){const n=t.exception=t.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Ja(t,e){const n=Za(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r?.data,...e.data};n.mechanism.data=t}}function Va(t){if(function(t){try{return t.yt}catch{}}(t))return!0;try{La(t,"__sentry_captured__",!0)}catch{}return!1}function Qa(){return Date.now()/1e3}let Xa;function Ka(){return(Xa??(Xa=function(){const{performance:t}=Ls;if(!t?.now||!t.timeOrigin)return Qa;const e=t.timeOrigin;return()=>(e+t.now())/1e3}()))()}function tc(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ka(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Ua()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function ec(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)({}).hasOwnProperty.call(e,t)&&(r[t]=ec(r[t],e[t],n-1));return r}function nc(){return Ua()}function rc(){return Ua().substring(16)}const ic="_sentrySpan";function oc(t,e){e?La(t,ic,e):delete t[ic]}function sc(t){return t[ic]}class ac{constructor(){this.vt=!1,this.wt=[],this.bt=[],this.xt=[],this.kt=[],this.St={},this.$t={},this._t={},this.Nt={},this.Et={},this.Tt={traceId:nc(),sampleRand:Math.random()}}clone(){const t=new ac;return t.xt=[...this.xt],t.$t={...this.$t},t._t={...this._t},t.Nt={...this.Nt},this.Nt.flags&&(t.Nt.flags={values:[...this.Nt.flags.values]}),t.St=this.St,t.Ct=this.Ct,t.It=this.It,t.Mt=this.Mt,t.Dt=this.Dt,t.bt=[...this.bt],t.kt=[...this.kt],t.Et={...this.Et},t.Tt={...this.Tt},t.Pt=this.Pt,t.Ot=this.Ot,oc(t,sc(this)),t}setClient(t){this.Pt=t}setLastEventId(t){this.Ot=t}getClient(){return this.Pt}lastEventId(){return this.Ot}addScopeListener(t){this.wt.push(t)}addEventProcessor(t){return this.bt.push(t),this}setUser(t){return this.St=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.It&&tc(this.It,{user:t}),this.Rt(),this}getUser(){return this.St}setTags(t){return this.$t={...this.$t,...t},this.Rt(),this}setTag(t,e){return this.$t={...this.$t,[t]:e},this.Rt(),this}setExtras(t){return this._t={...this._t,...t},this.Rt(),this}setExtra(t,e){return this._t={...this._t,[t]:e},this.Rt(),this}setFingerprint(t){return this.Dt=t,this.Rt(),this}setLevel(t){return this.Ct=t,this.Rt(),this}setTransactionName(t){return this.Mt=t,this.Rt(),this}setContext(t,e){return null===e?delete this.Nt[t]:this.Nt[t]=e,this.Rt(),this}setSession(t){return t?this.It=t:delete this.It,this.Rt(),this}getSession(){return this.It}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,n=e instanceof ac?e.getScopeData():_a(e)?t:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this.$t={...this.$t,...r},this._t={...this._t,...i},this.Nt={...this.Nt,...s},o&&Object.keys(o).length&&(this.St=o),a&&(this.Ct=a),c.length&&(this.Dt=c),l&&(this.Tt=l),this}clear(){return this.xt=[],this.$t={},this._t={},this.St={},this.Nt={},this.Ct=void 0,this.Mt=void 0,this.Dt=void 0,this.It=void 0,oc(this,void 0),this.kt=[],this.setPropagationContext({traceId:nc(),sampleRand:Math.random()}),this.Rt(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:Qa(),...t,message:t.message?Oa(t.message,2048):t.message};return this.xt.push(r),this.xt.length>n&&(this.xt=this.xt.slice(-n),this.Pt?.recordDroppedEvent("buffer_overflow","log_item")),this.Rt(),this}getLastBreadcrumb(){return this.xt[this.xt.length-1]}clearBreadcrumbs(){return this.xt=[],this.Rt(),this}addAttachment(t){return this.kt.push(t),this}clearAttachments(){return this.kt=[],this}getScopeData(){return{breadcrumbs:this.xt,attachments:this.kt,contexts:this.Nt,tags:this.$t,extra:this._t,user:this.St,level:this.Ct,fingerprint:this.Dt||[],eventProcessors:this.bt,propagationContext:this.Tt,sdkProcessingMetadata:this.Et,transactionName:this.Mt,span:sc(this)}}setSDKProcessingMetadata(t){return this.Et=ec(this.Et,t,2),this}setPropagationContext(t){return this.Tt=t,this}getPropagationContext(){return this.Tt}captureException(t,e){const n=e?.event_id||Ua();if(!this.Pt)return zs&&Xs("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Pt.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n?.event_id||Ua();if(!this.Pt)return zs&&Xs("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this.Pt.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e?.event_id||Ua();return this.Pt?(this.Pt.captureEvent(t,{...e,event_id:n},this),n):(zs&&Xs("No client configured on scope - will not capture event!"),n)}Rt(){this.vt||(this.vt=!0,this.wt.forEach(t=>{t(this)}),this.vt=!1)}}class cc{constructor(t,e){let n,r;n=t||new ac,r=e||new ac,this.jt=[{scope:n}],this.At=r}withScope(t){const e=this.zt();let n;try{n=t(e)}catch(t){throw this.Lt(),t}return Ea(n)?n.then(t=>(this.Lt(),t),t=>{throw this.Lt(),t}):(this.Lt(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.At}getStackTop(){return this.jt[this.jt.length-1]}zt(){const t=this.getScope().clone();return this.jt.push({client:this.getClient(),scope:t}),t}Lt(){return!(this.jt.length<=1||!this.jt.pop())}}function lc(){const t=qs(Fs());return t.stack=t.stack||new cc(Bs("defaultCurrentScope",()=>new ac),Bs("defaultIsolationScope",()=>new ac))}function uc(t){return lc().withScope(t)}function dc(t,e){const n=lc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function hc(t){return lc().withScope(()=>t(lc().getIsolationScope()))}function fc(t){const e=qs(t);return e.acs?e.acs:{withIsolationScope:hc,withScope:uc,withSetScope:dc,withSetIsolationScope:(t,e)=>hc(e),getCurrentScope:()=>lc().getScope(),getIsolationScope:()=>lc().getIsolationScope()}}function mc(){return fc(Fs()).getCurrentScope()}function pc(){return fc(Fs()).getIsolationScope()}function gc(...t){const e=fc(Fs());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}function yc(){return mc().getClient()}function vc(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,o={trace_id:n,span_id:i||rc()};return r&&(o.parent_span_id=r),o}const wc="sentry.profile_id",bc="sentry.exclusive_time";function xc(t){if(t){if("object"==typeof t&&"deref"in t&&"function"==typeof t.deref)try{return t.deref()}catch{return}return t}}function kc(t){const e=t;return{scope:e.Wt,isolationScope:xc(e.Ft)}}const Sc=/^sentry-/;function $c(t){return t.split(",").map(t=>t.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((t,[e,n])=>(e&&n&&(t[e]=n),t),{})}const _c=/^o(\d+)\./,Nc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Ec(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Tc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Cc(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=function(t){const e=t.match(_c);return e?.[1]}(n)),r}let Ic=!1;function Mc(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:Rc(t).parent_span_id,o=kc(t).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||rc():e,trace_id:n}}function Dc(t){return t&&t.length>0?t.map(({context:{spanId:t,traceId:e,traceFlags:n,...r},attributes:i})=>({span_id:t,trace_id:e,sampled:1===n,attributes:i,...r})):void 0}function Pc(t){return"number"==typeof t?Oc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Oc(t.getTime()):Ka()}function Oc(t){return t>9999999999?t/1e3:t}function Rc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:Pc(i),timestamp:Pc(s)||void 0,status:jc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Dc(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function jc(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Ac(t){return t.qt||t}function zc(){Ic||(Zs(()=>{}),Ic=!0)}function Lc(t){Qs(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Wc(t,e){if(!e?.length||!t.description)return!1;for(const n of e){if(qc(n)){if(ja(t.description,n))return zs&&Lc(t),!0;continue}if(!n.name&&!n.op)continue;const e=!n.name||ja(t.description,n.name),r=!n.op||t.op&&ja(t.op,n.op);if(e&&r)return zs&&Lc(t),!0}return!1}function Fc(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const e of t)e.parent_span_id===r&&(e.parent_span_id=n)}function qc(t){return"string"==typeof t||t instanceof RegExp}const Bc="production";function Hc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||Bc,release:n.release,public_key:r,trace_id:t,org_id:Cc(e)};return e.emit("createDsc",i),i}function Uc(t){const e=yc();if(!e)return{};const n=Ac(t),r=Rc(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(t){return"number"!=typeof s&&"string"!=typeof s||(t.sample_rate=`${s}`),t}const c=n.Bt;if(c)return a(c);const l=o?.get("sentry.dsc"),u=l&&function(t){const e=function(t){if(t&&(ka(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce((t,e)=>{const n=$c(e);return Object.entries(n).forEach(([e,n])=>{t[e]=n}),t},{}):$c(t)}(t);if(!e)return;const n=Object.entries(e).reduce((t,[e,n])=>(e.match(Sc)&&(t[e.slice(7)]=n),t),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Hc(t.spanContext().traceId,e),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 t=yc()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(n)),d.sample_rand=o?.get("sentry.sample_rand")??kc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function Zc(t,e=100,n=1/0){try{return Yc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Gc(t,e=3,n=102400){const r=Zc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?Gc(t,e-1,n):r;var i}function Yc(t,e,n=1/0,r=1/0,i=function(){const t=new WeakSet;return[function(e){return!!t.has(e)||(t.add(e),!1)},function(e){t.delete(e)}]}()){const[o,s]=i;if(null==e||["boolean","string"].includes(typeof e)||"number"==typeof e&&Number.isFinite(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.Ht)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(Ca(e))return"[VueViewModel]";if(_a(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&!Number.isFinite(e))return`[${e}]`;if("function"==typeof e)return`[Function: ${sa(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.Ut)return e;const c="number"==typeof e.Zt?e.Zt:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const l=e;if(l&&"function"==typeof l.toJSON)try{return Yc("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const h=qa(e);for(const t in h){if(!{}.hasOwnProperty.call(h,t))continue;if(d>=r){u[t]="[MaxProperties ~]";break}const e=h[t];u[t]=Yc(t,e,c-1,r,i),d++}return s(e),u}function Jc(t,e=[]){return[t,e]}function Vc(t,e){const[n,r]=t;return[n,[...r,e]]}function Qc(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Xc(t){const e=qs(Ls);return e.encodePolyfill?e.encodePolyfill(t):(new TextEncoder).encode(t)}function Kc(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Xc(r),t]:r.push("string"==typeof t?Xc(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch{t=JSON.stringify(Zc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function tl(t){const e="string"==typeof t.data?Xc(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const el={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 nl(t){return el[t]}function rl(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function il(t){return new sl(e=>{e(t)})}function ol(t){return new sl((e,n)=>{n(t)})}class sl{constructor(t){this.Gt=0,this.Yt=[],this.Jt(t)}then(t,e){return new sl((n,r)=>{this.Yt.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.Vt()})}catch(t){return this.then(t=>t,t)}finally(t){return new sl((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{i?n(r):e(r)})})}Vt(){if(0===this.Gt)return;const t=this.Yt.slice();this.Yt=[],t.forEach(t=>{t[0]||(1===this.Gt&&t[1](this.Qt),2===this.Gt&&t[2](this.Qt),t[0]=!0)})}Jt(t){const e=(t,e)=>{0===this.Gt&&(Ea(e)?e.then(n,r):(this.Gt=t,this.Qt=e,this.Vt()))},n=t=>{e(1,t)},r=t=>{e(2,t)};try{t(n,r)}catch(t){r(t)}}}function al(t,e,n,r=0){try{const i=cl(e,n,t,r);return Ea(i)?i:il(i)}catch(t){return ol(t)}}function cl(t,e,n,r){const i=n[r];if(!t||!i)return t;const o=i({...t},e);return zs&&null===o&&Qs(`Event processor "${i.id||"?"}" dropped event`),Ea(o)?o.then(t=>cl(t,e,n,r+1)):cl(o,e,n,r+1)}function ll(t,e){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}=e;ul(t,"extra",n),ul(t,"tags",r),ul(t,"user",i),ul(t,"contexts",o),t.sdkProcessingMetadata=ec(t.sdkProcessingMetadata,a,2),s&&(t.level=s),f&&(t.transactionName=f),m&&(t.span=m),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function ul(t,e,n){t[e]=ec(t[e],n,1)}let dl,hl,fl;function ml(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||Ua(),timestamp:e.timestamp||Qa()},l=n.integrations||t.integrations.map(t=>t.name);!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||n||Bc,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const s=t.request;s?.url&&(s.url=Oa(s.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,l),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=function(t){const e=Ls.Xt;if(!e)return{};const n=Object.keys(e);return fl&&n.length===hl||(hl=n.length,fl=n.reduce((n,r)=>{dl||(dl={});const i=dl[r];if(i)n[i[0]]=i[1];else{const i=t(r);for(let t=i.length-1;t>=0;t--){const o=i[t],s=o?.filename,a=e[r];if(s&&a){n[s]=a,dl[r]=[s,a];break}}}return n},{})),fl}(e);t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.filename&&(t.debug_id=n[t.filename])})})}(c,t.stackParser);const u=function(t,e){if(!e)return t;const n=t?t.clone():new ac;return n.update(e),n}(r,n.captureContext);n.mechanism&&Ja(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Bs("globalScope",()=>new ac).getScopeData();o&&ll(h,o.getScopeData()),u&&ll(h,u.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(o).length&&(t.contexts={...o,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:Mc(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Uc(e),...t.sdkProcessingMetadata};const n=Rc(Ac(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,h),al([...d,...h.eventProcessors],c,n).then(t=>(t&&function(t){const e={};if(t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)})}),0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})})}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>({...t,...t.data&&{data:Zc(t.data,e,n)}}))},...t.user&&{user:Zc(t.user,e,n)},...t.contexts&&{contexts:Zc(t.contexts,e,n)},...t.extra&&{extra:Zc(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Zc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(t=>({...t,...t.data&&{data:Zc(t.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Zc(t.contexts.flags,3,n)),r}(t,s,a):t))}function pl(t){return mc().captureException(t,void 0)}function gl(t,e){const n="string"==typeof e?e:void 0,r="string"!=typeof e?{captureContext:e}:void 0;return mc().captureMessage(t,n,r)}function yl(t,e){return mc().captureEvent(t,e)}function vl(t){const e=pc(),n=mc(),{userAgent:r}=Ls.navigator||{},i=function(t){const e=Ka(),n={sid:Ua(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(n)};return t&&tc(n,t),n}({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),o=e.getSession();return"ok"===o?.status&&tc(o,{status:"exited"}),wl(),e.setSession(i),i}function wl(){const t=pc(),e=mc().getSession()||t.getSession();e&&function(t){let e={};"ok"===t.status&&(e={status:"exited"}),tc(t,e)}(e),bl(),t.setSession()}function bl(){const t=pc(),e=yc(),n=t.getSession();n&&e&&e.captureSession(n)}function xl(t=!1){t?wl():bl()}const kl=[];function Sl(t){const e=t.defaultIntegrations||[],n=t.integrations;let r;if(e.forEach(t=>{t.isDefaultInstance=!0}),Array.isArray(n))r=[...e,...n];else if("function"==typeof n){const t=n(e);r=Array.isArray(t)?t:[t]}else r=e;return function(t){const e={};return t.forEach(t=>{const{name:n}=t,r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)}),Object.values(e)}(r)}function $l(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function _l(t,e,n){if(n[e.name])zs&&Qs(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===kl.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),kl.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(e,r)=>n(e,r,t))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign((e,r)=>n(e,r,t),{id:e.name});t.addEventProcessor(r)}zs&&Qs(`Integration installed: ${e.name}`)}}function Nl(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}const El="Not capturing exception because it's already been captured.",Tl="Discarded session because of missing or non-string release",Cl=Symbol.for("SentryInternalError"),Il=Symbol.for("SentryDoNotSendEventError");function Ml(t){return{message:t,[Cl]:!0}}function Dl(t){return{message:t,[Il]:!0}}function Pl(t){return!!t&&"object"==typeof t&&Cl in t}function Ol(t){return!!t&&"object"==typeof t&&Il in t}class Rl{constructor(t){if(this.Kt=t,this.te={},this.ee=0,this.ne={},this.re={},this.bt=[],t.dsn?this.ie=function(t){const e="string"==typeof t?function(t){const e=Nc.exec(t);if(!e)return void Zs(()=>{});const[n,r,i="",o="",s="",a=""]=e.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 t=l.match(/^\d+/);t&&(l=t[0])}return Tc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(t):Tc(t);if(e&&function(t){if(!zs)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find(e=>!t[e]&&(Ks(`Invalid Sentry Dsn: ${e} missing`),!0))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(Ks(`Invalid Sentry Dsn: Invalid port ${e}`),1):(Ks(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Ks(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):zs&&Xs("No DSN provided, client will not send events."),this.ie){const i=(e=this.ie,n=t.tunnel,r=t.oe?t.oe.sdk:void 0,n||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(e)}?${function(t,e){const n={sentry_version:"7"};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}(e,r)}`);this.se=t.transport({tunnel:this.Kt.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}var e,n,r}captureException(t,e,n){const r=Ua();if(Va(t))return zs&&Qs(El),r;const i={event_id:r,...e};return this.ae(this.eventFromException(t,i).then(t=>this.ce(t,i,n))),i.event_id}captureMessage(t,e,n,r){const i={event_id:Ua(),...n},o=Sa(t)?t:String(t),s=$a(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this.ae(s.then(t=>this.ce(t,i,r))),i.event_id}captureEvent(t,e,n){const r=Ua();if(e?.originalException&&Va(e.originalException))return zs&&Qs(El),r;const i={event_id:r,...e},o=t.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.ae(this.ce(t,i,s||n,a)),i.event_id}captureSession(t){this.sendSession(t),tc(t,{init:!1})}getDsn(){return this.ie}getOptions(){return this.Kt}getSdkMetadata(){return this.Kt.oe}getTransport(){return this.se}async flush(t){const e=this.se;if(!e)return!0;this.emit("flush");const n=await this.le(t),r=await e.flush(t);return n&&r}async close(t){const e=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),e}getEventProcessors(){return this.bt}addEventProcessor(t){this.bt.push(t)}init(){(this.ue()||this.Kt.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this.de()}getIntegrationByName(t){return this.te[t]}addIntegration(t){const e=this.te[t.name];_l(this,t,this.te),e||$l(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=rl(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){if(!e)return t;const n=t.sdk||{};t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0}}(t,n?.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Ec(r)},...i&&{trace:i}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Jc(s,[[{type:o},t]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);for(const t of e.attachments||[])n=Vc(n,tl(t));this.sendEnvelope(n).then(e=>this.emit("afterSendEvent",t,e))}sendSession(t){const{release:e,environment:n=Bc}=this.Kt;if("aggregates"in t){const r=t.attrs||{};if(!r.release&&!e)return void(zs&&Xs(Tl));r.release=r.release||e,r.environment=r.environment||n,t.attrs=r}else{if(!t.release&&!e)return void(zs&&Xs(Tl));t.release=t.release||e,t.environment=t.environment||n}this.emit("beforeSendSession",t);const r=function(t,e,n,r){const i=rl(n);return Jc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:Ec(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);this.sendEnvelope(r)}recordDroppedEvent(t,e,n=1){if(this.Kt.sendClientReports){const r=`${t}:${e}`;zs&&Qs(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.ne[r]=(this.ne[r]||0)+n}}on(t,e){const n=this.re[t]=this.re[t]||new Set,r=(...t)=>e(...t);return n.add(r),()=>{n.delete(r)}}emit(t,...e){const n=this.re[t];n&&n.forEach(t=>t(...e))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this.ue()&&this.se)try{return await this.se.send(t)}catch(t){return zs&&Ks("Error while sending envelope:",t),{}}return zs&&Ks("Transport disabled"),{}}de(){const{integrations:t}=this.Kt;this.te=function(t,e){const n={};return e.forEach(e=>{e&&_l(t,e,n)}),n}(this,t),$l(this,t)}he(t,e){let n="fatal"===e.level,r=!1;const i=e.exception?.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(!1===e?.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(tc(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}async le(t){let e=0;for(;!t||e<t;){if(await new Promise(t=>setTimeout(t,1)),!this.ee)return!0;e++}return!1}ue(){return!1!==this.getOptions().enabled&&void 0!==this.se}fe(t,e,n,r){const i=this.getOptions(),o=Object.keys(this.te);return!e.integrations&&o?.length&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),ml(i,t,e,n,this,r).then(t=>{if(null===t)return t;this.emit("postprocessEvent",t,e),t.contexts={trace:vc(n),...t.contexts};const r=function(t,e){const n=e.getPropagationContext();return n.dsc||Hc(n.traceId,t)}(this,n);return t.sdkProcessingMetadata={dynamicSamplingContext:r,...t.sdkProcessingMetadata},t})}ce(t,e={},n=mc(),r=pc()){return zs&&jl(t)&&Qs(`Captured error event \`${Nl(t)[0]||"<unknown>"}\``),this.me(t,e,n,r).then(t=>t.event_id,t=>{zs&&(Ol(t)?Qs(t.message):Pl(t)?Xs(t.message):Xs(t))})}me(t,e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Al(t),a=jl(t),c=t.type||"error",l=`before send for type \`${c}\``,u=void 0===o?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;return"number"!=typeof e||isNaN(e)||e<0||e>1?void 0:e}(o);if(a&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),ol(Dl(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.fe(t,e,n,r).then(t=>{if(null===t)throw this.recordDroppedEvent("event_processor",d),Dl("An event processor returned `null`, will not send event.");if(e.data&&!0===e.data.pe)return t;const n=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=e;let c=n;if(jl(c)&&i)return i(c,r);if(Al(c)){if(s||a){const e=function(t){const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[wc],exclusive_time:s?.[bc],measurements:t.measurements,is_segment:!0}}(c);if(a?.length&&Wc(e,a))return null;if(s){const t=s(e);t?c=ec(n,{type:"transaction",timestamp:(l=t).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&&{[wc]:l.profile_id},...l.exclusive_time&&{[bc]:l.exclusive_time}}}},measurements:l.measurements}):zc()}if(c.spans){const e=[],n=c.spans;for(const t of n)if(a?.length&&Wc(t,a))Fc(n,t);else if(s){const n=s(t);n?e.push(n):(zc(),e.push(t))}else e.push(t);const r=c.spans.length-e.length;r&&t.recordDroppedEvent("before_send","span",r),c.spans=e}}if(o){if(c.spans){const t=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:t}}return o(c,r)}}var l;return c}(this,i,t,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Ea(t))return t.then(t=>{if(!_a(t)&&null!==t)throw Ml(n);return t},t=>{throw Ml(`${e} rejected with ${t}`)});if(!_a(t)&&null!==t)throw Ml(n);return t}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const e=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",e)}throw Dl(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.he(o,i),s){const t=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);t>0&&this.recordDroppedEvent("before_send","span",t)}const c=i.transaction_info;if(s&&c&&i.transaction!==t.transaction){const t="custom";i.transaction_info={...c,source:t}}return this.sendEvent(i,e),i}).then(null,t=>{if(Ol(t)||Pl(t))throw t;throw this.captureException(t,{mechanism:{handled:!1,type:"internal"},data:{pe:!0},originalException:t}),Ml(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)})}ae(t){this.ee++,t.then(t=>(this.ee--,t),t=>(this.ee--,t))}ge(){const t=this.ne;return this.ne={},Object.entries(t).map(([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}})}ye(){zs&&Qs("Flushing outcomes...");const t=this.ge();if(0===t.length)return void(zs&&Qs("No outcomes to send"));if(!this.ie)return void(zs&&Qs("No dsn provided, will not send outcomes"));zs&&Qs("Sending outcomes:",t);const e=(n=t,Jc((r=this.Kt.tunnel&&Ec(this.ie))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Qa(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}function jl(t){return void 0===t.type}function Al(t){return"transaction"===t.type}function zl(t){const e=function(t){return Ll().get(t)}(t)??[];if(0===e.length)return;const n=t.getOptions(),r=function(t,e,n,r){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=Ec(r)),Jc(i,[(o=t,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(e,n.oe,n.tunnel,t.getDsn());Ll().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(r)}function Ll(){return Bs("clientToLogBufferMap",()=>new WeakMap)}const Wl=Symbol.for("SentryBufferFullError");function Fl(t,e,n=function(t=100){const e=new Set;function n(t){e.delete(t)}return{get $(){return Array.from(e)},add:function(r){if(!(e.size<t))return ol(Wl);const i=r();return e.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(t){if(!e.size)return il(!0);const n=Promise.allSettled(Array.from(e)).then(()=>!0);if(!t)return n;const r=[n,new Promise(e=>setTimeout(()=>e(!1),t))];return Promise.race(r)}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Qc(i,(e,n)=>{const i=nl(n);!function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)?o.push(e):t.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=Jc(i[0],o),a=e=>{Qc(s,(n,r)=>{t.recordDroppedEvent(e,nl(r))})};return n.add(()=>e({body:Kc(s)}).then(t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&zs&&Xs(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t),t=>{throw a("network_error"),zs&&Ks("Encountered error running transport request:",t),t})).then(t=>t,t=>{if(t===Wl)return zs&&Ks("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw t})},flush:t=>n.drain(t)}}function ql(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Bl(t){"aggregates"in t?void 0===t.attrs?.ip_address&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):void 0===t.ipAddress&&(t.ipAddress="{{auto}}")}const Hl=100;function Ul(t,e){const n=yc(),r=pc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Hl}=n.getOptions();if(o<=0)return;const s={timestamp:Qa(),...t},a=i?Zs(()=>i(s,e)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let Zl;const Gl=new WeakMap,Yl=()=>({name:"FunctionToString",setupOnce(){Zl=function(){}.toString;try{Function.prototype.toString=function(...t){const e=Fa(this),n=Gl.has(yc())&&void 0!==e?e:this;return Zl.apply(n,t)}}catch{}},setup(t){Gl.set(t,!0)}}),Jl=[/^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$/],Vl=(t={})=>{let e;return{name:"EventFilters",setup(n){const r=n.getOptions();e=Xl(t,r)},processEvent(n,r,i){if(!e){const n=i.getOptions();e=Xl(t,n)}return function(t,e){if(t.type){if("transaction"===t.type&&function(t,e){if(!e?.length)return!1;const n=t.transaction;return!!n&&Aa(n,e)}(t,e.ignoreTransactions))return zs&&Xs(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ga(t)}`),!0}else{if(function(t,e){return!!e?.length&&Nl(t).some(t=>Aa(t,e))}(t,e.ignoreErrors))return zs&&Xs(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ga(t)}`),!0;if(function(t){return!!t.exception?.values?.length&&(!t.message&&!t.exception.values.some(t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))}(t))return zs&&Xs(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Ga(t)}`),!0;if(function(t,e){if(!e?.length)return!1;const n=Kl(t);return!!n&&Aa(n,e)}(t,e.denyUrls))return zs&&Xs(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ga(t)}.\nUrl: ${Kl(t)}`),!0;if(!function(t,e){if(!e?.length)return!0;const n=Kl(t);return!n||Aa(n,e)}(t,e.allowUrls))return zs&&Xs(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ga(t)}.\nUrl: ${Kl(t)}`),!0}return!1}(n,e)?null:n}}},Ql=(t={})=>({...Vl(t),name:"InboundFilters"});function Xl(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Jl],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Kl(t){try{const e=[...t.exception?.values??[]].reverse().find(t=>void 0===t.mechanism?.parent_id&&t.stacktrace?.frames?.length),n=e?.stacktrace?.frames;return n?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return zs&&Ks(`Cannot extract url for event ${Ga(t)}`),null}}function tu(t,e,n,r,i,o){if(!i.exception?.values||!o||!Ta(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=eu(t,e,r,o.originalException,n,i.exception.values,s,0))}function eu(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Ta(r[i],Error)){nu(s,a);const o=t(e,r[i]),l=c.length;ru(o,i,l,a),c=eu(t,e,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Ta(r,Error)){nu(s,a);const l=t(e,r),u=c.length;ru(l,`errors[${o}]`,u,a),c=eu(t,e,n,r,i,[l,...c],l,u)}}),c}function nu(t,e){t.mechanism={handled:!0,type:"auto.core.linked_errors",...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function ru(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function iu(){"console"in Ls&&Hs.forEach(function(t){t in Ls.console&&za(Ls.console,t,function(e){return Us[t]=e,function(...e){ha("console",{args:e,level:t});const n=Us[t];n?.apply(Ls.console,e)}})})}const ou=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!au(t,e)&&!!su(t,e))))}(t,e)||!!function(t,e){const n=cu(e),r=cu(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!au(t,e)&&!!su(t,e)))}(t,e))}(e,t))return zs&&Xs("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function su(t,e){let n=aa(t),r=aa(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function au(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function cu(t){return t.exception?.values?.[0]}function lu(t){return void 0===t?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const uu=Ls;function du(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function hu(t,e){const n="fetch";ua(n,t),da(n,()=>function(t,e=!1){e&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in uu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(du(uu.fetch))return!0;let t=!1;const e=uu.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=du(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){zs&&Xs("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t}()||za(Ls,"fetch",function(t){return function(...e){const n=new Error,{method:r,url:i}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:mu(e),method:fu(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:mu(e),method:fu(e,"method")?String(e.method).toUpperCase():"GET"}}(e),o={args:e,fetchData:{method:r,url:i},startTimestamp:1e3*Ka(),virtualError:n,headers:pu(e)};return ha("fetch",{...o}),t.apply(Ls,e).then(async t=>(ha("fetch",{...o,endTimestamp:1e3*Ka(),response:t}),t),t=>{if(ha("fetch",{...o,endTimestamp:1e3*Ka(),error:t}),va(t)&&void 0===t.stack&&(t.stack=n.stack,La(t,"framesToPop",1)),t instanceof TypeError&&("Failed to fetch"===t.message||"Load failed"===t.message||"NetworkError when attempting to fetch resource."===t.message))try{const e=new URL(o.fetchData.url);t.message=`${t.message} (${e.host})`}catch{}throw t})}})}(0,e))}function fu(t,e){return!!t&&"object"==typeof t&&!!t[e]}function mu(t){return"string"==typeof t?t:t?fu(t,"url")?t.url:t.toString?t.toString():"":""}function pu(t){const[e,n]=t;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&Ta(e,Request))return new Headers(e.headers)}catch{}}const gu=Ls;let yu=0;function vu(){return yu>0}function wu(t,e={}){if(!function(t){return"function"==typeof t}(t))return t;try{const e=t.ve;if(e)return"function"==typeof e?e:t;if(Fa(t))return t}catch{return t}const n=function(...n){try{const r=n.map(t=>wu(t,e));return t.apply(this,r)}catch(t){throw yu++,setTimeout(()=>{yu--}),gc(r=>{r.addEventProcessor(t=>(e.mechanism&&(Ya(t,void 0),Ja(t,e.mechanism)),t.extra={...t.extra,arguments:n},t)),pl(t)}),t}};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}catch{}Wa(n,t),La(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}function bu(t,e){const n=ku(t,e),r={type:_u(e),value:Nu(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function xu(t,e){return{exception:{values:[bu(t,e)]}}}function ku(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&Su.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const Su=/Minified React error #\d+;/i;function $u(t){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&t instanceof WebAssembly.Exception}function _u(t){const e=t?.name;return!e&&$u(t)?t.message&&Array.isArray(t.message)&&2==t.message.length?t.message[0]:"WebAssembly.Exception":e}function Nu(t){const e=t?.message;return $u(t)?Array.isArray(t.message)&&2==t.message.length?t.message[1]:"wasm exception":e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function Eu(t,e,n,r,i){let o;if(ba(e)&&e.error)return xu(t,e.error);if(xa(e)||wa(e,"DOMException")){const i=e;if("stack"in e)o=xu(t,e);else{const e=i.name||(xa(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=Tu(t,s,n,r),Ya(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return va(e)?xu(t,e):_a(e)||Na(e)?(o=function(t,e,n,r){const i=yc(),o=i?.getOptions().normalizeDepth,s=function(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={we:Gc(e,o)};if(s)return{exception:{values:[bu(t,s)]},extra:a};const c={exception:{values:[{type:Na(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Cu(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=ku(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),Ja(o,{synthetic:!0}),o):(o=Tu(t,e,n,r),Ya(o,`${e}`),Ja(o,{synthetic:!0}),o)}function Tu(t,e,n,r){const i={};if(r&&n){const r=ku(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),Ja(i,{synthetic:!0})}if(Sa(e)){const{lt:t,ut:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function Cu(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(qa(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Oa(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Oa(r,e)}return""}(t),r=e?"promise rejection":"exception";return ba(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Na(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Iu extends Rl{constructor(t){const e=(n=t,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:gu.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(t,e,n=[e],r="npm"){const i=t.oe||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(t=>({name:`${r}:@sentry/${t}`,version:Ws})),version:Ws}),t.oe=i}(e,"browser",["browser"],gu.SENTRY_SDK_SOURCE||"npm"),e.oe?.sdk&&(e.oe.sdk.settings={infer_ip:e.sendDefaultPii?"auto":"never",...e.oe.sdk.settings}),super(e);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Kt;gu.document&&(i||o)&&gu.document.addEventListener("visibilitychange",()=>{"hidden"===gu.document.visibilityState&&(i&&this.ye(),o&&zl(this))}),o&&(this.on("flush",()=>{zl(this)}),this.on("afterCaptureLog",()=>{this.be&&clearTimeout(this.be),this.be=setTimeout(()=>{zl(this)},5e3)})),r&&this.on("beforeSendSession",Bl)}eventFromException(t,e){return function(t,e,n,r){const i=Eu(t,e,n?.syntheticException||void 0,r);return Ja(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),il(i)}(this.Kt.stackParser,t,e,this.Kt.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=Tu(t,e,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),il(o)}(this.Kt.stackParser,t,e,n,this.Kt.attachStacktrace)}fe(t,e,n,r){return t.platform=t.platform||"javascript",super.fe(t,e,n,r)}}const Mu="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Du=Ls;let Pu,Ou,Ru,ju;function Au(){if(!Du.document)return;const t=ha.bind(null,"dom"),e=zu(t,!0);Du.document.addEventListener("click",e,!1),Du.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(e=>{const n=Du,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(za(r,"addEventListener",function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xe=this.xe||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=zu(t);o.handler=r,e.call(this,n,r,i)}o.refCount++}catch{}return e.call(this,n,r,i)}}),za(r,"removeEventListener",function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this.xe||{},i=n[e];i&&(i.refCount--,i.refCount<=0&&(t.call(this,e,i.handler,r),i.handler=void 0,delete n[e]),0===Object.keys(n).length&&delete this.xe)}catch{}return t.call(this,e,n,r)}}))})}function zu(t,e=!1){return n=>{if(!n||n.ke)return;const r=function(t){try{return t.target}catch{return null}}(n);if(function(t,e){return"keypress"===t&&(!e?.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;La(n,"_sentryCaptured",!0),r&&!r.Se&&La(r,"_sentryId",Ua());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Ou)return!1;try{if(!t.target||t.target.Se!==Ru)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Ou=n.type,Ru=r?r.Se:void 0),clearTimeout(Pu),Pu=Du.setTimeout(()=>{Ru=void 0,Ou=void 0},1e3)}}function Lu(t){const e="history";ua(e,t),da(e,Wu)}function Wu(){function t(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const r=ju,i=function(t){try{return new URL(t,Du.location.origin).toString()}catch{return t}}(String(n));if(ju=i,r===i)return t.apply(this,e);ha("history",{from:r,to:i})}return t.apply(this,e)}}Du.addEventListener("popstate",()=>{const t=Du.location.href,e=ju;ju=t,e!==t&&ha("history",{from:e,to:t})}),"history"in uu&&uu.history&&(za(Du.history,"pushState",t),za(Du.history,"replaceState",t))}const Fu={},qu="__sentry_xhr_v3__";function Bu(){if(!Du.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(t,e,n){const r=new Error,i=1e3*Ka(),o=ka(n[0])?n[0].toUpperCase():void 0,s=function(t){if(ka(t))return t;try{return t.toString()}catch{}}(n[1]);if(!o||!s)return t.apply(e,n);e[qu]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(e.$e=!0);const a=()=>{const t=e[qu];if(t&&4===e.readyState){try{t.status_code=e.status}catch{}ha("xhr",{endTimestamp:1e3*Ka(),startTimestamp:i,xhr:e,virtualError:r})}};return"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?e.onreadystatechange=new Proxy(e.onreadystatechange,{apply:(t,e,n)=>(a(),t.apply(e,n))}):e.addEventListener("readystatechange",a),e.setRequestHeader=new Proxy(e.setRequestHeader,{apply(t,e,n){const[r,i]=n,o=e[qu];return o&&ka(r)&&ka(i)&&(o.request_headers[r.toLowerCase()]=i),t.apply(e,n)}}),t.apply(e,n)}}),t.send=new Proxy(t.send,{apply(t,e,n){const r=e[qu];return r?(void 0!==n[0]&&(r.body=n[0]),ha("xhr",{startTimestamp:1e3*Ka(),xhr:e}),t.apply(e,n)):t.apply(e,n)}})}function Hu(t,e=function(t){const e=Fu[t];if(e)return e;let n=Du[t];if(du(n))return Fu[t]=n.bind(Du);const r=Du.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){Mu&&Xs(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?Fu[t]=n.bind(Du):n}("fetch")){let n=0,r=0;return Fl(t,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const n=await e(t.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(t){throw Fu.fetch=void 0,t}finally{n-=o,r--}})}function Uu(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?ta:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Zu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yu=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ju=/at (.+?) ?\(data:(.+?),/,Vu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Qu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Xu=ra([30,t=>{const e=t.match(Ju);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=Zu.exec(t);if(n){const[,t,e,r]=n;return Uu(t,ta,+e,+r)}const r=Gu.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){const t=Yu.exec(r[2]);t&&(r[2]=t[1],r[3]=t[2],r[4]=t[3])}const[t,e]=Ku(r[1]||ta,r[2]);return Uu(e,t,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,t=>{const e=Vu.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Qu.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||ta;return[n,t]=Ku(n,t),Uu(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Ku=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:ta,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},td="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ed=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";ua(e,t),da(e,iu)}(function(t){return function(e){if(yc()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Ra(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${Ra(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}Ul(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(yc()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(td&&Xs(`\`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 t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=Ma(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!Ia.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Ul(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),ua("dom",n),da("dom",Au)),e.xhr&&function(t){ua("xhr",t),da("xhr",Bu)}(function(t){return function(e){if(yc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[qu];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:e.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:l,type:"http",level:lu(a)};t.emit("beforeOutgoingRequestBreadcrumb",d,u),Ul(d,u)}}(t)),e.fetch&&hu(function(t){return function(e){if(yc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error){const i=e.fetchData,o={data:e.error,input:e.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",s,o),Ul(s,o)}else{const i=e.response,o={...e.fetchData,status_code:i?.status},s={input:e.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:lu(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Ul(a,s)}}}(t)),e.history&&Lu(function(t){return function(e){if(yc()!==t)return;let n=e.from,r=e.to;const i=ql(gu.location.href);let o=n?ql(n):void 0;const s=ql(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),Ul({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){yc()===t&&Ul({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:Ga(e)},{event:e})}}(t))}}},nd=["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"],rd=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&za(gu,"setTimeout",id),e.setInterval&&za(gu,"setInterval",id),e.requestAnimationFrame&&za(gu,"requestAnimationFrame",od),e.XMLHttpRequest&&"XMLHttpRequest"in gu&&za(XMLHttpRequest.prototype,"send",sd);const t=e.eventTarget;t&&(Array.isArray(t)?t:nd).forEach(t=>function(t,e){const n=gu,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(za(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=wu(i.handleEvent,{mechanism:{data:{handler:sa(i),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&function(t,e,n){t&&"object"==typeof t&&"removeEventListener"in t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n)}(this,r,i),n.apply(this,[r,wu(i,{mechanism:{data:{handler:sa(i),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),za(r,"removeEventListener",function(t){return function(e,n,r){try{const i=n.ve;i&&t.call(this,e,i,r)}catch{}return t.call(this,e,n,r)}}))}(t,e))}}};function id(t){return function(...e){const n=e[0];return e[0]=wu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${sa(t)}`}}),t.apply(this,e)}}function od(t){return function(e){return t.apply(this,[wu(e,{mechanism:{data:{handler:sa(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function sd(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&za(n,t,function(e){const n={mechanism:{data:{handler:sa(e)},handled:!1,type:`auto.browser.browserapierrors.xhr.${t}`}},r=Fa(e);return r&&(n.mechanism.data.handler=sa(r)),wu(e,n)})}),t.apply(this,e)}}const ad=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";ua(e,e=>{const{stackParser:n,attachStacktrace:r}=ld();if(yc()!==t||vu())return;const{msg:i,url:o,line:s,column:a,error:c}=e,l=function(t,e,n,r){const i=t.exception=t.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(t){if(ka(t)&&0!==t.length){if(t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);return`<data:${e?e[1]:"text/javascript"}${t.includes("base64,")?",base64":""}>`}return t.slice(0,1024)}}(e)??Pa();return 0===c.length&&c.push({colno:l,filename:d,function:ta,in_app:!0,lineno:u}),t}(Eu(n,c||i,void 0,r,!1),o,s,a);l.level="error",yl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),da(e,ma)}()}(t),cd("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";ua(e,e=>{const{stackParser:n,attachStacktrace:r}=ld();if(yc()!==t||vu())return;const i=function(t){if($a(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}(e),o=$a(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Eu(n,i,void 0,r,!0);o.level="error",yl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),da(e,ga)}()}(t),cd("onunhandledrejection"))}}};function cd(t){td&&Qs(`Global Handler attached: ${t}`)}function ld(){const t=yc();return t?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const ud=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){tu(bu,i.getOptions().stackParser,n,e,t,r)}}};let dd=!1;function hd(e){if(dd)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];!function(t={}){const e=!t.skipBrowserExtensionCheck&&!!function(){if(void 0===gu.window)return!1;const t=gu;if(t.nw)return!1;const e=t.chrome||t.browser;if(!e?.runtime?.id)return!1;const n=Pa();return!(gu===gu.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(t=>n.startsWith(`${t}://`)))}()&&(td&&Zs(()=>{}),!0),n={...t,enabled:!e&&t.enabled,stackParser:(r=t.stackParser||Xu,Array.isArray(r)?ra(...r):r),integrations:Sl({integrations:t.integrations,defaultIntegrations:null==t.defaultIntegrations?[Ql(),Yl(),rd(),ed(),ad(),ud(),ou(),{name:"HttpContext",preprocessEvent(t){if(!gu.navigator&&!gu.location&&!gu.document)return;const e=function(){const t=Pa(),{referrer:e}=gu.document||{},{userAgent:n}=gu.navigator||{};return{url:t,headers:{...e&&{Referer:e},...n&&{"User-Agent":n}}}}(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}},{name:"BrowserSession",setupOnce(){void 0!==gu.document?(vl({ignoreDuration:!0}),xl(),Lu(({from:t,to:e})=>{void 0!==t&&t!==e&&(vl({ignoreDuration:!0}),xl())})):td&&Xs("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:t.defaultIntegrations}),transport:t.transport||Hu};var r;!function(t,e){!0===e.debug&&(zs?Vs():Zs(()=>{})),mc().update(e.initialScope);const n=new t(e);(function(t){mc().setClient(t)})(n),n.init()}(Iu,n)}({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(t,e){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=t.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(t=>!!t.filename&&e.some(e=>e.test(t.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[ed({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),ou()],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"]}),dd=!0,t()}catch(t){}else t()}function fd(e,n){if(dd)try{n?gc(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),pl(e)}):pl(e)}catch(e){t()}}function md(e,n="info",r){if(dd)try{r?gc(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),gl(e,n)}):gl(e,n)}catch(e){t()}}function pd(e){if(dd)try{!function(t){pc().setUser(t)}(e)}catch(e){t()}}function gd(e){if(dd)try{Ul(e)}catch(e){t()}}function yd(e,n){if(dd)try{!function(t,e){pc().setTag(t,e)}(e,n)}catch(e){t()}}function vd(){return dd}var wd=Object.freeze({__proto__:null,addBreadcrumb:gd,captureException:fd,captureMessage:md,initializeSentry:hd,isSentryInitialized:vd,setTag:yd,setUser:pd});const bd="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",xd="production",kd="insureos-scripts",Sd=!0,$d=1,_d=.1;class Nd{constructor(t={}){var e,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(e=t.enabled)||void 0===e||e,customDataLayer:null!==(n=t.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=t.includePersonalData)&&void 0!==r&&r,debug:null!==(i=t.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const t=this.config.customDataLayer;window[t]||(window[t]=[],this.logDebug(`Created new ${t} array`)),Array.isArray(window[t])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${t}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${t}' exists but is not an array`))}catch(t){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",t)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const t=window[this.config.customDataLayer];return Array.isArray(t)?t:null}catch(t){return this.logDebug("Failed to get data layer:",t),null}}push(t){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",t.event);const e=this.getDataLayer();if(e)try{const n=this.config.includePersonalData?t:this.removePII(t);e.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(t){this.logDebug("❌ Failed to push event to data layer:",t)}else this.logDebug("⚠️ Data layer not available, skipping event:",t.event)}removePII(t){const e={...t},n=["email","phone","name","address","client_name","client_email"];for(const t of n)t in e&&delete e[t];return e}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(t){this.logDebug("Failed to clear data layer:",t)}}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},(t.customDataLayer||void 0!==t.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class Ed{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{hd({dsn:bd,environment:xd,release:kd,enabled:Sd,sampleRate:$d,tracesSampleRate:_d}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(t){if(!t.orgId)throw new Error("orgId is required")}initializeAnalyticsOnce(e){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new Nd({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:e.debug}),gt(this.analyticsManager),t()}catch(e){t()}}async mount(t,r){r.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(r),this.initializeSentryOnce(),this.initializeAnalyticsOnce(r),function(t,r){var i,o,s;r==document&&(r=document.documentElement),n.m&&n.m(t,r),i=r.i,o=[],s=[],O(r,t=r.i=b(k,null,[t]),i||m,m,r.namespaceURI,i?null:r.firstChild?e.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),j(o,t,s)}(b(js,{config:r,initializeFormContext:this.initializeFormContext.bind(this)}),t)}createHttpClient(t){var e,n,r,i,o,s,a,c,l,u;this.validateConfig(t);const d=t.apiBaseUrl||"https://api.os.insure";return new U({orgId:t.orgId,apiBaseUrl:d,timeout:(null===(e=t.httpConfig)||void 0===e?void 0:e.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=t.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=t.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=t.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(l=null===(c=t.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===l?void 0:l.retryableStatusCodes)||[429,500,502,503,504],...null===(u=t.httpConfig)||void 0===u?void 0:u.retryConfig}})}createClient(t){const e=this.createHttpClient(t);return new Ct(e)}async initializeFormContext(e){const n=this.createHttpClient(e),r="sessionStorage"===e.storageType?new G:new Z;r.isAvailable()?t(r.constructor.name):t();const i=new V(r),o=new Q(i),s=async()=>{t();const r=e.quoteIntentUrl?await n.getQuoteIntent(e.quoteIntentUrl):await n.createQuoteIntent(e.product);return t(),{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:e.orgId,product_id:r.product.id,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,organisation:r.organisation,cached_result:r.cached_result}},a=async r=>{t();const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id"),a=await n.getQuoteIntent(r);let c;if(t(),t(a.cached_result),a.cached_result?(t(),t(a.cached_result.outcome_type)):t(),s&&a.payment_transactions){t();const e=a.payment_transactions.find(t=>t.id===s);if(e){t();let n="unknown";switch(e.status){case"completed":n="success";break;case"failed":n="declined";break;case"cancelled":n="cancelled";break;default:n="error"}c={paymentTransactionId:e.id,paymentStatus:n,transactionStatus:e};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 t()}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:e.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,organisation:a.organisation,payment_return:c,cached_result:a.cached_result};return t(),c&&i.saveQuoteIntent(e.orgId,l),l};t();const c=`insure_os_quote_intent_${e.orgId}`;localStorage.getItem(c),t(),i.getQuoteIntent(e.orgId),t(),t();let l=null,u=!1;try{const n=i.getQuoteIntent(e.orgId),r=await o.getOrCreateQuoteIntent(e.orgId,s,a);t(),t(r.cached_result),r.cached_result&&t(r.cached_result.outcome_type),l=r,u=!n}catch(n){if(t(),!(n instanceof q&&404===n.statusCode))throw n;t(),o.clearQuoteIntent(e.orgId),l=await o.getOrCreateQuoteIntent(e.orgId,s,a),u=!0}if(u&&l&&wt(l),!l)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(t(),localStorage.clear());const d=new Et(l,n,o,{autoSave:l.form_definition.settings.autoSave,autoSaveInterval:l.form_definition.settings.autoSaveInterval});if(l.form_data&&d.restoreFormProgress(l.form_data),t(l.cached_result),l.cached_result?(t(l.cached_result),d.restoreCalculationResult(l.cached_result),t(),t(d.hasCalculationResponse())):t(),l.organisation&&l.organisation.theme)try{await As.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(e){t()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:l,quoteIntentStore:o,formStateManager:d}}async handleAutoCalculationIfComplete(e){try{const n=e.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const r=e.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;t((o.length,e.getIsCalculating(),e.hasLastCalculationFailed())),s&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const Td=new Ed;"undefined"!=typeof window&&(window.InsureOS=Td,function(){const t=document.querySelectorAll('script[src*="insureos"]'),e=t[t.length-1];if(e&&e.src){const t=new URL(e.src),n=t.searchParams.get("orgId"),r=t.searchParams.get("productCode");if(n&&r){const e=t.searchParams.get("container"),i=e?document.getElementById(e):document.body;if(i){const t={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(t);const e=async()=>{try{await Td.mount(i,t)}catch(t){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}}}}());class Cd{constructor(t={}){var e,n,r;this.detectionResults=null,this.config={fetch:null===(e=t.fetch)||void 0===e||e,promise:null===(n=t.promise)||void 0===n||n,url:null===(r=t.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(t){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 t=Promise.resolve(42);return"function"!=typeof t.then||"function"!=typeof t.catch}catch(t){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const t=new URL("http://example.com/path?param=value#hash");if("string"!=typeof t.protocol||"string"!=typeof t.hostname||"string"!=typeof t.pathname||"string"!=typeof t.search||"string"!=typeof t.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const e=new URLSearchParams("param=value");return"function"!=typeof e.get||"function"!=typeof e.set}catch(t){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:t,Headers:e,Request:n,Response:r}=await Promise.resolve().then(function(){return Rd});void 0===globalThis.fetch&&(globalThis.fetch=t),void 0===globalThis.Headers&&(globalThis.Headers=e),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(t){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:t}=await Promise.resolve().then(function(){return Ad});void 0===globalThis.Promise&&(globalThis.Promise=t)}catch(t){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:t,URLSearchParamsPolyfill:e}=await Promise.resolve().then(function(){return Ld});void 0===globalThis.URL&&(globalThis.URL=t),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=e)}catch(t){}}}class Id{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Id.instance)return Id.instance;Id.instance=this}startMeasurement(t){this.measurements.set(t,this.now())}endMeasurement(t){const e=this.measurements.get(t);if(void 0===e)throw new Error(`No measurement started for: ${t}`);const n=this.now()-e;return this.measurements.delete(t),this.completedMeasurements.has(t)||this.completedMeasurements.set(t,[]),this.completedMeasurements.get(t).push(n),"initialization"===t&&(this.initializationTime=n),n}async measureApiCall(t,e){const n=this.now();let r,i=!1;try{const t=await e();return i=!0,t}catch(t){throw i=!1,r=t instanceof Error?t.message:"Unknown error",t}finally{const e=this.now()-n;this.apiCallMetrics.push({operation:t,duration:e,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 t=performance.memory;return{usedJSHeapSize:t.usedJSHeapSize||0,totalJSHeapSize:t.totalJSHeapSize||0,jsHeapSizeLimit:t.jsHeapSizeLimit||0}}return null}getMetrics(){var t;const e=this.apiCallMetrics.filter(t=>t.success).map(t=>t.duration),n=e.length>0?e.reduce((t,e)=>t+e,0)/e.length:0,r={};return this.completedMeasurements.forEach((t,e)=>{r[e]=[...t]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:e.length>0&&null!==(t=e[e.length-1])&&void 0!==t?t: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 t=this.getMetrics(),e=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${t.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${t.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${t.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(t.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,e&&(n+="Memory Details:\n",n+=` Used Heap: ${(e.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(e.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(e.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const t=new Map;this.apiCallMetrics.forEach(e=>{t.has(e.operation)||t.set(e.operation,{count:0,totalTime:0,errors:0});const n=t.get(e.operation);n.count++,n.totalTime+=e.duration,e.success||n.errors++}),t.forEach((t,e)=>{const r=t.totalTime/t.count,i=(t.errors/t.count*100).toFixed(1);n+=` ${e}: ${t.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(t){(new Id).startMeasurement(t)}static endMeasurement(t){return(new Id).endMeasurement(t)}static measureMemoryUsage(){return(new Id).measureMemoryUsage()}static async measureApiCall(t,e){return(new Id).measureApiCall(t,e)}static getMetrics(){return(new Id).getMetrics()}static generateReport(){return(new Id).generateReport()}}var Md;!function(t){t.FIXED="fixed",t.LATEST="latest"}(Md||(Md={}));let Dd=class t{constructor(e){this.headers=new Map,e&&(Array.isArray(e)?e.forEach(([t,e])=>this.set(t,e)):e instanceof t?e.forEach((t,e)=>this.set(e,t)):Object.entries(e).forEach(([t,e])=>this.set(t,e)))}append(t,e){const n=this.get(t);this.set(t,n?`${n}, ${e}`:e)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())||null}has(t){return this.headers.has(t.toLowerCase())}set(t,e){this.headers.set(t.toLowerCase(),e)}forEach(t){this.headers.forEach(t)}},Pd=class{constructor(t,e={}){var n;"string"==typeof t?(this.url=t,this.method=e.method||"GET",this.headers=new Dd(e.headers),this.body=e.body||null,this.signal=e.signal||void 0):(this.url=t.url,this.method=e.method||t.method,this.headers=new Dd(e.headers||t.headers),this.body=void 0!==e.body?e.body:t.body,this.signal=void 0!==e.signal?null!==(n=e.signal)&&void 0!==n?n:void 0:t.signal)}},Od=class{constructor(t="",e={}){this.status=e.status||200,this.statusText=e.statusText||"OK",this.headers=new Dd(e.headers),this.ok=this.status>=200&&this.status<300,this._e=t}async text(){return this._e}async json(){return JSON.parse(this._e)}};var Rd=Object.freeze({__proto__:null,Headers:Dd,Request:Pd,Response:Od,fetch:async function(t,e={}){return new Promise((n,r)=>{const i=new Pd(t,e),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((t,e)=>{o.setRequestHeader(e,t)}),o.onload=()=>{const t=new Dd;o.getAllResponseHeaders().split("\r\n").forEach(e=>{const[n,r]=e.split(": ");n&&r&&t.set(n,r)});const e=new Od(o.responseText,{status:o.status,statusText:o.statusText,headers:t});n(e)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class jd{constructor(t){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{t(this.resolve.bind(this),this.reject.bind(this))}catch(t){this.reject(t)}}resolve(t){"pending"===this.state&&(this.state="fulfilled",this.value=t,this.onFulfilledCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}reject(t){"pending"===this.state&&(this.state="rejected",this.reason=t,this.onRejectedCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}then(t,e){return new jd((n,r)=>{const i=e=>{try{if(t){const i=t(e);i instanceof jd?i.then(n,r):n(i)}else n(e)}catch(t){r(t)}},o=t=>{try{if(e){const i=e(t);i instanceof jd?i.then(n,r):n(i)}else r(t)}catch(t){r(t)}};"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(t){return this.then(void 0,t)}static resolve(t){return new jd(e=>e(t))}static reject(t){return new jd((e,n)=>n(t))}static all(t){return new jd((e,n)=>{if(0===t.length)return void e([]);const r=[];let i=0;t.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===t.length&&e(r)},n)})})}}var Ad=Object.freeze({__proto__:null,PromisePolyfill:jd});class zd{constructor(t){this.params=new Map,"string"==typeof t?this.parseString(t):t&&"object"==typeof t&&"forEach"in t&&"function"==typeof t.forEach?t.forEach((t,e)=>this.append(e,t)):t&&"object"==typeof t&&Object.entries(t).forEach(([t,e])=>this.set(t,e))}parseString(t){const e=t.startsWith("?")?t.slice(1):t;e&&e.split("&").forEach(t=>{if(!t)return;const e=t.indexOf("=");let n,r;-1===e?(n=t,r=""):(n=t.substring(0,e),r=t.substring(e+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(t,e){const n=this.params.get(t)||[];n.push(e),this.params.set(t,n)}delete(t){this.params.delete(t)}get(t){var e;const n=this.params.get(t);return n&&n.length>0&&null!==(e=n[0])&&void 0!==e?e:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}forEach(t){this.params.forEach((e,n)=>{e.forEach(e=>t(e,n))})}toString(){const t=[];return this.params.forEach((e,n)=>{e.forEach(e=>{t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`)})}),t.join("&")}}var Ld=Object.freeze({__proto__:null,URLPolyfill:class{constructor(t,e){const n=this.parseUrl(t,e);this.protocol=n.protocol,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.hash=n.hash,this.host=this.port?`${this.hostname}:${this.port}`:this.hostname,this.origin=`${this.protocol}//${this.host}`,this.href=this.toString(),this.searchParams=new zd(this.search)}parseUrl(t,e){const n=document.createElement("a");if(e){const r=document.createElement("a");r.href=e,n.href=this.resolveUrl(t,r.href)}else n.href=t;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(t,e){if(t.includes("://"))return t;if(t.startsWith("/")){const n=document.createElement("a");return n.href=e,`${n.protocol}//${n.host}${t}`}return`${e.split("/").slice(0,-1).join("/")}/${t}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:zd});export{Nd as DataLayerManager,U as EnhancedHttpClient,B as ErrorHandlingStrategy,f as ErrorType,Et as FormStateManager,Td as InsureOS,Ed as InsureOSClient,q as InsureOSError,V as LocalStateManager,Z as LocalStorageAdapter,Y as MemoryStorageAdapter,Id as PerformanceMonitor,Cd as PolyfillManager,H as RetryStrategy,G as SessionStorageAdapter,As as ThemeLoader,Md as VersionStrategy,gd as addBreadcrumb,fd as captureException,md as captureMessage,st as createAppError,yt as getAnalytics,mt as getSupportMessage,nt as groupErrorsByField,gt as initializeAnalytics,hd as initializeSentry,vd as isSentryInitialized,et as parseServerValidationErrors,yd as setTag,pd as setUser,ht as shouldShowErrorPage,ft as shouldShowMaintenancePage,bt as trackFormProgress,_t as trackPaymentCompleted,Nt as trackPaymentFailed,$t as trackPaymentInitiated,kt as trackQuoteAtCheckout,xt as trackQuoteCalculated,St as trackQuoteReferred,wt as trackQuoteStarted,K as validateField,tt as validatePage};
2
2
  //# sourceMappingURL=index.esm.js.map