@metron-labs/quote-react 0.1.45 → 0.1.47
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/app/stages/BasketStage.d.ts +1 -1
- package/dist/app/stages/BasketStage.js +9 -4
- package/dist/components/estimators/BrickBlockEstimator.js +9 -3
- package/dist/components/estimators/ConcreteAggregateEstimator.js +4 -2
- package/dist/components/estimators/DeckingEstimator.js +5 -4
- package/dist/components/estimators/EstimatorResults.d.ts +2 -1
- package/dist/components/estimators/EstimatorResults.js +1 -1
- package/dist/components/estimators/EstimatorReviewStage.d.ts +2 -1
- package/dist/components/estimators/InsulationEstimator.js +9 -5
- package/dist/components/estimators/PavingEstimator.js +26 -10
- package/dist/components/estimators/PlasterboardEstimator.js +8 -3
- package/dist/components/estimators/SkirtingEstimator.js +2 -2
- package/dist/components/estimators/registry.js +3 -3
- package/dist/components/estimators/useFixedBasket.d.ts +1 -0
- package/dist/components/estimators/useFixedBasket.js +3 -3
- package/dist/embed/quote.js +12 -12
- package/dist/lib/estimators/fixedProducts.d.ts +3 -0
- package/dist/lib/estimators/fixedProducts.js +41 -25
- package/dist/lib/estimators/resolveProducts.d.ts +14 -4
- package/dist/lib/estimators/resolveProducts.js +34 -8
- package/package.json +1 -1
package/dist/embed/quote.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as Ua,b as X}from"./chunk-SQE76S5B.js";var hm=Ua(rt=>{"use strict";function qc(e,t){var a=e.length;e.push(t);e:for(;0<a;){var r=a-1>>>1,i=e[r];if(0<ml(i,t))e[r]=t,e[a]=i,a=r;else break e}}function Da(e){return e.length===0?null:e[0]}function gl(e){if(e.length===0)return null;var t=e[0],a=e.pop();if(a!==t){e[0]=a;e:for(var r=0,i=e.length,n=i>>>1;r<n;){var o=2*(r+1)-1,l=e[o],c=o+1,p=e[c];if(0>ml(l,a))c<i&&0>ml(p,l)?(e[r]=p,e[c]=a,r=c):(e[r]=l,e[o]=a,r=o);else if(c<i&&0>ml(p,a))e[r]=p,e[c]=a,r=c;else break e}}return t}function ml(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}rt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(lm=performance,rt.unstable_now=function(){return lm.now()}):(Nc=Date,sm=Nc.now(),rt.unstable_now=function(){return Nc.now()-sm});var lm,Nc,sm,Ka=[],wr=[],$w=1,da=null,Ut=3,Ec=!1,Zn=!1,Kn=!1,Mc=!1,pm=typeof setTimeout=="function"?setTimeout:null,dm=typeof clearTimeout=="function"?clearTimeout:null,cm=typeof setImmediate<"u"?setImmediate:null;function fl(e){for(var t=Da(wr);t!==null;){if(t.callback===null)gl(wr);else if(t.startTime<=e)gl(wr),t.sortIndex=t.expirationTime,qc(Ka,t);else break;t=Da(wr)}}function Tc(e){if(Kn=!1,fl(e),!Zn)if(Da(Ka)!==null)Zn=!0,Ai||(Ai=!0,zi());else{var t=Da(wr);t!==null&&zc(Tc,t.startTime-e)}}var Ai=!1,Pn=-1,mm=5,fm=-1;function gm(){return Mc?!0:!(rt.unstable_now()-fm<mm)}function Sc(){if(Mc=!1,Ai){var e=rt.unstable_now();fm=e;var t=!0;try{e:{Zn=!1,Kn&&(Kn=!1,dm(Pn),Pn=-1),Ec=!0;var a=Ut;try{t:{for(fl(e),da=Da(Ka);da!==null&&!(da.expirationTime>e&&gm());){var r=da.callback;if(typeof r=="function"){da.callback=null,Ut=da.priorityLevel;var i=r(da.expirationTime<=e);if(e=rt.unstable_now(),typeof i=="function"){da.callback=i,fl(e),t=!0;break t}da===Da(Ka)&&gl(Ka),fl(e)}else gl(Ka);da=Da(Ka)}if(da!==null)t=!0;else{var n=Da(wr);n!==null&&zc(Tc,n.startTime-e),t=!1}}break e}finally{da=null,Ut=a,Ec=!1}t=void 0}}finally{t?zi():Ai=!1}}}var zi;typeof cm=="function"?zi=function(){cm(Sc)}:typeof MessageChannel<"u"?(Cc=new MessageChannel,um=Cc.port2,Cc.port1.onmessage=Sc,zi=function(){um.postMessage(null)}):zi=function(){pm(Sc,0)};var Cc,um;function zc(e,t){Pn=pm(function(){e(rt.unstable_now())},t)}rt.unstable_IdlePriority=5;rt.unstable_ImmediatePriority=1;rt.unstable_LowPriority=4;rt.unstable_NormalPriority=3;rt.unstable_Profiling=null;rt.unstable_UserBlockingPriority=2;rt.unstable_cancelCallback=function(e){e.callback=null};rt.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):mm=0<e?Math.floor(1e3/e):5};rt.unstable_getCurrentPriorityLevel=function(){return Ut};rt.unstable_next=function(e){switch(Ut){case 1:case 2:case 3:var t=3;break;default:t=Ut}var a=Ut;Ut=t;try{return e()}finally{Ut=a}};rt.unstable_requestPaint=function(){Mc=!0};rt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=Ut;Ut=e;try{return t()}finally{Ut=a}};rt.unstable_scheduleCallback=function(e,t,a){var r=rt.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?r+a:r):a=r,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return i=a+i,e={id:$w++,callback:t,priorityLevel:e,startTime:a,expirationTime:i,sortIndex:-1},a>r?(e.sortIndex=a,qc(wr,e),Da(Ka)===null&&e===Da(wr)&&(Kn?(dm(Pn),Pn=-1):Kn=!0,zc(Tc,a-r))):(e.sortIndex=i,qc(Ka,e),Zn||Ec||(Zn=!0,Ai||(Ai=!0,zi()))),e};rt.unstable_shouldYield=gm;rt.unstable_wrapCallback=function(e){var t=Ut;return function(){var a=Ut;Ut=t;try{return e.apply(this,arguments)}finally{Ut=a}}}});var vm=Ua((ux,bm)=>{"use strict";bm.exports=hm()});var Mm=Ua(he=>{"use strict";var Uc=Symbol.for("react.transitional.element"),Zw=Symbol.for("react.portal"),Kw=Symbol.for("react.fragment"),Pw=Symbol.for("react.strict_mode"),Jw=Symbol.for("react.profiler"),Fw=Symbol.for("react.consumer"),Iw=Symbol.for("react.context"),Ww=Symbol.for("react.forward_ref"),e0=Symbol.for("react.suspense"),t0=Symbol.for("react.memo"),km=Symbol.for("react.lazy"),a0=Symbol.for("react.activity"),wm=Symbol.iterator;function r0(e){return e===null||typeof e!="object"?null:(e=wm&&e[wm]||e["@@iterator"],typeof e=="function"?e:null)}var Nm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Sm=Object.assign,Cm={};function Ui(e,t,a){this.props=e,this.context=t,this.refs=Cm,this.updater=a||Nm}Ui.prototype.isReactComponent={};Ui.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ui.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qm(){}qm.prototype=Ui.prototype;function Dc(e,t,a){this.props=e,this.context=t,this.refs=Cm,this.updater=a||Nm}var Oc=Dc.prototype=new qm;Oc.constructor=Dc;Sm(Oc,Ui.prototype);Oc.isPureReactComponent=!0;var ym=Array.isArray;function Rc(){}var Ie={H:null,A:null,T:null,S:null},Em=Object.prototype.hasOwnProperty;function Bc(e,t,a){var r=a.ref;return{$$typeof:Uc,type:e,key:t,ref:r!==void 0?r:null,props:a}}function i0(e,t){return Bc(e.type,t,e.props)}function Lc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uc}function n0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var _m=/\/+/g;function Ac(e,t){return typeof e=="object"&&e!==null&&e.key!=null?n0(""+e.key):t.toString(36)}function o0(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Rc,Rc):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ri(e,t,a,r,i){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(n){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Uc:case Zw:o=!0;break;case km:return o=e._init,Ri(o(e._payload),t,a,r,i)}}if(o)return i=i(e),o=r===""?"."+Ac(e,0):r,ym(i)?(a="",o!=null&&(a=o.replace(_m,"$&/")+"/"),Ri(i,t,a,"",function(p){return p})):i!=null&&(Lc(i)&&(i=i0(i,a+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(_m,"$&/")+"/")+o)),t.push(i)),1;o=0;var l=r===""?".":r+":";if(ym(e))for(var c=0;c<e.length;c++)r=e[c],n=l+Ac(r,c),o+=Ri(r,t,a,n,i);else if(c=r0(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,n=l+Ac(r,c++),o+=Ri(r,t,a,n,i);else if(n==="object"){if(typeof e.then=="function")return Ri(o0(e),t,a,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function hl(e,t,a){if(e==null)return e;var r=[],i=0;return Ri(e,r,"","",function(n){return t.call(a,n,i++)}),r}function l0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var xm=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},s0={map:hl,forEach:function(e,t,a){hl(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return hl(e,function(){t++}),t},toArray:function(e){return hl(e,function(t){return t})||[]},only:function(e){if(!Lc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};he.Activity=a0;he.Children=s0;he.Component=Ui;he.Fragment=Kw;he.Profiler=Jw;he.PureComponent=Dc;he.StrictMode=Pw;he.Suspense=e0;he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ie;he.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ie.H.useMemoCache(e)}};he.cache=function(e){return function(){return e.apply(null,arguments)}};he.cacheSignal=function(){return null};he.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=Sm({},e.props),i=e.key;if(t!=null)for(n in t.key!==void 0&&(i=""+t.key),t)!Em.call(t,n)||n==="key"||n==="__self"||n==="__source"||n==="ref"&&t.ref===void 0||(r[n]=t[n]);var n=arguments.length-2;if(n===1)r.children=a;else if(1<n){for(var o=Array(n),l=0;l<n;l++)o[l]=arguments[l+2];r.children=o}return Bc(e.type,i,r)};he.createContext=function(e){return e={$$typeof:Iw,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Fw,_context:e},e};he.createElement=function(e,t,a){var r,i={},n=null;if(t!=null)for(r in t.key!==void 0&&(n=""+t.key),t)Em.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=a;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return Bc(e,n,i)};he.createRef=function(){return{current:null}};he.forwardRef=function(e){return{$$typeof:Ww,render:e}};he.isValidElement=Lc;he.lazy=function(e){return{$$typeof:km,_payload:{_status:-1,_result:e},_init:l0}};he.memo=function(e,t){return{$$typeof:t0,type:e,compare:t===void 0?null:t}};he.startTransition=function(e){var t=Ie.T,a={};Ie.T=a;try{var r=e(),i=Ie.S;i!==null&&i(a,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Rc,xm)}catch(n){xm(n)}finally{t!==null&&a.types!==null&&(t.types=a.types),Ie.T=t}};he.unstable_useCacheRefresh=function(){return Ie.H.useCacheRefresh()};he.use=function(e){return Ie.H.use(e)};he.useActionState=function(e,t,a){return Ie.H.useActionState(e,t,a)};he.useCallback=function(e,t){return Ie.H.useCallback(e,t)};he.useContext=function(e){return Ie.H.useContext(e)};he.useDebugValue=function(){};he.useDeferredValue=function(e,t){return Ie.H.useDeferredValue(e,t)};he.useEffect=function(e,t){return Ie.H.useEffect(e,t)};he.useEffectEvent=function(e){return Ie.H.useEffectEvent(e)};he.useId=function(){return Ie.H.useId()};he.useImperativeHandle=function(e,t,a){return Ie.H.useImperativeHandle(e,t,a)};he.useInsertionEffect=function(e,t){return Ie.H.useInsertionEffect(e,t)};he.useLayoutEffect=function(e,t){return Ie.H.useLayoutEffect(e,t)};he.useMemo=function(e,t){return Ie.H.useMemo(e,t)};he.useOptimistic=function(e,t){return Ie.H.useOptimistic(e,t)};he.useReducer=function(e,t,a){return Ie.H.useReducer(e,t,a)};he.useRef=function(e){return Ie.H.useRef(e)};he.useState=function(e){return Ie.H.useState(e)};he.useSyncExternalStore=function(e,t,a){return Ie.H.useSyncExternalStore(e,t,a)};he.useTransition=function(){return Ie.H.useTransition()};he.version="19.2.3"});var Xe=Ua((dx,Tm)=>{"use strict";Tm.exports=Mm()});var Am=Ua(Bt=>{"use strict";var c0=Xe();function zm(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function yr(){}var Ot={d:{f:yr,r:function(){throw Error(zm(522))},D:yr,C:yr,L:yr,m:yr,X:yr,S:yr,M:yr},p:0,findDOMNode:null},u0=Symbol.for("react.portal");function p0(e,t,a){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u0,key:r==null?null:""+r,children:e,containerInfo:t,implementation:a}}var Jn=c0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function bl(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ot;Bt.createPortal=function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(zm(299));return p0(e,t,null,a)};Bt.flushSync=function(e){var t=Jn.T,a=Ot.p;try{if(Jn.T=null,Ot.p=2,e)return e()}finally{Jn.T=t,Ot.p=a,Ot.d.f()}};Bt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ot.d.C(e,t))};Bt.prefetchDNS=function(e){typeof e=="string"&&Ot.d.D(e)};Bt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,r=bl(a,t.crossOrigin),i=typeof t.integrity=="string"?t.integrity:void 0,n=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?Ot.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:n}):a==="script"&&Ot.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:n,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Bt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=bl(t.as,t.crossOrigin);Ot.d.M(e,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Ot.d.M(e)};Bt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,r=bl(a,t.crossOrigin);Ot.d.L(e,a,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Bt.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=bl(t.as,t.crossOrigin);Ot.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Ot.d.m(e)};Bt.requestFormReset=function(e){Ot.d.r(e)};Bt.unstable_batchedUpdates=function(e,t){return e(t)};Bt.useFormState=function(e,t,a){return Jn.H.useFormState(e,t,a)};Bt.useFormStatus=function(){return Jn.H.useHostTransitionStatus()};Bt.version="19.2.3"});var Dm=Ua((fx,Um)=>{"use strict";function Rm(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rm)}catch(e){console.error(e)}}Rm(),Um.exports=Am()});var Kb=Ua(Gs=>{"use strict";var yt=vm(),sg=Xe(),d0=Dm();function L(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function cg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bo(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function ug(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function pg(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Om(e){if(Bo(e)!==e)throw Error(L(188))}function m0(e){var t=e.alternate;if(!t){if(t=Bo(e),t===null)throw Error(L(188));return t!==e?null:e}for(var a=e,r=t;;){var i=a.return;if(i===null)break;var n=i.alternate;if(n===null){if(r=i.return,r!==null){a=r;continue}break}if(i.child===n.child){for(n=i.child;n;){if(n===a)return Om(i),e;if(n===r)return Om(i),t;n=n.sibling}throw Error(L(188))}if(a.return!==r.return)a=i,r=n;else{for(var o=!1,l=i.child;l;){if(l===a){o=!0,a=i,r=n;break}if(l===r){o=!0,r=i,a=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===a){o=!0,a=n,r=i;break}if(l===r){o=!0,r=n,a=i;break}l=l.sibling}if(!o)throw Error(L(189))}}if(a.alternate!==r)throw Error(L(190))}if(a.tag!==3)throw Error(L(188));return a.stateNode.current===a?e:t}function dg(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=dg(e),t!==null)return t;e=e.sibling}return null}var tt=Object.assign,f0=Symbol.for("react.element"),vl=Symbol.for("react.transitional.element"),io=Symbol.for("react.portal"),ji=Symbol.for("react.fragment"),mg=Symbol.for("react.strict_mode"),vu=Symbol.for("react.profiler"),fg=Symbol.for("react.consumer"),ar=Symbol.for("react.context"),mp=Symbol.for("react.forward_ref"),wu=Symbol.for("react.suspense"),yu=Symbol.for("react.suspense_list"),fp=Symbol.for("react.memo"),_r=Symbol.for("react.lazy"),_u=Symbol.for("react.activity"),g0=Symbol.for("react.memo_cache_sentinel"),Bm=Symbol.iterator;function Fn(e){return e===null||typeof e!="object"?null:(e=Bm&&e[Bm]||e["@@iterator"],typeof e=="function"?e:null)}var h0=Symbol.for("react.client.reference");function xu(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===h0?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ji:return"Fragment";case vu:return"Profiler";case mg:return"StrictMode";case wu:return"Suspense";case yu:return"SuspenseList";case _u:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case io:return"Portal";case ar:return e.displayName||"Context";case fg:return(e._context.displayName||"Context")+".Consumer";case mp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fp:return t=e.displayName||null,t!==null?t:xu(e.type)||"Memo";case _r:t=e._payload,e=e._init;try{return xu(e(t))}catch{}}return null}var no=Array.isArray,ue=sg.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Be=d0.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ri={pending:!1,data:null,method:null,action:null},ku=[],Qi=-1;function ja(e){return{current:e}}function St(e){0>Qi||(e.current=ku[Qi],ku[Qi]=null,Qi--)}function Pe(e,t){Qi++,ku[Qi]=e.current,e.current=t}var Ha=ja(null),ko=ja(null),Ar=ja(null),Fl=ja(null);function Il(e,t){switch(Pe(Ar,t),Pe(ko,e),Pe(Ha,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vf(t),e=Ub(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}St(Ha),Pe(Ha,e)}function on(){St(Ha),St(ko),St(Ar)}function Nu(e){e.memoizedState!==null&&Pe(Fl,e);var t=Ha.current,a=Ub(t,e.type);t!==a&&(Pe(ko,e),Pe(Ha,a))}function Wl(e){ko.current===e&&(St(Ha),St(ko)),Fl.current===e&&(St(Fl),Uo._currentValue=ri)}var Hc,Lm;function Wr(e){if(Hc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Hc=t&&t[1]||"",Lm=-1<a.stack.indexOf(`
|
|
1
|
+
import{a as Ua,b as X}from"./chunk-SQE76S5B.js";var vm=Ua(rt=>{"use strict";function qc(e,t){var a=e.length;e.push(t);e:for(;0<a;){var r=a-1>>>1,i=e[r];if(0<ml(i,t))e[r]=t,e[a]=i,a=r;else break e}}function Da(e){return e.length===0?null:e[0]}function gl(e){if(e.length===0)return null;var t=e[0],a=e.pop();if(a!==t){e[0]=a;e:for(var r=0,i=e.length,n=i>>>1;r<n;){var o=2*(r+1)-1,l=e[o],c=o+1,p=e[c];if(0>ml(l,a))c<i&&0>ml(p,l)?(e[r]=p,e[c]=a,r=c):(e[r]=l,e[o]=a,r=o);else if(c<i&&0>ml(p,a))e[r]=p,e[c]=a,r=c;else break e}}return t}function ml(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}rt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(cm=performance,rt.unstable_now=function(){return cm.now()}):(Nc=Date,um=Nc.now(),rt.unstable_now=function(){return Nc.now()-um});var cm,Nc,um,Ka=[],yr=[],Kw=1,ma=null,Ut=3,Ec=!1,Zn=!1,Kn=!1,Mc=!1,mm=typeof setTimeout=="function"?setTimeout:null,fm=typeof clearTimeout=="function"?clearTimeout:null,pm=typeof setImmediate<"u"?setImmediate:null;function fl(e){for(var t=Da(yr);t!==null;){if(t.callback===null)gl(yr);else if(t.startTime<=e)gl(yr),t.sortIndex=t.expirationTime,qc(Ka,t);else break;t=Da(yr)}}function Tc(e){if(Kn=!1,fl(e),!Zn)if(Da(Ka)!==null)Zn=!0,Ai||(Ai=!0,zi());else{var t=Da(yr);t!==null&&zc(Tc,t.startTime-e)}}var Ai=!1,Pn=-1,gm=5,hm=-1;function bm(){return Mc?!0:!(rt.unstable_now()-hm<gm)}function Sc(){if(Mc=!1,Ai){var e=rt.unstable_now();hm=e;var t=!0;try{e:{Zn=!1,Kn&&(Kn=!1,fm(Pn),Pn=-1),Ec=!0;var a=Ut;try{t:{for(fl(e),ma=Da(Ka);ma!==null&&!(ma.expirationTime>e&&bm());){var r=ma.callback;if(typeof r=="function"){ma.callback=null,Ut=ma.priorityLevel;var i=r(ma.expirationTime<=e);if(e=rt.unstable_now(),typeof i=="function"){ma.callback=i,fl(e),t=!0;break t}ma===Da(Ka)&&gl(Ka),fl(e)}else gl(Ka);ma=Da(Ka)}if(ma!==null)t=!0;else{var n=Da(yr);n!==null&&zc(Tc,n.startTime-e),t=!1}}break e}finally{ma=null,Ut=a,Ec=!1}t=void 0}}finally{t?zi():Ai=!1}}}var zi;typeof pm=="function"?zi=function(){pm(Sc)}:typeof MessageChannel<"u"?(Cc=new MessageChannel,dm=Cc.port2,Cc.port1.onmessage=Sc,zi=function(){dm.postMessage(null)}):zi=function(){mm(Sc,0)};var Cc,dm;function zc(e,t){Pn=mm(function(){e(rt.unstable_now())},t)}rt.unstable_IdlePriority=5;rt.unstable_ImmediatePriority=1;rt.unstable_LowPriority=4;rt.unstable_NormalPriority=3;rt.unstable_Profiling=null;rt.unstable_UserBlockingPriority=2;rt.unstable_cancelCallback=function(e){e.callback=null};rt.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):gm=0<e?Math.floor(1e3/e):5};rt.unstable_getCurrentPriorityLevel=function(){return Ut};rt.unstable_next=function(e){switch(Ut){case 1:case 2:case 3:var t=3;break;default:t=Ut}var a=Ut;Ut=t;try{return e()}finally{Ut=a}};rt.unstable_requestPaint=function(){Mc=!0};rt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=Ut;Ut=e;try{return t()}finally{Ut=a}};rt.unstable_scheduleCallback=function(e,t,a){var r=rt.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?r+a:r):a=r,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return i=a+i,e={id:Kw++,callback:t,priorityLevel:e,startTime:a,expirationTime:i,sortIndex:-1},a>r?(e.sortIndex=a,qc(yr,e),Da(Ka)===null&&e===Da(yr)&&(Kn?(fm(Pn),Pn=-1):Kn=!0,zc(Tc,a-r))):(e.sortIndex=i,qc(Ka,e),Zn||Ec||(Zn=!0,Ai||(Ai=!0,zi()))),e};rt.unstable_shouldYield=bm;rt.unstable_wrapCallback=function(e){var t=Ut;return function(){var a=Ut;Ut=t;try{return e.apply(this,arguments)}finally{Ut=a}}}});var ym=Ua((fx,wm)=>{"use strict";wm.exports=vm()});var zm=Ua(he=>{"use strict";var Uc=Symbol.for("react.transitional.element"),Pw=Symbol.for("react.portal"),Jw=Symbol.for("react.fragment"),Iw=Symbol.for("react.strict_mode"),Fw=Symbol.for("react.profiler"),Ww=Symbol.for("react.consumer"),e0=Symbol.for("react.context"),t0=Symbol.for("react.forward_ref"),a0=Symbol.for("react.suspense"),r0=Symbol.for("react.memo"),Sm=Symbol.for("react.lazy"),i0=Symbol.for("react.activity"),_m=Symbol.iterator;function n0(e){return e===null||typeof e!="object"?null:(e=_m&&e[_m]||e["@@iterator"],typeof e=="function"?e:null)}var Cm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qm=Object.assign,Em={};function Ui(e,t,a){this.props=e,this.context=t,this.refs=Em,this.updater=a||Cm}Ui.prototype.isReactComponent={};Ui.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ui.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Mm(){}Mm.prototype=Ui.prototype;function Dc(e,t,a){this.props=e,this.context=t,this.refs=Em,this.updater=a||Cm}var Oc=Dc.prototype=new Mm;Oc.constructor=Dc;qm(Oc,Ui.prototype);Oc.isPureReactComponent=!0;var xm=Array.isArray;function Rc(){}var Fe={H:null,A:null,T:null,S:null},Tm=Object.prototype.hasOwnProperty;function Bc(e,t,a){var r=a.ref;return{$$typeof:Uc,type:e,key:t,ref:r!==void 0?r:null,props:a}}function o0(e,t){return Bc(e.type,t,e.props)}function Lc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uc}function l0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var km=/\/+/g;function Ac(e,t){return typeof e=="object"&&e!==null&&e.key!=null?l0(""+e.key):t.toString(36)}function s0(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Rc,Rc):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ri(e,t,a,r,i){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(n){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Uc:case Pw:o=!0;break;case Sm:return o=e._init,Ri(o(e._payload),t,a,r,i)}}if(o)return i=i(e),o=r===""?"."+Ac(e,0):r,xm(i)?(a="",o!=null&&(a=o.replace(km,"$&/")+"/"),Ri(i,t,a,"",function(p){return p})):i!=null&&(Lc(i)&&(i=o0(i,a+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(km,"$&/")+"/")+o)),t.push(i)),1;o=0;var l=r===""?".":r+":";if(xm(e))for(var c=0;c<e.length;c++)r=e[c],n=l+Ac(r,c),o+=Ri(r,t,a,n,i);else if(c=n0(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,n=l+Ac(r,c++),o+=Ri(r,t,a,n,i);else if(n==="object"){if(typeof e.then=="function")return Ri(s0(e),t,a,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function hl(e,t,a){if(e==null)return e;var r=[],i=0;return Ri(e,r,"","",function(n){return t.call(a,n,i++)}),r}function c0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Nm=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},u0={map:hl,forEach:function(e,t,a){hl(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return hl(e,function(){t++}),t},toArray:function(e){return hl(e,function(t){return t})||[]},only:function(e){if(!Lc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};he.Activity=i0;he.Children=u0;he.Component=Ui;he.Fragment=Jw;he.Profiler=Fw;he.PureComponent=Dc;he.StrictMode=Iw;he.Suspense=a0;he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Fe;he.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Fe.H.useMemoCache(e)}};he.cache=function(e){return function(){return e.apply(null,arguments)}};he.cacheSignal=function(){return null};he.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=qm({},e.props),i=e.key;if(t!=null)for(n in t.key!==void 0&&(i=""+t.key),t)!Tm.call(t,n)||n==="key"||n==="__self"||n==="__source"||n==="ref"&&t.ref===void 0||(r[n]=t[n]);var n=arguments.length-2;if(n===1)r.children=a;else if(1<n){for(var o=Array(n),l=0;l<n;l++)o[l]=arguments[l+2];r.children=o}return Bc(e.type,i,r)};he.createContext=function(e){return e={$$typeof:e0,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Ww,_context:e},e};he.createElement=function(e,t,a){var r,i={},n=null;if(t!=null)for(r in t.key!==void 0&&(n=""+t.key),t)Tm.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=a;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return Bc(e,n,i)};he.createRef=function(){return{current:null}};he.forwardRef=function(e){return{$$typeof:t0,render:e}};he.isValidElement=Lc;he.lazy=function(e){return{$$typeof:Sm,_payload:{_status:-1,_result:e},_init:c0}};he.memo=function(e,t){return{$$typeof:r0,type:e,compare:t===void 0?null:t}};he.startTransition=function(e){var t=Fe.T,a={};Fe.T=a;try{var r=e(),i=Fe.S;i!==null&&i(a,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Rc,Nm)}catch(n){Nm(n)}finally{t!==null&&a.types!==null&&(t.types=a.types),Fe.T=t}};he.unstable_useCacheRefresh=function(){return Fe.H.useCacheRefresh()};he.use=function(e){return Fe.H.use(e)};he.useActionState=function(e,t,a){return Fe.H.useActionState(e,t,a)};he.useCallback=function(e,t){return Fe.H.useCallback(e,t)};he.useContext=function(e){return Fe.H.useContext(e)};he.useDebugValue=function(){};he.useDeferredValue=function(e,t){return Fe.H.useDeferredValue(e,t)};he.useEffect=function(e,t){return Fe.H.useEffect(e,t)};he.useEffectEvent=function(e){return Fe.H.useEffectEvent(e)};he.useId=function(){return Fe.H.useId()};he.useImperativeHandle=function(e,t,a){return Fe.H.useImperativeHandle(e,t,a)};he.useInsertionEffect=function(e,t){return Fe.H.useInsertionEffect(e,t)};he.useLayoutEffect=function(e,t){return Fe.H.useLayoutEffect(e,t)};he.useMemo=function(e,t){return Fe.H.useMemo(e,t)};he.useOptimistic=function(e,t){return Fe.H.useOptimistic(e,t)};he.useReducer=function(e,t,a){return Fe.H.useReducer(e,t,a)};he.useRef=function(e){return Fe.H.useRef(e)};he.useState=function(e){return Fe.H.useState(e)};he.useSyncExternalStore=function(e,t,a){return Fe.H.useSyncExternalStore(e,t,a)};he.useTransition=function(){return Fe.H.useTransition()};he.version="19.2.3"});var Xe=Ua((hx,Am)=>{"use strict";Am.exports=zm()});var Um=Ua(Bt=>{"use strict";var p0=Xe();function Rm(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function _r(){}var Ot={d:{f:_r,r:function(){throw Error(Rm(522))},D:_r,C:_r,L:_r,m:_r,X:_r,S:_r,M:_r},p:0,findDOMNode:null},d0=Symbol.for("react.portal");function m0(e,t,a){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d0,key:r==null?null:""+r,children:e,containerInfo:t,implementation:a}}var Jn=p0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function bl(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ot;Bt.createPortal=function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Rm(299));return m0(e,t,null,a)};Bt.flushSync=function(e){var t=Jn.T,a=Ot.p;try{if(Jn.T=null,Ot.p=2,e)return e()}finally{Jn.T=t,Ot.p=a,Ot.d.f()}};Bt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ot.d.C(e,t))};Bt.prefetchDNS=function(e){typeof e=="string"&&Ot.d.D(e)};Bt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,r=bl(a,t.crossOrigin),i=typeof t.integrity=="string"?t.integrity:void 0,n=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?Ot.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:n}):a==="script"&&Ot.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:n,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Bt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=bl(t.as,t.crossOrigin);Ot.d.M(e,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Ot.d.M(e)};Bt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,r=bl(a,t.crossOrigin);Ot.d.L(e,a,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Bt.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=bl(t.as,t.crossOrigin);Ot.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Ot.d.m(e)};Bt.requestFormReset=function(e){Ot.d.r(e)};Bt.unstable_batchedUpdates=function(e,t){return e(t)};Bt.useFormState=function(e,t,a){return Jn.H.useFormState(e,t,a)};Bt.useFormStatus=function(){return Jn.H.useHostTransitionStatus()};Bt.version="19.2.3"});var Bm=Ua((vx,Om)=>{"use strict";function Dm(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dm)}catch(e){console.error(e)}}Dm(),Om.exports=Um()});var Jb=Ua(Gs=>{"use strict";var yt=ym(),ug=Xe(),f0=Bm();function L(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function pg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bo(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function dg(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function mg(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Lm(e){if(Bo(e)!==e)throw Error(L(188))}function g0(e){var t=e.alternate;if(!t){if(t=Bo(e),t===null)throw Error(L(188));return t!==e?null:e}for(var a=e,r=t;;){var i=a.return;if(i===null)break;var n=i.alternate;if(n===null){if(r=i.return,r!==null){a=r;continue}break}if(i.child===n.child){for(n=i.child;n;){if(n===a)return Lm(i),e;if(n===r)return Lm(i),t;n=n.sibling}throw Error(L(188))}if(a.return!==r.return)a=i,r=n;else{for(var o=!1,l=i.child;l;){if(l===a){o=!0,a=i,r=n;break}if(l===r){o=!0,r=i,a=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===a){o=!0,a=n,r=i;break}if(l===r){o=!0,r=n,a=i;break}l=l.sibling}if(!o)throw Error(L(189))}}if(a.alternate!==r)throw Error(L(190))}if(a.tag!==3)throw Error(L(188));return a.stateNode.current===a?e:t}function fg(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=fg(e),t!==null)return t;e=e.sibling}return null}var tt=Object.assign,h0=Symbol.for("react.element"),vl=Symbol.for("react.transitional.element"),io=Symbol.for("react.portal"),ji=Symbol.for("react.fragment"),gg=Symbol.for("react.strict_mode"),vu=Symbol.for("react.profiler"),hg=Symbol.for("react.consumer"),ar=Symbol.for("react.context"),mp=Symbol.for("react.forward_ref"),wu=Symbol.for("react.suspense"),yu=Symbol.for("react.suspense_list"),fp=Symbol.for("react.memo"),xr=Symbol.for("react.lazy"),_u=Symbol.for("react.activity"),b0=Symbol.for("react.memo_cache_sentinel"),Hm=Symbol.iterator;function In(e){return e===null||typeof e!="object"?null:(e=Hm&&e[Hm]||e["@@iterator"],typeof e=="function"?e:null)}var v0=Symbol.for("react.client.reference");function xu(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===v0?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ji:return"Fragment";case vu:return"Profiler";case gg:return"StrictMode";case wu:return"Suspense";case yu:return"SuspenseList";case _u:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case io:return"Portal";case ar:return e.displayName||"Context";case hg:return(e._context.displayName||"Context")+".Consumer";case mp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fp:return t=e.displayName||null,t!==null?t:xu(e.type)||"Memo";case xr:t=e._payload,e=e._init;try{return xu(e(t))}catch{}}return null}var no=Array.isArray,ue=ug.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Be=f0.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ri={pending:!1,data:null,method:null,action:null},ku=[],Qi=-1;function ja(e){return{current:e}}function St(e){0>Qi||(e.current=ku[Qi],ku[Qi]=null,Qi--)}function Pe(e,t){Qi++,ku[Qi]=e.current,e.current=t}var Ha=ja(null),ko=ja(null),Rr=ja(null),Il=ja(null);function Fl(e,t){switch(Pe(Rr,t),Pe(ko,e),Pe(Ha,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zf(t),e=Ob(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}St(Ha),Pe(Ha,e)}function on(){St(Ha),St(ko),St(Rr)}function Nu(e){e.memoizedState!==null&&Pe(Il,e);var t=Ha.current,a=Ob(t,e.type);t!==a&&(Pe(ko,e),Pe(Ha,a))}function Wl(e){ko.current===e&&(St(Ha),St(ko)),Il.current===e&&(St(Il),Uo._currentValue=ri)}var Hc,jm;function Wr(e){if(Hc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Hc=t&&t[1]||"",jm=-1<a.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Hc+e+
|
|
3
|
+
`+Hc+e+jm}var jc=!1;function Qc(e,t){if(!e||jc)return"";jc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(h){var f=h}Reflect.construct(e,[],g)}else{try{g.call()}catch(h){f=h}e.call(g.prototype)}}else{try{throw Error()}catch(h){f=h}(g=e())&&typeof g.catch=="function"&&g.catch(function(){})}}catch(h){if(h&&f&&typeof h.stack=="string")return[h.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var n=r.DetermineComponentFrameRoot(),o=n[0],l=n[1];if(o&&l){var c=o.split(`
|
|
4
4
|
`),p=l.split(`
|
|
5
5
|
`);for(i=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;i<p.length&&!p[i].includes("DetermineComponentFrameRoot");)i++;if(r===c.length||i===p.length)for(r=c.length-1,i=p.length-1;1<=r&&0<=i&&c[r]!==p[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==p[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==p[i]){var d=`
|
|
6
|
-
`+c[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=i);break}}}finally{jc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Wr(a):""}function
|
|
6
|
+
`+c[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=i);break}}}finally{jc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Wr(a):""}function w0(e,t){switch(e.tag){case 26:case 27:case 5:return Wr(e.type);case 16:return Wr("Lazy");case 13:return e.child!==t&&t!==null?Wr("Suspense Fallback"):Wr("Suspense");case 19:return Wr("SuspenseList");case 0:case 15:return Qc(e.type,!1);case 11:return Qc(e.type.render,!1);case 1:return Qc(e.type,!0);case 31:return Wr("Activity");default:return""}}function Qm(e){try{var t="",a=null;do t+=w0(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
7
7
|
Error generating stack: `+r.message+`
|
|
8
|
-
`+r.stack}}var Su=Object.prototype.hasOwnProperty,gp=yt.unstable_scheduleCallback,Gc=yt.unstable_cancelCallback,v0=yt.unstable_shouldYield,w0=yt.unstable_requestPaint,ia=yt.unstable_now,y0=yt.unstable_getCurrentPriorityLevel,gg=yt.unstable_ImmediatePriority,hg=yt.unstable_UserBlockingPriority,es=yt.unstable_NormalPriority,_0=yt.unstable_LowPriority,bg=yt.unstable_IdlePriority,x0=yt.log,k0=yt.unstable_setDisableYieldValue,Lo=null,na=null;function qr(e){if(typeof x0=="function"&&k0(e),na&&typeof na.setStrictMode=="function")try{na.setStrictMode(Lo,e)}catch{}}var oa=Math.clz32?Math.clz32:C0,N0=Math.log,S0=Math.LN2;function C0(e){return e>>>=0,e===0?32:31-(N0(e)/S0|0)|0}var wl=256,yl=262144,_l=4194304;function ei(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Cs(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~n,r!==0?i=ei(r):(o&=l,o!==0?i=ei(o):a||(a=l&~e,a!==0&&(i=ei(a))))):(l=r&~n,l!==0?i=ei(l):o!==0?i=ei(o):a||(a=r&~e,a!==0&&(i=ei(a)))),i===0?0:t!==0&&t!==i&&(t&n)===0&&(n=i&-i,a=t&-t,n>=a||n===32&&(a&4194048)!==0)?t:i}function Ho(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function q0(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vg(){var e=_l;return _l<<=1,(_l&62914560)===0&&(_l=4194304),e}function Yc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function jo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function E0(e,t,a,r,i,n){var o=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var d=31-oa(a),g=1<<d;l[d]=0,c[d]=-1;var f=p[d];if(f!==null)for(p[d]=null,d=0;d<f.length;d++){var h=f[d];h!==null&&(h.lane&=-536870913)}a&=~g}r!==0&&wg(e,r,0),n!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=n&~(o&~t))}function wg(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-oa(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function yg(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-oa(a),i=1<<r;i&t|e[r]&t&&(e[r]|=t),a&=~i}}function _g(e,t){var a=t&-t;return a=(a&42)!==0?1:hp(a),(a&(e.suspendedLanes|t))!==0?0:a}function hp(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function bp(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function xg(){var e=Be.p;return e!==0?e:(e=window.event,e===void 0?32:Vb(e.type))}function jm(e,t){var a=Be.p;try{return Be.p=e,t()}finally{Be.p=a}}var Vr=Math.random().toString(36).slice(2),Et="__reactFiber$"+Vr,Zt="__reactProps$"+Vr,bn="__reactContainer$"+Vr,Cu="__reactEvents$"+Vr,M0="__reactListeners$"+Vr,T0="__reactHandles$"+Vr,Qm="__reactResources$"+Vr,Qo="__reactMarker$"+Vr;function vp(e){delete e[Et],delete e[Zt],delete e[Cu],delete e[M0],delete e[T0]}function Gi(e){var t=e[Et];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[Et]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Jf(e);e!==null;){if(a=e[Et])return a;e=Jf(e)}return t}e=a,a=e.parentNode}return null}function vn(e){if(e=e[Et]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function oo(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Ii(e){var t=e[Qm];return t||(t=e[Qm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Nt(e){e[Qo]=!0}var kg=new Set,Ng={};function mi(e,t){ln(e,t),ln(e+"Capture",t)}function ln(e,t){for(Ng[e]=t,e=0;e<t.length;e++)kg.add(t[e])}var z0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Gm={},Ym={};function A0(e){return Su.call(Ym,e)?!0:Su.call(Gm,e)?!1:z0.test(e)?Ym[e]=!0:(Gm[e]=!0,!1)}function Ol(e,t,a){if(A0(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function xl(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Pa(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function fa(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function R0(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){a=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(o){a=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qu(e){if(!e._valueTracker){var t=Sg(e)?"checked":"value";e._valueTracker=R0(e,t,""+e[t])}}function Cg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Sg(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function ts(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var U0=/[\n"\\]/g;function ba(e){return e.replace(U0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eu(e,t,a,r,i,n,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+fa(t)):e.value!==""+fa(t)&&(e.value=""+fa(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Mu(e,o,fa(t)):a!=null?Mu(e,o,fa(a)):r!=null&&e.removeAttribute("value"),i==null&&n!=null&&(e.defaultChecked=!!n),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+fa(l):e.removeAttribute("name")}function qg(e,t,a,r,i,n,o,l){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||a!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){qu(e);return}a=a!=null?""+fa(a):"",t=t!=null?""+fa(t):a,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),qu(e)}function Mu(e,t,a){t==="number"&&ts(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Wi(e,t,a,r){if(e=e.options,t){t={};for(var i=0;i<a.length;i++)t["$"+a[i]]=!0;for(a=0;a<e.length;a++)i=t.hasOwnProperty("$"+e[a].value),e[a].selected!==i&&(e[a].selected=i),i&&r&&(e[a].defaultSelected=!0)}else{for(a=""+fa(a),t=null,i=0;i<e.length;i++){if(e[i].value===a){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Eg(e,t,a){if(t!=null&&(t=""+fa(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+fa(a):""}function Mg(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(L(92));if(no(r)){if(1<r.length)throw Error(L(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=fa(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),qu(e)}function sn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var D0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Xm(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||D0.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Tg(e,t,a){if(t!=null&&typeof t!="object")throw Error(L(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&a[i]!==r&&Xm(e,i,r)}else for(var n in t)t.hasOwnProperty(n)&&Xm(e,n,t[n])}function wp(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var O0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),B0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bl(e){return B0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function rr(){}var Tu=null;function yp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,en=null;function Vm(e){var t=vn(e);if(t&&(e=t.stateNode)){var a=e[Zt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Eu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ba(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var i=r[Zt]||null;if(!i)throw Error(L(90));Eu(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Cg(r)}break e;case"textarea":Eg(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Wi(e,!!a.multiple,t,!1)}}}var Xc=!1;function zg(e,t,a){if(Xc)return e(t,a);Xc=!0;try{var r=e(t);return r}finally{if(Xc=!1,(Yi!==null||en!==null)&&(Ls(),Yi&&(t=Yi,e=en,en=Yi=null,Vm(t),e)))for(t=0;t<e.length;t++)Vm(e[t])}}function No(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Zt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(L(231,t,typeof a));return a}var sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zu=!1;if(sr)try{Di={},Object.defineProperty(Di,"passive",{get:function(){zu=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{zu=!1}var Di,Er=null,_p=null,Ll=null;function Ag(){if(Ll)return Ll;var e,t=_p,a=t.length,r,i="value"in Er?Er.value:Er.textContent,n=i.length;for(e=0;e<a&&t[e]===i[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===i[n-r];r++);return Ll=i.slice(e,1<r?1-r:void 0)}function Hl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function kl(){return!0}function $m(){return!1}function Kt(e){function t(a,r,i,n,o){this._reactName=a,this._targetInst=i,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?kl:$m,this.isPropagationStopped=$m,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),t}var fi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qs=Kt(fi),Go=tt({},fi,{view:0,detail:0}),L0=Kt(Go),Vc,$c,In,Es=tt({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xp,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==In&&(In&&e.type==="mousemove"?(Vc=e.screenX-In.screenX,$c=e.screenY-In.screenY):$c=Vc=0,In=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:$c}}),Zm=Kt(Es),H0=tt({},Es,{dataTransfer:0}),j0=Kt(H0),Q0=tt({},Go,{relatedTarget:0}),Zc=Kt(Q0),G0=tt({},fi,{animationName:0,elapsedTime:0,pseudoElement:0}),Y0=Kt(G0),X0=tt({},fi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),V0=Kt(X0),$0=tt({},fi,{data:0}),Km=Kt($0),Z0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},P0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=P0[e])?!!t[e]:!1}function xp(){return J0}var F0=tt({},Go,{key:function(e){if(e.key){var t=Z0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?K0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xp,charCode:function(e){return e.type==="keypress"?Hl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),I0=Kt(F0),W0=tt({},Es,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pm=Kt(W0),ey=tt({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xp}),ty=Kt(ey),ay=tt({},fi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ry=Kt(ay),iy=tt({},Es,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ny=Kt(iy),oy=tt({},fi,{newState:0,oldState:0}),ly=Kt(oy),sy=[9,13,27,32],kp=sr&&"CompositionEvent"in window,co=null;sr&&"documentMode"in document&&(co=document.documentMode);var cy=sr&&"TextEvent"in window&&!co,Rg=sr&&(!kp||co&&8<co&&11>=co),Jm=" ",Fm=!1;function Ug(e,t){switch(e){case"keyup":return sy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xi=!1;function uy(e,t){switch(e){case"compositionend":return Dg(t);case"keypress":return t.which!==32?null:(Fm=!0,Jm);case"textInput":return e=t.data,e===Jm&&Fm?null:e;default:return null}}function py(e,t){if(Xi)return e==="compositionend"||!kp&&Ug(e,t)?(e=Ag(),Ll=_p=Er=null,Xi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Rg&&t.locale!=="ko"?null:t.data;default:return null}}var dy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Im(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dy[e.type]:t==="textarea"}function Og(e,t,a,r){Yi?en?en.push(r):en=[r]:Yi=r,t=ws(t,"onChange"),0<t.length&&(a=new qs("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var uo=null,So=null;function my(e){zb(e,0)}function Ms(e){var t=oo(e);if(Cg(t))return e}function Wm(e,t){if(e==="change")return t}var Bg=!1;sr&&(sr?(Sl="oninput"in document,Sl||(Kc=document.createElement("div"),Kc.setAttribute("oninput","return;"),Sl=typeof Kc.oninput=="function"),Nl=Sl):Nl=!1,Bg=Nl&&(!document.documentMode||9<document.documentMode));var Nl,Sl,Kc;function ef(){uo&&(uo.detachEvent("onpropertychange",Lg),So=uo=null)}function Lg(e){if(e.propertyName==="value"&&Ms(So)){var t=[];Og(t,So,e,yp(e)),zg(my,t)}}function fy(e,t,a){e==="focusin"?(ef(),uo=t,So=a,uo.attachEvent("onpropertychange",Lg)):e==="focusout"&&ef()}function gy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ms(So)}function hy(e,t){if(e==="click")return Ms(t)}function by(e,t){if(e==="input"||e==="change")return Ms(t)}function vy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sa=typeof Object.is=="function"?Object.is:vy;function Co(e,t){if(sa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var i=a[r];if(!Su.call(t,i)||!sa(e[i],t[i]))return!1}return!0}function tf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function af(e,t){var a=tf(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=tf(a)}}function Hg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ts(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=ts(e.document)}return t}function Np(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var wy=sr&&"documentMode"in document&&11>=document.documentMode,Vi=null,Au=null,po=null,Ru=!1;function rf(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ru||Vi==null||Vi!==ts(r)||(r=Vi,"selectionStart"in r&&Np(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),po&&Co(po,r)||(po=r,r=ws(Au,"onSelect"),0<r.length&&(t=new qs("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Vi)))}function Ir(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var $i={animationend:Ir("Animation","AnimationEnd"),animationiteration:Ir("Animation","AnimationIteration"),animationstart:Ir("Animation","AnimationStart"),transitionrun:Ir("Transition","TransitionRun"),transitionstart:Ir("Transition","TransitionStart"),transitioncancel:Ir("Transition","TransitionCancel"),transitionend:Ir("Transition","TransitionEnd")},Pc={},Qg={};sr&&(Qg=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function gi(e){if(Pc[e])return Pc[e];if(!$i[e])return e;var t=$i[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Qg)return Pc[e]=t[a];return e}var Gg=gi("animationend"),Yg=gi("animationiteration"),Xg=gi("animationstart"),yy=gi("transitionrun"),_y=gi("transitionstart"),xy=gi("transitioncancel"),Vg=gi("transitionend"),$g=new Map,Uu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Uu.push("scrollEnd");function Aa(e,t){$g.set(e,t),mi(t,[e])}var as=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ma=[],Zi=0,Sp=0;function Ts(){for(var e=Zi,t=Sp=Zi=0;t<e;){var a=ma[t];ma[t++]=null;var r=ma[t];ma[t++]=null;var i=ma[t];ma[t++]=null;var n=ma[t];if(ma[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}n!==0&&Zg(a,i,n)}}function zs(e,t,a,r){ma[Zi++]=e,ma[Zi++]=t,ma[Zi++]=a,ma[Zi++]=r,Sp|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Cp(e,t,a,r){return zs(e,t,a,r),rs(e)}function hi(e,t){return zs(e,null,null,t),rs(e)}function Zg(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var i=!1,n=e.return;n!==null;)n.childLanes|=a,r=n.alternate,r!==null&&(r.childLanes|=a),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(i=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,i&&t!==null&&(i=31-oa(a),e=n.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=a|536870912),n):null}function rs(e){if(50<_o)throw _o=0,tp=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ki={};function ky(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function aa(e,t,a,r){return new ky(e,t,a,r)}function qp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nr(e,t){var a=e.alternate;return a===null?(a=aa(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Kg(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function jl(e,t,a,r,i,n){var o=0;if(r=e,typeof e=="function")qp(e)&&(o=1);else if(typeof e=="string")o=C1(e,a,Ha.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case _u:return e=aa(31,a,t,i),e.elementType=_u,e.lanes=n,e;case ji:return ii(a.children,i,n,t);case mg:o=8,i|=24;break;case vu:return e=aa(12,a,t,i|2),e.elementType=vu,e.lanes=n,e;case wu:return e=aa(13,a,t,i),e.elementType=wu,e.lanes=n,e;case yu:return e=aa(19,a,t,i),e.elementType=yu,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ar:o=10;break e;case fg:o=9;break e;case mp:o=11;break e;case fp:o=14;break e;case _r:o=16,r=null;break e}o=29,a=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=aa(o,a,t,i),t.elementType=e,t.type=r,t.lanes=n,t}function ii(e,t,a,r){return e=aa(7,e,r,t),e.lanes=a,e}function Jc(e,t,a){return e=aa(6,e,null,t),e.lanes=a,e}function Pg(e){var t=aa(18,null,null,0);return t.stateNode=e,t}function Fc(e,t,a){return t=aa(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var nf=new WeakMap;function va(e,t){if(typeof e=="object"&&e!==null){var a=nf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Hm(t)},nf.set(e,t),t)}return{value:e,source:t,stack:Hm(t)}}var Pi=[],Ji=0,is=null,qo=0,ga=[],ha=0,Qr=null,Oa=1,Ba="";function er(e,t){Pi[Ji++]=qo,Pi[Ji++]=is,is=e,qo=t}function Jg(e,t,a){ga[ha++]=Oa,ga[ha++]=Ba,ga[ha++]=Qr,Qr=e;var r=Oa;e=Ba;var i=32-oa(r)-1;r&=~(1<<i),a+=1;var n=32-oa(t)+i;if(30<n){var o=i-i%5;n=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Oa=1<<32-oa(t)+i|a<<i|r,Ba=n+e}else Oa=1<<n|a<<i|r,Ba=e}function Ep(e){e.return!==null&&(er(e,1),Jg(e,1,0))}function Mp(e){for(;e===is;)is=Pi[--Ji],Pi[Ji]=null,qo=Pi[--Ji],Pi[Ji]=null;for(;e===Qr;)Qr=ga[--ha],ga[ha]=null,Ba=ga[--ha],ga[ha]=null,Oa=ga[--ha],ga[ha]=null}function Fg(e,t){ga[ha++]=Oa,ga[ha++]=Ba,ga[ha++]=Qr,Oa=t.id,Ba=t.overflow,Qr=e}var Mt=null,et=null,Te=!1,Rr=null,wa=!1,Du=Error(L(519));function Gr(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(va(t,e)),Du}function of(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Et]=e,t[Zt]=r,a){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(a=0;a<Ao.length;a++)Ce(Ao[a],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),qg(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),Mg(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||Rb(t.textContent,a)?(r.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),r.onScroll!=null&&Ce("scroll",t),r.onScrollEnd!=null&&Ce("scrollend",t),r.onClick!=null&&(t.onclick=rr),t=!0):t=!1,t||Gr(e,!0)}function lf(e){for(Mt=e.return;Mt;)switch(Mt.tag){case 5:case 31:case 13:wa=!1;return;case 27:case 3:wa=!0;return;default:Mt=Mt.return}}function Oi(e){if(e!==Mt)return!1;if(!Te)return lf(e),Te=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||op(e.type,e.memoizedProps)),a=!a),a&&et&&Gr(e),lf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));et=Pf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));et=Pf(e)}else t===27?(t=et,$r(e.type)?(e=up,up=null,et=e):et=t):et=Mt?_a(e.stateNode.nextSibling):null;return!0}function si(){et=Mt=null,Te=!1}function Ic(){var e=Rr;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Rr=null),e}function Eo(e){Rr===null?Rr=[e]:Rr.push(e)}var Ou=ja(null),bi=null,ir=null;function kr(e,t,a){Pe(Ou,t._currentValue),t._currentValue=a}function or(e){e._currentValue=Ou.current,St(Ou)}function Bu(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Lu(e,t,a,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var n=i.dependencies;if(n!==null){var o=i.child;n=n.firstContext;e:for(;n!==null;){var l=n;n=i;for(var c=0;c<t.length;c++)if(l.context===t[c]){n.lanes|=a,l=n.alternate,l!==null&&(l.lanes|=a),Bu(n.return,a,e),r||(o=null);break e}n=l.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=a,n=o.alternate,n!==null&&(n.lanes|=a),Bu(o,a,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function wn(e,t,a,r){e=null;for(var i=t,n=!1;i!==null;){if(!n){if((i.flags&524288)!==0)n=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(L(387));if(o=o.memoizedProps,o!==null){var l=i.type;sa(i.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(i===Fl.current){if(o=i.alternate,o===null)throw Error(L(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Uo):e=[Uo])}i=i.return}e!==null&&Lu(t,e,a,r),t.flags|=262144}function ns(e){for(e=e.firstContext;e!==null;){if(!sa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ci(e){bi=e,ir=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return Ig(bi,e)}function Cl(e,t){return bi===null&&ci(e),Ig(e,t)}function Ig(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ir===null){if(e===null)throw Error(L(308));ir=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ir=ir.next=t;return a}var Ny=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Sy=yt.unstable_scheduleCallback,Cy=yt.unstable_NormalPriority,bt={$$typeof:ar,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tp(){return{controller:new Ny,data:new Map,refCount:0}}function Yo(e){e.refCount--,e.refCount===0&&Sy(Cy,function(){e.controller.abort()})}var mo=null,Hu=0,cn=0,tn=null;function qy(e,t){if(mo===null){var a=mo=[];Hu=0,cn=td(),tn={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Hu++,t.then(sf,sf),t}function sf(){if(--Hu===0&&mo!==null){tn!==null&&(tn.status="fulfilled");var e=mo;mo=null,cn=0,tn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ey(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(i){a.push(i)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var i=0;i<a.length;i++)(0,a[i])(t)},function(i){for(r.status="rejected",r.reason=i,i=0;i<a.length;i++)(0,a[i])(void 0)}),r}var cf=ue.S;ue.S=function(e,t){db=ia(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&qy(e,t),cf!==null&&cf(e,t)};var ni=ja(null);function zp(){var e=ni.current;return e!==null?e:Ze.pooledCache}function Ql(e,t){t===null?Pe(ni,ni.current):Pe(ni,t.pool)}function Wg(){var e=zp();return e===null?null:{parent:bt._currentValue,pool:e}}var yn=Error(L(460)),Ap=Error(L(474)),As=Error(L(542)),os={then:function(){}};function uf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function eh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(rr,rr),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,df(e),e;default:if(typeof t.status=="string")t.then(rr,rr);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=r}},function(r){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,df(e),e}throw oi=t,yn}}function ti(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(oi=a,yn):a}}var oi=null;function pf(){if(oi===null)throw Error(L(459));var e=oi;return oi=null,e}function df(e){if(e===yn||e===As)throw Error(L(483))}var an=null,Mo=0;function ql(e){var t=Mo;return Mo+=1,an===null&&(an=[]),eh(an,e,t)}function Wn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function El(e,t){throw t.$$typeof===f0?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function th(e){function t(m,u){if(e){var b=m.deletions;b===null?(m.deletions=[u],m.flags|=16):b.push(u)}}function a(m,u){if(!e)return null;for(;u!==null;)t(m,u),u=u.sibling;return null}function r(m){for(var u=new Map;m!==null;)m.key!==null?u.set(m.key,m):u.set(m.index,m),m=m.sibling;return u}function i(m,u){return m=nr(m,u),m.index=0,m.sibling=null,m}function n(m,u,b){return m.index=b,e?(b=m.alternate,b!==null?(b=b.index,b<u?(m.flags|=67108866,u):b):(m.flags|=67108866,u)):(m.flags|=1048576,u)}function o(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function l(m,u,b,v){return u===null||u.tag!==6?(u=Jc(b,m.mode,v),u.return=m,u):(u=i(u,b),u.return=m,u)}function c(m,u,b,v){var N=b.type;return N===ji?d(m,u,b.props.children,v,b.key):u!==null&&(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===_r&&ti(N)===u.type)?(u=i(u,b.props),Wn(u,b),u.return=m,u):(u=jl(b.type,b.key,b.props,null,m.mode,v),Wn(u,b),u.return=m,u)}function p(m,u,b,v){return u===null||u.tag!==4||u.stateNode.containerInfo!==b.containerInfo||u.stateNode.implementation!==b.implementation?(u=Fc(b,m.mode,v),u.return=m,u):(u=i(u,b.children||[]),u.return=m,u)}function d(m,u,b,v,N){return u===null||u.tag!==7?(u=ii(b,m.mode,v,N),u.return=m,u):(u=i(u,b),u.return=m,u)}function g(m,u,b){if(typeof u=="string"&&u!==""||typeof u=="number"||typeof u=="bigint")return u=Jc(""+u,m.mode,b),u.return=m,u;if(typeof u=="object"&&u!==null){switch(u.$$typeof){case vl:return b=jl(u.type,u.key,u.props,null,m.mode,b),Wn(b,u),b.return=m,b;case io:return u=Fc(u,m.mode,b),u.return=m,u;case _r:return u=ti(u),g(m,u,b)}if(no(u)||Fn(u))return u=ii(u,m.mode,b,null),u.return=m,u;if(typeof u.then=="function")return g(m,ql(u),b);if(u.$$typeof===ar)return g(m,Cl(m,u),b);El(m,u)}return null}function f(m,u,b,v){var N=u!==null?u.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return N!==null?null:l(m,u,""+b,v);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vl:return b.key===N?c(m,u,b,v):null;case io:return b.key===N?p(m,u,b,v):null;case _r:return b=ti(b),f(m,u,b,v)}if(no(b)||Fn(b))return N!==null?null:d(m,u,b,v,null);if(typeof b.then=="function")return f(m,u,ql(b),v);if(b.$$typeof===ar)return f(m,u,Cl(m,b),v);El(m,b)}return null}function h(m,u,b,v,N){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return m=m.get(b)||null,l(u,m,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case vl:return m=m.get(v.key===null?b:v.key)||null,c(u,m,v,N);case io:return m=m.get(v.key===null?b:v.key)||null,p(u,m,v,N);case _r:return v=ti(v),h(m,u,b,v,N)}if(no(v)||Fn(v))return m=m.get(b)||null,d(u,m,v,N,null);if(typeof v.then=="function")return h(m,u,b,ql(v),N);if(v.$$typeof===ar)return h(m,u,b,Cl(u,v),N);El(u,v)}return null}function w(m,u,b,v){for(var N=null,A=null,T=u,z=u=0,G=null;T!==null&&z<b.length;z++){T.index>z?(G=T,T=null):G=T.sibling;var P=f(m,T,b[z],v);if(P===null){T===null&&(T=G);break}e&&T&&P.alternate===null&&t(m,T),u=n(P,u,z),A===null?N=P:A.sibling=P,A=P,T=G}if(z===b.length)return a(m,T),Te&&er(m,z),N;if(T===null){for(;z<b.length;z++)T=g(m,b[z],v),T!==null&&(u=n(T,u,z),A===null?N=T:A.sibling=T,A=T);return Te&&er(m,z),N}for(T=r(T);z<b.length;z++)G=h(T,m,z,b[z],v),G!==null&&(e&&G.alternate!==null&&T.delete(G.key===null?z:G.key),u=n(G,u,z),A===null?N=G:A.sibling=G,A=G);return e&&T.forEach(function(be){return t(m,be)}),Te&&er(m,z),N}function M(m,u,b,v){if(b==null)throw Error(L(151));for(var N=null,A=null,T=u,z=u=0,G=null,P=b.next();T!==null&&!P.done;z++,P=b.next()){T.index>z?(G=T,T=null):G=T.sibling;var be=f(m,T,P.value,v);if(be===null){T===null&&(T=G);break}e&&T&&be.alternate===null&&t(m,T),u=n(be,u,z),A===null?N=be:A.sibling=be,A=be,T=G}if(P.done)return a(m,T),Te&&er(m,z),N;if(T===null){for(;!P.done;z++,P=b.next())P=g(m,P.value,v),P!==null&&(u=n(P,u,z),A===null?N=P:A.sibling=P,A=P);return Te&&er(m,z),N}for(T=r(T);!P.done;z++,P=b.next())P=h(T,m,z,P.value,v),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?z:P.key),u=n(P,u,z),A===null?N=P:A.sibling=P,A=P);return e&&T.forEach(function(De){return t(m,De)}),Te&&er(m,z),N}function D(m,u,b,v){if(typeof b=="object"&&b!==null&&b.type===ji&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case vl:e:{for(var N=b.key;u!==null;){if(u.key===N){if(N=b.type,N===ji){if(u.tag===7){a(m,u.sibling),v=i(u,b.props.children),v.return=m,m=v;break e}}else if(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===_r&&ti(N)===u.type){a(m,u.sibling),v=i(u,b.props),Wn(v,b),v.return=m,m=v;break e}a(m,u);break}else t(m,u);u=u.sibling}b.type===ji?(v=ii(b.props.children,m.mode,v,b.key),v.return=m,m=v):(v=jl(b.type,b.key,b.props,null,m.mode,v),Wn(v,b),v.return=m,m=v)}return o(m);case io:e:{for(N=b.key;u!==null;){if(u.key===N)if(u.tag===4&&u.stateNode.containerInfo===b.containerInfo&&u.stateNode.implementation===b.implementation){a(m,u.sibling),v=i(u,b.children||[]),v.return=m,m=v;break e}else{a(m,u);break}else t(m,u);u=u.sibling}v=Fc(b,m.mode,v),v.return=m,m=v}return o(m);case _r:return b=ti(b),D(m,u,b,v)}if(no(b))return w(m,u,b,v);if(Fn(b)){if(N=Fn(b),typeof N!="function")throw Error(L(150));return b=N.call(b),M(m,u,b,v)}if(typeof b.then=="function")return D(m,u,ql(b),v);if(b.$$typeof===ar)return D(m,u,Cl(m,b),v);El(m,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,u!==null&&u.tag===6?(a(m,u.sibling),v=i(u,b),v.return=m,m=v):(a(m,u),v=Jc(b,m.mode,v),v.return=m,m=v),o(m)):a(m,u)}return function(m,u,b,v){try{Mo=0;var N=D(m,u,b,v);return an=null,N}catch(T){if(T===yn||T===As)throw T;var A=aa(29,T,null,m.mode);return A.lanes=v,A.return=m,A}}}var ui=th(!0),ah=th(!1),xr=!1;function Rp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ju(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Dr(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Oe&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=rs(e),Zg(e,null,a),t}return zs(e,r,t,a),rs(e)}function fo(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,yg(e,a)}}function Wc(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var i=null,n=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};n===null?i=n=o:n=n.next=o,a=a.next}while(a!==null);n===null?i=n=t:n=n.next=t}else i=n=t;a={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:n,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Qu=!1;function go(){if(Qu){var e=tn;if(e!==null)throw e}}function ho(e,t,a,r){Qu=!1;var i=e.updateQueue;xr=!1;var n=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,p=c.next;c.next=null,o===null?n=p:o.next=p,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=p:l.next=p,d.lastBaseUpdate=c))}if(n!==null){var g=i.baseState;o=0,d=p=c=null,l=n;do{var f=l.lane&-536870913,h=f!==l.lane;if(h?(Me&f)===f:(r&f)===f){f!==0&&f===cn&&(Qu=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var w=e,M=l;f=t;var D=a;switch(M.tag){case 1:if(w=M.payload,typeof w=="function"){g=w.call(D,g,f);break e}g=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=M.payload,f=typeof w=="function"?w.call(D,g,f):w,f==null)break e;g=tt({},g,f);break e;case 2:xr=!0}}f=l.callback,f!==null&&(e.flags|=64,h&&(e.flags|=8192),h=i.callbacks,h===null?i.callbacks=[f]:h.push(f))}else h={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(p=d=h,c=g):d=d.next=h,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;h=l,l=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);d===null&&(c=g),i.baseState=c,i.firstBaseUpdate=p,i.lastBaseUpdate=d,n===null&&(i.shared.lanes=0),Xr|=o,e.lanes=o,e.memoizedState=g}}function rh(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function ih(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)rh(a[e],t)}var un=ja(null),ls=ja(0);function mf(e,t){e=dr,Pe(ls,e),Pe(un,t),dr=e|t.baseLanes}function Gu(){Pe(ls,dr),Pe(un,un.current)}function Up(){dr=ls.current,St(un),St(ls)}var ca=ja(null),ya=null;function Nr(e){var t=e.alternate;Pe(dt,dt.current&1),Pe(ca,e),ya===null&&(t===null||un.current!==null||t.memoizedState!==null)&&(ya=e)}function Yu(e){Pe(dt,dt.current),Pe(ca,e),ya===null&&(ya=e)}function nh(e){e.tag===22?(Pe(dt,dt.current),Pe(ca,e),ya===null&&(ya=e)):Sr(e)}function Sr(){Pe(dt,dt.current),Pe(ca,ca.current)}function ta(e){St(ca),ya===e&&(ya=null),St(dt)}var dt=ja(0);function ss(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||sp(a)||cp(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var cr=0,ve=null,$e=null,gt=null,cs=!1,rn=!1,pi=!1,us=0,To=0,nn=null,My=0;function lt(){throw Error(L(321))}function Dp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!sa(e[a],t[a]))return!1;return!0}function Op(e,t,a,r,i,n){return cr=n,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ue.H=e===null||e.memoizedState===null?Oh:Zp,pi=!1,n=a(r,i),pi=!1,rn&&(n=lh(t,a,r,i)),oh(e),n}function oh(e){ue.H=zo;var t=$e!==null&&$e.next!==null;if(cr=0,gt=$e=ve=null,cs=!1,To=0,nn=null,t)throw Error(L(300));e===null||vt||(e=e.dependencies,e!==null&&ns(e)&&(vt=!0))}function lh(e,t,a,r){ve=e;var i=0;do{if(rn&&(nn=null),To=0,rn=!1,25<=i)throw Error(L(301));if(i+=1,gt=$e=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}ue.H=Bh,n=t(a,r)}while(rn);return n}function Ty(){var e=ue.H,t=e.useState()[0];return t=typeof t.then=="function"?Xo(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(ve.flags|=1024),t}function Bp(){var e=us!==0;return us=0,e}function Lp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hp(e){if(cs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}cs=!1}cr=0,gt=$e=ve=null,rn=!1,To=us=0,nn=null}function Lt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?ve.memoizedState=gt=e:gt=gt.next=e,gt}function mt(){if($e===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=gt===null?ve.memoizedState:gt.next;if(t!==null)gt=t,$e=e;else{if(e===null)throw ve.alternate===null?Error(L(467)):Error(L(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},gt===null?ve.memoizedState=gt=e:gt=gt.next=e}return gt}function Rs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(e){var t=To;return To+=1,nn===null&&(nn=[]),e=eh(nn,e,t),t=ve,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,ue.H=t===null||t.memoizedState===null?Oh:Zp),e}function Us(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xo(e);if(e.$$typeof===ar)return Tt(e)}throw Error(L(438,String(e)))}function jp(e){var t=null,a=ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=ve.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Rs(),ve.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=g0;return t.index++,a}function ur(e,t){return typeof t=="function"?t(e):t}function Gl(e){var t=mt();return Qp(t,$e,e)}function Qp(e,t,a){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=a;var i=e.baseQueue,n=r.pending;if(n!==null){if(i!==null){var o=i.next;i.next=n.next,n.next=o}t.baseQueue=i=n,r.pending=null}if(n=e.baseState,i===null)e.memoizedState=n;else{t=i.next;var l=o=null,c=null,p=t,d=!1;do{var g=p.lane&-536870913;if(g!==p.lane?(Me&g)===g:(cr&g)===g){var f=p.revertLane;if(f===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),g===cn&&(d=!0);else if((cr&f)===f){p=p.next,f===cn&&(d=!0);continue}else g={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=g,o=n):c=c.next=g,ve.lanes|=f,Xr|=f;g=p.action,pi&&a(n,g),n=p.hasEagerState?p.eagerState:a(n,g)}else f={lane:g,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=f,o=n):c=c.next=f,ve.lanes|=g,Xr|=g;p=p.next}while(p!==null&&p!==t);if(c===null?o=n:c.next=l,!sa(n,e.memoizedState)&&(vt=!0,d&&(a=tn,a!==null)))throw a;e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function eu(e){var t=mt(),a=t.queue;if(a===null)throw Error(L(311));a.lastRenderedReducer=e;var r=a.dispatch,i=a.pending,n=t.memoizedState;if(i!==null){a.pending=null;var o=i=i.next;do n=e(n,o.action),o=o.next;while(o!==i);sa(n,t.memoizedState)||(vt=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),a.lastRenderedState=n}return[n,r]}function sh(e,t,a){var r=ve,i=mt(),n=Te;if(n){if(a===void 0)throw Error(L(407));a=a()}else a=t();var o=!sa(($e||i).memoizedState,a);if(o&&(i.memoizedState=a,vt=!0),i=i.queue,Gp(ph.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||gt!==null&>.memoizedState.tag&1){if(r.flags|=2048,pn(9,{destroy:void 0},uh.bind(null,r,i,a,t),null),Ze===null)throw Error(L(349));n||(cr&127)!==0||ch(r,t,a)}return a}function ch(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ve.updateQueue,t===null?(t=Rs(),ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function uh(e,t,a,r){t.value=a,t.getSnapshot=r,dh(t)&&mh(e)}function ph(e,t,a){return a(function(){dh(t)&&mh(e)})}function dh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!sa(e,a)}catch{return!0}}function mh(e){var t=hi(e,2);t!==null&&$t(t,e,2)}function Xu(e){var t=Lt();if(typeof e=="function"){var a=e;if(e=a(),pi){qr(!0);try{a()}finally{qr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:e},t}function fh(e,t,a,r){return e.baseState=a,Qp(e,$e,typeof r=="function"?r:ur)}function zy(e,t,a,r,i){if(Os(e))throw Error(L(485));if(e=t.action,e!==null){var n={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){n.listeners.push(o)}};ue.T!==null?a(!0):n.isTransition=!1,r(n),a=t.pending,a===null?(n.next=t.pending=n,gh(t,n)):(n.next=a.next,t.pending=a.next=n)}}function gh(e,t){var a=t.action,r=t.payload,i=e.state;if(t.isTransition){var n=ue.T,o={};ue.T=o;try{var l=a(i,r),c=ue.S;c!==null&&c(o,l),ff(e,t,l)}catch(p){Vu(e,t,p)}finally{n!==null&&o.types!==null&&(n.types=o.types),ue.T=n}}else try{n=a(i,r),ff(e,t,n)}catch(p){Vu(e,t,p)}}function ff(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){gf(e,t,r)},function(r){return Vu(e,t,r)}):gf(e,t,a)}function gf(e,t,a){t.status="fulfilled",t.value=a,hh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,gh(e,a)))}function Vu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,hh(t),t=t.next;while(t!==r)}e.action=null}function hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bh(e,t){return t}function hf(e,t){if(Te){var a=Ze.formState;if(a!==null){e:{var r=ve;if(Te){if(et){t:{for(var i=et,n=wa;i.nodeType!==8;){if(!n){i=null;break t}if(i=_a(i.nextSibling),i===null){i=null;break t}}n=i.data,i=n==="F!"||n==="F"?i:null}if(i){et=_a(i.nextSibling),r=i.data==="F!";break e}}Gr(r)}r=!1}r&&(t=a[0])}}return a=Lt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bh,lastRenderedState:t},a.queue=r,a=Rh.bind(null,ve,r),r.dispatch=a,r=Xu(!1),n=$p.bind(null,ve,!1,r.queue),r=Lt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,a=zy.bind(null,ve,i,n,a),i.dispatch=a,r.memoizedState=e,[t,a,!1]}function bf(e){var t=mt();return vh(t,$e,e)}function vh(e,t,a){if(t=Qp(e,t,bh)[0],e=Gl(ur)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Xo(t)}catch(o){throw o===yn?As:o}else r=t;t=mt();var i=t.queue,n=i.dispatch;return a!==t.memoizedState&&(ve.flags|=2048,pn(9,{destroy:void 0},Ay.bind(null,i,a),null)),[r,n,e]}function Ay(e,t){e.action=t}function vf(e){var t=mt(),a=$e;if(a!==null)return vh(t,a,e);mt(),t=t.memoizedState,a=mt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function pn(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Rs(),ve.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function wh(){return mt().memoizedState}function Yl(e,t,a,r){var i=Lt();ve.flags|=e,i.memoizedState=pn(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ds(e,t,a,r){var i=mt();r=r===void 0?null:r;var n=i.memoizedState.inst;$e!==null&&r!==null&&Dp(r,$e.memoizedState.deps)?i.memoizedState=pn(t,n,a,r):(ve.flags|=e,i.memoizedState=pn(1|t,n,a,r))}function wf(e,t){Yl(8390656,8,e,t)}function Gp(e,t){Ds(2048,8,e,t)}function Ry(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Rs(),ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function yh(e){var t=mt().memoizedState;return Ry({ref:t,nextImpl:e}),function(){if((Oe&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function _h(e,t){return Ds(4,2,e,t)}function xh(e,t){return Ds(4,4,e,t)}function kh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Nh(e,t,a){a=a!=null?a.concat([e]):null,Ds(4,4,kh.bind(null,t,e),a)}function Yp(){}function Sh(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Dp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Ch(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Dp(t,r[1]))return r[0];if(r=e(),pi){qr(!0);try{e()}finally{qr(!1)}}return a.memoizedState=[r,t],r}function Xp(e,t,a){return a===void 0||(cr&1073741824)!==0&&(Me&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=fb(),ve.lanes|=e,Xr|=e,a)}function qh(e,t,a,r){return sa(a,t)?a:un.current!==null?(e=Xp(e,a,r),sa(e,t)||(vt=!0),e):(cr&42)===0||(cr&1073741824)!==0&&(Me&261930)===0?(vt=!0,e.memoizedState=a):(e=fb(),ve.lanes|=e,Xr|=e,t)}function Eh(e,t,a,r,i){var n=Be.p;Be.p=n!==0&&8>n?n:8;var o=ue.T,l={};ue.T=l,$p(e,!1,t,a);try{var c=i(),p=ue.S;if(p!==null&&p(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Ey(c,r);bo(e,t,d,la(e))}else bo(e,t,r,la(e))}catch(g){bo(e,t,{then:function(){},status:"rejected",reason:g},la())}finally{Be.p=n,o!==null&&l.types!==null&&(o.types=l.types),ue.T=o}}function Uy(){}function $u(e,t,a,r){if(e.tag!==5)throw Error(L(476));var i=Mh(e).queue;Eh(e,i,t,ri,a===null?Uy:function(){return Th(e),a(r)})}function Mh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ri,baseState:ri,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:ri},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Th(e){var t=Mh(e);t.next===null&&(t=e.alternate.memoizedState),bo(e,t.next.queue,{},la())}function Vp(){return Tt(Uo)}function zh(){return mt().memoizedState}function Ah(){return mt().memoizedState}function Dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=la();e=Ur(a);var r=Dr(t,e,a);r!==null&&($t(r,t,a),fo(r,t,a)),t={cache:Tp()},e.payload=t;return}t=t.return}}function Oy(e,t,a){var r=la();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Os(e)?Uh(t,a):(a=Cp(e,t,a,r),a!==null&&($t(a,e,r),Dh(a,t,r)))}function Rh(e,t,a){var r=la();bo(e,t,a,r)}function bo(e,t,a,r){var i={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Os(e))Uh(t,i);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,a);if(i.hasEagerState=!0,i.eagerState=l,sa(l,o))return zs(e,t,i,0),Ze===null&&Ts(),!1}catch{}if(a=Cp(e,t,i,r),a!==null)return $t(a,e,r),Dh(a,t,r),!0}return!1}function $p(e,t,a,r){if(r={lane:2,revertLane:td(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(L(479))}else t=Cp(e,a,r,2),t!==null&&$t(t,e,2)}function Os(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Uh(e,t){rn=cs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Dh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,yg(e,a)}}var zo={readContext:Tt,use:Us,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};zo.useEffectEvent=lt;var Oh={readContext:Tt,use:Us,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:wf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Yl(4194308,4,kh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Yl(4194308,4,e,t)},useInsertionEffect:function(e,t){Yl(4,2,e,t)},useMemo:function(e,t){var a=Lt();t=t===void 0?null:t;var r=e();if(pi){qr(!0);try{e()}finally{qr(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Lt();if(a!==void 0){var i=a(t);if(pi){qr(!0);try{a(t)}finally{qr(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Oy.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xu(e);var t=e.queue,a=Rh.bind(null,ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Yp,useDeferredValue:function(e,t){var a=Lt();return Xp(a,e,t)},useTransition:function(){var e=Xu(!1);return e=Eh.bind(null,ve,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ve,i=Lt();if(Te){if(a===void 0)throw Error(L(407));a=a()}else{if(a=t(),Ze===null)throw Error(L(349));(Me&127)!==0||ch(r,t,a)}i.memoizedState=a;var n={value:a,getSnapshot:t};return i.queue=n,wf(ph.bind(null,r,n,e),[e]),r.flags|=2048,pn(9,{destroy:void 0},uh.bind(null,r,n,a,t),null),a},useId:function(){var e=Lt(),t=Ze.identifierPrefix;if(Te){var a=Ba,r=Oa;a=(r&~(1<<32-oa(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=us++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=My++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Vp,useFormState:hf,useActionState:hf,useOptimistic:function(e){var t=Lt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=$p.bind(null,ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:jp,useCacheRefresh:function(){return Lt().memoizedState=Dy.bind(null,ve)},useEffectEvent:function(e){var t=Lt(),a={impl:e};return t.memoizedState=a,function(){if((Oe&2)!==0)throw Error(L(440));return a.impl.apply(void 0,arguments)}}},Zp={readContext:Tt,use:Us,useCallback:Sh,useContext:Tt,useEffect:Gp,useImperativeHandle:Nh,useInsertionEffect:_h,useLayoutEffect:xh,useMemo:Ch,useReducer:Gl,useRef:wh,useState:function(){return Gl(ur)},useDebugValue:Yp,useDeferredValue:function(e,t){var a=mt();return qh(a,$e.memoizedState,e,t)},useTransition:function(){var e=Gl(ur)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:sh,useId:zh,useHostTransitionStatus:Vp,useFormState:bf,useActionState:bf,useOptimistic:function(e,t){var a=mt();return fh(a,$e,e,t)},useMemoCache:jp,useCacheRefresh:Ah};Zp.useEffectEvent=yh;var Bh={readContext:Tt,use:Us,useCallback:Sh,useContext:Tt,useEffect:Gp,useImperativeHandle:Nh,useInsertionEffect:_h,useLayoutEffect:xh,useMemo:Ch,useReducer:eu,useRef:wh,useState:function(){return eu(ur)},useDebugValue:Yp,useDeferredValue:function(e,t){var a=mt();return $e===null?Xp(a,e,t):qh(a,$e.memoizedState,e,t)},useTransition:function(){var e=eu(ur)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:sh,useId:zh,useHostTransitionStatus:Vp,useFormState:vf,useActionState:vf,useOptimistic:function(e,t){var a=mt();return $e!==null?fh(a,$e,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:jp,useCacheRefresh:Ah};Bh.useEffectEvent=yh;function tu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:tt({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Zu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=la(),i=Ur(r);i.payload=t,a!=null&&(i.callback=a),t=Dr(e,i,r),t!==null&&($t(t,e,r),fo(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=la(),i=Ur(r);i.tag=1,i.payload=t,a!=null&&(i.callback=a),t=Dr(e,i,r),t!==null&&($t(t,e,r),fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=la(),r=Ur(a);r.tag=2,t!=null&&(r.callback=t),t=Dr(e,r,a),t!==null&&($t(t,e,a),fo(t,e,a))}};function yf(e,t,a,r,i,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!Co(a,r)||!Co(i,n):!0}function _f(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Zu.enqueueReplaceState(t,t.state,null)}function di(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=tt({},a));for(var i in e)a[i]===void 0&&(a[i]=e[i])}return a}function Lh(e){as(e)}function Hh(e){console.error(e)}function jh(e){as(e)}function ps(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function xf(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function Ku(e,t,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){ps(e,t)},a}function Qh(e){return e=Ur(e),e.tag=3,e}function Gh(e,t,a,r){var i=a.type.getDerivedStateFromError;if(typeof i=="function"){var n=r.value;e.payload=function(){return i(n)},e.callback=function(){xf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){xf(t,a,r),typeof i!="function"&&(Or===null?Or=new Set([this]):Or.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function By(e,t,a,r,i){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&wn(t,a,i,!0),a=ca.current,a!==null){switch(a.tag){case 31:case 13:return ya===null?hs():a.alternate===null&&st===0&&(st=3),a.flags&=-257,a.flags|=65536,a.lanes=i,r===os?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),du(e,r,i)),!1;case 22:return a.flags|=65536,r===os?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),du(e,r,i)),!1}throw Error(L(435,a.tag))}return du(e,r,i),hs(),!1}if(Te)return t=ca.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Du&&(e=Error(L(422),{cause:r}),Eo(va(e,a)))):(r!==Du&&(t=Error(L(423),{cause:r}),Eo(va(t,a))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=va(r,a),i=Ku(e.stateNode,r,i),Wc(e,i),st!==4&&(st=2)),!1;var n=Error(L(520),{cause:r});if(n=va(n,a),yo===null?yo=[n]:yo.push(n),st!==4&&(st=2),t===null)return!0;r=va(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=i&-i,a.lanes|=e,e=Ku(a.stateNode,r,e),Wc(a,e),!1;case 1:if(t=a.type,n=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(Or===null||!Or.has(n))))return a.flags|=65536,i&=-i,a.lanes|=i,i=Qh(i),Gh(i,e,a,r),Wc(a,i),!1}a=a.return}while(a!==null);return!1}var Kp=Error(L(461)),vt=!1;function qt(e,t,a,r){t.child=e===null?ah(t,null,a,r):ui(t,e.child,a,r)}function kf(e,t,a,r,i){a=a.render;var n=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return ci(t),r=Op(e,t,a,o,n,i),l=Bp(),e!==null&&!vt?(Lp(e,t,i),pr(e,t,i)):(Te&&l&&Ep(t),t.flags|=1,qt(e,t,r,i),t.child)}function Nf(e,t,a,r,i){if(e===null){var n=a.type;return typeof n=="function"&&!qp(n)&&n.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=n,Yh(e,t,n,r,i)):(e=jl(a.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!Pp(e,i)){var o=n.memoizedProps;if(a=a.compare,a=a!==null?a:Co,a(o,r)&&e.ref===t.ref)return pr(e,t,i)}return t.flags|=1,e=nr(n,r),e.ref=t.ref,e.return=t,t.child=e}function Yh(e,t,a,r,i){if(e!==null){var n=e.memoizedProps;if(Co(n,r)&&e.ref===t.ref)if(vt=!1,t.pendingProps=r=n,Pp(e,i))(e.flags&131072)!==0&&(vt=!0);else return t.lanes=e.lanes,pr(e,t,i)}return Pu(e,t,a,r,i)}function Xh(e,t,a,r){var i=r.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(n=n!==null?n.baseLanes|a:a,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~n}else r=0,t.child=null;return Sf(e,t,n,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ql(t,n!==null?n.cachePool:null),n!==null?mf(t,n):Gu(),nh(t);else return r=t.lanes=536870912,Sf(e,t,n!==null?n.baseLanes|a:a,a,r)}else n!==null?(Ql(t,n.cachePool),mf(t,n),Sr(t),t.memoizedState=null):(e!==null&&Ql(t,null),Gu(),Sr(t));return qt(e,t,i,a),t.child}function lo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sf(e,t,a,r,i){var n=zp();return n=n===null?null:{parent:bt._currentValue,pool:n},t.memoizedState={baseLanes:a,cachePool:n},e!==null&&Ql(t,null),Gu(),nh(t),e!==null&&wn(e,t,r,!0),t.childLanes=i,null}function Xl(e,t){return t=ds({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Cf(e,t,a){return ui(t,e.child,null,a),e=Xl(t,t.pendingProps),e.flags|=2,ta(t),t.memoizedState=null,e}function Ly(e,t,a){var r=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Te){if(r.mode==="hidden")return e=Xl(t,r),t.lanes=536870912,lo(null,e);if(Yu(t),(e=et)?(e=Ob(e,wa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qr!==null?{id:Oa,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Pg(e),a.return=t,t.child=a,Mt=t,et=null)):e=null,e===null)throw Gr(t);return t.lanes=536870912,null}return Xl(t,r)}var n=e.memoizedState;if(n!==null){var o=n.dehydrated;if(Yu(t),i)if(t.flags&256)t.flags&=-257,t=Cf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(vt||wn(e,t,a,!1),i=(a&e.childLanes)!==0,vt||i){if(r=Ze,r!==null&&(o=_g(r,a),o!==0&&o!==n.retryLane))throw n.retryLane=o,hi(e,o),$t(r,e,o),Kp;hs(),t=Cf(e,t,a)}else e=n.treeContext,et=_a(o.nextSibling),Mt=t,Te=!0,Rr=null,wa=!1,e!==null&&Fg(t,e),t=Xl(t,r),t.flags|=4096;return t}return e=nr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(L(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Pu(e,t,a,r,i){return ci(t),a=Op(e,t,a,r,void 0,i),r=Bp(),e!==null&&!vt?(Lp(e,t,i),pr(e,t,i)):(Te&&r&&Ep(t),t.flags|=1,qt(e,t,a,i),t.child)}function qf(e,t,a,r,i,n){return ci(t),t.updateQueue=null,a=lh(t,r,a,i),oh(e),r=Bp(),e!==null&&!vt?(Lp(e,t,n),pr(e,t,n)):(Te&&r&&Ep(t),t.flags|=1,qt(e,t,a,n),t.child)}function Ef(e,t,a,r,i){if(ci(t),t.stateNode===null){var n=Ki,o=a.contextType;typeof o=="object"&&o!==null&&(n=Tt(o)),n=new a(r,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Zu,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=r,n.state=t.memoizedState,n.refs={},Rp(t),o=a.contextType,n.context=typeof o=="object"&&o!==null?Tt(o):Ki,n.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(tu(t,a,o,r),n.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(o=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),o!==n.state&&Zu.enqueueReplaceState(n,n.state,null),ho(t,r,n,i),go(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){n=t.stateNode;var l=t.memoizedProps,c=di(a,l);n.props=c;var p=n.context,d=a.contextType;o=Ki,typeof d=="object"&&d!==null&&(o=Tt(d));var g=a.getDerivedStateFromProps;d=typeof g=="function"||typeof n.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,d||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l||p!==o)&&_f(t,n,r,o),xr=!1;var f=t.memoizedState;n.state=f,ho(t,r,n,i),go(),p=t.memoizedState,l||f!==p||xr?(typeof g=="function"&&(tu(t,a,g,r),p=t.memoizedState),(c=xr||yf(t,a,c,r,f,p,o))?(d||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),n.props=r,n.state=p,n.context=o,r=c):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{n=t.stateNode,ju(e,t),o=t.memoizedProps,d=di(a,o),n.props=d,g=t.pendingProps,f=n.context,p=a.contextType,c=Ki,typeof p=="object"&&p!==null&&(c=Tt(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(o!==g||f!==c)&&_f(t,n,r,c),xr=!1,f=t.memoizedState,n.state=f,ho(t,r,n,i),go();var h=t.memoizedState;o!==g||f!==h||xr||e!==null&&e.dependencies!==null&&ns(e.dependencies)?(typeof l=="function"&&(tu(t,a,l,r),h=t.memoizedState),(d=xr||yf(t,a,d,r,f,h,c)||e!==null&&e.dependencies!==null&&ns(e.dependencies))?(p||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(r,h,c),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(r,h,c)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),n.props=r,n.state=h,n.context=c,r=d):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return n=r,Vl(e,t),r=(t.flags&128)!==0,n||r?(n=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&r?(t.child=ui(t,e.child,null,i),t.child=ui(t,null,a,i)):qt(e,t,a,i),t.memoizedState=n.state,e=t.child):e=pr(e,t,i),e}function Mf(e,t,a,r){return si(),t.flags|=256,qt(e,t,a,r),t.child}var au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ru(e){return{baseLanes:e,cachePool:Wg()}}function iu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ra),e}function Vh(e,t,a){var r=t.pendingProps,i=!1,n=(t.flags&128)!==0,o;if((o=n)||(o=e!==null&&e.memoizedState===null?!1:(dt.current&2)!==0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Te){if(i?Nr(t):Sr(t),(e=et)?(e=Ob(e,wa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qr!==null?{id:Oa,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Pg(e),a.return=t,t.child=a,Mt=t,et=null)):e=null,e===null)throw Gr(t);return cp(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,i?(Sr(t),i=t.mode,l=ds({mode:"hidden",children:l},i),r=ii(r,i,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=ru(a),r.childLanes=iu(e,o,a),t.memoizedState=au,lo(null,r)):(Nr(t),Ju(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(n)t.flags&256?(Nr(t),t.flags&=-257,t=nu(e,t,a)):t.memoizedState!==null?(Sr(t),t.child=e.child,t.flags|=128,t=null):(Sr(t),l=r.fallback,i=t.mode,r=ds({mode:"visible",children:r.children},i),l=ii(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,ui(t,e.child,null,a),r=t.child,r.memoizedState=ru(a),r.childLanes=iu(e,o,a),t.memoizedState=au,t=lo(null,r));else if(Nr(t),cp(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(L(419)),r.stack="",r.digest=o,Eo({value:r,source:null,stack:null}),t=nu(e,t,a)}else if(vt||wn(e,t,a,!1),o=(a&e.childLanes)!==0,vt||o){if(o=Ze,o!==null&&(r=_g(o,a),r!==0&&r!==c.retryLane))throw c.retryLane=r,hi(e,r),$t(o,e,r),Kp;sp(l)||hs(),t=nu(e,t,a)}else sp(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,et=_a(l.nextSibling),Mt=t,Te=!0,Rr=null,wa=!1,e!==null&&Fg(t,e),t=Ju(t,r.children),t.flags|=4096);return t}return i?(Sr(t),l=r.fallback,i=t.mode,c=e.child,p=c.sibling,r=nr(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,p!==null?l=nr(p,l):(l=ii(l,i,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,lo(null,r),r=t.child,l=e.child.memoizedState,l===null?l=ru(a):(i=l.cachePool,i!==null?(c=bt._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=Wg(),l={baseLanes:l.baseLanes|a,cachePool:i}),r.memoizedState=l,r.childLanes=iu(e,o,a),t.memoizedState=au,lo(e.child,r)):(Nr(t),a=e.child,e=a.sibling,a=nr(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=a,t.memoizedState=null,a)}function Ju(e,t){return t=ds({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ds(e,t){return e=aa(22,e,null,t),e.lanes=0,e}function nu(e,t,a){return ui(t,e.child,null,a),e=Ju(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tf(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bu(e.return,t,a)}function ou(e,t,a,r,i,n){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:i,treeForkCount:n}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=i,o.treeForkCount=n)}function $h(e,t,a){var r=t.pendingProps,i=r.revealOrder,n=r.tail;r=r.children;var o=dt.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Pe(dt,o),qt(e,t,r,a),r=Te?qo:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Tf(e,a,t);else if(e.tag===19)Tf(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(a=t.child,i=null;a!==null;)e=a.alternate,e!==null&&ss(e)===null&&(i=a),a=a.sibling;a=i,a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null),ou(t,!1,i,a,n,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ss(e)===null){t.child=i;break}e=i.sibling,i.sibling=a,a=i,i=e}ou(t,!0,a,null,n,r);break;case"together":ou(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function pr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Xr|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(wn(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,a=nr(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=nr(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Pp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ns(e)))}function Hy(e,t,a){switch(t.tag){case 3:Il(t,t.stateNode.containerInfo),kr(t,bt,e.memoizedState.cache),si();break;case 27:case 5:Nu(t);break;case 4:Il(t,t.stateNode.containerInfo);break;case 10:kr(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Yu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Nr(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Vh(e,t,a):(Nr(t),e=pr(e,t,a),e!==null?e.sibling:null);Nr(t);break;case 19:var i=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(wn(e,t,a,!1),r=(a&t.childLanes)!==0),i){if(r)return $h(e,t,a);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(dt,dt.current),r)break;return null;case 22:return t.lanes=0,Xh(e,t,a,t.pendingProps);case 24:kr(t,bt,e.memoizedState.cache)}return pr(e,t,a)}function Zh(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)vt=!0;else{if(!Pp(e,a)&&(t.flags&128)===0)return vt=!1,Hy(e,t,a);vt=(e.flags&131072)!==0}else vt=!1,Te&&(t.flags&1048576)!==0&&Jg(t,qo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ti(t.elementType),t.type=e,typeof e=="function")qp(e)?(r=di(e,r),t.tag=1,t=Ef(null,t,e,r,a)):(t.tag=0,t=Pu(null,t,e,r,a));else{if(e!=null){var i=e.$$typeof;if(i===mp){t.tag=11,t=kf(null,t,e,r,a);break e}else if(i===fp){t.tag=14,t=Nf(null,t,e,r,a);break e}}throw t=xu(e)||e,Error(L(306,t,""))}}return t;case 0:return Pu(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,i=di(r,t.pendingProps),Ef(e,t,r,i,a);case 3:e:{if(Il(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var n=t.memoizedState;i=n.element,ju(e,t),ho(t,r,null,a);var o=t.memoizedState;if(r=o.cache,kr(t,bt,r),r!==n.cache&&Lu(t,[bt],a,!0),go(),r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=Mf(e,t,r,a);break e}else if(r!==i){i=va(Error(L(424)),t),Eo(i),t=Mf(e,t,r,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,et=_a(e.firstChild),Mt=t,Te=!0,Rr=null,wa=!0,a=ah(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(si(),r===i){t=pr(e,t,a);break e}qt(e,t,r,a)}t=t.child}return t;case 26:return Vl(e,t),e===null?(a=If(t.type,null,t.pendingProps,null))?t.memoizedState=a:Te||(a=t.type,e=t.pendingProps,r=ys(Ar.current).createElement(a),r[Et]=t,r[Zt]=e,zt(r,a,e),Nt(r),t.stateNode=r):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Nu(t),e===null&&Te&&(r=t.stateNode=Bb(t.type,t.pendingProps,Ar.current),Mt=t,wa=!0,i=et,$r(t.type)?(up=i,et=_a(r.firstChild)):et=i),qt(e,t,t.pendingProps.children,a),Vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Te&&((i=r=et)&&(r=m1(r,t.type,t.pendingProps,wa),r!==null?(t.stateNode=r,Mt=t,et=_a(r.firstChild),wa=!1,i=!0):i=!1),i||Gr(t)),Nu(t),i=t.type,n=t.pendingProps,o=e!==null?e.memoizedProps:null,r=n.children,op(i,n)?r=null:o!==null&&op(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=Op(e,t,Ty,null,null,a),Uo._currentValue=i),Vl(e,t),qt(e,t,r,a),t.child;case 6:return e===null&&Te&&((e=a=et)&&(a=f1(a,t.pendingProps,wa),a!==null?(t.stateNode=a,Mt=t,et=null,e=!0):e=!1),e||Gr(t)),null;case 13:return Vh(e,t,a);case 4:return Il(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ui(t,null,r,a):qt(e,t,r,a),t.child;case 11:return kf(e,t,t.type,t.pendingProps,a);case 7:return qt(e,t,t.pendingProps,a),t.child;case 8:return qt(e,t,t.pendingProps.children,a),t.child;case 12:return qt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,kr(t,t.type,r.value),qt(e,t,r.children,a),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ci(t),i=Tt(i),r=r(i),t.flags|=1,qt(e,t,r,a),t.child;case 14:return Nf(e,t,t.type,t.pendingProps,a);case 15:return Yh(e,t,t.type,t.pendingProps,a);case 19:return $h(e,t,a);case 31:return Ly(e,t,a);case 22:return Xh(e,t,a,t.pendingProps);case 24:return ci(t),r=Tt(bt),e===null?(i=zp(),i===null&&(i=Ze,n=Tp(),i.pooledCache=n,n.refCount++,n!==null&&(i.pooledCacheLanes|=a),i=n),t.memoizedState={parent:r,cache:i},Rp(t),kr(t,bt,i)):((e.lanes&a)!==0&&(ju(e,t),ho(t,null,null,a),go()),i=e.memoizedState,n=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),kr(t,bt,r)):(r=n.cache,kr(t,bt,r),r!==i.cache&&Lu(t,[bt],a,!0))),qt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Ja(e){e.flags|=4}function lu(e,t,a,r,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(bb())e.flags|=8192;else throw oi=os,Ap}else e.flags&=-16777217}function zf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!jb(t))if(bb())e.flags|=8192;else throw oi=os,Ap}function Ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?vg():536870912,e.lanes|=t,dn|=t)}function eo(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function jy(e,t,a){var r=t.pendingProps;switch(Mp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),or(bt),on(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?Ja(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ic())),We(t),null;case 26:var i=t.type,n=t.memoizedState;return e===null?(Ja(t),n!==null?(We(t),zf(t,n)):(We(t),lu(t,i,null,r,a))):n?n!==e.memoizedState?(Ja(t),We(t),zf(t,n)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ja(t),We(t),lu(t,i,e,r,a)),null;case 27:if(Wl(t),a=Ar.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return We(t),null}e=Ha.current,Oi(t)?of(t,e):(e=Bb(i,r,a),t.stateNode=e,Ja(t))}return We(t),null;case 5:if(Wl(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return We(t),null}if(n=Ha.current,Oi(t))of(t,n);else{var o=ys(Ar.current);switch(n){case 1:n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?n.multiple=!0:r.size&&(n.size=r.size);break;default:n=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}n[Et]=t,n[Zt]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)n.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=n;e:switch(zt(n,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ja(t)}}return We(t),lu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Ar.current,Oi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,i=Mt,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Et]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Rb(e.nodeValue,a)),e||Gr(t,!0)}else e=ys(e).createTextNode(r),e[Et]=t,t.stateNode=e}return We(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Oi(t),a!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Et]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else a=Ic(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ta(t),t):(ta(t),null);if((t.flags&128)!==0)throw Error(L(558))}return We(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Oi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(L(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(L(317));i[Et]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),i=!1}else i=Ic(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ta(t),t):(ta(t),null)}return ta(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Ml(t,t.updateQueue),We(t),null);case 4:return on(),e===null&&ad(t.stateNode.containerInfo),We(t),null;case 10:return or(t.type),We(t),null;case 19:if(St(dt),r=t.memoizedState,r===null)return We(t),null;if(i=(t.flags&128)!==0,n=r.rendering,n===null)if(i)eo(r,!1);else{if(st!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(n=ss(e),n!==null){for(t.flags|=128,eo(r,!1),e=n.updateQueue,t.updateQueue=e,Ml(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Kg(a,e),a=a.sibling;return Pe(dt,dt.current&1|2),Te&&er(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ia()>fs&&(t.flags|=128,i=!0,eo(r,!1),t.lanes=4194304)}else{if(!i)if(e=ss(n),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Ml(t,e),eo(r,!0),r.tail===null&&r.tailMode==="hidden"&&!n.alternate&&!Te)return We(t),null}else 2*ia()-r.renderingStartTime>fs&&a!==536870912&&(t.flags|=128,i=!0,eo(r,!1),t.lanes=4194304);r.isBackwards?(n.sibling=t.child,t.child=n):(e=r.last,e!==null?e.sibling=n:t.child=n,r.last=n)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ia(),e.sibling=null,a=dt.current,Pe(dt,i?a&1|2:a&1),Te&&er(t,r.treeForkCount),e):(We(t),null);case 22:case 23:return ta(t),Up(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),a=t.updateQueue,a!==null&&Ml(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&St(ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),or(bt),We(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function Qy(e,t){switch(Mp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return or(bt),on(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Wl(t),null;case 31:if(t.memoizedState!==null){if(ta(t),t.alternate===null)throw Error(L(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ta(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return St(dt),null;case 4:return on(),null;case 10:return or(t.type),null;case 22:case 23:return ta(t),Up(),e!==null&&St(ni),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return or(bt),null;case 25:return null;default:return null}}function Kh(e,t){switch(Mp(t),t.tag){case 3:or(bt),on();break;case 26:case 27:case 5:Wl(t);break;case 4:on();break;case 31:t.memoizedState!==null&&ta(t);break;case 13:ta(t);break;case 19:St(dt);break;case 10:or(t.type);break;case 22:case 23:ta(t),Up(),e!==null&&St(ni);break;case 24:or(bt)}}function Vo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var i=r.next;a=i;do{if((a.tag&e)===e){r=void 0;var n=a.create,o=a.inst;r=n(),o.destroy=r}a=a.next}while(a!==i)}}catch(l){Qe(t,t.return,l)}}function Yr(e,t,a){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var n=i.next;r=n;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,i=t;var c=a,p=l;try{p()}catch(d){Qe(i,c,d)}}}r=r.next}while(r!==n)}}catch(d){Qe(t,t.return,d)}}function Ph(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{ih(t,a)}catch(r){Qe(e,e.return,r)}}}function Jh(e,t,a){a.props=di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Qe(e,t,r)}}function vo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(i){Qe(e,t,i)}}function La(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(i){Qe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Qe(e,t,i)}else a.current=null}function Fh(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(i){Qe(e,e.return,i)}}function su(e,t,a){try{var r=e.stateNode;l1(r,e.type,a,t),r[Zt]=t}catch(i){Qe(e,e.return,i)}}function Ih(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$r(e.type)||e.tag===4}function cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ih(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$r(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fu(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=rr));else if(r!==4&&(r===27&&$r(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Fu(e,t,a),e=e.sibling;e!==null;)Fu(e,t,a),e=e.sibling}function ms(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&$r(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ms(e,t,a),e=e.sibling;e!==null;)ms(e,t,a),e=e.sibling}function Wh(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zt(t,r,a),t[Et]=e,t[Zt]=a}catch(n){Qe(e,e.return,n)}}var tr=!1,ht=!1,uu=!1,Af=typeof WeakSet=="function"?WeakSet:Set,kt=null;function Gy(e,t){if(e=e.containerInfo,ip=Ns,e=jg(e),Np(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var i=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{a.nodeType,n.nodeType}catch{a=null;break e}var o=0,l=-1,c=-1,p=0,d=0,g=e,f=null;t:for(;;){for(var h;g!==a||i!==0&&g.nodeType!==3||(l=o+i),g!==n||r!==0&&g.nodeType!==3||(c=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(h=g.firstChild)!==null;)f=g,g=h;for(;;){if(g===e)break t;if(f===a&&++p===i&&(l=o),f===n&&++d===r&&(c=o),(h=g.nextSibling)!==null)break;g=f,f=g.parentNode}g=h}a=l===-1||c===-1?null:{start:l,end:c}}else a=null}a=a||{start:0,end:0}}else a=null;for(np={focusedElem:e,selectionRange:a},Ns=!1,kt=t;kt!==null;)if(t=kt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,kt=e;else for(;kt!==null;){switch(t=kt,n=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)i=e[a],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&n!==null){e=void 0,a=t,i=n.memoizedProps,n=n.memoizedState,r=a.stateNode;try{var w=di(a.type,i);e=r.getSnapshotBeforeUpdate(w,n),r.__reactInternalSnapshotBeforeUpdate=e}catch(M){Qe(a,a.return,M)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)lp(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":lp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,kt=e;break}kt=t.return}}function eb(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ia(e,a),r&4&&Vo(5,a);break;case 1:if(Ia(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(o){Qe(a,a.return,o)}else{var i=di(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Qe(a,a.return,o)}}r&64&&Ph(a),r&512&&vo(a,a.return);break;case 3:if(Ia(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{ih(e,t)}catch(o){Qe(a,a.return,o)}}break;case 27:t===null&&r&4&&Wh(a);case 26:case 5:Ia(e,a),t===null&&r&4&&Fh(a),r&512&&vo(a,a.return);break;case 12:Ia(e,a);break;case 31:Ia(e,a),r&4&&rb(e,a);break;case 13:Ia(e,a),r&4&&ib(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Fy.bind(null,a),g1(e,a))));break;case 22:if(r=a.memoizedState!==null||tr,!r){t=t!==null&&t.memoizedState!==null||ht,i=tr;var n=ht;tr=r,(ht=t)&&!n?Wa(e,a,(a.subtreeFlags&8772)!==0):Ia(e,a),tr=i,ht=n}break;case 30:break;default:Ia(e,a)}}function tb(e){var t=e.alternate;t!==null&&(e.alternate=null,tb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vp(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var it=null,Xt=!1;function Fa(e,t,a){for(a=a.child;a!==null;)ab(e,t,a),a=a.sibling}function ab(e,t,a){if(na&&typeof na.onCommitFiberUnmount=="function")try{na.onCommitFiberUnmount(Lo,a)}catch{}switch(a.tag){case 26:ht||La(a,t),Fa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ht||La(a,t);var r=it,i=Xt;$r(a.type)&&(it=a.stateNode,Xt=!1),Fa(e,t,a),xo(a.stateNode),it=r,Xt=i;break;case 5:ht||La(a,t);case 6:if(r=it,i=Xt,it=null,Fa(e,t,a),it=r,Xt=i,it!==null)if(Xt)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(a.stateNode)}catch(n){Qe(a,t,n)}else try{it.removeChild(a.stateNode)}catch(n){Qe(a,t,n)}break;case 18:it!==null&&(Xt?(e=it,Zf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),hn(e)):Zf(it,a.stateNode));break;case 4:r=it,i=Xt,it=a.stateNode.containerInfo,Xt=!0,Fa(e,t,a),it=r,Xt=i;break;case 0:case 11:case 14:case 15:Yr(2,a,t),ht||Yr(4,a,t),Fa(e,t,a);break;case 1:ht||(La(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Jh(a,t,r)),Fa(e,t,a);break;case 21:Fa(e,t,a);break;case 22:ht=(r=ht)||a.memoizedState!==null,Fa(e,t,a),ht=r;break;default:Fa(e,t,a)}}function rb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hn(e)}catch(a){Qe(t,t.return,a)}}}function ib(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hn(e)}catch(a){Qe(t,t.return,a)}}function Yy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Af),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Af),t;default:throw Error(L(435,e.tag))}}function Tl(e,t){var a=Yy(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var i=Iy.bind(null,e,r);r.then(i,i)}})}function Gt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var i=a[r],n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if($r(l.type)){it=l.stateNode,Xt=!1;break e}break;case 5:it=l.stateNode,Xt=!1;break e;case 3:case 4:it=l.stateNode.containerInfo,Xt=!0;break e}l=l.return}if(it===null)throw Error(L(160));ab(n,o,i),it=null,Xt=!1,n=i.alternate,n!==null&&(n.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)nb(t,e),t=t.sibling}var za=null;function nb(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gt(t,e),Yt(e),r&4&&(Yr(3,e,e.return),Vo(3,e),Yr(5,e,e.return));break;case 1:Gt(t,e),Yt(e),r&512&&(ht||a===null||La(a,a.return)),r&64&&tr&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var i=za;if(Gt(t,e),Yt(e),r&512&&(ht||a===null||La(a,a.return)),r&4){var n=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":n=i.getElementsByTagName("title")[0],(!n||n[Qo]||n[Et]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=i.createElement(r),i.head.insertBefore(n,i.querySelector("head > title"))),zt(n,r,a),n[Et]=e,Nt(n),r=n;break e;case"link":var o=eg("link","href",i).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(n=o[l],n.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&n.getAttribute("rel")===(a.rel==null?null:a.rel)&&n.getAttribute("title")===(a.title==null?null:a.title)&&n.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;case"meta":if(o=eg("meta","content",i).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(n=o[l],n.getAttribute("content")===(a.content==null?null:""+a.content)&&n.getAttribute("name")===(a.name==null?null:a.name)&&n.getAttribute("property")===(a.property==null?null:a.property)&&n.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&n.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;default:throw Error(L(468,r))}n[Et]=e,Nt(n),r=n}e.stateNode=r}else tg(i,e.type,e.stateNode);else e.stateNode=Wf(i,r,e.memoizedProps);else n!==r?(n===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):n.count--,r===null?tg(i,e.type,e.stateNode):Wf(i,r,e.memoizedProps)):r===null&&e.stateNode!==null&&su(e,e.memoizedProps,a.memoizedProps)}break;case 27:Gt(t,e),Yt(e),r&512&&(ht||a===null||La(a,a.return)),a!==null&&r&4&&su(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Gt(t,e),Yt(e),r&512&&(ht||a===null||La(a,a.return)),e.flags&32){i=e.stateNode;try{sn(i,"")}catch(w){Qe(e,e.return,w)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,su(e,i,a!==null?a.memoizedProps:i)),r&1024&&(uu=!0);break;case 6:if(Gt(t,e),Yt(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(w){Qe(e,e.return,w)}}break;case 3:if(Kl=null,i=za,za=_s(t.containerInfo),Gt(t,e),za=i,Yt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{hn(t.containerInfo)}catch(w){Qe(e,e.return,w)}uu&&(uu=!1,ob(e));break;case 4:r=za,za=_s(e.stateNode.containerInfo),Gt(t,e),Yt(e),za=r;break;case 12:Gt(t,e),Yt(e);break;case 31:Gt(t,e),Yt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 13:Gt(t,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bs=ia()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 22:i=e.memoizedState!==null;var c=a!==null&&a.memoizedState!==null,p=tr,d=ht;if(tr=p||i,ht=d||c,Gt(t,e),ht=d,tr=p,Yt(e),r&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(a===null||c||tr||ht||ai(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){c=a=t;try{if(n=c.stateNode,i)o=n.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var g=c.memoizedProps.style,f=g!=null&&g.hasOwnProperty("display")?g.display:null;l.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(w){Qe(c,c.return,w)}}}else if(t.tag===6){if(a===null){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(w){Qe(c,c.return,w)}}}else if(t.tag===18){if(a===null){c=t;try{var h=c.stateNode;i?Kf(h,!0):Kf(c.stateNode,!1)}catch(w){Qe(c,c.return,w)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,Tl(e,a))));break;case 19:Gt(t,e),Yt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 30:break;case 21:break;default:Gt(t,e),Yt(e)}}function Yt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(Ih(r)){a=r;break}r=r.return}if(a==null)throw Error(L(160));switch(a.tag){case 27:var i=a.stateNode,n=cu(e);ms(e,n,i);break;case 5:var o=a.stateNode;a.flags&32&&(sn(o,""),a.flags&=-33);var l=cu(e);ms(e,l,o);break;case 3:case 4:var c=a.stateNode.containerInfo,p=cu(e);Fu(e,p,c);break;default:throw Error(L(161))}}catch(d){Qe(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ob(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ob(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ia(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)eb(e,t.alternate,t),t=t.sibling}function ai(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Yr(4,t,t.return),ai(t);break;case 1:La(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Jh(t,t.return,a),ai(t);break;case 27:xo(t.stateNode);case 26:case 5:La(t,t.return),ai(t);break;case 22:t.memoizedState===null&&ai(t);break;case 30:ai(t);break;default:ai(t)}e=e.sibling}}function Wa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,i=e,n=t,o=n.flags;switch(n.tag){case 0:case 11:case 15:Wa(i,n,a),Vo(4,n);break;case 1:if(Wa(i,n,a),r=n,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(p){Qe(r,r.return,p)}if(r=n,i=r.updateQueue,i!==null){var l=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)rh(c[i],l)}catch(p){Qe(r,r.return,p)}}a&&o&64&&Ph(n),vo(n,n.return);break;case 27:Wh(n);case 26:case 5:Wa(i,n,a),a&&r===null&&o&4&&Fh(n),vo(n,n.return);break;case 12:Wa(i,n,a);break;case 31:Wa(i,n,a),a&&o&4&&rb(i,n);break;case 13:Wa(i,n,a),a&&o&4&&ib(i,n);break;case 22:n.memoizedState===null&&Wa(i,n,a),vo(n,n.return);break;case 30:break;default:Wa(i,n,a)}t=t.sibling}}function Jp(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Yo(a))}function Fp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yo(e))}function Ta(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lb(e,t,a,r),t=t.sibling}function lb(e,t,a,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ta(e,t,a,r),i&2048&&Vo(9,t);break;case 1:Ta(e,t,a,r);break;case 3:Ta(e,t,a,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yo(e)));break;case 12:if(i&2048){Ta(e,t,a,r),e=t.stateNode;try{var n=t.memoizedProps,o=n.id,l=n.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Qe(t,t.return,c)}}else Ta(e,t,a,r);break;case 31:Ta(e,t,a,r);break;case 13:Ta(e,t,a,r);break;case 23:break;case 22:n=t.stateNode,o=t.alternate,t.memoizedState!==null?n._visibility&2?Ta(e,t,a,r):wo(e,t):n._visibility&2?Ta(e,t,a,r):(n._visibility|=2,Li(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),i&2048&&Jp(o,t);break;case 24:Ta(e,t,a,r),i&2048&&Fp(t.alternate,t);break;default:Ta(e,t,a,r)}}function Li(e,t,a,r,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,o=t,l=a,c=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Li(n,o,l,c,i),Vo(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?Li(n,o,l,c,i):wo(n,o):(d._visibility|=2,Li(n,o,l,c,i)),i&&p&2048&&Jp(o.alternate,o);break;case 24:Li(n,o,l,c,i),i&&p&2048&&Fp(o.alternate,o);break;default:Li(n,o,l,c,i)}t=t.sibling}}function wo(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,i=r.flags;switch(r.tag){case 22:wo(a,r),i&2048&&Jp(r.alternate,r);break;case 24:wo(a,r),i&2048&&Fp(r.alternate,r);break;default:wo(a,r)}t=t.sibling}}var so=8192;function Bi(e,t,a){if(e.subtreeFlags&so)for(e=e.child;e!==null;)sb(e,t,a),e=e.sibling}function sb(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&so&&e.memoizedState!==null&&q1(a,za,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var r=za;za=_s(e.stateNode.containerInfo),Bi(e,t,a),za=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=so,so=16777216,Bi(e,t,a),so=r):Bi(e,t,a));break;default:Bi(e,t,a)}}function cb(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function to(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];kt=r,pb(r,e)}cb(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ub(e),e=e.sibling}function ub(e){switch(e.tag){case 0:case 11:case 15:to(e),e.flags&2048&&Yr(9,e,e.return);break;case 3:to(e);break;case 12:to(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$l(e)):to(e);break;default:to(e)}}function $l(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];kt=r,pb(r,e)}cb(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yr(8,t,t.return),$l(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,$l(t));break;default:$l(t)}e=e.sibling}}function pb(e,t){for(;kt!==null;){var a=kt;switch(a.tag){case 0:case 11:case 15:Yr(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Yo(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,kt=r;else e:for(a=e;kt!==null;){r=kt;var i=r.sibling,n=r.return;if(tb(r),r===a){kt=null;break e}if(i!==null){i.return=n,kt=i;break e}kt=n}}}var Xy={getCacheForType:function(e){var t=Tt(bt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(bt).controller.signal}},Vy=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Ze=null,qe=null,Me=0,je=0,ea=null,Mr=!1,_n=!1,Ip=!1,dr=0,st=0,Xr=0,li=0,Wp=0,ra=0,dn=0,yo=null,Vt=null,Iu=!1,Bs=0,db=0,fs=1/0,gs=null,Or=null,wt=0,Br=null,mn=null,lr=0,Wu=0,ep=null,mb=null,_o=0,tp=null;function la(){return(Oe&2)!==0&&Me!==0?Me&-Me:ue.T!==null?td():xg()}function fb(){if(ra===0)if((Me&536870912)===0||Te){var e=yl;yl<<=1,(yl&3932160)===0&&(yl=262144),ra=e}else ra=536870912;return e=ca.current,e!==null&&(e.flags|=32),ra}function $t(e,t,a){(e===Ze&&(je===2||je===9)||e.cancelPendingCommit!==null)&&(fn(e,0),Tr(e,Me,ra,!1)),jo(e,a),((Oe&2)===0||e!==Ze)&&(e===Ze&&((Oe&2)===0&&(li|=a),st===4&&Tr(e,Me,ra,!1)),Qa(e))}function gb(e,t,a){if((Oe&6)!==0)throw Error(L(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ho(e,t),i=r?Ky(e,t):pu(e,t,!0),n=r;do{if(i===0){_n&&!r&&Tr(e,t,0,!1);break}else{if(a=e.current.alternate,n&&!$y(a)){i=pu(e,t,!1),n=!1;continue}if(i===2){if(n=t,e.errorRecoveryDisabledLanes&n)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;i=yo;var c=l.current.memoizedState.isDehydrated;if(c&&(fn(l,o).flags|=256),o=pu(l,o,!1),o!==2){if(Ip&&!c){l.errorRecoveryDisabledLanes|=n,li|=n,i=4;break e}n=Vt,Vt=i,n!==null&&(Vt===null?Vt=n:Vt.push.apply(Vt,n))}i=o}if(n=!1,i!==2)continue}}if(i===1){fn(e,0),Tr(e,t,0,!0);break}e:{switch(r=e,n=i,n){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:Tr(r,t,ra,!Mr);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(i=Bs+300-ia(),10<i)){if(Tr(r,t,ra,!Mr),Cs(r,0,!0)!==0)break e;lr=t,r.timeoutHandle=Db(Rf.bind(null,r,a,Vt,gs,Iu,t,ra,li,dn,Mr,n,"Throttled",-0,0),i);break e}Rf(r,a,Vt,gs,Iu,t,ra,li,dn,Mr,n,null,-0,0)}}break}while(!0);Qa(e)}function Rf(e,t,a,r,i,n,o,l,c,p,d,g,f,h){if(e.timeoutHandle=-1,g=t.subtreeFlags,g&8192||(g&16785408)===16785408){g={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:rr},sb(t,n,g);var w=(n&62914560)===n?Bs-ia():(n&4194048)===n?db-ia():0;if(w=E1(g,w),w!==null){lr=n,e.cancelPendingCommit=w(Df.bind(null,e,t,n,a,r,i,o,l,c,d,g,null,f,h)),Tr(e,n,o,!p);return}}Df(e,t,n,a,r,i,o,l,c)}function $y(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var i=a[r],n=i.getSnapshot;i=i.value;try{if(!sa(n(),i))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Tr(e,t,a,r){t&=~Wp,t&=~li,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var n=31-oa(i),o=1<<n;r[n]=-1,i&=~o}a!==0&&wg(e,a,t)}function Ls(){return(Oe&6)===0?($o(0,!1),!1):!0}function ed(){if(qe!==null){if(je===0)var e=qe.return;else e=qe,ir=bi=null,Hp(e),an=null,Mo=0,e=qe;for(;e!==null;)Kh(e.alternate,e),e=e.return;qe=null}}function fn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,u1(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),lr=0,ed(),Ze=e,qe=a=nr(e.current,null),Me=t,je=0,ea=null,Mr=!1,_n=Ho(e,t),Ip=!1,dn=ra=Wp=li=Xr=st=0,Vt=yo=null,Iu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-oa(r),n=1<<i;t|=e[i],r&=~n}return dr=t,Ts(),a}function hb(e,t){ve=null,ue.H=zo,t===yn||t===As?(t=pf(),je=3):t===Ap?(t=pf(),je=4):je=t===Kp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ea=t,qe===null&&(st=1,ps(e,va(t,e.current)))}function bb(){var e=ca.current;return e===null?!0:(Me&4194048)===Me?ya===null:(Me&62914560)===Me||(Me&536870912)!==0?e===ya:!1}function vb(){var e=ue.H;return ue.H=zo,e===null?zo:e}function wb(){var e=ue.A;return ue.A=Xy,e}function hs(){st=4,Mr||(Me&4194048)!==Me&&ca.current!==null||(_n=!0),(Xr&134217727)===0&&(li&134217727)===0||Ze===null||Tr(Ze,Me,ra,!1)}function pu(e,t,a){var r=Oe;Oe|=2;var i=vb(),n=wb();(Ze!==e||Me!==t)&&(gs=null,fn(e,t)),t=!1;var o=st;e:do try{if(je!==0&&qe!==null){var l=qe,c=ea;switch(je){case 8:ed(),o=6;break e;case 3:case 2:case 9:case 6:ca.current===null&&(t=!0);var p=je;if(je=0,ea=null,Fi(e,l,c,p),a&&_n){o=0;break e}break;default:p=je,je=0,ea=null,Fi(e,l,c,p)}}Zy(),o=st;break}catch(d){hb(e,d)}while(!0);return t&&e.shellSuspendCounter++,ir=bi=null,Oe=r,ue.H=i,ue.A=n,qe===null&&(Ze=null,Me=0,Ts()),o}function Zy(){for(;qe!==null;)yb(qe)}function Ky(e,t){var a=Oe;Oe|=2;var r=vb(),i=wb();Ze!==e||Me!==t?(gs=null,fs=ia()+500,fn(e,t)):_n=Ho(e,t);e:do try{if(je!==0&&qe!==null){t=qe;var n=ea;t:switch(je){case 1:je=0,ea=null,Fi(e,t,n,1);break;case 2:case 9:if(uf(n)){je=0,ea=null,Uf(t);break}t=function(){je!==2&&je!==9||Ze!==e||(je=7),Qa(e)},n.then(t,t);break e;case 3:je=7;break e;case 4:je=5;break e;case 7:uf(n)?(je=0,ea=null,Uf(t)):(je=0,ea=null,Fi(e,t,n,7));break;case 5:var o=null;switch(qe.tag){case 26:o=qe.memoizedState;case 5:case 27:var l=qe;if(o?jb(o):l.stateNode.complete){je=0,ea=null;var c=l.sibling;if(c!==null)qe=c;else{var p=l.return;p!==null?(qe=p,Hs(p)):qe=null}break t}}je=0,ea=null,Fi(e,t,n,5);break;case 6:je=0,ea=null,Fi(e,t,n,6);break;case 8:ed(),st=6;break e;default:throw Error(L(462))}}Py();break}catch(d){hb(e,d)}while(!0);return ir=bi=null,ue.H=r,ue.A=i,Oe=a,qe!==null?0:(Ze=null,Me=0,Ts(),st)}function Py(){for(;qe!==null&&!v0();)yb(qe)}function yb(e){var t=Zh(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?Hs(e):qe=t}function Uf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=qf(a,t,t.pendingProps,t.type,void 0,Me);break;case 11:t=qf(a,t,t.pendingProps,t.type.render,t.ref,Me);break;case 5:Hp(t);default:Kh(a,t),t=qe=Kg(t,dr),t=Zh(a,t,dr)}e.memoizedProps=e.pendingProps,t===null?Hs(e):qe=t}function Fi(e,t,a,r){ir=bi=null,Hp(t),an=null,Mo=0;var i=t.return;try{if(By(e,i,t,a,Me)){st=1,ps(e,va(a,e.current)),qe=null;return}}catch(n){if(i!==null)throw qe=i,n;st=1,ps(e,va(a,e.current)),qe=null;return}t.flags&32768?(Te||r===1?e=!0:_n||(Me&536870912)!==0?e=!1:(Mr=e=!0,(r===2||r===9||r===3||r===6)&&(r=ca.current,r!==null&&r.tag===13&&(r.flags|=16384))),_b(t,e)):Hs(t)}function Hs(e){var t=e;do{if((t.flags&32768)!==0){_b(t,Mr);return}e=t.return;var a=jy(t.alternate,t,dr);if(a!==null){qe=a;return}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);st===0&&(st=5)}function _b(e,t){do{var a=Qy(e.alternate,e);if(a!==null){a.flags&=32767,qe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){qe=e;return}qe=e=a}while(e!==null);st=6,qe=null}function Df(e,t,a,r,i,n,o,l,c){e.cancelPendingCommit=null;do js();while(wt!==0);if((Oe&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(n=t.lanes|t.childLanes,n|=Sp,E0(e,a,n,o,l,c),e===Ze&&(qe=Ze=null,Me=0),mn=t,Br=e,lr=a,Wu=n,ep=i,mb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Wy(es,function(){return Cb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=ue.T,ue.T=null,i=Be.p,Be.p=2,o=Oe,Oe|=4;try{Gy(e,t,a)}finally{Oe=o,Be.p=i,ue.T=r}}wt=1,xb(),kb(),Nb()}}function xb(){if(wt===1){wt=0;var e=Br,t=mn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=ue.T,ue.T=null;var r=Be.p;Be.p=2;var i=Oe;Oe|=4;try{nb(t,e);var n=np,o=jg(e.containerInfo),l=n.focusedElem,c=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&Hg(l.ownerDocument.documentElement,l)){if(c!==null&&Np(l)){var p=c.start,d=c.end;if(d===void 0&&(d=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(d,l.value.length);else{var g=l.ownerDocument||document,f=g&&g.defaultView||window;if(f.getSelection){var h=f.getSelection(),w=l.textContent.length,M=Math.min(c.start,w),D=c.end===void 0?M:Math.min(c.end,w);!h.extend&&M>D&&(o=D,D=M,M=o);var m=af(l,M),u=af(l,D);if(m&&u&&(h.rangeCount!==1||h.anchorNode!==m.node||h.anchorOffset!==m.offset||h.focusNode!==u.node||h.focusOffset!==u.offset)){var b=g.createRange();b.setStart(m.node,m.offset),h.removeAllRanges(),M>D?(h.addRange(b),h.extend(u.node,u.offset)):(b.setEnd(u.node,u.offset),h.addRange(b))}}}}for(g=[],h=l;h=h.parentNode;)h.nodeType===1&&g.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<g.length;l++){var v=g[l];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}Ns=!!ip,np=ip=null}finally{Oe=i,Be.p=r,ue.T=a}}e.current=t,wt=2}}function kb(){if(wt===2){wt=0;var e=Br,t=mn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=ue.T,ue.T=null;var r=Be.p;Be.p=2;var i=Oe;Oe|=4;try{eb(e,t.alternate,t)}finally{Oe=i,Be.p=r,ue.T=a}}wt=3}}function Nb(){if(wt===4||wt===3){wt=0,w0();var e=Br,t=mn,a=lr,r=mb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?wt=5:(wt=0,mn=Br=null,Sb(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Or=null),bp(a),t=t.stateNode,na&&typeof na.onCommitFiberRoot=="function")try{na.onCommitFiberRoot(Lo,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=ue.T,i=Be.p,Be.p=2,ue.T=null;try{for(var n=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];n(l.value,{componentStack:l.stack})}}finally{ue.T=t,Be.p=i}}(lr&3)!==0&&js(),Qa(e),i=e.pendingLanes,(a&261930)!==0&&(i&42)!==0?e===tp?_o++:(_o=0,tp=e):_o=0,$o(0,!1)}}function Sb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Yo(t)))}function js(){return xb(),kb(),Nb(),Cb()}function Cb(){if(wt!==5)return!1;var e=Br,t=Wu;Wu=0;var a=bp(lr),r=ue.T,i=Be.p;try{Be.p=32>a?32:a,ue.T=null,a=ep,ep=null;var n=Br,o=lr;if(wt=0,mn=Br=null,lr=0,(Oe&6)!==0)throw Error(L(331));var l=Oe;if(Oe|=4,ub(n.current),lb(n,n.current,o,a),Oe=l,$o(0,!1),na&&typeof na.onPostCommitFiberRoot=="function")try{na.onPostCommitFiberRoot(Lo,n)}catch{}return!0}finally{Be.p=i,ue.T=r,Sb(e,t)}}function Of(e,t,a){t=va(a,t),t=Ku(e.stateNode,t,2),e=Dr(e,t,2),e!==null&&(jo(e,2),Qa(e))}function Qe(e,t,a){if(e.tag===3)Of(e,e,a);else for(;t!==null;){if(t.tag===3){Of(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Or===null||!Or.has(r))){e=va(a,e),a=Qh(2),r=Dr(t,a,2),r!==null&&(Gh(a,r,t,e),jo(r,2),Qa(r));break}}t=t.return}}function du(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Vy;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(a)||(Ip=!0,i.add(a),e=Jy.bind(null,e,t,a),t.then(e,e))}function Jy(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Me&a)===a&&(st===4||st===3&&(Me&62914560)===Me&&300>ia()-Bs?(Oe&2)===0&&fn(e,0):Wp|=a,dn===Me&&(dn=0)),Qa(e)}function qb(e,t){t===0&&(t=vg()),e=hi(e,t),e!==null&&(jo(e,t),Qa(e))}function Fy(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),qb(e,a)}function Iy(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(L(314))}r!==null&&r.delete(t),qb(e,a)}function Wy(e,t){return gp(e,t)}var bs=null,Hi=null,ap=!1,vs=!1,mu=!1,zr=0;function Qa(e){e!==Hi&&e.next===null&&(Hi===null?bs=Hi=e:Hi=Hi.next=e),vs=!0,ap||(ap=!0,t1())}function $o(e,t){if(!mu&&vs){mu=!0;do for(var a=!1,r=bs;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var n=0;else{var o=r.suspendedLanes,l=r.pingedLanes;n=(1<<31-oa(42|e)+1)-1,n&=i&~(o&~l),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(a=!0,Bf(r,n))}else n=Me,n=Cs(r,r===Ze?n:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(n&3)===0||Ho(r,n)||(a=!0,Bf(r,n));r=r.next}while(a);mu=!1}}function e1(){Eb()}function Eb(){vs=ap=!1;var e=0;zr!==0&&c1()&&(e=zr);for(var t=ia(),a=null,r=bs;r!==null;){var i=r.next,n=Mb(r,t);n===0?(r.next=null,a===null?bs=i:a.next=i,i===null&&(Hi=a)):(a=r,(e!==0||(n&3)!==0)&&(vs=!0)),r=i}wt!==0&&wt!==5||$o(e,!1),zr!==0&&(zr=0)}function Mb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var o=31-oa(n),l=1<<o,c=i[o];c===-1?((l&a)===0||(l&r)!==0)&&(i[o]=q0(l,t)):c<=t&&(e.expiredLanes|=l),n&=~l}if(t=Ze,a=Me,a=Cs(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(je===2||je===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Gc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ho(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Gc(r),bp(a)){case 2:case 8:a=hg;break;case 32:a=es;break;case 268435456:a=bg;break;default:a=es}return r=Tb.bind(null,e),a=gp(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Gc(r),e.callbackPriority=2,e.callbackNode=null,2}function Tb(e,t){if(wt!==0&&wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(js()&&e.callbackNode!==a)return null;var r=Me;return r=Cs(e,e===Ze?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gb(e,r,t),Mb(e,ia()),e.callbackNode!=null&&e.callbackNode===a?Tb.bind(null,e):null)}function Bf(e,t){if(js())return null;gb(e,t,!0)}function t1(){p1(function(){(Oe&6)!==0?gp(gg,e1):Eb()})}function td(){if(zr===0){var e=cn;e===0&&(e=wl,wl<<=1,(wl&261888)===0&&(wl=256)),zr=e}return zr}function Lf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bl(""+e)}function Hf(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function a1(e,t,a,r,i){if(t==="submit"&&a&&a.stateNode===i){var n=Lf((i[Zt]||null).action),o=r.submitter;o&&(t=(t=o[Zt]||null)?Lf(t.formAction):o.getAttribute("formAction"),t!==null&&(n=t,o=null));var l=new qs("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(zr!==0){var c=o?Hf(i,o):new FormData(i);$u(a,{pending:!0,data:c,method:i.method,action:n},null,c)}}else typeof n=="function"&&(l.preventDefault(),c=o?Hf(i,o):new FormData(i),$u(a,{pending:!0,data:c,method:i.method,action:n},n,c))},currentTarget:i}]})}}for(zl=0;zl<Uu.length;zl++)Al=Uu[zl],jf=Al.toLowerCase(),Qf=Al[0].toUpperCase()+Al.slice(1),Aa(jf,"on"+Qf);var Al,jf,Qf,zl;Aa(Gg,"onAnimationEnd");Aa(Yg,"onAnimationIteration");Aa(Xg,"onAnimationStart");Aa("dblclick","onDoubleClick");Aa("focusin","onFocus");Aa("focusout","onBlur");Aa(yy,"onTransitionRun");Aa(_y,"onTransitionStart");Aa(xy,"onTransitionCancel");Aa(Vg,"onTransitionEnd");ln("onMouseEnter",["mouseout","mouseover"]);ln("onMouseLeave",["mouseout","mouseover"]);ln("onPointerEnter",["pointerout","pointerover"]);ln("onPointerLeave",["pointerout","pointerover"]);mi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));mi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));mi("onBeforeInput",["compositionend","keypress","textInput","paste"]);mi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),r1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ao));function zb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],i=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,p=l.currentTarget;if(l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(d){as(d)}i.currentTarget=null,n=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,p=l.currentTarget,l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(d){as(d)}i.currentTarget=null,n=c}}}}function Ce(e,t){var a=t[Cu];a===void 0&&(a=t[Cu]=new Set);var r=e+"__bubble";a.has(r)||(Ab(t,e,2,!1),a.add(r))}function fu(e,t,a){var r=0;t&&(r|=4),Ab(a,e,r,t)}var Rl="_reactListening"+Math.random().toString(36).slice(2);function ad(e){if(!e[Rl]){e[Rl]=!0,kg.forEach(function(a){a!=="selectionchange"&&(r1.has(a)||fu(a,!1,e),fu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rl]||(t[Rl]=!0,fu("selectionchange",!1,t))}}function Ab(e,t,a,r){switch(Vb(t)){case 2:var i=z1;break;case 8:i=A1;break;default:i=od}a=i.bind(null,t,a,e),i=void 0,!zu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,a,{capture:!0,passive:i}):e.addEventListener(t,a,!0):i!==void 0?e.addEventListener(t,a,{passive:i}):e.addEventListener(t,a,!1)}function gu(e,t,a,r,i){var n=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;l!==null;){if(o=Gi(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=n=o;continue e}l=l.parentNode}}r=r.return}zg(function(){var p=n,d=yp(a),g=[];e:{var f=$g.get(e);if(f!==void 0){var h=qs,w=e;switch(e){case"keypress":if(Hl(a)===0)break e;case"keydown":case"keyup":h=I0;break;case"focusin":w="focus",h=Zc;break;case"focusout":w="blur",h=Zc;break;case"beforeblur":case"afterblur":h=Zc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Zm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=j0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=ty;break;case Gg:case Yg:case Xg:h=Y0;break;case Vg:h=ry;break;case"scroll":case"scrollend":h=L0;break;case"wheel":h=ny;break;case"copy":case"cut":case"paste":h=V0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Pm;break;case"toggle":case"beforetoggle":h=ly}var M=(t&4)!==0,D=!M&&(e==="scroll"||e==="scrollend"),m=M?f!==null?f+"Capture":null:f;M=[];for(var u=p,b;u!==null;){var v=u;if(b=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||b===null||m===null||(v=No(u,m),v!=null&&M.push(Ro(u,v,b))),D)break;u=u.return}0<M.length&&(f=new h(f,w,null,a,d),g.push({event:f,listeners:M}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&a!==Tu&&(w=a.relatedTarget||a.fromElement)&&(Gi(w)||w[bn]))break e;if((h||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,h?(w=a.relatedTarget||a.toElement,h=p,w=w?Gi(w):null,w!==null&&(D=Bo(w),M=w.tag,w!==D||M!==5&&M!==27&&M!==6)&&(w=null)):(h=null,w=p),h!==w)){if(M=Zm,v="onMouseLeave",m="onMouseEnter",u="mouse",(e==="pointerout"||e==="pointerover")&&(M=Pm,v="onPointerLeave",m="onPointerEnter",u="pointer"),D=h==null?f:oo(h),b=w==null?f:oo(w),f=new M(v,u+"leave",h,a,d),f.target=D,f.relatedTarget=b,v=null,Gi(d)===p&&(M=new M(m,u+"enter",w,a,d),M.target=b,M.relatedTarget=D,v=M),D=v,h&&w)t:{for(M=i1,m=h,u=w,b=0,v=m;v;v=M(v))b++;v=0;for(var N=u;N;N=M(N))v++;for(;0<b-v;)m=M(m),b--;for(;0<v-b;)u=M(u),v--;for(;b--;){if(m===u||u!==null&&m===u.alternate){M=m;break t}m=M(m),u=M(u)}M=null}else M=null;h!==null&&Gf(g,f,h,M,!1),w!==null&&D!==null&&Gf(g,D,w,M,!0)}}e:{if(f=p?oo(p):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var A=Wm;else if(Im(f))if(Bg)A=by;else{A=gy;var T=fy}else h=f.nodeName,!h||h.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?p&&wp(p.elementType)&&(A=Wm):A=hy;if(A&&(A=A(e,p))){Og(g,A,a,d);break e}T&&T(e,f,p),e==="focusout"&&p&&f.type==="number"&&p.memoizedProps.value!=null&&Mu(f,"number",f.value)}switch(T=p?oo(p):window,e){case"focusin":(Im(T)||T.contentEditable==="true")&&(Vi=T,Au=p,po=null);break;case"focusout":po=Au=Vi=null;break;case"mousedown":Ru=!0;break;case"contextmenu":case"mouseup":case"dragend":Ru=!1,rf(g,a,d);break;case"selectionchange":if(wy)break;case"keydown":case"keyup":rf(g,a,d)}var z;if(kp)e:{switch(e){case"compositionstart":var G="onCompositionStart";break e;case"compositionend":G="onCompositionEnd";break e;case"compositionupdate":G="onCompositionUpdate";break e}G=void 0}else Xi?Ug(e,a)&&(G="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(G="onCompositionStart");G&&(Rg&&a.locale!=="ko"&&(Xi||G!=="onCompositionStart"?G==="onCompositionEnd"&&Xi&&(z=Ag()):(Er=d,_p="value"in Er?Er.value:Er.textContent,Xi=!0)),T=ws(p,G),0<T.length&&(G=new Km(G,e,null,a,d),g.push({event:G,listeners:T}),z?G.data=z:(z=Dg(a),z!==null&&(G.data=z)))),(z=cy?uy(e,a):py(e,a))&&(G=ws(p,"onBeforeInput"),0<G.length&&(T=new Km("onBeforeInput","beforeinput",null,a,d),g.push({event:T,listeners:G}),T.data=z)),a1(g,e,p,a,d)}zb(g,t)})}function Ro(e,t,a){return{instance:e,listener:t,currentTarget:a}}function ws(e,t){for(var a=t+"Capture",r=[];e!==null;){var i=e,n=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||n===null||(i=No(e,a),i!=null&&r.unshift(Ro(e,i,n)),i=No(e,t),i!=null&&r.push(Ro(e,i,n))),e.tag===3)return r;e=e.return}return[]}function i1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Gf(e,t,a,r,i){for(var n=t._reactName,o=[];a!==null&&a!==r;){var l=a,c=l.alternate,p=l.stateNode;if(l=l.tag,c!==null&&c===r)break;l!==5&&l!==26&&l!==27||p===null||(c=p,i?(p=No(a,n),p!=null&&o.unshift(Ro(a,p,c))):i||(p=No(a,n),p!=null&&o.push(Ro(a,p,c)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var n1=/\r\n?/g,o1=/\u0000|\uFFFD/g;function Yf(e){return(typeof e=="string"?e:""+e).replace(n1,`
|
|
9
|
-
`).replace(o1,"")}function Rb(e,t){return t=Yf(t),Yf(e)===t}function Ve(e,t,a,r,i,n){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||sn(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&sn(e,""+r);break;case"className":xl(e,"class",r);break;case"tabIndex":xl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":xl(e,a,r);break;case"style":Tg(e,r,n);break;case"data":if(t!=="object"){xl(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Bl(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof n=="function"&&(a==="formAction"?(t!=="input"&&Ve(e,t,"name",i.name,i,null),Ve(e,t,"formEncType",i.formEncType,i,null),Ve(e,t,"formMethod",i.formMethod,i,null),Ve(e,t,"formTarget",i.formTarget,i,null)):(Ve(e,t,"encType",i.encType,i,null),Ve(e,t,"method",i.method,i,null),Ve(e,t,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Bl(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=rr);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Bl(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ol(e,"popover",r);break;case"xlinkActuate":Pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Pa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Pa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Pa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Pa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ol(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=O0.get(a)||a,Ol(e,a,r))}}function rp(e,t,a,r,i,n){switch(a){case"style":Tg(e,r,n);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"children":typeof r=="string"?sn(e,r):(typeof r=="number"||typeof r=="bigint")&&sn(e,""+r);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"onClick":r!=null&&(e.onclick=rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ng.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(i=a.endsWith("Capture"),t=a.slice(2,i?a.length-7:void 0),n=e[Zt]||null,n=n!=null?n[a]:null,typeof n=="function"&&e.removeEventListener(t,n,i),typeof r=="function")){typeof n!="function"&&n!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,i);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Ol(e,a,r)}}}function zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var r=!1,i=!1,n;for(n in a)if(a.hasOwnProperty(n)){var o=a[n];if(o!=null)switch(n){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Ve(e,t,n,o,a,null)}}i&&Ve(e,t,"srcSet",a.srcSet,a,null),r&&Ve(e,t,"src",a.src,a,null);return;case"input":Ce("invalid",e);var l=n=o=i=null,c=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var d=a[r];if(d!=null)switch(r){case"name":i=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":p=d;break;case"value":n=d;break;case"defaultValue":l=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(L(137,t));break;default:Ve(e,t,r,d,a,null)}}qg(e,n,l,c,p,o,i,!1);return;case"select":Ce("invalid",e),r=o=n=null;for(i in a)if(a.hasOwnProperty(i)&&(l=a[i],l!=null))switch(i){case"value":n=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:Ve(e,t,i,l,a,null)}t=n,a=o,e.multiple=!!r,t!=null?Wi(e,!!r,t,!1):a!=null&&Wi(e,!!r,a,!0);return;case"textarea":Ce("invalid",e),n=i=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":i=l;break;case"children":n=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(L(91));break;default:Ve(e,t,o,l,a,null)}Mg(e,r,i,n);return;case"option":for(c in a)a.hasOwnProperty(c)&&(r=a[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Ve(e,t,c,r,a,null));return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(r=0;r<Ao.length;r++)Ce(Ao[r],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(p in a)if(a.hasOwnProperty(p)&&(r=a[p],r!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Ve(e,t,p,r,a,null)}return;default:if(wp(t)){for(d in a)a.hasOwnProperty(d)&&(r=a[d],r!==void 0&&rp(e,t,d,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&Ve(e,t,l,r,a,null))}function l1(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,n=null,o=null,l=null,c=null,p=null,d=null;for(h in a){var g=a[h];if(a.hasOwnProperty(h)&&g!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":c=g;default:r.hasOwnProperty(h)||Ve(e,t,h,null,r,g)}}for(var f in r){var h=r[f];if(g=a[f],r.hasOwnProperty(f)&&(h!=null||g!=null))switch(f){case"type":n=h;break;case"name":i=h;break;case"checked":p=h;break;case"defaultChecked":d=h;break;case"value":o=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(L(137,t));break;default:h!==g&&Ve(e,t,f,h,r,g)}}Eu(e,o,l,c,p,d,n,i);return;case"select":h=o=l=f=null;for(n in a)if(c=a[n],a.hasOwnProperty(n)&&c!=null)switch(n){case"value":break;case"multiple":h=c;default:r.hasOwnProperty(n)||Ve(e,t,n,null,r,c)}for(i in r)if(n=r[i],c=a[i],r.hasOwnProperty(i)&&(n!=null||c!=null))switch(i){case"value":f=n;break;case"defaultValue":l=n;break;case"multiple":o=n;default:n!==c&&Ve(e,t,i,n,r,c)}t=l,a=o,r=h,f!=null?Wi(e,!!a,f,!1):!!r!=!!a&&(t!=null?Wi(e,!!a,t,!0):Wi(e,!!a,a?[]:"",!1));return;case"textarea":h=f=null;for(l in a)if(i=a[l],a.hasOwnProperty(l)&&i!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Ve(e,t,l,null,r,i)}for(o in r)if(i=r[o],n=a[o],r.hasOwnProperty(o)&&(i!=null||n!=null))switch(o){case"value":f=i;break;case"defaultValue":h=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(L(91));break;default:i!==n&&Ve(e,t,o,i,r,n)}Eg(e,f,h);return;case"option":for(var w in a)f=a[w],a.hasOwnProperty(w)&&f!=null&&!r.hasOwnProperty(w)&&(w==="selected"?e.selected=!1:Ve(e,t,w,null,r,f));for(c in r)f=r[c],h=a[c],r.hasOwnProperty(c)&&f!==h&&(f!=null||h!=null)&&(c==="selected"?e.selected=f&&typeof f!="function"&&typeof f!="symbol":Ve(e,t,c,f,r,h));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var M in a)f=a[M],a.hasOwnProperty(M)&&f!=null&&!r.hasOwnProperty(M)&&Ve(e,t,M,null,r,f);for(p in r)if(f=r[p],h=a[p],r.hasOwnProperty(p)&&f!==h&&(f!=null||h!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Ve(e,t,p,f,r,h)}return;default:if(wp(t)){for(var D in a)f=a[D],a.hasOwnProperty(D)&&f!==void 0&&!r.hasOwnProperty(D)&&rp(e,t,D,void 0,r,f);for(d in r)f=r[d],h=a[d],!r.hasOwnProperty(d)||f===h||f===void 0&&h===void 0||rp(e,t,d,f,r,h);return}}for(var m in a)f=a[m],a.hasOwnProperty(m)&&f!=null&&!r.hasOwnProperty(m)&&Ve(e,t,m,null,r,f);for(g in r)f=r[g],h=a[g],!r.hasOwnProperty(g)||f===h||f==null&&h==null||Ve(e,t,g,f,r,h)}function Xf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function s1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var i=a[r],n=i.transferSize,o=i.initiatorType,l=i.duration;if(n&&l&&Xf(o)){for(o=0,l=i.responseEnd,r+=1;r<a.length;r++){var c=a[r],p=c.startTime;if(p>l)break;var d=c.transferSize,g=c.initiatorType;d&&Xf(g)&&(c=c.responseEnd,o+=d*(c<l?1:(l-p)/(c-p)))}if(--r,t+=8*(n+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ip=null,np=null;function ys(e){return e.nodeType===9?e:e.ownerDocument}function Vf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ub(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function op(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hu=null;function c1(){var e=window.event;return e&&e.type==="popstate"?e===hu?!1:(hu=e,!0):(hu=null,!1)}var Db=typeof setTimeout=="function"?setTimeout:void 0,u1=typeof clearTimeout=="function"?clearTimeout:void 0,$f=typeof Promise=="function"?Promise:void 0,p1=typeof queueMicrotask=="function"?queueMicrotask:typeof $f<"u"?function(e){return $f.resolve(null).then(e).catch(d1)}:Db;function d1(e){setTimeout(function(){throw e})}function $r(e){return e==="head"}function Zf(e,t){var a=t,r=0;do{var i=a.nextSibling;if(e.removeChild(a),i&&i.nodeType===8)if(a=i.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(i),hn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")xo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,xo(a);for(var n=a.firstChild;n;){var o=n.nextSibling,l=n.nodeName;n[Qo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&n.rel.toLowerCase()==="stylesheet"||a.removeChild(n),n=o}}else a==="body"&&xo(e.ownerDocument.body);a=i}while(a);hn(t)}function Kf(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function lp(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":lp(a),vp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function m1(e,t,a,r){for(;e.nodeType===1;){var i=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Qo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=_a(e.nextSibling),e===null)break}return null}function f1(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=_a(e.nextSibling),e===null))return null;return e}function Ob(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=_a(e.nextSibling),e===null))return null;return e}function sp(e){return e.data==="$?"||e.data==="$~"}function cp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function g1(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function _a(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var up=null;function Pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return _a(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Jf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Bb(e,t,a){switch(t=ys(a),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function xo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vp(e)}var xa=new Map,Ff=new Set;function _s(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var mr=Be.d;Be.d={f:h1,r:b1,D:v1,C:w1,L:y1,m:_1,X:k1,S:x1,M:N1};function h1(){var e=mr.f(),t=Ls();return e||t}function b1(e){var t=vn(e);t!==null&&t.tag===5&&t.type==="form"?Th(t):mr.r(e)}var xn=typeof document>"u"?null:document;function Lb(e,t,a){var r=xn;if(r&&typeof t=="string"&&t){var i=ba(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),Ff.has(i)||(Ff.add(i),e={rel:e,crossOrigin:a,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),zt(t,"link",e),Nt(t),r.head.appendChild(t)))}}function v1(e){mr.D(e),Lb("dns-prefetch",e,null)}function w1(e,t){mr.C(e,t),Lb("preconnect",e,t)}function y1(e,t,a){mr.L(e,t,a);var r=xn;if(r&&e&&t){var i='link[rel="preload"][as="'+ba(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+ba(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+ba(a.imageSizes)+'"]')):i+='[href="'+ba(e)+'"]';var n=i;switch(t){case"style":n=gn(e);break;case"script":n=kn(e)}xa.has(n)||(e=tt({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),xa.set(n,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(Zo(n))||t==="script"&&r.querySelector(Ko(n))||(t=r.createElement("link"),zt(t,"link",e),Nt(t),r.head.appendChild(t)))}}function _1(e,t){mr.m(e,t);var a=xn;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ba(r)+'"][href="'+ba(e)+'"]',n=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=kn(e)}if(!xa.has(n)&&(e=tt({rel:"modulepreload",href:e},t),xa.set(n,e),a.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ko(n)))return}r=a.createElement("link"),zt(r,"link",e),Nt(r),a.head.appendChild(r)}}}function x1(e,t,a){mr.S(e,t,a);var r=xn;if(r&&e){var i=Ii(r).hoistableStyles,n=gn(e);t=t||"default";var o=i.get(n);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Zo(n)))l.loading=5;else{e=tt({rel:"stylesheet",href:e,"data-precedence":t},a),(a=xa.get(n))&&rd(e,a);var c=o=r.createElement("link");Nt(c),zt(c,"link",e),c._p=new Promise(function(p,d){c.onload=p,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Zl(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},i.set(n,o)}}}function k1(e,t){mr.X(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Ko(i)),n||(e=tt({src:e,async:!0},t),(t=xa.get(i))&&id(e,t),n=a.createElement("script"),Nt(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function N1(e,t){mr.M(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Ko(i)),n||(e=tt({src:e,async:!0,type:"module"},t),(t=xa.get(i))&&id(e,t),n=a.createElement("script"),Nt(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function If(e,t,a,r){var i=(i=Ar.current)?_s(i):null;if(!i)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=gn(a.href),a=Ii(i).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=gn(a.href);var n=Ii(i).hoistableStyles,o=n.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,o),(n=i.querySelector(Zo(e)))&&!n._p&&(o.instance=n,o.state.loading=5),xa.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},xa.set(e,a),n||S1(i,e,a,o.state))),t&&r===null)throw Error(L(528,""));return o}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=kn(a),a=Ii(i).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(L(444,e))}}function gn(e){return'href="'+ba(e)+'"'}function Zo(e){return'link[rel="stylesheet"]['+e+"]"}function Hb(e){return tt({},e,{"data-precedence":e.precedence,precedence:null})}function S1(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),zt(t,"link",a),Nt(t),e.head.appendChild(t))}function kn(e){return'[src="'+ba(e)+'"]'}function Ko(e){return"script[async]"+e}function Wf(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ba(a.href)+'"]');if(r)return t.instance=r,Nt(r),r;var i=tt({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Nt(r),zt(r,"style",i),Zl(r,a.precedence,e),t.instance=r;case"stylesheet":i=gn(a.href);var n=e.querySelector(Zo(i));if(n)return t.state.loading|=4,t.instance=n,Nt(n),n;r=Hb(a),(i=xa.get(i))&&rd(r,i),n=(e.ownerDocument||e).createElement("link"),Nt(n);var o=n;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),t.state.loading|=4,Zl(n,a.precedence,e),t.instance=n;case"script":return n=kn(a.src),(i=e.querySelector(Ko(n)))?(t.instance=i,Nt(i),i):(r=a,(i=xa.get(n))&&(r=tt({},a),id(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),Nt(i),zt(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Zl(r,a.precedence,e));return t.instance}function Zl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,n=i,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)n=l;else if(n!==i)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function rd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function id(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Kl=null;function eg(e,t,a){if(Kl===null){var r=new Map,i=Kl=new Map;i.set(a,r)}else i=Kl,r=i.get(a),r||(r=new Map,i.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),i=0;i<a.length;i++){var n=a[i];if(!(n[Qo]||n[Et]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var o=n.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(n):r.set(o,[n])}}return r}function tg(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function C1(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function jb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function q1(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=gn(r.href),n=t.querySelector(Zo(i));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=xs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=n,Nt(n);return}n=t.ownerDocument||t,r=Hb(r),(i=xa.get(i))&&rd(r,i),n=n.createElement("link"),Nt(n);var o=n;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),a.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=xs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var bu=0;function E1(e,t){return e.stylesheets&&e.count===0&&Pl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Pl(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&bu===0&&(bu=62500*s1());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pl(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>bu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function xs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ks=null;function Pl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ks=new Map,t.forEach(M1,e),ks=null,xs.call(e))}function M1(e,t){if(!(t.state.loading&4)){var a=ks.get(e);if(a)var r=a.get(null);else{a=new Map,ks.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<i.length;n++){var o=i[n];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}i=t.instance,o=i.getAttribute("data-precedence"),n=a.get(o)||r,n===r&&a.set(null,i),a.set(o,i),this.count++,r=xs.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),n?n.parentNode.insertBefore(i,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Uo={$$typeof:ar,Provider:null,Consumer:null,_currentValue:ri,_currentValue2:ri,_threadCount:0};function T1(e,t,a,r,i,n,o,l,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yc(0),this.hiddenUpdates=Yc(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=n,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Qb(e,t,a,r,i,n,o,l,c,p,d,g){return e=new T1(e,t,a,o,c,p,d,g,l),t=1,n===!0&&(t|=24),n=aa(3,null,null,t),e.current=n,n.stateNode=e,t=Tp(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:r,isDehydrated:a,cache:t},Rp(n),e}function Gb(e){return e?(e=Ki,e):Ki}function Yb(e,t,a,r,i,n){i=Gb(i),r.context===null?r.context=i:r.pendingContext=i,r=Ur(t),r.payload={element:a},n=n===void 0?null:n,n!==null&&(r.callback=n),a=Dr(e,r,t),a!==null&&($t(a,e,t),fo(a,e,t))}function ag(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function nd(e,t){ag(e,t),(e=e.alternate)&&ag(e,t)}function Xb(e){if(e.tag===13||e.tag===31){var t=hi(e,67108864);t!==null&&$t(t,e,67108864),nd(e,67108864)}}function rg(e){if(e.tag===13||e.tag===31){var t=la();t=hp(t);var a=hi(e,t);a!==null&&$t(a,e,t),nd(e,t)}}var Ns=!0;function z1(e,t,a,r){var i=ue.T;ue.T=null;var n=Be.p;try{Be.p=2,od(e,t,a,r)}finally{Be.p=n,ue.T=i}}function A1(e,t,a,r){var i=ue.T;ue.T=null;var n=Be.p;try{Be.p=8,od(e,t,a,r)}finally{Be.p=n,ue.T=i}}function od(e,t,a,r){if(Ns){var i=pp(r);if(i===null)gu(e,t,r,Ss,a),ig(e,r);else if(U1(i,e,t,a,r))r.stopPropagation();else if(ig(e,r),t&4&&-1<R1.indexOf(e)){for(;i!==null;){var n=vn(i);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var o=ei(n.pendingLanes);if(o!==0){var l=n;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-oa(o);l.entanglements[1]|=c,o&=~c}Qa(n),(Oe&6)===0&&(fs=ia()+500,$o(0,!1))}}break;case 31:case 13:l=hi(n,2),l!==null&&$t(l,n,2),Ls(),nd(n,2)}if(n=pp(r),n===null&&gu(e,t,r,Ss,a),n===i)break;i=n}i!==null&&r.stopPropagation()}else gu(e,t,r,null,a)}}function pp(e){return e=yp(e),ld(e)}var Ss=null;function ld(e){if(Ss=null,e=Gi(e),e!==null){var t=Bo(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=ug(t),e!==null)return e;e=null}else if(a===31){if(e=pg(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ss=e,null}function Vb(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(y0()){case gg:return 2;case hg:return 8;case es:case _0:return 32;case bg:return 268435456;default:return 32}default:return 32}}var dp=!1,Lr=null,Hr=null,jr=null,Do=new Map,Oo=new Map,Cr=[],R1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ig(e,t){switch(e){case"focusin":case"focusout":Lr=null;break;case"dragenter":case"dragleave":Hr=null;break;case"mouseover":case"mouseout":jr=null;break;case"pointerover":case"pointerout":Do.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(t.pointerId)}}function ao(e,t,a,r,i,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:n,targetContainers:[i]},t!==null&&(t=vn(t),t!==null&&Xb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function U1(e,t,a,r,i){switch(t){case"focusin":return Lr=ao(Lr,e,t,a,r,i),!0;case"dragenter":return Hr=ao(Hr,e,t,a,r,i),!0;case"mouseover":return jr=ao(jr,e,t,a,r,i),!0;case"pointerover":var n=i.pointerId;return Do.set(n,ao(Do.get(n)||null,e,t,a,r,i)),!0;case"gotpointercapture":return n=i.pointerId,Oo.set(n,ao(Oo.get(n)||null,e,t,a,r,i)),!0}return!1}function $b(e){var t=Gi(e.target);if(t!==null){var a=Bo(t);if(a!==null){if(t=a.tag,t===13){if(t=ug(a),t!==null){e.blockedOn=t,jm(e.priority,function(){rg(a)});return}}else if(t===31){if(t=pg(a),t!==null){e.blockedOn=t,jm(e.priority,function(){rg(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=pp(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Tu=r,a.target.dispatchEvent(r),Tu=null}else return t=vn(a),t!==null&&Xb(t),e.blockedOn=a,!1;t.shift()}return!0}function ng(e,t,a){Jl(e)&&a.delete(t)}function D1(){dp=!1,Lr!==null&&Jl(Lr)&&(Lr=null),Hr!==null&&Jl(Hr)&&(Hr=null),jr!==null&&Jl(jr)&&(jr=null),Do.forEach(ng),Oo.forEach(ng)}function Ul(e,t){e.blockedOn===t&&(e.blockedOn=null,dp||(dp=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,D1)))}var Dl=null;function og(e){Dl!==e&&(Dl=e,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,function(){Dl===e&&(Dl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],i=e[t+2];if(typeof r!="function"){if(ld(r||a)===null)continue;break}var n=vn(a);n!==null&&(e.splice(t,3),t-=3,$u(n,{pending:!0,data:i,method:a.method,action:r},r,i))}}))}function hn(e){function t(c){return Ul(c,e)}Lr!==null&&Ul(Lr,e),Hr!==null&&Ul(Hr,e),jr!==null&&Ul(jr,e),Do.forEach(t),Oo.forEach(t);for(var a=0;a<Cr.length;a++){var r=Cr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cr.length&&(a=Cr[0],a.blockedOn===null);)$b(a),a.blockedOn===null&&Cr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var i=a[r],n=a[r+1],o=i[Zt]||null;if(typeof n=="function")o||og(a);else if(o){var l=null;if(n&&n.hasAttribute("formAction")){if(i=n,o=n[Zt]||null)l=o.formAction;else if(ld(i)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),og(a)}}}function Zb(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function sd(e){this._internalRoot=e}Qs.prototype.render=sd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var a=t.current,r=la();Yb(a,r,e,t,null,null)};Qs.prototype.unmount=sd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Yb(e.current,2,null,e,null,null),Ls(),t[bn]=null}};function Qs(e){this._internalRoot=e}Qs.prototype.unstable_scheduleHydration=function(e){if(e){var t=xg();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Cr.length&&t!==0&&t<Cr[a].priority;a++);Cr.splice(a,0,e),a===0&&$b(e)}};var lg=sg.version;if(lg!=="19.2.3")throw Error(L(527,lg,"19.2.3"));Be.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=m0(t),e=e!==null?dg(e):null,e=e===null?null:e.stateNode,e};var O1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:ue,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(ro=__REACT_DEVTOOLS_GLOBAL_HOOK__,!ro.isDisabled&&ro.supportsFiber))try{Lo=ro.inject(O1),na=ro}catch{}var ro;Gs.createRoot=function(e,t){if(!cg(e))throw Error(L(299));var a=!1,r="",i=Lh,n=Hh,o=jh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Qb(e,1,!1,null,null,a,r,null,i,n,o,Zb),e[bn]=t.current,ad(e),new sd(t)};Gs.hydrateRoot=function(e,t,a){if(!cg(e))throw Error(L(299));var r=!1,i="",n=Lh,o=Hh,l=jh,c=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(n=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(c=a.formState)),t=Qb(e,1,!0,t,a??null,r,i,c,n,o,l,Zb),t.context=Gb(null),a=t.current,r=la(),r=hp(r),i=Ur(r),i.callback=null,Dr(a,i,r),a=r,t.current.lanes=a,jo(t,a),Qa(t),e[bn]=t.current,ad(e),new Qs(t)};Gs.version="19.2.3"});var Fb=Ua((hx,Jb)=>{"use strict";function Pb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Pb)}catch(e){console.error(e)}}Pb(),Jb.exports=Kb()});var Gv=Ua($s=>{"use strict";var X1=Symbol.for("react.transitional.element"),V1=Symbol.for("react.fragment");function Qv(e,t,a){var r=null;if(a!==void 0&&(r=""+a),t.key!==void 0&&(r=""+t.key),"key"in t){a={};for(var i in t)i!=="key"&&(a[i]=t[i])}else a=t;return t=a.ref,{$$typeof:X1,type:e,key:r,ref:t!==void 0?t:null,props:a}}$s.Fragment=V1;$s.jsx=Qv;$s.jsxs=Qv});var ie=Ua((Yk,Yv)=>{"use strict";Yv.exports=Gv()});var Dw=X(Fb());var Ib=`/* Every rule is scoped to .app-wrapper, the root of each widget, so nothing here styles
|
|
8
|
+
`+r.stack}}var Su=Object.prototype.hasOwnProperty,gp=yt.unstable_scheduleCallback,Gc=yt.unstable_cancelCallback,y0=yt.unstable_shouldYield,_0=yt.unstable_requestPaint,na=yt.unstable_now,x0=yt.unstable_getCurrentPriorityLevel,bg=yt.unstable_ImmediatePriority,vg=yt.unstable_UserBlockingPriority,es=yt.unstable_NormalPriority,k0=yt.unstable_LowPriority,wg=yt.unstable_IdlePriority,N0=yt.log,S0=yt.unstable_setDisableYieldValue,Lo=null,oa=null;function Er(e){if(typeof N0=="function"&&S0(e),oa&&typeof oa.setStrictMode=="function")try{oa.setStrictMode(Lo,e)}catch{}}var la=Math.clz32?Math.clz32:E0,C0=Math.log,q0=Math.LN2;function E0(e){return e>>>=0,e===0?32:31-(C0(e)/q0|0)|0}var wl=256,yl=262144,_l=4194304;function ei(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Cs(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~n,r!==0?i=ei(r):(o&=l,o!==0?i=ei(o):a||(a=l&~e,a!==0&&(i=ei(a))))):(l=r&~n,l!==0?i=ei(l):o!==0?i=ei(o):a||(a=r&~e,a!==0&&(i=ei(a)))),i===0?0:t!==0&&t!==i&&(t&n)===0&&(n=i&-i,a=t&-t,n>=a||n===32&&(a&4194048)!==0)?t:i}function Ho(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function M0(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yg(){var e=_l;return _l<<=1,(_l&62914560)===0&&(_l=4194304),e}function Yc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function jo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function T0(e,t,a,r,i,n){var o=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var d=31-la(a),g=1<<d;l[d]=0,c[d]=-1;var f=p[d];if(f!==null)for(p[d]=null,d=0;d<f.length;d++){var h=f[d];h!==null&&(h.lane&=-536870913)}a&=~g}r!==0&&_g(e,r,0),n!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=n&~(o&~t))}function _g(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-la(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function xg(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-la(a),i=1<<r;i&t|e[r]&t&&(e[r]|=t),a&=~i}}function kg(e,t){var a=t&-t;return a=(a&42)!==0?1:hp(a),(a&(e.suspendedLanes|t))!==0?0:a}function hp(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function bp(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ng(){var e=Be.p;return e!==0?e:(e=window.event,e===void 0?32:Zb(e.type))}function Gm(e,t){var a=Be.p;try{return Be.p=e,t()}finally{Be.p=a}}var $r=Math.random().toString(36).slice(2),Et="__reactFiber$"+$r,Kt="__reactProps$"+$r,bn="__reactContainer$"+$r,Cu="__reactEvents$"+$r,z0="__reactListeners$"+$r,A0="__reactHandles$"+$r,Ym="__reactResources$"+$r,Qo="__reactMarker$"+$r;function vp(e){delete e[Et],delete e[Kt],delete e[Cu],delete e[z0],delete e[A0]}function Gi(e){var t=e[Et];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[Et]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Ff(e);e!==null;){if(a=e[Et])return a;e=Ff(e)}return t}e=a,a=e.parentNode}return null}function vn(e){if(e=e[Et]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function oo(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Fi(e){var t=e[Ym];return t||(t=e[Ym]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Nt(e){e[Qo]=!0}var Sg=new Set,Cg={};function mi(e,t){ln(e,t),ln(e+"Capture",t)}function ln(e,t){for(Cg[e]=t,e=0;e<t.length;e++)Sg.add(t[e])}var R0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Xm={},Vm={};function U0(e){return Su.call(Vm,e)?!0:Su.call(Xm,e)?!1:R0.test(e)?Vm[e]=!0:(Xm[e]=!0,!1)}function Ol(e,t,a){if(U0(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function xl(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Pa(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function ga(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function D0(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){a=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(o){a=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qu(e){if(!e._valueTracker){var t=qg(e)?"checked":"value";e._valueTracker=D0(e,t,""+e[t])}}function Eg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=qg(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function ts(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var O0=/[\n"\\]/g;function va(e){return e.replace(O0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eu(e,t,a,r,i,n,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ga(t)):e.value!==""+ga(t)&&(e.value=""+ga(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Mu(e,o,ga(t)):a!=null?Mu(e,o,ga(a)):r!=null&&e.removeAttribute("value"),i==null&&n!=null&&(e.defaultChecked=!!n),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+ga(l):e.removeAttribute("name")}function Mg(e,t,a,r,i,n,o,l){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||a!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){qu(e);return}a=a!=null?""+ga(a):"",t=t!=null?""+ga(t):a,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),qu(e)}function Mu(e,t,a){t==="number"&&ts(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Wi(e,t,a,r){if(e=e.options,t){t={};for(var i=0;i<a.length;i++)t["$"+a[i]]=!0;for(a=0;a<e.length;a++)i=t.hasOwnProperty("$"+e[a].value),e[a].selected!==i&&(e[a].selected=i),i&&r&&(e[a].defaultSelected=!0)}else{for(a=""+ga(a),t=null,i=0;i<e.length;i++){if(e[i].value===a){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Tg(e,t,a){if(t!=null&&(t=""+ga(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+ga(a):""}function zg(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(L(92));if(no(r)){if(1<r.length)throw Error(L(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=ga(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),qu(e)}function sn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var B0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $m(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||B0.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Ag(e,t,a){if(t!=null&&typeof t!="object")throw Error(L(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&a[i]!==r&&$m(e,i,r)}else for(var n in t)t.hasOwnProperty(n)&&$m(e,n,t[n])}function wp(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var L0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),H0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bl(e){return H0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function rr(){}var Tu=null;function yp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,en=null;function Zm(e){var t=vn(e);if(t&&(e=t.stateNode)){var a=e[Kt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Eu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+va(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var i=r[Kt]||null;if(!i)throw Error(L(90));Eu(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Eg(r)}break e;case"textarea":Tg(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Wi(e,!!a.multiple,t,!1)}}}var Xc=!1;function Rg(e,t,a){if(Xc)return e(t,a);Xc=!0;try{var r=e(t);return r}finally{if(Xc=!1,(Yi!==null||en!==null)&&(Ls(),Yi&&(t=Yi,e=en,en=Yi=null,Zm(t),e)))for(t=0;t<e.length;t++)Zm(e[t])}}function No(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Kt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(L(231,t,typeof a));return a}var sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zu=!1;if(sr)try{Di={},Object.defineProperty(Di,"passive",{get:function(){zu=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{zu=!1}var Di,Mr=null,_p=null,Ll=null;function Ug(){if(Ll)return Ll;var e,t=_p,a=t.length,r,i="value"in Mr?Mr.value:Mr.textContent,n=i.length;for(e=0;e<a&&t[e]===i[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===i[n-r];r++);return Ll=i.slice(e,1<r?1-r:void 0)}function Hl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function kl(){return!0}function Km(){return!1}function Pt(e){function t(a,r,i,n,o){this._reactName=a,this._targetInst=i,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?kl:Km,this.isPropagationStopped=Km,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),t}var fi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qs=Pt(fi),Go=tt({},fi,{view:0,detail:0}),j0=Pt(Go),Vc,$c,Fn,Es=tt({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xp,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Fn&&(Fn&&e.type==="mousemove"?(Vc=e.screenX-Fn.screenX,$c=e.screenY-Fn.screenY):$c=Vc=0,Fn=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:$c}}),Pm=Pt(Es),Q0=tt({},Es,{dataTransfer:0}),G0=Pt(Q0),Y0=tt({},Go,{relatedTarget:0}),Zc=Pt(Y0),X0=tt({},fi,{animationName:0,elapsedTime:0,pseudoElement:0}),V0=Pt(X0),$0=tt({},fi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Z0=Pt($0),K0=tt({},fi,{data:0}),Jm=Pt(K0),P0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},I0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function F0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=I0[e])?!!t[e]:!1}function xp(){return F0}var W0=tt({},Go,{key:function(e){if(e.key){var t=P0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?J0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xp,charCode:function(e){return e.type==="keypress"?Hl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ey=Pt(W0),ty=tt({},Es,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Im=Pt(ty),ay=tt({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xp}),ry=Pt(ay),iy=tt({},fi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ny=Pt(iy),oy=tt({},Es,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ly=Pt(oy),sy=tt({},fi,{newState:0,oldState:0}),cy=Pt(sy),uy=[9,13,27,32],kp=sr&&"CompositionEvent"in window,co=null;sr&&"documentMode"in document&&(co=document.documentMode);var py=sr&&"TextEvent"in window&&!co,Dg=sr&&(!kp||co&&8<co&&11>=co),Fm=" ",Wm=!1;function Og(e,t){switch(e){case"keyup":return uy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xi=!1;function dy(e,t){switch(e){case"compositionend":return Bg(t);case"keypress":return t.which!==32?null:(Wm=!0,Fm);case"textInput":return e=t.data,e===Fm&&Wm?null:e;default:return null}}function my(e,t){if(Xi)return e==="compositionend"||!kp&&Og(e,t)?(e=Ug(),Ll=_p=Mr=null,Xi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Dg&&t.locale!=="ko"?null:t.data;default:return null}}var fy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ef(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!fy[e.type]:t==="textarea"}function Lg(e,t,a,r){Yi?en?en.push(r):en=[r]:Yi=r,t=ws(t,"onChange"),0<t.length&&(a=new qs("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var uo=null,So=null;function gy(e){Rb(e,0)}function Ms(e){var t=oo(e);if(Eg(t))return e}function tf(e,t){if(e==="change")return t}var Hg=!1;sr&&(sr?(Sl="oninput"in document,Sl||(Kc=document.createElement("div"),Kc.setAttribute("oninput","return;"),Sl=typeof Kc.oninput=="function"),Nl=Sl):Nl=!1,Hg=Nl&&(!document.documentMode||9<document.documentMode));var Nl,Sl,Kc;function af(){uo&&(uo.detachEvent("onpropertychange",jg),So=uo=null)}function jg(e){if(e.propertyName==="value"&&Ms(So)){var t=[];Lg(t,So,e,yp(e)),Rg(gy,t)}}function hy(e,t,a){e==="focusin"?(af(),uo=t,So=a,uo.attachEvent("onpropertychange",jg)):e==="focusout"&&af()}function by(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ms(So)}function vy(e,t){if(e==="click")return Ms(t)}function wy(e,t){if(e==="input"||e==="change")return Ms(t)}function yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ca=typeof Object.is=="function"?Object.is:yy;function Co(e,t){if(ca(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var i=a[r];if(!Su.call(t,i)||!ca(e[i],t[i]))return!1}return!0}function rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function nf(e,t){var a=rf(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=rf(a)}}function Qg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ts(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=ts(e.document)}return t}function Np(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var _y=sr&&"documentMode"in document&&11>=document.documentMode,Vi=null,Au=null,po=null,Ru=!1;function of(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ru||Vi==null||Vi!==ts(r)||(r=Vi,"selectionStart"in r&&Np(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),po&&Co(po,r)||(po=r,r=ws(Au,"onSelect"),0<r.length&&(t=new qs("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Vi)))}function Fr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var $i={animationend:Fr("Animation","AnimationEnd"),animationiteration:Fr("Animation","AnimationIteration"),animationstart:Fr("Animation","AnimationStart"),transitionrun:Fr("Transition","TransitionRun"),transitionstart:Fr("Transition","TransitionStart"),transitioncancel:Fr("Transition","TransitionCancel"),transitionend:Fr("Transition","TransitionEnd")},Pc={},Yg={};sr&&(Yg=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function gi(e){if(Pc[e])return Pc[e];if(!$i[e])return e;var t=$i[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Yg)return Pc[e]=t[a];return e}var Xg=gi("animationend"),Vg=gi("animationiteration"),$g=gi("animationstart"),xy=gi("transitionrun"),ky=gi("transitionstart"),Ny=gi("transitioncancel"),Zg=gi("transitionend"),Kg=new Map,Uu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Uu.push("scrollEnd");function Aa(e,t){Kg.set(e,t),mi(t,[e])}var as=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},fa=[],Zi=0,Sp=0;function Ts(){for(var e=Zi,t=Sp=Zi=0;t<e;){var a=fa[t];fa[t++]=null;var r=fa[t];fa[t++]=null;var i=fa[t];fa[t++]=null;var n=fa[t];if(fa[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}n!==0&&Pg(a,i,n)}}function zs(e,t,a,r){fa[Zi++]=e,fa[Zi++]=t,fa[Zi++]=a,fa[Zi++]=r,Sp|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Cp(e,t,a,r){return zs(e,t,a,r),rs(e)}function hi(e,t){return zs(e,null,null,t),rs(e)}function Pg(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var i=!1,n=e.return;n!==null;)n.childLanes|=a,r=n.alternate,r!==null&&(r.childLanes|=a),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(i=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,i&&t!==null&&(i=31-la(a),e=n.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=a|536870912),n):null}function rs(e){if(50<_o)throw _o=0,tp=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ki={};function Sy(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(e,t,a,r){return new Sy(e,t,a,r)}function qp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nr(e,t){var a=e.alternate;return a===null?(a=ra(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Jg(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function jl(e,t,a,r,i,n){var o=0;if(r=e,typeof e=="function")qp(e)&&(o=1);else if(typeof e=="string")o=E1(e,a,Ha.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case _u:return e=ra(31,a,t,i),e.elementType=_u,e.lanes=n,e;case ji:return ii(a.children,i,n,t);case gg:o=8,i|=24;break;case vu:return e=ra(12,a,t,i|2),e.elementType=vu,e.lanes=n,e;case wu:return e=ra(13,a,t,i),e.elementType=wu,e.lanes=n,e;case yu:return e=ra(19,a,t,i),e.elementType=yu,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ar:o=10;break e;case hg:o=9;break e;case mp:o=11;break e;case fp:o=14;break e;case xr:o=16,r=null;break e}o=29,a=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=ra(o,a,t,i),t.elementType=e,t.type=r,t.lanes=n,t}function ii(e,t,a,r){return e=ra(7,e,r,t),e.lanes=a,e}function Jc(e,t,a){return e=ra(6,e,null,t),e.lanes=a,e}function Ig(e){var t=ra(18,null,null,0);return t.stateNode=e,t}function Ic(e,t,a){return t=ra(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var lf=new WeakMap;function wa(e,t){if(typeof e=="object"&&e!==null){var a=lf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Qm(t)},lf.set(e,t),t)}return{value:e,source:t,stack:Qm(t)}}var Pi=[],Ji=0,is=null,qo=0,ha=[],ba=0,Gr=null,Oa=1,Ba="";function er(e,t){Pi[Ji++]=qo,Pi[Ji++]=is,is=e,qo=t}function Fg(e,t,a){ha[ba++]=Oa,ha[ba++]=Ba,ha[ba++]=Gr,Gr=e;var r=Oa;e=Ba;var i=32-la(r)-1;r&=~(1<<i),a+=1;var n=32-la(t)+i;if(30<n){var o=i-i%5;n=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Oa=1<<32-la(t)+i|a<<i|r,Ba=n+e}else Oa=1<<n|a<<i|r,Ba=e}function Ep(e){e.return!==null&&(er(e,1),Fg(e,1,0))}function Mp(e){for(;e===is;)is=Pi[--Ji],Pi[Ji]=null,qo=Pi[--Ji],Pi[Ji]=null;for(;e===Gr;)Gr=ha[--ba],ha[ba]=null,Ba=ha[--ba],ha[ba]=null,Oa=ha[--ba],ha[ba]=null}function Wg(e,t){ha[ba++]=Oa,ha[ba++]=Ba,ha[ba++]=Gr,Oa=t.id,Ba=t.overflow,Gr=e}var Mt=null,et=null,Te=!1,Ur=null,ya=!1,Du=Error(L(519));function Yr(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(wa(t,e)),Du}function sf(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Et]=e,t[Kt]=r,a){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(a=0;a<Ao.length;a++)Ce(Ao[a],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),Mg(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),zg(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||Db(t.textContent,a)?(r.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),r.onScroll!=null&&Ce("scroll",t),r.onScrollEnd!=null&&Ce("scrollend",t),r.onClick!=null&&(t.onclick=rr),t=!0):t=!1,t||Yr(e,!0)}function cf(e){for(Mt=e.return;Mt;)switch(Mt.tag){case 5:case 31:case 13:ya=!1;return;case 27:case 3:ya=!0;return;default:Mt=Mt.return}}function Oi(e){if(e!==Mt)return!1;if(!Te)return cf(e),Te=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||op(e.type,e.memoizedProps)),a=!a),a&&et&&Yr(e),cf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));et=If(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));et=If(e)}else t===27?(t=et,Zr(e.type)?(e=up,up=null,et=e):et=t):et=Mt?xa(e.stateNode.nextSibling):null;return!0}function si(){et=Mt=null,Te=!1}function Fc(){var e=Ur;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),Ur=null),e}function Eo(e){Ur===null?Ur=[e]:Ur.push(e)}var Ou=ja(null),bi=null,ir=null;function Nr(e,t,a){Pe(Ou,t._currentValue),t._currentValue=a}function or(e){e._currentValue=Ou.current,St(Ou)}function Bu(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Lu(e,t,a,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var n=i.dependencies;if(n!==null){var o=i.child;n=n.firstContext;e:for(;n!==null;){var l=n;n=i;for(var c=0;c<t.length;c++)if(l.context===t[c]){n.lanes|=a,l=n.alternate,l!==null&&(l.lanes|=a),Bu(n.return,a,e),r||(o=null);break e}n=l.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=a,n=o.alternate,n!==null&&(n.lanes|=a),Bu(o,a,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function wn(e,t,a,r){e=null;for(var i=t,n=!1;i!==null;){if(!n){if((i.flags&524288)!==0)n=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(L(387));if(o=o.memoizedProps,o!==null){var l=i.type;ca(i.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(i===Il.current){if(o=i.alternate,o===null)throw Error(L(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Uo):e=[Uo])}i=i.return}e!==null&&Lu(t,e,a,r),t.flags|=262144}function ns(e){for(e=e.firstContext;e!==null;){if(!ca(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ci(e){bi=e,ir=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return eh(bi,e)}function Cl(e,t){return bi===null&&ci(e),eh(e,t)}function eh(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ir===null){if(e===null)throw Error(L(308));ir=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ir=ir.next=t;return a}var Cy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},qy=yt.unstable_scheduleCallback,Ey=yt.unstable_NormalPriority,bt={$$typeof:ar,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tp(){return{controller:new Cy,data:new Map,refCount:0}}function Yo(e){e.refCount--,e.refCount===0&&qy(Ey,function(){e.controller.abort()})}var mo=null,Hu=0,cn=0,tn=null;function My(e,t){if(mo===null){var a=mo=[];Hu=0,cn=td(),tn={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Hu++,t.then(uf,uf),t}function uf(){if(--Hu===0&&mo!==null){tn!==null&&(tn.status="fulfilled");var e=mo;mo=null,cn=0,tn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ty(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(i){a.push(i)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var i=0;i<a.length;i++)(0,a[i])(t)},function(i){for(r.status="rejected",r.reason=i,i=0;i<a.length;i++)(0,a[i])(void 0)}),r}var pf=ue.S;ue.S=function(e,t){fb=na(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&My(e,t),pf!==null&&pf(e,t)};var ni=ja(null);function zp(){var e=ni.current;return e!==null?e:Ze.pooledCache}function Ql(e,t){t===null?Pe(ni,ni.current):Pe(ni,t.pool)}function th(){var e=zp();return e===null?null:{parent:bt._currentValue,pool:e}}var yn=Error(L(460)),Ap=Error(L(474)),As=Error(L(542)),os={then:function(){}};function df(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ah(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(rr,rr),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ff(e),e;default:if(typeof t.status=="string")t.then(rr,rr);else{if(e=Ze,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=r}},function(r){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ff(e),e}throw oi=t,yn}}function ti(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(oi=a,yn):a}}var oi=null;function mf(){if(oi===null)throw Error(L(459));var e=oi;return oi=null,e}function ff(e){if(e===yn||e===As)throw Error(L(483))}var an=null,Mo=0;function ql(e){var t=Mo;return Mo+=1,an===null&&(an=[]),ah(an,e,t)}function Wn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function El(e,t){throw t.$$typeof===h0?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function rh(e){function t(m,u){if(e){var b=m.deletions;b===null?(m.deletions=[u],m.flags|=16):b.push(u)}}function a(m,u){if(!e)return null;for(;u!==null;)t(m,u),u=u.sibling;return null}function r(m){for(var u=new Map;m!==null;)m.key!==null?u.set(m.key,m):u.set(m.index,m),m=m.sibling;return u}function i(m,u){return m=nr(m,u),m.index=0,m.sibling=null,m}function n(m,u,b){return m.index=b,e?(b=m.alternate,b!==null?(b=b.index,b<u?(m.flags|=67108866,u):b):(m.flags|=67108866,u)):(m.flags|=1048576,u)}function o(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function l(m,u,b,v){return u===null||u.tag!==6?(u=Jc(b,m.mode,v),u.return=m,u):(u=i(u,b),u.return=m,u)}function c(m,u,b,v){var N=b.type;return N===ji?d(m,u,b.props.children,v,b.key):u!==null&&(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===xr&&ti(N)===u.type)?(u=i(u,b.props),Wn(u,b),u.return=m,u):(u=jl(b.type,b.key,b.props,null,m.mode,v),Wn(u,b),u.return=m,u)}function p(m,u,b,v){return u===null||u.tag!==4||u.stateNode.containerInfo!==b.containerInfo||u.stateNode.implementation!==b.implementation?(u=Ic(b,m.mode,v),u.return=m,u):(u=i(u,b.children||[]),u.return=m,u)}function d(m,u,b,v,N){return u===null||u.tag!==7?(u=ii(b,m.mode,v,N),u.return=m,u):(u=i(u,b),u.return=m,u)}function g(m,u,b){if(typeof u=="string"&&u!==""||typeof u=="number"||typeof u=="bigint")return u=Jc(""+u,m.mode,b),u.return=m,u;if(typeof u=="object"&&u!==null){switch(u.$$typeof){case vl:return b=jl(u.type,u.key,u.props,null,m.mode,b),Wn(b,u),b.return=m,b;case io:return u=Ic(u,m.mode,b),u.return=m,u;case xr:return u=ti(u),g(m,u,b)}if(no(u)||In(u))return u=ii(u,m.mode,b,null),u.return=m,u;if(typeof u.then=="function")return g(m,ql(u),b);if(u.$$typeof===ar)return g(m,Cl(m,u),b);El(m,u)}return null}function f(m,u,b,v){var N=u!==null?u.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return N!==null?null:l(m,u,""+b,v);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vl:return b.key===N?c(m,u,b,v):null;case io:return b.key===N?p(m,u,b,v):null;case xr:return b=ti(b),f(m,u,b,v)}if(no(b)||In(b))return N!==null?null:d(m,u,b,v,null);if(typeof b.then=="function")return f(m,u,ql(b),v);if(b.$$typeof===ar)return f(m,u,Cl(m,b),v);El(m,b)}return null}function h(m,u,b,v,N){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return m=m.get(b)||null,l(u,m,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case vl:return m=m.get(v.key===null?b:v.key)||null,c(u,m,v,N);case io:return m=m.get(v.key===null?b:v.key)||null,p(u,m,v,N);case xr:return v=ti(v),h(m,u,b,v,N)}if(no(v)||In(v))return m=m.get(b)||null,d(u,m,v,N,null);if(typeof v.then=="function")return h(m,u,b,ql(v),N);if(v.$$typeof===ar)return h(m,u,b,Cl(u,v),N);El(u,v)}return null}function w(m,u,b,v){for(var N=null,A=null,T=u,z=u=0,G=null;T!==null&&z<b.length;z++){T.index>z?(G=T,T=null):G=T.sibling;var P=f(m,T,b[z],v);if(P===null){T===null&&(T=G);break}e&&T&&P.alternate===null&&t(m,T),u=n(P,u,z),A===null?N=P:A.sibling=P,A=P,T=G}if(z===b.length)return a(m,T),Te&&er(m,z),N;if(T===null){for(;z<b.length;z++)T=g(m,b[z],v),T!==null&&(u=n(T,u,z),A===null?N=T:A.sibling=T,A=T);return Te&&er(m,z),N}for(T=r(T);z<b.length;z++)G=h(T,m,z,b[z],v),G!==null&&(e&&G.alternate!==null&&T.delete(G.key===null?z:G.key),u=n(G,u,z),A===null?N=G:A.sibling=G,A=G);return e&&T.forEach(function(be){return t(m,be)}),Te&&er(m,z),N}function M(m,u,b,v){if(b==null)throw Error(L(151));for(var N=null,A=null,T=u,z=u=0,G=null,P=b.next();T!==null&&!P.done;z++,P=b.next()){T.index>z?(G=T,T=null):G=T.sibling;var be=f(m,T,P.value,v);if(be===null){T===null&&(T=G);break}e&&T&&be.alternate===null&&t(m,T),u=n(be,u,z),A===null?N=be:A.sibling=be,A=be,T=G}if(P.done)return a(m,T),Te&&er(m,z),N;if(T===null){for(;!P.done;z++,P=b.next())P=g(m,P.value,v),P!==null&&(u=n(P,u,z),A===null?N=P:A.sibling=P,A=P);return Te&&er(m,z),N}for(T=r(T);!P.done;z++,P=b.next())P=h(T,m,z,P.value,v),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?z:P.key),u=n(P,u,z),A===null?N=P:A.sibling=P,A=P);return e&&T.forEach(function(De){return t(m,De)}),Te&&er(m,z),N}function D(m,u,b,v){if(typeof b=="object"&&b!==null&&b.type===ji&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case vl:e:{for(var N=b.key;u!==null;){if(u.key===N){if(N=b.type,N===ji){if(u.tag===7){a(m,u.sibling),v=i(u,b.props.children),v.return=m,m=v;break e}}else if(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===xr&&ti(N)===u.type){a(m,u.sibling),v=i(u,b.props),Wn(v,b),v.return=m,m=v;break e}a(m,u);break}else t(m,u);u=u.sibling}b.type===ji?(v=ii(b.props.children,m.mode,v,b.key),v.return=m,m=v):(v=jl(b.type,b.key,b.props,null,m.mode,v),Wn(v,b),v.return=m,m=v)}return o(m);case io:e:{for(N=b.key;u!==null;){if(u.key===N)if(u.tag===4&&u.stateNode.containerInfo===b.containerInfo&&u.stateNode.implementation===b.implementation){a(m,u.sibling),v=i(u,b.children||[]),v.return=m,m=v;break e}else{a(m,u);break}else t(m,u);u=u.sibling}v=Ic(b,m.mode,v),v.return=m,m=v}return o(m);case xr:return b=ti(b),D(m,u,b,v)}if(no(b))return w(m,u,b,v);if(In(b)){if(N=In(b),typeof N!="function")throw Error(L(150));return b=N.call(b),M(m,u,b,v)}if(typeof b.then=="function")return D(m,u,ql(b),v);if(b.$$typeof===ar)return D(m,u,Cl(m,b),v);El(m,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,u!==null&&u.tag===6?(a(m,u.sibling),v=i(u,b),v.return=m,m=v):(a(m,u),v=Jc(b,m.mode,v),v.return=m,m=v),o(m)):a(m,u)}return function(m,u,b,v){try{Mo=0;var N=D(m,u,b,v);return an=null,N}catch(T){if(T===yn||T===As)throw T;var A=ra(29,T,null,m.mode);return A.lanes=v,A.return=m,A}}}var ui=rh(!0),ih=rh(!1),kr=!1;function Rp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ju(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Dr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Or(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Oe&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=rs(e),Pg(e,null,a),t}return zs(e,r,t,a),rs(e)}function fo(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,xg(e,a)}}function Wc(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var i=null,n=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};n===null?i=n=o:n=n.next=o,a=a.next}while(a!==null);n===null?i=n=t:n=n.next=t}else i=n=t;a={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:n,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Qu=!1;function go(){if(Qu){var e=tn;if(e!==null)throw e}}function ho(e,t,a,r){Qu=!1;var i=e.updateQueue;kr=!1;var n=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,p=c.next;c.next=null,o===null?n=p:o.next=p,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=p:l.next=p,d.lastBaseUpdate=c))}if(n!==null){var g=i.baseState;o=0,d=p=c=null,l=n;do{var f=l.lane&-536870913,h=f!==l.lane;if(h?(Me&f)===f:(r&f)===f){f!==0&&f===cn&&(Qu=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var w=e,M=l;f=t;var D=a;switch(M.tag){case 1:if(w=M.payload,typeof w=="function"){g=w.call(D,g,f);break e}g=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=M.payload,f=typeof w=="function"?w.call(D,g,f):w,f==null)break e;g=tt({},g,f);break e;case 2:kr=!0}}f=l.callback,f!==null&&(e.flags|=64,h&&(e.flags|=8192),h=i.callbacks,h===null?i.callbacks=[f]:h.push(f))}else h={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(p=d=h,c=g):d=d.next=h,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;h=l,l=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);d===null&&(c=g),i.baseState=c,i.firstBaseUpdate=p,i.lastBaseUpdate=d,n===null&&(i.shared.lanes=0),Vr|=o,e.lanes=o,e.memoizedState=g}}function nh(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function oh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)nh(a[e],t)}var un=ja(null),ls=ja(0);function gf(e,t){e=dr,Pe(ls,e),Pe(un,t),dr=e|t.baseLanes}function Gu(){Pe(ls,dr),Pe(un,un.current)}function Up(){dr=ls.current,St(un),St(ls)}var ua=ja(null),_a=null;function Sr(e){var t=e.alternate;Pe(dt,dt.current&1),Pe(ua,e),_a===null&&(t===null||un.current!==null||t.memoizedState!==null)&&(_a=e)}function Yu(e){Pe(dt,dt.current),Pe(ua,e),_a===null&&(_a=e)}function lh(e){e.tag===22?(Pe(dt,dt.current),Pe(ua,e),_a===null&&(_a=e)):Cr(e)}function Cr(){Pe(dt,dt.current),Pe(ua,ua.current)}function aa(e){St(ua),_a===e&&(_a=null),St(dt)}var dt=ja(0);function ss(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||sp(a)||cp(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var cr=0,ve=null,$e=null,gt=null,cs=!1,rn=!1,pi=!1,us=0,To=0,nn=null,zy=0;function lt(){throw Error(L(321))}function Dp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!ca(e[a],t[a]))return!1;return!0}function Op(e,t,a,r,i,n){return cr=n,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ue.H=e===null||e.memoizedState===null?Lh:Zp,pi=!1,n=a(r,i),pi=!1,rn&&(n=ch(t,a,r,i)),sh(e),n}function sh(e){ue.H=zo;var t=$e!==null&&$e.next!==null;if(cr=0,gt=$e=ve=null,cs=!1,To=0,nn=null,t)throw Error(L(300));e===null||vt||(e=e.dependencies,e!==null&&ns(e)&&(vt=!0))}function ch(e,t,a,r){ve=e;var i=0;do{if(rn&&(nn=null),To=0,rn=!1,25<=i)throw Error(L(301));if(i+=1,gt=$e=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}ue.H=Hh,n=t(a,r)}while(rn);return n}function Ay(){var e=ue.H,t=e.useState()[0];return t=typeof t.then=="function"?Xo(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(ve.flags|=1024),t}function Bp(){var e=us!==0;return us=0,e}function Lp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hp(e){if(cs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}cs=!1}cr=0,gt=$e=ve=null,rn=!1,To=us=0,nn=null}function Lt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?ve.memoizedState=gt=e:gt=gt.next=e,gt}function mt(){if($e===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=gt===null?ve.memoizedState:gt.next;if(t!==null)gt=t,$e=e;else{if(e===null)throw ve.alternate===null?Error(L(467)):Error(L(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},gt===null?ve.memoizedState=gt=e:gt=gt.next=e}return gt}function Rs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(e){var t=To;return To+=1,nn===null&&(nn=[]),e=ah(nn,e,t),t=ve,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,ue.H=t===null||t.memoizedState===null?Lh:Zp),e}function Us(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xo(e);if(e.$$typeof===ar)return Tt(e)}throw Error(L(438,String(e)))}function jp(e){var t=null,a=ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=ve.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Rs(),ve.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=b0;return t.index++,a}function ur(e,t){return typeof t=="function"?t(e):t}function Gl(e){var t=mt();return Qp(t,$e,e)}function Qp(e,t,a){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=a;var i=e.baseQueue,n=r.pending;if(n!==null){if(i!==null){var o=i.next;i.next=n.next,n.next=o}t.baseQueue=i=n,r.pending=null}if(n=e.baseState,i===null)e.memoizedState=n;else{t=i.next;var l=o=null,c=null,p=t,d=!1;do{var g=p.lane&-536870913;if(g!==p.lane?(Me&g)===g:(cr&g)===g){var f=p.revertLane;if(f===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),g===cn&&(d=!0);else if((cr&f)===f){p=p.next,f===cn&&(d=!0);continue}else g={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=g,o=n):c=c.next=g,ve.lanes|=f,Vr|=f;g=p.action,pi&&a(n,g),n=p.hasEagerState?p.eagerState:a(n,g)}else f={lane:g,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=f,o=n):c=c.next=f,ve.lanes|=g,Vr|=g;p=p.next}while(p!==null&&p!==t);if(c===null?o=n:c.next=l,!ca(n,e.memoizedState)&&(vt=!0,d&&(a=tn,a!==null)))throw a;e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function eu(e){var t=mt(),a=t.queue;if(a===null)throw Error(L(311));a.lastRenderedReducer=e;var r=a.dispatch,i=a.pending,n=t.memoizedState;if(i!==null){a.pending=null;var o=i=i.next;do n=e(n,o.action),o=o.next;while(o!==i);ca(n,t.memoizedState)||(vt=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),a.lastRenderedState=n}return[n,r]}function uh(e,t,a){var r=ve,i=mt(),n=Te;if(n){if(a===void 0)throw Error(L(407));a=a()}else a=t();var o=!ca(($e||i).memoizedState,a);if(o&&(i.memoizedState=a,vt=!0),i=i.queue,Gp(mh.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||gt!==null&>.memoizedState.tag&1){if(r.flags|=2048,pn(9,{destroy:void 0},dh.bind(null,r,i,a,t),null),Ze===null)throw Error(L(349));n||(cr&127)!==0||ph(r,t,a)}return a}function ph(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ve.updateQueue,t===null?(t=Rs(),ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function dh(e,t,a,r){t.value=a,t.getSnapshot=r,fh(t)&&gh(e)}function mh(e,t,a){return a(function(){fh(t)&&gh(e)})}function fh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!ca(e,a)}catch{return!0}}function gh(e){var t=hi(e,2);t!==null&&Zt(t,e,2)}function Xu(e){var t=Lt();if(typeof e=="function"){var a=e;if(e=a(),pi){Er(!0);try{a()}finally{Er(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:e},t}function hh(e,t,a,r){return e.baseState=a,Qp(e,$e,typeof r=="function"?r:ur)}function Ry(e,t,a,r,i){if(Os(e))throw Error(L(485));if(e=t.action,e!==null){var n={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){n.listeners.push(o)}};ue.T!==null?a(!0):n.isTransition=!1,r(n),a=t.pending,a===null?(n.next=t.pending=n,bh(t,n)):(n.next=a.next,t.pending=a.next=n)}}function bh(e,t){var a=t.action,r=t.payload,i=e.state;if(t.isTransition){var n=ue.T,o={};ue.T=o;try{var l=a(i,r),c=ue.S;c!==null&&c(o,l),hf(e,t,l)}catch(p){Vu(e,t,p)}finally{n!==null&&o.types!==null&&(n.types=o.types),ue.T=n}}else try{n=a(i,r),hf(e,t,n)}catch(p){Vu(e,t,p)}}function hf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){bf(e,t,r)},function(r){return Vu(e,t,r)}):bf(e,t,a)}function bf(e,t,a){t.status="fulfilled",t.value=a,vh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,bh(e,a)))}function Vu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,vh(t),t=t.next;while(t!==r)}e.action=null}function vh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function wh(e,t){return t}function vf(e,t){if(Te){var a=Ze.formState;if(a!==null){e:{var r=ve;if(Te){if(et){t:{for(var i=et,n=ya;i.nodeType!==8;){if(!n){i=null;break t}if(i=xa(i.nextSibling),i===null){i=null;break t}}n=i.data,i=n==="F!"||n==="F"?i:null}if(i){et=xa(i.nextSibling),r=i.data==="F!";break e}}Yr(r)}r=!1}r&&(t=a[0])}}return a=Lt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wh,lastRenderedState:t},a.queue=r,a=Dh.bind(null,ve,r),r.dispatch=a,r=Xu(!1),n=$p.bind(null,ve,!1,r.queue),r=Lt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,a=Ry.bind(null,ve,i,n,a),i.dispatch=a,r.memoizedState=e,[t,a,!1]}function wf(e){var t=mt();return yh(t,$e,e)}function yh(e,t,a){if(t=Qp(e,t,wh)[0],e=Gl(ur)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Xo(t)}catch(o){throw o===yn?As:o}else r=t;t=mt();var i=t.queue,n=i.dispatch;return a!==t.memoizedState&&(ve.flags|=2048,pn(9,{destroy:void 0},Uy.bind(null,i,a),null)),[r,n,e]}function Uy(e,t){e.action=t}function yf(e){var t=mt(),a=$e;if(a!==null)return yh(t,a,e);mt(),t=t.memoizedState,a=mt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function pn(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Rs(),ve.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function _h(){return mt().memoizedState}function Yl(e,t,a,r){var i=Lt();ve.flags|=e,i.memoizedState=pn(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ds(e,t,a,r){var i=mt();r=r===void 0?null:r;var n=i.memoizedState.inst;$e!==null&&r!==null&&Dp(r,$e.memoizedState.deps)?i.memoizedState=pn(t,n,a,r):(ve.flags|=e,i.memoizedState=pn(1|t,n,a,r))}function _f(e,t){Yl(8390656,8,e,t)}function Gp(e,t){Ds(2048,8,e,t)}function Dy(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Rs(),ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function xh(e){var t=mt().memoizedState;return Dy({ref:t,nextImpl:e}),function(){if((Oe&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function kh(e,t){return Ds(4,2,e,t)}function Nh(e,t){return Ds(4,4,e,t)}function Sh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ch(e,t,a){a=a!=null?a.concat([e]):null,Ds(4,4,Sh.bind(null,t,e),a)}function Yp(){}function qh(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Dp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Eh(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Dp(t,r[1]))return r[0];if(r=e(),pi){Er(!0);try{e()}finally{Er(!1)}}return a.memoizedState=[r,t],r}function Xp(e,t,a){return a===void 0||(cr&1073741824)!==0&&(Me&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=hb(),ve.lanes|=e,Vr|=e,a)}function Mh(e,t,a,r){return ca(a,t)?a:un.current!==null?(e=Xp(e,a,r),ca(e,t)||(vt=!0),e):(cr&42)===0||(cr&1073741824)!==0&&(Me&261930)===0?(vt=!0,e.memoizedState=a):(e=hb(),ve.lanes|=e,Vr|=e,t)}function Th(e,t,a,r,i){var n=Be.p;Be.p=n!==0&&8>n?n:8;var o=ue.T,l={};ue.T=l,$p(e,!1,t,a);try{var c=i(),p=ue.S;if(p!==null&&p(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Ty(c,r);bo(e,t,d,sa(e))}else bo(e,t,r,sa(e))}catch(g){bo(e,t,{then:function(){},status:"rejected",reason:g},sa())}finally{Be.p=n,o!==null&&l.types!==null&&(o.types=l.types),ue.T=o}}function Oy(){}function $u(e,t,a,r){if(e.tag!==5)throw Error(L(476));var i=zh(e).queue;Th(e,i,t,ri,a===null?Oy:function(){return Ah(e),a(r)})}function zh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ri,baseState:ri,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:ri},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ah(e){var t=zh(e);t.next===null&&(t=e.alternate.memoizedState),bo(e,t.next.queue,{},sa())}function Vp(){return Tt(Uo)}function Rh(){return mt().memoizedState}function Uh(){return mt().memoizedState}function By(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=sa();e=Dr(a);var r=Or(t,e,a);r!==null&&(Zt(r,t,a),fo(r,t,a)),t={cache:Tp()},e.payload=t;return}t=t.return}}function Ly(e,t,a){var r=sa();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Os(e)?Oh(t,a):(a=Cp(e,t,a,r),a!==null&&(Zt(a,e,r),Bh(a,t,r)))}function Dh(e,t,a){var r=sa();bo(e,t,a,r)}function bo(e,t,a,r){var i={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Os(e))Oh(t,i);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,a);if(i.hasEagerState=!0,i.eagerState=l,ca(l,o))return zs(e,t,i,0),Ze===null&&Ts(),!1}catch{}if(a=Cp(e,t,i,r),a!==null)return Zt(a,e,r),Bh(a,t,r),!0}return!1}function $p(e,t,a,r){if(r={lane:2,revertLane:td(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(L(479))}else t=Cp(e,a,r,2),t!==null&&Zt(t,e,2)}function Os(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Oh(e,t){rn=cs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Bh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,xg(e,a)}}var zo={readContext:Tt,use:Us,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};zo.useEffectEvent=lt;var Lh={readContext:Tt,use:Us,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:_f,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Yl(4194308,4,Sh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Yl(4194308,4,e,t)},useInsertionEffect:function(e,t){Yl(4,2,e,t)},useMemo:function(e,t){var a=Lt();t=t===void 0?null:t;var r=e();if(pi){Er(!0);try{e()}finally{Er(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Lt();if(a!==void 0){var i=a(t);if(pi){Er(!0);try{a(t)}finally{Er(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ly.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xu(e);var t=e.queue,a=Dh.bind(null,ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Yp,useDeferredValue:function(e,t){var a=Lt();return Xp(a,e,t)},useTransition:function(){var e=Xu(!1);return e=Th.bind(null,ve,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ve,i=Lt();if(Te){if(a===void 0)throw Error(L(407));a=a()}else{if(a=t(),Ze===null)throw Error(L(349));(Me&127)!==0||ph(r,t,a)}i.memoizedState=a;var n={value:a,getSnapshot:t};return i.queue=n,_f(mh.bind(null,r,n,e),[e]),r.flags|=2048,pn(9,{destroy:void 0},dh.bind(null,r,n,a,t),null),a},useId:function(){var e=Lt(),t=Ze.identifierPrefix;if(Te){var a=Ba,r=Oa;a=(r&~(1<<32-la(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=us++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=zy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Vp,useFormState:vf,useActionState:vf,useOptimistic:function(e){var t=Lt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=$p.bind(null,ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:jp,useCacheRefresh:function(){return Lt().memoizedState=By.bind(null,ve)},useEffectEvent:function(e){var t=Lt(),a={impl:e};return t.memoizedState=a,function(){if((Oe&2)!==0)throw Error(L(440));return a.impl.apply(void 0,arguments)}}},Zp={readContext:Tt,use:Us,useCallback:qh,useContext:Tt,useEffect:Gp,useImperativeHandle:Ch,useInsertionEffect:kh,useLayoutEffect:Nh,useMemo:Eh,useReducer:Gl,useRef:_h,useState:function(){return Gl(ur)},useDebugValue:Yp,useDeferredValue:function(e,t){var a=mt();return Mh(a,$e.memoizedState,e,t)},useTransition:function(){var e=Gl(ur)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:uh,useId:Rh,useHostTransitionStatus:Vp,useFormState:wf,useActionState:wf,useOptimistic:function(e,t){var a=mt();return hh(a,$e,e,t)},useMemoCache:jp,useCacheRefresh:Uh};Zp.useEffectEvent=xh;var Hh={readContext:Tt,use:Us,useCallback:qh,useContext:Tt,useEffect:Gp,useImperativeHandle:Ch,useInsertionEffect:kh,useLayoutEffect:Nh,useMemo:Eh,useReducer:eu,useRef:_h,useState:function(){return eu(ur)},useDebugValue:Yp,useDeferredValue:function(e,t){var a=mt();return $e===null?Xp(a,e,t):Mh(a,$e.memoizedState,e,t)},useTransition:function(){var e=eu(ur)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:uh,useId:Rh,useHostTransitionStatus:Vp,useFormState:yf,useActionState:yf,useOptimistic:function(e,t){var a=mt();return $e!==null?hh(a,$e,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:jp,useCacheRefresh:Uh};Hh.useEffectEvent=xh;function tu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:tt({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Zu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=sa(),i=Dr(r);i.payload=t,a!=null&&(i.callback=a),t=Or(e,i,r),t!==null&&(Zt(t,e,r),fo(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=sa(),i=Dr(r);i.tag=1,i.payload=t,a!=null&&(i.callback=a),t=Or(e,i,r),t!==null&&(Zt(t,e,r),fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=sa(),r=Dr(a);r.tag=2,t!=null&&(r.callback=t),t=Or(e,r,a),t!==null&&(Zt(t,e,a),fo(t,e,a))}};function xf(e,t,a,r,i,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!Co(a,r)||!Co(i,n):!0}function kf(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Zu.enqueueReplaceState(t,t.state,null)}function di(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=tt({},a));for(var i in e)a[i]===void 0&&(a[i]=e[i])}return a}function jh(e){as(e)}function Qh(e){console.error(e)}function Gh(e){as(e)}function ps(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Nf(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function Ku(e,t,a){return a=Dr(a),a.tag=3,a.payload={element:null},a.callback=function(){ps(e,t)},a}function Yh(e){return e=Dr(e),e.tag=3,e}function Xh(e,t,a,r){var i=a.type.getDerivedStateFromError;if(typeof i=="function"){var n=r.value;e.payload=function(){return i(n)},e.callback=function(){Nf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Nf(t,a,r),typeof i!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function Hy(e,t,a,r,i){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&wn(t,a,i,!0),a=ua.current,a!==null){switch(a.tag){case 31:case 13:return _a===null?hs():a.alternate===null&&st===0&&(st=3),a.flags&=-257,a.flags|=65536,a.lanes=i,r===os?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),du(e,r,i)),!1;case 22:return a.flags|=65536,r===os?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),du(e,r,i)),!1}throw Error(L(435,a.tag))}return du(e,r,i),hs(),!1}if(Te)return t=ua.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Du&&(e=Error(L(422),{cause:r}),Eo(wa(e,a)))):(r!==Du&&(t=Error(L(423),{cause:r}),Eo(wa(t,a))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=wa(r,a),i=Ku(e.stateNode,r,i),Wc(e,i),st!==4&&(st=2)),!1;var n=Error(L(520),{cause:r});if(n=wa(n,a),yo===null?yo=[n]:yo.push(n),st!==4&&(st=2),t===null)return!0;r=wa(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=i&-i,a.lanes|=e,e=Ku(a.stateNode,r,e),Wc(a,e),!1;case 1:if(t=a.type,n=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(Br===null||!Br.has(n))))return a.flags|=65536,i&=-i,a.lanes|=i,i=Yh(i),Xh(i,e,a,r),Wc(a,i),!1}a=a.return}while(a!==null);return!1}var Kp=Error(L(461)),vt=!1;function qt(e,t,a,r){t.child=e===null?ih(t,null,a,r):ui(t,e.child,a,r)}function Sf(e,t,a,r,i){a=a.render;var n=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return ci(t),r=Op(e,t,a,o,n,i),l=Bp(),e!==null&&!vt?(Lp(e,t,i),pr(e,t,i)):(Te&&l&&Ep(t),t.flags|=1,qt(e,t,r,i),t.child)}function Cf(e,t,a,r,i){if(e===null){var n=a.type;return typeof n=="function"&&!qp(n)&&n.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=n,Vh(e,t,n,r,i)):(e=jl(a.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!Pp(e,i)){var o=n.memoizedProps;if(a=a.compare,a=a!==null?a:Co,a(o,r)&&e.ref===t.ref)return pr(e,t,i)}return t.flags|=1,e=nr(n,r),e.ref=t.ref,e.return=t,t.child=e}function Vh(e,t,a,r,i){if(e!==null){var n=e.memoizedProps;if(Co(n,r)&&e.ref===t.ref)if(vt=!1,t.pendingProps=r=n,Pp(e,i))(e.flags&131072)!==0&&(vt=!0);else return t.lanes=e.lanes,pr(e,t,i)}return Pu(e,t,a,r,i)}function $h(e,t,a,r){var i=r.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(n=n!==null?n.baseLanes|a:a,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~n}else r=0,t.child=null;return qf(e,t,n,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ql(t,n!==null?n.cachePool:null),n!==null?gf(t,n):Gu(),lh(t);else return r=t.lanes=536870912,qf(e,t,n!==null?n.baseLanes|a:a,a,r)}else n!==null?(Ql(t,n.cachePool),gf(t,n),Cr(t),t.memoizedState=null):(e!==null&&Ql(t,null),Gu(),Cr(t));return qt(e,t,i,a),t.child}function lo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function qf(e,t,a,r,i){var n=zp();return n=n===null?null:{parent:bt._currentValue,pool:n},t.memoizedState={baseLanes:a,cachePool:n},e!==null&&Ql(t,null),Gu(),lh(t),e!==null&&wn(e,t,r,!0),t.childLanes=i,null}function Xl(e,t){return t=ds({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ef(e,t,a){return ui(t,e.child,null,a),e=Xl(t,t.pendingProps),e.flags|=2,aa(t),t.memoizedState=null,e}function jy(e,t,a){var r=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Te){if(r.mode==="hidden")return e=Xl(t,r),t.lanes=536870912,lo(null,e);if(Yu(t),(e=et)?(e=Lb(e,ya),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gr!==null?{id:Oa,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Ig(e),a.return=t,t.child=a,Mt=t,et=null)):e=null,e===null)throw Yr(t);return t.lanes=536870912,null}return Xl(t,r)}var n=e.memoizedState;if(n!==null){var o=n.dehydrated;if(Yu(t),i)if(t.flags&256)t.flags&=-257,t=Ef(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(vt||wn(e,t,a,!1),i=(a&e.childLanes)!==0,vt||i){if(r=Ze,r!==null&&(o=kg(r,a),o!==0&&o!==n.retryLane))throw n.retryLane=o,hi(e,o),Zt(r,e,o),Kp;hs(),t=Ef(e,t,a)}else e=n.treeContext,et=xa(o.nextSibling),Mt=t,Te=!0,Ur=null,ya=!1,e!==null&&Wg(t,e),t=Xl(t,r),t.flags|=4096;return t}return e=nr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(L(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Pu(e,t,a,r,i){return ci(t),a=Op(e,t,a,r,void 0,i),r=Bp(),e!==null&&!vt?(Lp(e,t,i),pr(e,t,i)):(Te&&r&&Ep(t),t.flags|=1,qt(e,t,a,i),t.child)}function Mf(e,t,a,r,i,n){return ci(t),t.updateQueue=null,a=ch(t,r,a,i),sh(e),r=Bp(),e!==null&&!vt?(Lp(e,t,n),pr(e,t,n)):(Te&&r&&Ep(t),t.flags|=1,qt(e,t,a,n),t.child)}function Tf(e,t,a,r,i){if(ci(t),t.stateNode===null){var n=Ki,o=a.contextType;typeof o=="object"&&o!==null&&(n=Tt(o)),n=new a(r,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Zu,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=r,n.state=t.memoizedState,n.refs={},Rp(t),o=a.contextType,n.context=typeof o=="object"&&o!==null?Tt(o):Ki,n.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(tu(t,a,o,r),n.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(o=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),o!==n.state&&Zu.enqueueReplaceState(n,n.state,null),ho(t,r,n,i),go(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){n=t.stateNode;var l=t.memoizedProps,c=di(a,l);n.props=c;var p=n.context,d=a.contextType;o=Ki,typeof d=="object"&&d!==null&&(o=Tt(d));var g=a.getDerivedStateFromProps;d=typeof g=="function"||typeof n.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,d||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l||p!==o)&&kf(t,n,r,o),kr=!1;var f=t.memoizedState;n.state=f,ho(t,r,n,i),go(),p=t.memoizedState,l||f!==p||kr?(typeof g=="function"&&(tu(t,a,g,r),p=t.memoizedState),(c=kr||xf(t,a,c,r,f,p,o))?(d||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),n.props=r,n.state=p,n.context=o,r=c):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{n=t.stateNode,ju(e,t),o=t.memoizedProps,d=di(a,o),n.props=d,g=t.pendingProps,f=n.context,p=a.contextType,c=Ki,typeof p=="object"&&p!==null&&(c=Tt(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(o!==g||f!==c)&&kf(t,n,r,c),kr=!1,f=t.memoizedState,n.state=f,ho(t,r,n,i),go();var h=t.memoizedState;o!==g||f!==h||kr||e!==null&&e.dependencies!==null&&ns(e.dependencies)?(typeof l=="function"&&(tu(t,a,l,r),h=t.memoizedState),(d=kr||xf(t,a,d,r,f,h,c)||e!==null&&e.dependencies!==null&&ns(e.dependencies))?(p||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(r,h,c),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(r,h,c)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),n.props=r,n.state=h,n.context=c,r=d):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return n=r,Vl(e,t),r=(t.flags&128)!==0,n||r?(n=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&r?(t.child=ui(t,e.child,null,i),t.child=ui(t,null,a,i)):qt(e,t,a,i),t.memoizedState=n.state,e=t.child):e=pr(e,t,i),e}function zf(e,t,a,r){return si(),t.flags|=256,qt(e,t,a,r),t.child}var au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ru(e){return{baseLanes:e,cachePool:th()}}function iu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ia),e}function Zh(e,t,a){var r=t.pendingProps,i=!1,n=(t.flags&128)!==0,o;if((o=n)||(o=e!==null&&e.memoizedState===null?!1:(dt.current&2)!==0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Te){if(i?Sr(t):Cr(t),(e=et)?(e=Lb(e,ya),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gr!==null?{id:Oa,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Ig(e),a.return=t,t.child=a,Mt=t,et=null)):e=null,e===null)throw Yr(t);return cp(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,i?(Cr(t),i=t.mode,l=ds({mode:"hidden",children:l},i),r=ii(r,i,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=ru(a),r.childLanes=iu(e,o,a),t.memoizedState=au,lo(null,r)):(Sr(t),Ju(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(n)t.flags&256?(Sr(t),t.flags&=-257,t=nu(e,t,a)):t.memoizedState!==null?(Cr(t),t.child=e.child,t.flags|=128,t=null):(Cr(t),l=r.fallback,i=t.mode,r=ds({mode:"visible",children:r.children},i),l=ii(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,ui(t,e.child,null,a),r=t.child,r.memoizedState=ru(a),r.childLanes=iu(e,o,a),t.memoizedState=au,t=lo(null,r));else if(Sr(t),cp(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(L(419)),r.stack="",r.digest=o,Eo({value:r,source:null,stack:null}),t=nu(e,t,a)}else if(vt||wn(e,t,a,!1),o=(a&e.childLanes)!==0,vt||o){if(o=Ze,o!==null&&(r=kg(o,a),r!==0&&r!==c.retryLane))throw c.retryLane=r,hi(e,r),Zt(o,e,r),Kp;sp(l)||hs(),t=nu(e,t,a)}else sp(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,et=xa(l.nextSibling),Mt=t,Te=!0,Ur=null,ya=!1,e!==null&&Wg(t,e),t=Ju(t,r.children),t.flags|=4096);return t}return i?(Cr(t),l=r.fallback,i=t.mode,c=e.child,p=c.sibling,r=nr(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,p!==null?l=nr(p,l):(l=ii(l,i,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,lo(null,r),r=t.child,l=e.child.memoizedState,l===null?l=ru(a):(i=l.cachePool,i!==null?(c=bt._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=th(),l={baseLanes:l.baseLanes|a,cachePool:i}),r.memoizedState=l,r.childLanes=iu(e,o,a),t.memoizedState=au,lo(e.child,r)):(Sr(t),a=e.child,e=a.sibling,a=nr(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=a,t.memoizedState=null,a)}function Ju(e,t){return t=ds({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ds(e,t){return e=ra(22,e,null,t),e.lanes=0,e}function nu(e,t,a){return ui(t,e.child,null,a),e=Ju(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Af(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bu(e.return,t,a)}function ou(e,t,a,r,i,n){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:i,treeForkCount:n}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=i,o.treeForkCount=n)}function Kh(e,t,a){var r=t.pendingProps,i=r.revealOrder,n=r.tail;r=r.children;var o=dt.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Pe(dt,o),qt(e,t,r,a),r=Te?qo:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Af(e,a,t);else if(e.tag===19)Af(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(a=t.child,i=null;a!==null;)e=a.alternate,e!==null&&ss(e)===null&&(i=a),a=a.sibling;a=i,a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null),ou(t,!1,i,a,n,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ss(e)===null){t.child=i;break}e=i.sibling,i.sibling=a,a=i,i=e}ou(t,!0,a,null,n,r);break;case"together":ou(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function pr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Vr|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(wn(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,a=nr(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=nr(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Pp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ns(e)))}function Qy(e,t,a){switch(t.tag){case 3:Fl(t,t.stateNode.containerInfo),Nr(t,bt,e.memoizedState.cache),si();break;case 27:case 5:Nu(t);break;case 4:Fl(t,t.stateNode.containerInfo);break;case 10:Nr(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Yu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Sr(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Zh(e,t,a):(Sr(t),e=pr(e,t,a),e!==null?e.sibling:null);Sr(t);break;case 19:var i=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(wn(e,t,a,!1),r=(a&t.childLanes)!==0),i){if(r)return Kh(e,t,a);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(dt,dt.current),r)break;return null;case 22:return t.lanes=0,$h(e,t,a,t.pendingProps);case 24:Nr(t,bt,e.memoizedState.cache)}return pr(e,t,a)}function Ph(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)vt=!0;else{if(!Pp(e,a)&&(t.flags&128)===0)return vt=!1,Qy(e,t,a);vt=(e.flags&131072)!==0}else vt=!1,Te&&(t.flags&1048576)!==0&&Fg(t,qo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ti(t.elementType),t.type=e,typeof e=="function")qp(e)?(r=di(e,r),t.tag=1,t=Tf(null,t,e,r,a)):(t.tag=0,t=Pu(null,t,e,r,a));else{if(e!=null){var i=e.$$typeof;if(i===mp){t.tag=11,t=Sf(null,t,e,r,a);break e}else if(i===fp){t.tag=14,t=Cf(null,t,e,r,a);break e}}throw t=xu(e)||e,Error(L(306,t,""))}}return t;case 0:return Pu(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,i=di(r,t.pendingProps),Tf(e,t,r,i,a);case 3:e:{if(Fl(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var n=t.memoizedState;i=n.element,ju(e,t),ho(t,r,null,a);var o=t.memoizedState;if(r=o.cache,Nr(t,bt,r),r!==n.cache&&Lu(t,[bt],a,!0),go(),r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=zf(e,t,r,a);break e}else if(r!==i){i=wa(Error(L(424)),t),Eo(i),t=zf(e,t,r,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,et=xa(e.firstChild),Mt=t,Te=!0,Ur=null,ya=!0,a=ih(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(si(),r===i){t=pr(e,t,a);break e}qt(e,t,r,a)}t=t.child}return t;case 26:return Vl(e,t),e===null?(a=eg(t.type,null,t.pendingProps,null))?t.memoizedState=a:Te||(a=t.type,e=t.pendingProps,r=ys(Rr.current).createElement(a),r[Et]=t,r[Kt]=e,zt(r,a,e),Nt(r),t.stateNode=r):t.memoizedState=eg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Nu(t),e===null&&Te&&(r=t.stateNode=Hb(t.type,t.pendingProps,Rr.current),Mt=t,ya=!0,i=et,Zr(t.type)?(up=i,et=xa(r.firstChild)):et=i),qt(e,t,t.pendingProps.children,a),Vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Te&&((i=r=et)&&(r=g1(r,t.type,t.pendingProps,ya),r!==null?(t.stateNode=r,Mt=t,et=xa(r.firstChild),ya=!1,i=!0):i=!1),i||Yr(t)),Nu(t),i=t.type,n=t.pendingProps,o=e!==null?e.memoizedProps:null,r=n.children,op(i,n)?r=null:o!==null&&op(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=Op(e,t,Ay,null,null,a),Uo._currentValue=i),Vl(e,t),qt(e,t,r,a),t.child;case 6:return e===null&&Te&&((e=a=et)&&(a=h1(a,t.pendingProps,ya),a!==null?(t.stateNode=a,Mt=t,et=null,e=!0):e=!1),e||Yr(t)),null;case 13:return Zh(e,t,a);case 4:return Fl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ui(t,null,r,a):qt(e,t,r,a),t.child;case 11:return Sf(e,t,t.type,t.pendingProps,a);case 7:return qt(e,t,t.pendingProps,a),t.child;case 8:return qt(e,t,t.pendingProps.children,a),t.child;case 12:return qt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,Nr(t,t.type,r.value),qt(e,t,r.children,a),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ci(t),i=Tt(i),r=r(i),t.flags|=1,qt(e,t,r,a),t.child;case 14:return Cf(e,t,t.type,t.pendingProps,a);case 15:return Vh(e,t,t.type,t.pendingProps,a);case 19:return Kh(e,t,a);case 31:return jy(e,t,a);case 22:return $h(e,t,a,t.pendingProps);case 24:return ci(t),r=Tt(bt),e===null?(i=zp(),i===null&&(i=Ze,n=Tp(),i.pooledCache=n,n.refCount++,n!==null&&(i.pooledCacheLanes|=a),i=n),t.memoizedState={parent:r,cache:i},Rp(t),Nr(t,bt,i)):((e.lanes&a)!==0&&(ju(e,t),ho(t,null,null,a),go()),i=e.memoizedState,n=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Nr(t,bt,r)):(r=n.cache,Nr(t,bt,r),r!==i.cache&&Lu(t,[bt],a,!0))),qt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Ja(e){e.flags|=4}function lu(e,t,a,r,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(wb())e.flags|=8192;else throw oi=os,Ap}else e.flags&=-16777217}function Rf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Gb(t))if(wb())e.flags|=8192;else throw oi=os,Ap}function Ml(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?yg():536870912,e.lanes|=t,dn|=t)}function eo(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function Gy(e,t,a){var r=t.pendingProps;switch(Mp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),or(bt),on(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?Ja(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Fc())),We(t),null;case 26:var i=t.type,n=t.memoizedState;return e===null?(Ja(t),n!==null?(We(t),Rf(t,n)):(We(t),lu(t,i,null,r,a))):n?n!==e.memoizedState?(Ja(t),We(t),Rf(t,n)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ja(t),We(t),lu(t,i,e,r,a)),null;case 27:if(Wl(t),a=Rr.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return We(t),null}e=Ha.current,Oi(t)?sf(t,e):(e=Hb(i,r,a),t.stateNode=e,Ja(t))}return We(t),null;case 5:if(Wl(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return We(t),null}if(n=Ha.current,Oi(t))sf(t,n);else{var o=ys(Rr.current);switch(n){case 1:n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?n.multiple=!0:r.size&&(n.size=r.size);break;default:n=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}n[Et]=t,n[Kt]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)n.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=n;e:switch(zt(n,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ja(t)}}return We(t),lu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ja(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Rr.current,Oi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,i=Mt,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Et]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Db(e.nodeValue,a)),e||Yr(t,!0)}else e=ys(e).createTextNode(r),e[Et]=t,t.stateNode=e}return We(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Oi(t),a!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Et]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else a=Fc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(aa(t),t):(aa(t),null);if((t.flags&128)!==0)throw Error(L(558))}return We(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Oi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(L(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(L(317));i[Et]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),i=!1}else i=Fc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(aa(t),t):(aa(t),null)}return aa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Ml(t,t.updateQueue),We(t),null);case 4:return on(),e===null&&ad(t.stateNode.containerInfo),We(t),null;case 10:return or(t.type),We(t),null;case 19:if(St(dt),r=t.memoizedState,r===null)return We(t),null;if(i=(t.flags&128)!==0,n=r.rendering,n===null)if(i)eo(r,!1);else{if(st!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(n=ss(e),n!==null){for(t.flags|=128,eo(r,!1),e=n.updateQueue,t.updateQueue=e,Ml(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Jg(a,e),a=a.sibling;return Pe(dt,dt.current&1|2),Te&&er(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&na()>fs&&(t.flags|=128,i=!0,eo(r,!1),t.lanes=4194304)}else{if(!i)if(e=ss(n),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Ml(t,e),eo(r,!0),r.tail===null&&r.tailMode==="hidden"&&!n.alternate&&!Te)return We(t),null}else 2*na()-r.renderingStartTime>fs&&a!==536870912&&(t.flags|=128,i=!0,eo(r,!1),t.lanes=4194304);r.isBackwards?(n.sibling=t.child,t.child=n):(e=r.last,e!==null?e.sibling=n:t.child=n,r.last=n)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=na(),e.sibling=null,a=dt.current,Pe(dt,i?a&1|2:a&1),Te&&er(t,r.treeForkCount),e):(We(t),null);case 22:case 23:return aa(t),Up(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),a=t.updateQueue,a!==null&&Ml(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&St(ni),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),or(bt),We(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function Yy(e,t){switch(Mp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return or(bt),on(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Wl(t),null;case 31:if(t.memoizedState!==null){if(aa(t),t.alternate===null)throw Error(L(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(aa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return St(dt),null;case 4:return on(),null;case 10:return or(t.type),null;case 22:case 23:return aa(t),Up(),e!==null&&St(ni),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return or(bt),null;case 25:return null;default:return null}}function Jh(e,t){switch(Mp(t),t.tag){case 3:or(bt),on();break;case 26:case 27:case 5:Wl(t);break;case 4:on();break;case 31:t.memoizedState!==null&&aa(t);break;case 13:aa(t);break;case 19:St(dt);break;case 10:or(t.type);break;case 22:case 23:aa(t),Up(),e!==null&&St(ni);break;case 24:or(bt)}}function Vo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var i=r.next;a=i;do{if((a.tag&e)===e){r=void 0;var n=a.create,o=a.inst;r=n(),o.destroy=r}a=a.next}while(a!==i)}}catch(l){Qe(t,t.return,l)}}function Xr(e,t,a){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var n=i.next;r=n;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,i=t;var c=a,p=l;try{p()}catch(d){Qe(i,c,d)}}}r=r.next}while(r!==n)}}catch(d){Qe(t,t.return,d)}}function Ih(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{oh(t,a)}catch(r){Qe(e,e.return,r)}}}function Fh(e,t,a){a.props=di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Qe(e,t,r)}}function vo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(i){Qe(e,t,i)}}function La(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(i){Qe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Qe(e,t,i)}else a.current=null}function Wh(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(i){Qe(e,e.return,i)}}function su(e,t,a){try{var r=e.stateNode;c1(r,e.type,a,t),r[Kt]=t}catch(i){Qe(e,e.return,i)}}function eb(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zr(e.type)||e.tag===4}function cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Iu(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=rr));else if(r!==4&&(r===27&&Zr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Iu(e,t,a),e=e.sibling;e!==null;)Iu(e,t,a),e=e.sibling}function ms(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&Zr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ms(e,t,a),e=e.sibling;e!==null;)ms(e,t,a),e=e.sibling}function tb(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zt(t,r,a),t[Et]=e,t[Kt]=a}catch(n){Qe(e,e.return,n)}}var tr=!1,ht=!1,uu=!1,Uf=typeof WeakSet=="function"?WeakSet:Set,kt=null;function Xy(e,t){if(e=e.containerInfo,ip=Ns,e=Gg(e),Np(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var i=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{a.nodeType,n.nodeType}catch{a=null;break e}var o=0,l=-1,c=-1,p=0,d=0,g=e,f=null;t:for(;;){for(var h;g!==a||i!==0&&g.nodeType!==3||(l=o+i),g!==n||r!==0&&g.nodeType!==3||(c=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(h=g.firstChild)!==null;)f=g,g=h;for(;;){if(g===e)break t;if(f===a&&++p===i&&(l=o),f===n&&++d===r&&(c=o),(h=g.nextSibling)!==null)break;g=f,f=g.parentNode}g=h}a=l===-1||c===-1?null:{start:l,end:c}}else a=null}a=a||{start:0,end:0}}else a=null;for(np={focusedElem:e,selectionRange:a},Ns=!1,kt=t;kt!==null;)if(t=kt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,kt=e;else for(;kt!==null;){switch(t=kt,n=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)i=e[a],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&n!==null){e=void 0,a=t,i=n.memoizedProps,n=n.memoizedState,r=a.stateNode;try{var w=di(a.type,i);e=r.getSnapshotBeforeUpdate(w,n),r.__reactInternalSnapshotBeforeUpdate=e}catch(M){Qe(a,a.return,M)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)lp(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":lp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,kt=e;break}kt=t.return}}function ab(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Fa(e,a),r&4&&Vo(5,a);break;case 1:if(Fa(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(o){Qe(a,a.return,o)}else{var i=di(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Qe(a,a.return,o)}}r&64&&Ih(a),r&512&&vo(a,a.return);break;case 3:if(Fa(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{oh(e,t)}catch(o){Qe(a,a.return,o)}}break;case 27:t===null&&r&4&&tb(a);case 26:case 5:Fa(e,a),t===null&&r&4&&Wh(a),r&512&&vo(a,a.return);break;case 12:Fa(e,a);break;case 31:Fa(e,a),r&4&&nb(e,a);break;case 13:Fa(e,a),r&4&&ob(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Wy.bind(null,a),b1(e,a))));break;case 22:if(r=a.memoizedState!==null||tr,!r){t=t!==null&&t.memoizedState!==null||ht,i=tr;var n=ht;tr=r,(ht=t)&&!n?Wa(e,a,(a.subtreeFlags&8772)!==0):Fa(e,a),tr=i,ht=n}break;case 30:break;default:Fa(e,a)}}function rb(e){var t=e.alternate;t!==null&&(e.alternate=null,rb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vp(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var it=null,Vt=!1;function Ia(e,t,a){for(a=a.child;a!==null;)ib(e,t,a),a=a.sibling}function ib(e,t,a){if(oa&&typeof oa.onCommitFiberUnmount=="function")try{oa.onCommitFiberUnmount(Lo,a)}catch{}switch(a.tag){case 26:ht||La(a,t),Ia(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ht||La(a,t);var r=it,i=Vt;Zr(a.type)&&(it=a.stateNode,Vt=!1),Ia(e,t,a),xo(a.stateNode),it=r,Vt=i;break;case 5:ht||La(a,t);case 6:if(r=it,i=Vt,it=null,Ia(e,t,a),it=r,Vt=i,it!==null)if(Vt)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(a.stateNode)}catch(n){Qe(a,t,n)}else try{it.removeChild(a.stateNode)}catch(n){Qe(a,t,n)}break;case 18:it!==null&&(Vt?(e=it,Pf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),hn(e)):Pf(it,a.stateNode));break;case 4:r=it,i=Vt,it=a.stateNode.containerInfo,Vt=!0,Ia(e,t,a),it=r,Vt=i;break;case 0:case 11:case 14:case 15:Xr(2,a,t),ht||Xr(4,a,t),Ia(e,t,a);break;case 1:ht||(La(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Fh(a,t,r)),Ia(e,t,a);break;case 21:Ia(e,t,a);break;case 22:ht=(r=ht)||a.memoizedState!==null,Ia(e,t,a),ht=r;break;default:Ia(e,t,a)}}function nb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hn(e)}catch(a){Qe(t,t.return,a)}}}function ob(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hn(e)}catch(a){Qe(t,t.return,a)}}function Vy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Uf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Uf),t;default:throw Error(L(435,e.tag))}}function Tl(e,t){var a=Vy(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var i=e1.bind(null,e,r);r.then(i,i)}})}function Yt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var i=a[r],n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Zr(l.type)){it=l.stateNode,Vt=!1;break e}break;case 5:it=l.stateNode,Vt=!1;break e;case 3:case 4:it=l.stateNode.containerInfo,Vt=!0;break e}l=l.return}if(it===null)throw Error(L(160));ib(n,o,i),it=null,Vt=!1,n=i.alternate,n!==null&&(n.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)lb(t,e),t=t.sibling}var za=null;function lb(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Yt(t,e),Xt(e),r&4&&(Xr(3,e,e.return),Vo(3,e),Xr(5,e,e.return));break;case 1:Yt(t,e),Xt(e),r&512&&(ht||a===null||La(a,a.return)),r&64&&tr&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var i=za;if(Yt(t,e),Xt(e),r&512&&(ht||a===null||La(a,a.return)),r&4){var n=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":n=i.getElementsByTagName("title")[0],(!n||n[Qo]||n[Et]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=i.createElement(r),i.head.insertBefore(n,i.querySelector("head > title"))),zt(n,r,a),n[Et]=e,Nt(n),r=n;break e;case"link":var o=ag("link","href",i).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(n=o[l],n.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&n.getAttribute("rel")===(a.rel==null?null:a.rel)&&n.getAttribute("title")===(a.title==null?null:a.title)&&n.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;case"meta":if(o=ag("meta","content",i).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(n=o[l],n.getAttribute("content")===(a.content==null?null:""+a.content)&&n.getAttribute("name")===(a.name==null?null:a.name)&&n.getAttribute("property")===(a.property==null?null:a.property)&&n.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&n.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;default:throw Error(L(468,r))}n[Et]=e,Nt(n),r=n}e.stateNode=r}else rg(i,e.type,e.stateNode);else e.stateNode=tg(i,r,e.memoizedProps);else n!==r?(n===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):n.count--,r===null?rg(i,e.type,e.stateNode):tg(i,r,e.memoizedProps)):r===null&&e.stateNode!==null&&su(e,e.memoizedProps,a.memoizedProps)}break;case 27:Yt(t,e),Xt(e),r&512&&(ht||a===null||La(a,a.return)),a!==null&&r&4&&su(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Yt(t,e),Xt(e),r&512&&(ht||a===null||La(a,a.return)),e.flags&32){i=e.stateNode;try{sn(i,"")}catch(w){Qe(e,e.return,w)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,su(e,i,a!==null?a.memoizedProps:i)),r&1024&&(uu=!0);break;case 6:if(Yt(t,e),Xt(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(w){Qe(e,e.return,w)}}break;case 3:if(Kl=null,i=za,za=_s(t.containerInfo),Yt(t,e),za=i,Xt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{hn(t.containerInfo)}catch(w){Qe(e,e.return,w)}uu&&(uu=!1,sb(e));break;case 4:r=za,za=_s(e.stateNode.containerInfo),Yt(t,e),Xt(e),za=r;break;case 12:Yt(t,e),Xt(e);break;case 31:Yt(t,e),Xt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 13:Yt(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bs=na()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 22:i=e.memoizedState!==null;var c=a!==null&&a.memoizedState!==null,p=tr,d=ht;if(tr=p||i,ht=d||c,Yt(t,e),ht=d,tr=p,Xt(e),r&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(a===null||c||tr||ht||ai(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){c=a=t;try{if(n=c.stateNode,i)o=n.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var g=c.memoizedProps.style,f=g!=null&&g.hasOwnProperty("display")?g.display:null;l.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(w){Qe(c,c.return,w)}}}else if(t.tag===6){if(a===null){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(w){Qe(c,c.return,w)}}}else if(t.tag===18){if(a===null){c=t;try{var h=c.stateNode;i?Jf(h,!0):Jf(c.stateNode,!1)}catch(w){Qe(c,c.return,w)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,Tl(e,a))));break;case 19:Yt(t,e),Xt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 30:break;case 21:break;default:Yt(t,e),Xt(e)}}function Xt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(eb(r)){a=r;break}r=r.return}if(a==null)throw Error(L(160));switch(a.tag){case 27:var i=a.stateNode,n=cu(e);ms(e,n,i);break;case 5:var o=a.stateNode;a.flags&32&&(sn(o,""),a.flags&=-33);var l=cu(e);ms(e,l,o);break;case 3:case 4:var c=a.stateNode.containerInfo,p=cu(e);Iu(e,p,c);break;default:throw Error(L(161))}}catch(d){Qe(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function sb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;sb(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ab(e,t.alternate,t),t=t.sibling}function ai(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Xr(4,t,t.return),ai(t);break;case 1:La(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Fh(t,t.return,a),ai(t);break;case 27:xo(t.stateNode);case 26:case 5:La(t,t.return),ai(t);break;case 22:t.memoizedState===null&&ai(t);break;case 30:ai(t);break;default:ai(t)}e=e.sibling}}function Wa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,i=e,n=t,o=n.flags;switch(n.tag){case 0:case 11:case 15:Wa(i,n,a),Vo(4,n);break;case 1:if(Wa(i,n,a),r=n,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(p){Qe(r,r.return,p)}if(r=n,i=r.updateQueue,i!==null){var l=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)nh(c[i],l)}catch(p){Qe(r,r.return,p)}}a&&o&64&&Ih(n),vo(n,n.return);break;case 27:tb(n);case 26:case 5:Wa(i,n,a),a&&r===null&&o&4&&Wh(n),vo(n,n.return);break;case 12:Wa(i,n,a);break;case 31:Wa(i,n,a),a&&o&4&&nb(i,n);break;case 13:Wa(i,n,a),a&&o&4&&ob(i,n);break;case 22:n.memoizedState===null&&Wa(i,n,a),vo(n,n.return);break;case 30:break;default:Wa(i,n,a)}t=t.sibling}}function Jp(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Yo(a))}function Ip(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yo(e))}function Ta(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)cb(e,t,a,r),t=t.sibling}function cb(e,t,a,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ta(e,t,a,r),i&2048&&Vo(9,t);break;case 1:Ta(e,t,a,r);break;case 3:Ta(e,t,a,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yo(e)));break;case 12:if(i&2048){Ta(e,t,a,r),e=t.stateNode;try{var n=t.memoizedProps,o=n.id,l=n.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Qe(t,t.return,c)}}else Ta(e,t,a,r);break;case 31:Ta(e,t,a,r);break;case 13:Ta(e,t,a,r);break;case 23:break;case 22:n=t.stateNode,o=t.alternate,t.memoizedState!==null?n._visibility&2?Ta(e,t,a,r):wo(e,t):n._visibility&2?Ta(e,t,a,r):(n._visibility|=2,Li(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),i&2048&&Jp(o,t);break;case 24:Ta(e,t,a,r),i&2048&&Ip(t.alternate,t);break;default:Ta(e,t,a,r)}}function Li(e,t,a,r,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,o=t,l=a,c=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Li(n,o,l,c,i),Vo(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?Li(n,o,l,c,i):wo(n,o):(d._visibility|=2,Li(n,o,l,c,i)),i&&p&2048&&Jp(o.alternate,o);break;case 24:Li(n,o,l,c,i),i&&p&2048&&Ip(o.alternate,o);break;default:Li(n,o,l,c,i)}t=t.sibling}}function wo(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,i=r.flags;switch(r.tag){case 22:wo(a,r),i&2048&&Jp(r.alternate,r);break;case 24:wo(a,r),i&2048&&Ip(r.alternate,r);break;default:wo(a,r)}t=t.sibling}}var so=8192;function Bi(e,t,a){if(e.subtreeFlags&so)for(e=e.child;e!==null;)ub(e,t,a),e=e.sibling}function ub(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&so&&e.memoizedState!==null&&M1(a,za,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var r=za;za=_s(e.stateNode.containerInfo),Bi(e,t,a),za=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=so,so=16777216,Bi(e,t,a),so=r):Bi(e,t,a));break;default:Bi(e,t,a)}}function pb(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function to(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];kt=r,mb(r,e)}pb(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)db(e),e=e.sibling}function db(e){switch(e.tag){case 0:case 11:case 15:to(e),e.flags&2048&&Xr(9,e,e.return);break;case 3:to(e);break;case 12:to(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$l(e)):to(e);break;default:to(e)}}function $l(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];kt=r,mb(r,e)}pb(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Xr(8,t,t.return),$l(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,$l(t));break;default:$l(t)}e=e.sibling}}function mb(e,t){for(;kt!==null;){var a=kt;switch(a.tag){case 0:case 11:case 15:Xr(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Yo(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,kt=r;else e:for(a=e;kt!==null;){r=kt;var i=r.sibling,n=r.return;if(rb(r),r===a){kt=null;break e}if(i!==null){i.return=n,kt=i;break e}kt=n}}}var $y={getCacheForType:function(e){var t=Tt(bt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(bt).controller.signal}},Zy=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Ze=null,qe=null,Me=0,je=0,ta=null,Tr=!1,_n=!1,Fp=!1,dr=0,st=0,Vr=0,li=0,Wp=0,ia=0,dn=0,yo=null,$t=null,Fu=!1,Bs=0,fb=0,fs=1/0,gs=null,Br=null,wt=0,Lr=null,mn=null,lr=0,Wu=0,ep=null,gb=null,_o=0,tp=null;function sa(){return(Oe&2)!==0&&Me!==0?Me&-Me:ue.T!==null?td():Ng()}function hb(){if(ia===0)if((Me&536870912)===0||Te){var e=yl;yl<<=1,(yl&3932160)===0&&(yl=262144),ia=e}else ia=536870912;return e=ua.current,e!==null&&(e.flags|=32),ia}function Zt(e,t,a){(e===Ze&&(je===2||je===9)||e.cancelPendingCommit!==null)&&(fn(e,0),zr(e,Me,ia,!1)),jo(e,a),((Oe&2)===0||e!==Ze)&&(e===Ze&&((Oe&2)===0&&(li|=a),st===4&&zr(e,Me,ia,!1)),Qa(e))}function bb(e,t,a){if((Oe&6)!==0)throw Error(L(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ho(e,t),i=r?Jy(e,t):pu(e,t,!0),n=r;do{if(i===0){_n&&!r&&zr(e,t,0,!1);break}else{if(a=e.current.alternate,n&&!Ky(a)){i=pu(e,t,!1),n=!1;continue}if(i===2){if(n=t,e.errorRecoveryDisabledLanes&n)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;i=yo;var c=l.current.memoizedState.isDehydrated;if(c&&(fn(l,o).flags|=256),o=pu(l,o,!1),o!==2){if(Fp&&!c){l.errorRecoveryDisabledLanes|=n,li|=n,i=4;break e}n=$t,$t=i,n!==null&&($t===null?$t=n:$t.push.apply($t,n))}i=o}if(n=!1,i!==2)continue}}if(i===1){fn(e,0),zr(e,t,0,!0);break}e:{switch(r=e,n=i,n){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:zr(r,t,ia,!Tr);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(i=Bs+300-na(),10<i)){if(zr(r,t,ia,!Tr),Cs(r,0,!0)!==0)break e;lr=t,r.timeoutHandle=Bb(Df.bind(null,r,a,$t,gs,Fu,t,ia,li,dn,Tr,n,"Throttled",-0,0),i);break e}Df(r,a,$t,gs,Fu,t,ia,li,dn,Tr,n,null,-0,0)}}break}while(!0);Qa(e)}function Df(e,t,a,r,i,n,o,l,c,p,d,g,f,h){if(e.timeoutHandle=-1,g=t.subtreeFlags,g&8192||(g&16785408)===16785408){g={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:rr},ub(t,n,g);var w=(n&62914560)===n?Bs-na():(n&4194048)===n?fb-na():0;if(w=T1(g,w),w!==null){lr=n,e.cancelPendingCommit=w(Bf.bind(null,e,t,n,a,r,i,o,l,c,d,g,null,f,h)),zr(e,n,o,!p);return}}Bf(e,t,n,a,r,i,o,l,c)}function Ky(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var i=a[r],n=i.getSnapshot;i=i.value;try{if(!ca(n(),i))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zr(e,t,a,r){t&=~Wp,t&=~li,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var n=31-la(i),o=1<<n;r[n]=-1,i&=~o}a!==0&&_g(e,a,t)}function Ls(){return(Oe&6)===0?($o(0,!1),!1):!0}function ed(){if(qe!==null){if(je===0)var e=qe.return;else e=qe,ir=bi=null,Hp(e),an=null,Mo=0,e=qe;for(;e!==null;)Jh(e.alternate,e),e=e.return;qe=null}}function fn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,d1(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),lr=0,ed(),Ze=e,qe=a=nr(e.current,null),Me=t,je=0,ta=null,Tr=!1,_n=Ho(e,t),Fp=!1,dn=ia=Wp=li=Vr=st=0,$t=yo=null,Fu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-la(r),n=1<<i;t|=e[i],r&=~n}return dr=t,Ts(),a}function vb(e,t){ve=null,ue.H=zo,t===yn||t===As?(t=mf(),je=3):t===Ap?(t=mf(),je=4):je=t===Kp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ta=t,qe===null&&(st=1,ps(e,wa(t,e.current)))}function wb(){var e=ua.current;return e===null?!0:(Me&4194048)===Me?_a===null:(Me&62914560)===Me||(Me&536870912)!==0?e===_a:!1}function yb(){var e=ue.H;return ue.H=zo,e===null?zo:e}function _b(){var e=ue.A;return ue.A=$y,e}function hs(){st=4,Tr||(Me&4194048)!==Me&&ua.current!==null||(_n=!0),(Vr&134217727)===0&&(li&134217727)===0||Ze===null||zr(Ze,Me,ia,!1)}function pu(e,t,a){var r=Oe;Oe|=2;var i=yb(),n=_b();(Ze!==e||Me!==t)&&(gs=null,fn(e,t)),t=!1;var o=st;e:do try{if(je!==0&&qe!==null){var l=qe,c=ta;switch(je){case 8:ed(),o=6;break e;case 3:case 2:case 9:case 6:ua.current===null&&(t=!0);var p=je;if(je=0,ta=null,Ii(e,l,c,p),a&&_n){o=0;break e}break;default:p=je,je=0,ta=null,Ii(e,l,c,p)}}Py(),o=st;break}catch(d){vb(e,d)}while(!0);return t&&e.shellSuspendCounter++,ir=bi=null,Oe=r,ue.H=i,ue.A=n,qe===null&&(Ze=null,Me=0,Ts()),o}function Py(){for(;qe!==null;)xb(qe)}function Jy(e,t){var a=Oe;Oe|=2;var r=yb(),i=_b();Ze!==e||Me!==t?(gs=null,fs=na()+500,fn(e,t)):_n=Ho(e,t);e:do try{if(je!==0&&qe!==null){t=qe;var n=ta;t:switch(je){case 1:je=0,ta=null,Ii(e,t,n,1);break;case 2:case 9:if(df(n)){je=0,ta=null,Of(t);break}t=function(){je!==2&&je!==9||Ze!==e||(je=7),Qa(e)},n.then(t,t);break e;case 3:je=7;break e;case 4:je=5;break e;case 7:df(n)?(je=0,ta=null,Of(t)):(je=0,ta=null,Ii(e,t,n,7));break;case 5:var o=null;switch(qe.tag){case 26:o=qe.memoizedState;case 5:case 27:var l=qe;if(o?Gb(o):l.stateNode.complete){je=0,ta=null;var c=l.sibling;if(c!==null)qe=c;else{var p=l.return;p!==null?(qe=p,Hs(p)):qe=null}break t}}je=0,ta=null,Ii(e,t,n,5);break;case 6:je=0,ta=null,Ii(e,t,n,6);break;case 8:ed(),st=6;break e;default:throw Error(L(462))}}Iy();break}catch(d){vb(e,d)}while(!0);return ir=bi=null,ue.H=r,ue.A=i,Oe=a,qe!==null?0:(Ze=null,Me=0,Ts(),st)}function Iy(){for(;qe!==null&&!y0();)xb(qe)}function xb(e){var t=Ph(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?Hs(e):qe=t}function Of(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Mf(a,t,t.pendingProps,t.type,void 0,Me);break;case 11:t=Mf(a,t,t.pendingProps,t.type.render,t.ref,Me);break;case 5:Hp(t);default:Jh(a,t),t=qe=Jg(t,dr),t=Ph(a,t,dr)}e.memoizedProps=e.pendingProps,t===null?Hs(e):qe=t}function Ii(e,t,a,r){ir=bi=null,Hp(t),an=null,Mo=0;var i=t.return;try{if(Hy(e,i,t,a,Me)){st=1,ps(e,wa(a,e.current)),qe=null;return}}catch(n){if(i!==null)throw qe=i,n;st=1,ps(e,wa(a,e.current)),qe=null;return}t.flags&32768?(Te||r===1?e=!0:_n||(Me&536870912)!==0?e=!1:(Tr=e=!0,(r===2||r===9||r===3||r===6)&&(r=ua.current,r!==null&&r.tag===13&&(r.flags|=16384))),kb(t,e)):Hs(t)}function Hs(e){var t=e;do{if((t.flags&32768)!==0){kb(t,Tr);return}e=t.return;var a=Gy(t.alternate,t,dr);if(a!==null){qe=a;return}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);st===0&&(st=5)}function kb(e,t){do{var a=Yy(e.alternate,e);if(a!==null){a.flags&=32767,qe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){qe=e;return}qe=e=a}while(e!==null);st=6,qe=null}function Bf(e,t,a,r,i,n,o,l,c){e.cancelPendingCommit=null;do js();while(wt!==0);if((Oe&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(n=t.lanes|t.childLanes,n|=Sp,T0(e,a,n,o,l,c),e===Ze&&(qe=Ze=null,Me=0),mn=t,Lr=e,lr=a,Wu=n,ep=i,gb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,t1(es,function(){return Eb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=ue.T,ue.T=null,i=Be.p,Be.p=2,o=Oe,Oe|=4;try{Xy(e,t,a)}finally{Oe=o,Be.p=i,ue.T=r}}wt=1,Nb(),Sb(),Cb()}}function Nb(){if(wt===1){wt=0;var e=Lr,t=mn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=ue.T,ue.T=null;var r=Be.p;Be.p=2;var i=Oe;Oe|=4;try{lb(t,e);var n=np,o=Gg(e.containerInfo),l=n.focusedElem,c=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&Qg(l.ownerDocument.documentElement,l)){if(c!==null&&Np(l)){var p=c.start,d=c.end;if(d===void 0&&(d=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(d,l.value.length);else{var g=l.ownerDocument||document,f=g&&g.defaultView||window;if(f.getSelection){var h=f.getSelection(),w=l.textContent.length,M=Math.min(c.start,w),D=c.end===void 0?M:Math.min(c.end,w);!h.extend&&M>D&&(o=D,D=M,M=o);var m=nf(l,M),u=nf(l,D);if(m&&u&&(h.rangeCount!==1||h.anchorNode!==m.node||h.anchorOffset!==m.offset||h.focusNode!==u.node||h.focusOffset!==u.offset)){var b=g.createRange();b.setStart(m.node,m.offset),h.removeAllRanges(),M>D?(h.addRange(b),h.extend(u.node,u.offset)):(b.setEnd(u.node,u.offset),h.addRange(b))}}}}for(g=[],h=l;h=h.parentNode;)h.nodeType===1&&g.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<g.length;l++){var v=g[l];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}Ns=!!ip,np=ip=null}finally{Oe=i,Be.p=r,ue.T=a}}e.current=t,wt=2}}function Sb(){if(wt===2){wt=0;var e=Lr,t=mn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=ue.T,ue.T=null;var r=Be.p;Be.p=2;var i=Oe;Oe|=4;try{ab(e,t.alternate,t)}finally{Oe=i,Be.p=r,ue.T=a}}wt=3}}function Cb(){if(wt===4||wt===3){wt=0,_0();var e=Lr,t=mn,a=lr,r=gb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?wt=5:(wt=0,mn=Lr=null,qb(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Br=null),bp(a),t=t.stateNode,oa&&typeof oa.onCommitFiberRoot=="function")try{oa.onCommitFiberRoot(Lo,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=ue.T,i=Be.p,Be.p=2,ue.T=null;try{for(var n=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];n(l.value,{componentStack:l.stack})}}finally{ue.T=t,Be.p=i}}(lr&3)!==0&&js(),Qa(e),i=e.pendingLanes,(a&261930)!==0&&(i&42)!==0?e===tp?_o++:(_o=0,tp=e):_o=0,$o(0,!1)}}function qb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Yo(t)))}function js(){return Nb(),Sb(),Cb(),Eb()}function Eb(){if(wt!==5)return!1;var e=Lr,t=Wu;Wu=0;var a=bp(lr),r=ue.T,i=Be.p;try{Be.p=32>a?32:a,ue.T=null,a=ep,ep=null;var n=Lr,o=lr;if(wt=0,mn=Lr=null,lr=0,(Oe&6)!==0)throw Error(L(331));var l=Oe;if(Oe|=4,db(n.current),cb(n,n.current,o,a),Oe=l,$o(0,!1),oa&&typeof oa.onPostCommitFiberRoot=="function")try{oa.onPostCommitFiberRoot(Lo,n)}catch{}return!0}finally{Be.p=i,ue.T=r,qb(e,t)}}function Lf(e,t,a){t=wa(a,t),t=Ku(e.stateNode,t,2),e=Or(e,t,2),e!==null&&(jo(e,2),Qa(e))}function Qe(e,t,a){if(e.tag===3)Lf(e,e,a);else for(;t!==null;){if(t.tag===3){Lf(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Br===null||!Br.has(r))){e=wa(a,e),a=Yh(2),r=Or(t,a,2),r!==null&&(Xh(a,r,t,e),jo(r,2),Qa(r));break}}t=t.return}}function du(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Zy;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(a)||(Fp=!0,i.add(a),e=Fy.bind(null,e,t,a),t.then(e,e))}function Fy(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ze===e&&(Me&a)===a&&(st===4||st===3&&(Me&62914560)===Me&&300>na()-Bs?(Oe&2)===0&&fn(e,0):Wp|=a,dn===Me&&(dn=0)),Qa(e)}function Mb(e,t){t===0&&(t=yg()),e=hi(e,t),e!==null&&(jo(e,t),Qa(e))}function Wy(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Mb(e,a)}function e1(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(L(314))}r!==null&&r.delete(t),Mb(e,a)}function t1(e,t){return gp(e,t)}var bs=null,Hi=null,ap=!1,vs=!1,mu=!1,Ar=0;function Qa(e){e!==Hi&&e.next===null&&(Hi===null?bs=Hi=e:Hi=Hi.next=e),vs=!0,ap||(ap=!0,r1())}function $o(e,t){if(!mu&&vs){mu=!0;do for(var a=!1,r=bs;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var n=0;else{var o=r.suspendedLanes,l=r.pingedLanes;n=(1<<31-la(42|e)+1)-1,n&=i&~(o&~l),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(a=!0,Hf(r,n))}else n=Me,n=Cs(r,r===Ze?n:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(n&3)===0||Ho(r,n)||(a=!0,Hf(r,n));r=r.next}while(a);mu=!1}}function a1(){Tb()}function Tb(){vs=ap=!1;var e=0;Ar!==0&&p1()&&(e=Ar);for(var t=na(),a=null,r=bs;r!==null;){var i=r.next,n=zb(r,t);n===0?(r.next=null,a===null?bs=i:a.next=i,i===null&&(Hi=a)):(a=r,(e!==0||(n&3)!==0)&&(vs=!0)),r=i}wt!==0&&wt!==5||$o(e,!1),Ar!==0&&(Ar=0)}function zb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var o=31-la(n),l=1<<o,c=i[o];c===-1?((l&a)===0||(l&r)!==0)&&(i[o]=M0(l,t)):c<=t&&(e.expiredLanes|=l),n&=~l}if(t=Ze,a=Me,a=Cs(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(je===2||je===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Gc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ho(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Gc(r),bp(a)){case 2:case 8:a=vg;break;case 32:a=es;break;case 268435456:a=wg;break;default:a=es}return r=Ab.bind(null,e),a=gp(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Gc(r),e.callbackPriority=2,e.callbackNode=null,2}function Ab(e,t){if(wt!==0&&wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(js()&&e.callbackNode!==a)return null;var r=Me;return r=Cs(e,e===Ze?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(bb(e,r,t),zb(e,na()),e.callbackNode!=null&&e.callbackNode===a?Ab.bind(null,e):null)}function Hf(e,t){if(js())return null;bb(e,t,!0)}function r1(){m1(function(){(Oe&6)!==0?gp(bg,a1):Tb()})}function td(){if(Ar===0){var e=cn;e===0&&(e=wl,wl<<=1,(wl&261888)===0&&(wl=256)),Ar=e}return Ar}function jf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bl(""+e)}function Qf(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function i1(e,t,a,r,i){if(t==="submit"&&a&&a.stateNode===i){var n=jf((i[Kt]||null).action),o=r.submitter;o&&(t=(t=o[Kt]||null)?jf(t.formAction):o.getAttribute("formAction"),t!==null&&(n=t,o=null));var l=new qs("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ar!==0){var c=o?Qf(i,o):new FormData(i);$u(a,{pending:!0,data:c,method:i.method,action:n},null,c)}}else typeof n=="function"&&(l.preventDefault(),c=o?Qf(i,o):new FormData(i),$u(a,{pending:!0,data:c,method:i.method,action:n},n,c))},currentTarget:i}]})}}for(zl=0;zl<Uu.length;zl++)Al=Uu[zl],Gf=Al.toLowerCase(),Yf=Al[0].toUpperCase()+Al.slice(1),Aa(Gf,"on"+Yf);var Al,Gf,Yf,zl;Aa(Xg,"onAnimationEnd");Aa(Vg,"onAnimationIteration");Aa($g,"onAnimationStart");Aa("dblclick","onDoubleClick");Aa("focusin","onFocus");Aa("focusout","onBlur");Aa(xy,"onTransitionRun");Aa(ky,"onTransitionStart");Aa(Ny,"onTransitionCancel");Aa(Zg,"onTransitionEnd");ln("onMouseEnter",["mouseout","mouseover"]);ln("onMouseLeave",["mouseout","mouseover"]);ln("onPointerEnter",["pointerout","pointerover"]);ln("onPointerLeave",["pointerout","pointerover"]);mi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));mi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));mi("onBeforeInput",["compositionend","keypress","textInput","paste"]);mi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));mi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),n1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ao));function Rb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],i=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,p=l.currentTarget;if(l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(d){as(d)}i.currentTarget=null,n=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,p=l.currentTarget,l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(d){as(d)}i.currentTarget=null,n=c}}}}function Ce(e,t){var a=t[Cu];a===void 0&&(a=t[Cu]=new Set);var r=e+"__bubble";a.has(r)||(Ub(t,e,2,!1),a.add(r))}function fu(e,t,a){var r=0;t&&(r|=4),Ub(a,e,r,t)}var Rl="_reactListening"+Math.random().toString(36).slice(2);function ad(e){if(!e[Rl]){e[Rl]=!0,Sg.forEach(function(a){a!=="selectionchange"&&(n1.has(a)||fu(a,!1,e),fu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rl]||(t[Rl]=!0,fu("selectionchange",!1,t))}}function Ub(e,t,a,r){switch(Zb(t)){case 2:var i=R1;break;case 8:i=U1;break;default:i=od}a=i.bind(null,t,a,e),i=void 0,!zu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,a,{capture:!0,passive:i}):e.addEventListener(t,a,!0):i!==void 0?e.addEventListener(t,a,{passive:i}):e.addEventListener(t,a,!1)}function gu(e,t,a,r,i){var n=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;l!==null;){if(o=Gi(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=n=o;continue e}l=l.parentNode}}r=r.return}Rg(function(){var p=n,d=yp(a),g=[];e:{var f=Kg.get(e);if(f!==void 0){var h=qs,w=e;switch(e){case"keypress":if(Hl(a)===0)break e;case"keydown":case"keyup":h=ey;break;case"focusin":w="focus",h=Zc;break;case"focusout":w="blur",h=Zc;break;case"beforeblur":case"afterblur":h=Zc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Pm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=G0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=ry;break;case Xg:case Vg:case $g:h=V0;break;case Zg:h=ny;break;case"scroll":case"scrollend":h=j0;break;case"wheel":h=ly;break;case"copy":case"cut":case"paste":h=Z0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Im;break;case"toggle":case"beforetoggle":h=cy}var M=(t&4)!==0,D=!M&&(e==="scroll"||e==="scrollend"),m=M?f!==null?f+"Capture":null:f;M=[];for(var u=p,b;u!==null;){var v=u;if(b=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||b===null||m===null||(v=No(u,m),v!=null&&M.push(Ro(u,v,b))),D)break;u=u.return}0<M.length&&(f=new h(f,w,null,a,d),g.push({event:f,listeners:M}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&a!==Tu&&(w=a.relatedTarget||a.fromElement)&&(Gi(w)||w[bn]))break e;if((h||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,h?(w=a.relatedTarget||a.toElement,h=p,w=w?Gi(w):null,w!==null&&(D=Bo(w),M=w.tag,w!==D||M!==5&&M!==27&&M!==6)&&(w=null)):(h=null,w=p),h!==w)){if(M=Pm,v="onMouseLeave",m="onMouseEnter",u="mouse",(e==="pointerout"||e==="pointerover")&&(M=Im,v="onPointerLeave",m="onPointerEnter",u="pointer"),D=h==null?f:oo(h),b=w==null?f:oo(w),f=new M(v,u+"leave",h,a,d),f.target=D,f.relatedTarget=b,v=null,Gi(d)===p&&(M=new M(m,u+"enter",w,a,d),M.target=b,M.relatedTarget=D,v=M),D=v,h&&w)t:{for(M=o1,m=h,u=w,b=0,v=m;v;v=M(v))b++;v=0;for(var N=u;N;N=M(N))v++;for(;0<b-v;)m=M(m),b--;for(;0<v-b;)u=M(u),v--;for(;b--;){if(m===u||u!==null&&m===u.alternate){M=m;break t}m=M(m),u=M(u)}M=null}else M=null;h!==null&&Xf(g,f,h,M,!1),w!==null&&D!==null&&Xf(g,D,w,M,!0)}}e:{if(f=p?oo(p):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var A=tf;else if(ef(f))if(Hg)A=wy;else{A=by;var T=hy}else h=f.nodeName,!h||h.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?p&&wp(p.elementType)&&(A=tf):A=vy;if(A&&(A=A(e,p))){Lg(g,A,a,d);break e}T&&T(e,f,p),e==="focusout"&&p&&f.type==="number"&&p.memoizedProps.value!=null&&Mu(f,"number",f.value)}switch(T=p?oo(p):window,e){case"focusin":(ef(T)||T.contentEditable==="true")&&(Vi=T,Au=p,po=null);break;case"focusout":po=Au=Vi=null;break;case"mousedown":Ru=!0;break;case"contextmenu":case"mouseup":case"dragend":Ru=!1,of(g,a,d);break;case"selectionchange":if(_y)break;case"keydown":case"keyup":of(g,a,d)}var z;if(kp)e:{switch(e){case"compositionstart":var G="onCompositionStart";break e;case"compositionend":G="onCompositionEnd";break e;case"compositionupdate":G="onCompositionUpdate";break e}G=void 0}else Xi?Og(e,a)&&(G="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(G="onCompositionStart");G&&(Dg&&a.locale!=="ko"&&(Xi||G!=="onCompositionStart"?G==="onCompositionEnd"&&Xi&&(z=Ug()):(Mr=d,_p="value"in Mr?Mr.value:Mr.textContent,Xi=!0)),T=ws(p,G),0<T.length&&(G=new Jm(G,e,null,a,d),g.push({event:G,listeners:T}),z?G.data=z:(z=Bg(a),z!==null&&(G.data=z)))),(z=py?dy(e,a):my(e,a))&&(G=ws(p,"onBeforeInput"),0<G.length&&(T=new Jm("onBeforeInput","beforeinput",null,a,d),g.push({event:T,listeners:G}),T.data=z)),i1(g,e,p,a,d)}Rb(g,t)})}function Ro(e,t,a){return{instance:e,listener:t,currentTarget:a}}function ws(e,t){for(var a=t+"Capture",r=[];e!==null;){var i=e,n=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||n===null||(i=No(e,a),i!=null&&r.unshift(Ro(e,i,n)),i=No(e,t),i!=null&&r.push(Ro(e,i,n))),e.tag===3)return r;e=e.return}return[]}function o1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,a,r,i){for(var n=t._reactName,o=[];a!==null&&a!==r;){var l=a,c=l.alternate,p=l.stateNode;if(l=l.tag,c!==null&&c===r)break;l!==5&&l!==26&&l!==27||p===null||(c=p,i?(p=No(a,n),p!=null&&o.unshift(Ro(a,p,c))):i||(p=No(a,n),p!=null&&o.push(Ro(a,p,c)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var l1=/\r\n?/g,s1=/\u0000|\uFFFD/g;function Vf(e){return(typeof e=="string"?e:""+e).replace(l1,`
|
|
9
|
+
`).replace(s1,"")}function Db(e,t){return t=Vf(t),Vf(e)===t}function Ve(e,t,a,r,i,n){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||sn(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&sn(e,""+r);break;case"className":xl(e,"class",r);break;case"tabIndex":xl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":xl(e,a,r);break;case"style":Ag(e,r,n);break;case"data":if(t!=="object"){xl(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Bl(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof n=="function"&&(a==="formAction"?(t!=="input"&&Ve(e,t,"name",i.name,i,null),Ve(e,t,"formEncType",i.formEncType,i,null),Ve(e,t,"formMethod",i.formMethod,i,null),Ve(e,t,"formTarget",i.formTarget,i,null)):(Ve(e,t,"encType",i.encType,i,null),Ve(e,t,"method",i.method,i,null),Ve(e,t,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Bl(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=rr);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Bl(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ol(e,"popover",r);break;case"xlinkActuate":Pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Pa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Pa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Pa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Pa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ol(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=L0.get(a)||a,Ol(e,a,r))}}function rp(e,t,a,r,i,n){switch(a){case"style":Ag(e,r,n);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"children":typeof r=="string"?sn(e,r):(typeof r=="number"||typeof r=="bigint")&&sn(e,""+r);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"onClick":r!=null&&(e.onclick=rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(i=a.endsWith("Capture"),t=a.slice(2,i?a.length-7:void 0),n=e[Kt]||null,n=n!=null?n[a]:null,typeof n=="function"&&e.removeEventListener(t,n,i),typeof r=="function")){typeof n!="function"&&n!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,i);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Ol(e,a,r)}}}function zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var r=!1,i=!1,n;for(n in a)if(a.hasOwnProperty(n)){var o=a[n];if(o!=null)switch(n){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Ve(e,t,n,o,a,null)}}i&&Ve(e,t,"srcSet",a.srcSet,a,null),r&&Ve(e,t,"src",a.src,a,null);return;case"input":Ce("invalid",e);var l=n=o=i=null,c=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var d=a[r];if(d!=null)switch(r){case"name":i=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":p=d;break;case"value":n=d;break;case"defaultValue":l=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(L(137,t));break;default:Ve(e,t,r,d,a,null)}}Mg(e,n,l,c,p,o,i,!1);return;case"select":Ce("invalid",e),r=o=n=null;for(i in a)if(a.hasOwnProperty(i)&&(l=a[i],l!=null))switch(i){case"value":n=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:Ve(e,t,i,l,a,null)}t=n,a=o,e.multiple=!!r,t!=null?Wi(e,!!r,t,!1):a!=null&&Wi(e,!!r,a,!0);return;case"textarea":Ce("invalid",e),n=i=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":i=l;break;case"children":n=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(L(91));break;default:Ve(e,t,o,l,a,null)}zg(e,r,i,n);return;case"option":for(c in a)a.hasOwnProperty(c)&&(r=a[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Ve(e,t,c,r,a,null));return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(r=0;r<Ao.length;r++)Ce(Ao[r],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(p in a)if(a.hasOwnProperty(p)&&(r=a[p],r!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Ve(e,t,p,r,a,null)}return;default:if(wp(t)){for(d in a)a.hasOwnProperty(d)&&(r=a[d],r!==void 0&&rp(e,t,d,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&Ve(e,t,l,r,a,null))}function c1(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,n=null,o=null,l=null,c=null,p=null,d=null;for(h in a){var g=a[h];if(a.hasOwnProperty(h)&&g!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":c=g;default:r.hasOwnProperty(h)||Ve(e,t,h,null,r,g)}}for(var f in r){var h=r[f];if(g=a[f],r.hasOwnProperty(f)&&(h!=null||g!=null))switch(f){case"type":n=h;break;case"name":i=h;break;case"checked":p=h;break;case"defaultChecked":d=h;break;case"value":o=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(L(137,t));break;default:h!==g&&Ve(e,t,f,h,r,g)}}Eu(e,o,l,c,p,d,n,i);return;case"select":h=o=l=f=null;for(n in a)if(c=a[n],a.hasOwnProperty(n)&&c!=null)switch(n){case"value":break;case"multiple":h=c;default:r.hasOwnProperty(n)||Ve(e,t,n,null,r,c)}for(i in r)if(n=r[i],c=a[i],r.hasOwnProperty(i)&&(n!=null||c!=null))switch(i){case"value":f=n;break;case"defaultValue":l=n;break;case"multiple":o=n;default:n!==c&&Ve(e,t,i,n,r,c)}t=l,a=o,r=h,f!=null?Wi(e,!!a,f,!1):!!r!=!!a&&(t!=null?Wi(e,!!a,t,!0):Wi(e,!!a,a?[]:"",!1));return;case"textarea":h=f=null;for(l in a)if(i=a[l],a.hasOwnProperty(l)&&i!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Ve(e,t,l,null,r,i)}for(o in r)if(i=r[o],n=a[o],r.hasOwnProperty(o)&&(i!=null||n!=null))switch(o){case"value":f=i;break;case"defaultValue":h=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(L(91));break;default:i!==n&&Ve(e,t,o,i,r,n)}Tg(e,f,h);return;case"option":for(var w in a)f=a[w],a.hasOwnProperty(w)&&f!=null&&!r.hasOwnProperty(w)&&(w==="selected"?e.selected=!1:Ve(e,t,w,null,r,f));for(c in r)f=r[c],h=a[c],r.hasOwnProperty(c)&&f!==h&&(f!=null||h!=null)&&(c==="selected"?e.selected=f&&typeof f!="function"&&typeof f!="symbol":Ve(e,t,c,f,r,h));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var M in a)f=a[M],a.hasOwnProperty(M)&&f!=null&&!r.hasOwnProperty(M)&&Ve(e,t,M,null,r,f);for(p in r)if(f=r[p],h=a[p],r.hasOwnProperty(p)&&f!==h&&(f!=null||h!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Ve(e,t,p,f,r,h)}return;default:if(wp(t)){for(var D in a)f=a[D],a.hasOwnProperty(D)&&f!==void 0&&!r.hasOwnProperty(D)&&rp(e,t,D,void 0,r,f);for(d in r)f=r[d],h=a[d],!r.hasOwnProperty(d)||f===h||f===void 0&&h===void 0||rp(e,t,d,f,r,h);return}}for(var m in a)f=a[m],a.hasOwnProperty(m)&&f!=null&&!r.hasOwnProperty(m)&&Ve(e,t,m,null,r,f);for(g in r)f=r[g],h=a[g],!r.hasOwnProperty(g)||f===h||f==null&&h==null||Ve(e,t,g,f,r,h)}function $f(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var i=a[r],n=i.transferSize,o=i.initiatorType,l=i.duration;if(n&&l&&$f(o)){for(o=0,l=i.responseEnd,r+=1;r<a.length;r++){var c=a[r],p=c.startTime;if(p>l)break;var d=c.transferSize,g=c.initiatorType;d&&$f(g)&&(c=c.responseEnd,o+=d*(c<l?1:(l-p)/(c-p)))}if(--r,t+=8*(n+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ip=null,np=null;function ys(e){return e.nodeType===9?e:e.ownerDocument}function Zf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ob(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function op(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hu=null;function p1(){var e=window.event;return e&&e.type==="popstate"?e===hu?!1:(hu=e,!0):(hu=null,!1)}var Bb=typeof setTimeout=="function"?setTimeout:void 0,d1=typeof clearTimeout=="function"?clearTimeout:void 0,Kf=typeof Promise=="function"?Promise:void 0,m1=typeof queueMicrotask=="function"?queueMicrotask:typeof Kf<"u"?function(e){return Kf.resolve(null).then(e).catch(f1)}:Bb;function f1(e){setTimeout(function(){throw e})}function Zr(e){return e==="head"}function Pf(e,t){var a=t,r=0;do{var i=a.nextSibling;if(e.removeChild(a),i&&i.nodeType===8)if(a=i.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(i),hn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")xo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,xo(a);for(var n=a.firstChild;n;){var o=n.nextSibling,l=n.nodeName;n[Qo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&n.rel.toLowerCase()==="stylesheet"||a.removeChild(n),n=o}}else a==="body"&&xo(e.ownerDocument.body);a=i}while(a);hn(t)}function Jf(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function lp(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":lp(a),vp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function g1(e,t,a,r){for(;e.nodeType===1;){var i=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Qo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=xa(e.nextSibling),e===null)break}return null}function h1(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=xa(e.nextSibling),e===null))return null;return e}function Lb(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=xa(e.nextSibling),e===null))return null;return e}function sp(e){return e.data==="$?"||e.data==="$~"}function cp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function b1(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function xa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var up=null;function If(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return xa(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Ff(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Hb(e,t,a){switch(t=ys(a),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function xo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vp(e)}var ka=new Map,Wf=new Set;function _s(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var mr=Be.d;Be.d={f:v1,r:w1,D:y1,C:_1,L:x1,m:k1,X:S1,S:N1,M:C1};function v1(){var e=mr.f(),t=Ls();return e||t}function w1(e){var t=vn(e);t!==null&&t.tag===5&&t.type==="form"?Ah(t):mr.r(e)}var xn=typeof document>"u"?null:document;function jb(e,t,a){var r=xn;if(r&&typeof t=="string"&&t){var i=va(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),Wf.has(i)||(Wf.add(i),e={rel:e,crossOrigin:a,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),zt(t,"link",e),Nt(t),r.head.appendChild(t)))}}function y1(e){mr.D(e),jb("dns-prefetch",e,null)}function _1(e,t){mr.C(e,t),jb("preconnect",e,t)}function x1(e,t,a){mr.L(e,t,a);var r=xn;if(r&&e&&t){var i='link[rel="preload"][as="'+va(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+va(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+va(a.imageSizes)+'"]')):i+='[href="'+va(e)+'"]';var n=i;switch(t){case"style":n=gn(e);break;case"script":n=kn(e)}ka.has(n)||(e=tt({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ka.set(n,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(Zo(n))||t==="script"&&r.querySelector(Ko(n))||(t=r.createElement("link"),zt(t,"link",e),Nt(t),r.head.appendChild(t)))}}function k1(e,t){mr.m(e,t);var a=xn;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+va(r)+'"][href="'+va(e)+'"]',n=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=kn(e)}if(!ka.has(n)&&(e=tt({rel:"modulepreload",href:e},t),ka.set(n,e),a.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ko(n)))return}r=a.createElement("link"),zt(r,"link",e),Nt(r),a.head.appendChild(r)}}}function N1(e,t,a){mr.S(e,t,a);var r=xn;if(r&&e){var i=Fi(r).hoistableStyles,n=gn(e);t=t||"default";var o=i.get(n);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Zo(n)))l.loading=5;else{e=tt({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ka.get(n))&&rd(e,a);var c=o=r.createElement("link");Nt(c),zt(c,"link",e),c._p=new Promise(function(p,d){c.onload=p,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Zl(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},i.set(n,o)}}}function S1(e,t){mr.X(e,t);var a=xn;if(a&&e){var r=Fi(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Ko(i)),n||(e=tt({src:e,async:!0},t),(t=ka.get(i))&&id(e,t),n=a.createElement("script"),Nt(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function C1(e,t){mr.M(e,t);var a=xn;if(a&&e){var r=Fi(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Ko(i)),n||(e=tt({src:e,async:!0,type:"module"},t),(t=ka.get(i))&&id(e,t),n=a.createElement("script"),Nt(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function eg(e,t,a,r){var i=(i=Rr.current)?_s(i):null;if(!i)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=gn(a.href),a=Fi(i).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=gn(a.href);var n=Fi(i).hoistableStyles,o=n.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,o),(n=i.querySelector(Zo(e)))&&!n._p&&(o.instance=n,o.state.loading=5),ka.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ka.set(e,a),n||q1(i,e,a,o.state))),t&&r===null)throw Error(L(528,""));return o}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=kn(a),a=Fi(i).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(L(444,e))}}function gn(e){return'href="'+va(e)+'"'}function Zo(e){return'link[rel="stylesheet"]['+e+"]"}function Qb(e){return tt({},e,{"data-precedence":e.precedence,precedence:null})}function q1(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),zt(t,"link",a),Nt(t),e.head.appendChild(t))}function kn(e){return'[src="'+va(e)+'"]'}function Ko(e){return"script[async]"+e}function tg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+va(a.href)+'"]');if(r)return t.instance=r,Nt(r),r;var i=tt({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Nt(r),zt(r,"style",i),Zl(r,a.precedence,e),t.instance=r;case"stylesheet":i=gn(a.href);var n=e.querySelector(Zo(i));if(n)return t.state.loading|=4,t.instance=n,Nt(n),n;r=Qb(a),(i=ka.get(i))&&rd(r,i),n=(e.ownerDocument||e).createElement("link"),Nt(n);var o=n;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),t.state.loading|=4,Zl(n,a.precedence,e),t.instance=n;case"script":return n=kn(a.src),(i=e.querySelector(Ko(n)))?(t.instance=i,Nt(i),i):(r=a,(i=ka.get(n))&&(r=tt({},a),id(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),Nt(i),zt(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Zl(r,a.precedence,e));return t.instance}function Zl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,n=i,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)n=l;else if(n!==i)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function rd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function id(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Kl=null;function ag(e,t,a){if(Kl===null){var r=new Map,i=Kl=new Map;i.set(a,r)}else i=Kl,r=i.get(a),r||(r=new Map,i.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),i=0;i<a.length;i++){var n=a[i];if(!(n[Qo]||n[Et]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var o=n.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(n):r.set(o,[n])}}return r}function rg(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function E1(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Gb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function M1(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=gn(r.href),n=t.querySelector(Zo(i));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=xs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=n,Nt(n);return}n=t.ownerDocument||t,r=Qb(r),(i=ka.get(i))&&rd(r,i),n=n.createElement("link"),Nt(n);var o=n;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),a.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=xs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var bu=0;function T1(e,t){return e.stylesheets&&e.count===0&&Pl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Pl(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&bu===0&&(bu=62500*u1());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pl(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>bu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function xs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ks=null;function Pl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ks=new Map,t.forEach(z1,e),ks=null,xs.call(e))}function z1(e,t){if(!(t.state.loading&4)){var a=ks.get(e);if(a)var r=a.get(null);else{a=new Map,ks.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<i.length;n++){var o=i[n];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}i=t.instance,o=i.getAttribute("data-precedence"),n=a.get(o)||r,n===r&&a.set(null,i),a.set(o,i),this.count++,r=xs.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),n?n.parentNode.insertBefore(i,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Uo={$$typeof:ar,Provider:null,Consumer:null,_currentValue:ri,_currentValue2:ri,_threadCount:0};function A1(e,t,a,r,i,n,o,l,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yc(0),this.hiddenUpdates=Yc(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=n,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Yb(e,t,a,r,i,n,o,l,c,p,d,g){return e=new A1(e,t,a,o,c,p,d,g,l),t=1,n===!0&&(t|=24),n=ra(3,null,null,t),e.current=n,n.stateNode=e,t=Tp(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:r,isDehydrated:a,cache:t},Rp(n),e}function Xb(e){return e?(e=Ki,e):Ki}function Vb(e,t,a,r,i,n){i=Xb(i),r.context===null?r.context=i:r.pendingContext=i,r=Dr(t),r.payload={element:a},n=n===void 0?null:n,n!==null&&(r.callback=n),a=Or(e,r,t),a!==null&&(Zt(a,e,t),fo(a,e,t))}function ig(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function nd(e,t){ig(e,t),(e=e.alternate)&&ig(e,t)}function $b(e){if(e.tag===13||e.tag===31){var t=hi(e,67108864);t!==null&&Zt(t,e,67108864),nd(e,67108864)}}function ng(e){if(e.tag===13||e.tag===31){var t=sa();t=hp(t);var a=hi(e,t);a!==null&&Zt(a,e,t),nd(e,t)}}var Ns=!0;function R1(e,t,a,r){var i=ue.T;ue.T=null;var n=Be.p;try{Be.p=2,od(e,t,a,r)}finally{Be.p=n,ue.T=i}}function U1(e,t,a,r){var i=ue.T;ue.T=null;var n=Be.p;try{Be.p=8,od(e,t,a,r)}finally{Be.p=n,ue.T=i}}function od(e,t,a,r){if(Ns){var i=pp(r);if(i===null)gu(e,t,r,Ss,a),og(e,r);else if(O1(i,e,t,a,r))r.stopPropagation();else if(og(e,r),t&4&&-1<D1.indexOf(e)){for(;i!==null;){var n=vn(i);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var o=ei(n.pendingLanes);if(o!==0){var l=n;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-la(o);l.entanglements[1]|=c,o&=~c}Qa(n),(Oe&6)===0&&(fs=na()+500,$o(0,!1))}}break;case 31:case 13:l=hi(n,2),l!==null&&Zt(l,n,2),Ls(),nd(n,2)}if(n=pp(r),n===null&&gu(e,t,r,Ss,a),n===i)break;i=n}i!==null&&r.stopPropagation()}else gu(e,t,r,null,a)}}function pp(e){return e=yp(e),ld(e)}var Ss=null;function ld(e){if(Ss=null,e=Gi(e),e!==null){var t=Bo(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=dg(t),e!==null)return e;e=null}else if(a===31){if(e=mg(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ss=e,null}function Zb(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(x0()){case bg:return 2;case vg:return 8;case es:case k0:return 32;case wg:return 268435456;default:return 32}default:return 32}}var dp=!1,Hr=null,jr=null,Qr=null,Do=new Map,Oo=new Map,qr=[],D1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function og(e,t){switch(e){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":jr=null;break;case"mouseover":case"mouseout":Qr=null;break;case"pointerover":case"pointerout":Do.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(t.pointerId)}}function ao(e,t,a,r,i,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:n,targetContainers:[i]},t!==null&&(t=vn(t),t!==null&&$b(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function O1(e,t,a,r,i){switch(t){case"focusin":return Hr=ao(Hr,e,t,a,r,i),!0;case"dragenter":return jr=ao(jr,e,t,a,r,i),!0;case"mouseover":return Qr=ao(Qr,e,t,a,r,i),!0;case"pointerover":var n=i.pointerId;return Do.set(n,ao(Do.get(n)||null,e,t,a,r,i)),!0;case"gotpointercapture":return n=i.pointerId,Oo.set(n,ao(Oo.get(n)||null,e,t,a,r,i)),!0}return!1}function Kb(e){var t=Gi(e.target);if(t!==null){var a=Bo(t);if(a!==null){if(t=a.tag,t===13){if(t=dg(a),t!==null){e.blockedOn=t,Gm(e.priority,function(){ng(a)});return}}else if(t===31){if(t=mg(a),t!==null){e.blockedOn=t,Gm(e.priority,function(){ng(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=pp(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Tu=r,a.target.dispatchEvent(r),Tu=null}else return t=vn(a),t!==null&&$b(t),e.blockedOn=a,!1;t.shift()}return!0}function lg(e,t,a){Jl(e)&&a.delete(t)}function B1(){dp=!1,Hr!==null&&Jl(Hr)&&(Hr=null),jr!==null&&Jl(jr)&&(jr=null),Qr!==null&&Jl(Qr)&&(Qr=null),Do.forEach(lg),Oo.forEach(lg)}function Ul(e,t){e.blockedOn===t&&(e.blockedOn=null,dp||(dp=!0,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,B1)))}var Dl=null;function sg(e){Dl!==e&&(Dl=e,yt.unstable_scheduleCallback(yt.unstable_NormalPriority,function(){Dl===e&&(Dl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],i=e[t+2];if(typeof r!="function"){if(ld(r||a)===null)continue;break}var n=vn(a);n!==null&&(e.splice(t,3),t-=3,$u(n,{pending:!0,data:i,method:a.method,action:r},r,i))}}))}function hn(e){function t(c){return Ul(c,e)}Hr!==null&&Ul(Hr,e),jr!==null&&Ul(jr,e),Qr!==null&&Ul(Qr,e),Do.forEach(t),Oo.forEach(t);for(var a=0;a<qr.length;a++){var r=qr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<qr.length&&(a=qr[0],a.blockedOn===null);)Kb(a),a.blockedOn===null&&qr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var i=a[r],n=a[r+1],o=i[Kt]||null;if(typeof n=="function")o||sg(a);else if(o){var l=null;if(n&&n.hasAttribute("formAction")){if(i=n,o=n[Kt]||null)l=o.formAction;else if(ld(i)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),sg(a)}}}function Pb(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function sd(e){this._internalRoot=e}Qs.prototype.render=sd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var a=t.current,r=sa();Vb(a,r,e,t,null,null)};Qs.prototype.unmount=sd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vb(e.current,2,null,e,null,null),Ls(),t[bn]=null}};function Qs(e){this._internalRoot=e}Qs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ng();e={blockedOn:null,target:e,priority:t};for(var a=0;a<qr.length&&t!==0&&t<qr[a].priority;a++);qr.splice(a,0,e),a===0&&Kb(e)}};var cg=ug.version;if(cg!=="19.2.3")throw Error(L(527,cg,"19.2.3"));Be.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=g0(t),e=e!==null?fg(e):null,e=e===null?null:e.stateNode,e};var L1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:ue,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(ro=__REACT_DEVTOOLS_GLOBAL_HOOK__,!ro.isDisabled&&ro.supportsFiber))try{Lo=ro.inject(L1),oa=ro}catch{}var ro;Gs.createRoot=function(e,t){if(!pg(e))throw Error(L(299));var a=!1,r="",i=jh,n=Qh,o=Gh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Yb(e,1,!1,null,null,a,r,null,i,n,o,Pb),e[bn]=t.current,ad(e),new sd(t)};Gs.hydrateRoot=function(e,t,a){if(!pg(e))throw Error(L(299));var r=!1,i="",n=jh,o=Qh,l=Gh,c=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(n=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(c=a.formState)),t=Yb(e,1,!0,t,a??null,r,i,c,n,o,l,Pb),t.context=Xb(null),a=t.current,r=sa(),r=hp(r),i=Dr(r),i.callback=null,Or(a,i,r),a=r,t.current.lanes=a,jo(t,a),Qa(t),e[bn]=t.current,ad(e),new Qs(t)};Gs.version="19.2.3"});var Wb=Ua((yx,Fb)=>{"use strict";function Ib(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ib)}catch(e){console.error(e)}}Ib(),Fb.exports=Jb()});var Xv=Ua($s=>{"use strict";var $1=Symbol.for("react.transitional.element"),Z1=Symbol.for("react.fragment");function Yv(e,t,a){var r=null;if(a!==void 0&&(r=""+a),t.key!==void 0&&(r=""+t.key),"key"in t){a={};for(var i in t)i!=="key"&&(a[i]=t[i])}else a=t;return t=a.ref,{$$typeof:$1,type:e,key:r,ref:t!==void 0?t:null,props:a}}$s.Fragment=Z1;$s.jsx=Yv;$s.jsxs=Yv});var ie=Ua((Zk,Vv)=>{"use strict";Vv.exports=Xv()});var Bw=X(Wb());var ev=`/* Every rule is scoped to .app-wrapper, the root of each widget, so nothing here styles
|
|
10
10
|
the host page. Start new selectors with :where(.app-wrapper), which scopes without
|
|
11
11
|
adding specificity, or with .app-wrapper for rules on the root itself. */
|
|
12
12
|
|
|
@@ -6777,11 +6777,11 @@ Error generating stack: `+r.message+`
|
|
|
6777
6777
|
width: 100%;
|
|
6778
6778
|
height: 100%;
|
|
6779
6779
|
}
|
|
6780
|
-
`;var Re=X(Xe());var Ys={};function
|
|
6781
|
-
`).map(t=>t.trim()).filter(Boolean);function
|
|
6782
|
-
`).filter(Z=>Z.trim()).length,G
|
|
6780
|
+
`;var Re=X(Xe());var Ys={};function tv(e){Ys={...e,client:e.client?.trim().toUpperCase()||void 0}}function Ht(){return Ys}function cd(){return!!Ys.apiBaseUrl}var j1=e=>e.replace(/\/$/,"");function jt(e){let t=Ys.apiBaseUrl;return t?`${j1(t)}${e.replace(/^\/api\//,"/v1/")}`:e}var Nn=X(Xe());var Q1="metron:step",G1="metron_step",Po=(0,Nn.createContext)(()=>{}),Sn=()=>(0,Nn.useContext)(Po);function Xs(e,t){return(0,Nn.useCallback)((a,r={})=>{let i=Ht(),n=i.analytics??"all";if(n==="none")return;let o={...r,widget:e,step:a};t.current?.dispatchEvent(new CustomEvent(Q1,{detail:o,bubbles:!0,composed:!0})),i.onEvent?.(o);let l=window.dataLayer;n==="all"&&Array.isArray(l)&&l.push({event:G1,...o})},[e,t])}var av="boq-session-id",rv="x-boq-session";function iv(){if(typeof window>"u")return"server";try{let e=window.localStorage.getItem(av);return e||(e=crypto.randomUUID(),window.localStorage.setItem(av,e)),e}catch{return crypto.randomUUID()}}var Y1="x-boq-client";function Vs(){return Ht().client}function Ga(){let{client:e,apiKey:t}=Ht();return cd()?t?{Authorization:`Bearer ${t}`}:{}:e?{[Y1]:e}:{}}function vi(){return{...cd()?{}:{[rv]:iv()},...Ga()}}function X1(e){return e&&typeof e=="object"&&e.success===!0&&"data"in e?e.data:e}async function Jt(e){return X1(await e.json().catch(()=>({})))}var nv=9e4;async function ov(e,t){let a=new AbortController,r=setTimeout(()=>a.abort(),nv),i;try{i=await fetch(e,{...t,signal:a.signal})}catch(o){throw o?.name==="AbortError"?new Error(`Request to ${e} timed out after ${nv/1e3}s. Please try again.`):o}finally{clearTimeout(r)}let n=await Jt(i);if(!i.ok||n?.error){let o=n;throw new Error(o.detail??o.message??o.error??`Server error ${i.status}`)}return n}function lv(e,t,a=!0){let r=new FormData;return r.append("file",e),t?.length&&r.append("provided_lines_json",JSON.stringify(t)),a||r.append("archive_source","false"),ov(jt("/api/schedule"),{method:"POST",body:r,headers:vi()})}function sv(e,t){let a=t?`?account=${encodeURIComponent(t)}`:"";return ov(jt(`/api/schedule/${e}${a}`),{headers:Ga()})}function cv(e,t,a,r){let i=!1,n=null,o=performance.now();return{promise:new Promise((p,d)=>{let g=async()=>{if(!i)try{let f=await e();if(i)return;if(f.status==="completed"||f.status==="failed"){console.log(`[pollJob:${r??"job"}] ${f.status} (${Math.round(performance.now()-o)}ms)`),p(f);return}a?.(),n=setTimeout(g,t)}catch(f){i||d(f)}};n=setTimeout(g,t)}),cancel:()=>{i=!0,n&&(clearTimeout(n),n=null)}}}var Ct=X(Xe());var uv=new URL("../assets/decking/boards/diagonal.webp",import.meta.url).href;var pv=new URL("../assets/decking/boards/no-border.webp",import.meta.url).href;var dv=new URL("../assets/decking/boards/picture-frame.webp",import.meta.url).href;var mv=new URL("../assets/decking/boards/straight.webp",import.meta.url).href;var fv=new URL("../assets/fencing/gates/no-gate.webp",import.meta.url).href;var gv=new URL("../assets/fencing/gates/single-gate.webp",import.meta.url).href;var hv=new URL("../assets/fencing/gravel-board.webp",import.meta.url).href;var bv=new URL("../assets/fencing/height/0.9.webp",import.meta.url).href;var vv=new URL("../assets/fencing/height/1.2.webp",import.meta.url).href;var wv=new URL("../assets/fencing/height/1.5.webp",import.meta.url).href;var yv=new URL("../assets/fencing/height/1.8.webp",import.meta.url).href;var _v=new URL("../assets/fencing/no-gravel-board.webp",import.meta.url).href;var xv=new URL("../assets/quick-order/paste-list.webp",import.meta.url).href;var kv=new URL("../assets/quick-order/photo-list.webp",import.meta.url).href;var Nv=new URL("../assets/quick-order/upload-file.webp",import.meta.url).href;var Sv=new URL("../assets/schedule-products/building-sand.webp",import.meta.url).href;var Cv=new URL("../assets/schedule-products/drywall-screws.webp",import.meta.url).href;var qv=new URL("../assets/schedule-products/loft-insulation-roll.webp",import.meta.url).href;var Ev=new URL("../assets/schedule-products/red-multi-stock-bricks.webp",import.meta.url).href;var Mv=new URL("../assets/schedule-products/scrim-tape.webp",import.meta.url).href;var Tv=new URL("../assets/schedule-products/wall-ties.webp",import.meta.url).href;var zv=new URL("../assets/tool-images/architrave.webp",import.meta.url).href;var Av=new URL("../assets/tool-images/brick-block.webp",import.meta.url).href;var Rv=new URL("../assets/tool-images/concrete-aggregate.webp",import.meta.url).href;var Uv=new URL("../assets/tool-images/decking.webp",import.meta.url).href;var Dv=new URL("../assets/tool-images/fencing.webp",import.meta.url).href;var Ov=new URL("../assets/tool-images/insulation.webp",import.meta.url).href;var Bv=new URL("../assets/tool-images/paint.webp",import.meta.url).href;var Lv=new URL("../assets/tool-images/paving.webp",import.meta.url).href;var Hv=new URL("../assets/tool-images/plasterboard.webp",import.meta.url).href;var jv=new URL("../assets/tool-images/skirting.webp",import.meta.url).href;var Qv=new URL("../assets/tool-images/timber.webp",import.meta.url).href;var Gv=new URL("../assets/tool-images/truss.webp",import.meta.url).href;var Ae=e=>typeof e=="string"?e:e.src,V1={"/decking/boards/diagonal.webp":Ae(uv),"/decking/boards/no-border.webp":Ae(pv),"/decking/boards/picture-frame.webp":Ae(dv),"/decking/boards/straight.webp":Ae(mv),"/fencing/gates/no-gate.webp":Ae(fv),"/fencing/gates/single-gate.webp":Ae(gv),"/fencing/gravel-board.webp":Ae(hv),"/fencing/height/0.9.webp":Ae(bv),"/fencing/height/1.2.webp":Ae(vv),"/fencing/height/1.5.webp":Ae(wv),"/fencing/height/1.8.webp":Ae(yv),"/fencing/no-gravel-board.webp":Ae(_v),"/quick-order/paste-list.webp":Ae(xv),"/quick-order/photo-list.webp":Ae(kv),"/quick-order/upload-file.webp":Ae(Nv),"/schedule-products/building-sand.webp":Ae(Sv),"/schedule-products/drywall-screws.webp":Ae(Cv),"/schedule-products/loft-insulation-roll.webp":Ae(qv),"/schedule-products/red-multi-stock-bricks.webp":Ae(Ev),"/schedule-products/scrim-tape.webp":Ae(Mv),"/schedule-products/wall-ties.webp":Ae(Tv),"/tool-images/architrave.webp":Ae(zv),"/tool-images/brick-block.webp":Ae(Av),"/tool-images/concrete-aggregate.webp":Ae(Rv),"/tool-images/decking.webp":Ae(Uv),"/tool-images/fencing.webp":Ae(Dv),"/tool-images/insulation.webp":Ae(Ov),"/tool-images/paint.webp":Ae(Bv),"/tool-images/paving.webp":Ae(Lv),"/tool-images/plasterboard.webp":Ae(Hv),"/tool-images/skirting.webp":Ae(jv),"/tool-images/timber.webp":Ae(Qv),"/tool-images/truss.webp":Ae(Gv)};function It(e){return V1[e]??e}var ud=X(ie());function Qt(){return(0,ud.jsx)("svg",{className:"forward-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ud.jsx)("path",{d:"M3 8H13M13 8L9 4M13 8L9 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var pd=X(ie());function Jo(){return(0,pd.jsx)("svg",{className:"close-icon",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,pd.jsx)("path",{d:"M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}var Cn={schedule:[".xlsx",".xls",".csv",".pdf",".docx"],photo:[".png",".jpg",".jpeg",".webp",".gif",".bmp",".heic",".heif"],email:[".eml",".msg"]};var Zv=(e,t)=>Cn[t].some(a=>e.toLowerCase().endsWith(a)),qn=e=>e.type.startsWith("image/")||Zv(e.name,"photo"),K1=e=>qn(e)||Zv(e.name,"schedule"),$v=e=>`${Math.max(.1,Math.round(e/1048576*10)/10)} MB`;function dd(e,t=5242880){return K1(e)?e.size===0?"That file is empty.":e.size>t?`That file is ${$v(e.size)} - the limit is ${$v(t)}.`:null:`Please upload a list or image file (${[...Cn.schedule,...Cn.photo].join(", ")}).`}var P1=e=>e.split(`
|
|
6781
|
+
`).map(t=>t.trim()).filter(Boolean);function Kv(e){let t=P1(e);if(t.length>500)return`That's ${t.length} lines - the limit is 500. Split the list and match it in parts.`;if(e.length>5e4)return`That's ${e.length.toLocaleString("en-GB")} characters - the limit is ${5e4.toLocaleString("en-GB")}. Split the list and match it in parts.`;let a=t.findIndex(r=>r.length>500);return a>=0?`Line ${a+1} is ${t[a].length} characters - keep each item on its own line (max 500).`:null}async function Pv(e){if(e.size<=5242880)return e;let t;try{t=await createImageBitmap(e)}catch{return e}let a=Math.min(1,2e3/Math.max(t.width,t.height)),r=document.createElement("canvas");r.width=Math.round(t.width*a),r.height=Math.round(t.height*a);let i=r.getContext("2d");if(!i)return e;i.fillStyle="#fff",i.fillRect(0,0,r.width,r.height),i.drawImage(t,0,0,r.width,r.height),t.close();let n=await new Promise(o=>r.toBlob(o,"image/jpeg",.85));return!n||n.size>=e.size?e:new File([n],`${e.name.replace(/\.[^.]+$/,"")}.jpg`,{type:"image/jpeg"})}var Kr=X(Xe());var Ks=X(Xe()),Zs=X(ie()),J1=[4,5,4],md=4e3;function fr(){let[e,t]=(0,Ks.useState)(0);(0,Ks.useEffect)(()=>{let r=setInterval(()=>t(i=>i+1),md);return()=>clearInterval(r)},[]);let a=0;return(0,Zs.jsx)("div",{className:"brick-wall","aria-hidden":!0,children:J1.map((r,i)=>(0,Zs.jsx)("div",{className:"brick-wall__course",children:Array.from({length:r},(n,o)=>(0,Zs.jsx)("span",{className:`brick-wall__brick${r===5&&(o===0||o===4)?" brick-wall__brick--half":""}`,style:{"--i":a++}},o))},i))},e)}var Io=X(ie()),Ps=["Measuring twice, quoting once","Counting bricks so you don't have to","Haggling with the price of timber","Adding a bit extra for the skip","Double-checking nobody ordered too much sand","Rounding up, obviously","Making sure the numbers add up better than the last lot did","Checking if copper pipe is still worth its weight in gold","Squeezing a bit more accuracy out of the numbers","Totting it all up on the back of a fag packet, digitally","Making sure the quote is tighter than your tolerances","Nearly there, unlike most site schedules","Working out if it'll all fit on one pallet","Double-checking the VAT, because someone has to","Giving the calculator a proper workout","Making sure nothing's out of stock before you get excited"];function Jv(e){let t=[...e];for(let a=t.length-1;a>0;a--){let r=Math.floor(Math.random()*(a+1));[t[a],t[r]]=[t[r],t[a]]}return t}function Iv(){let e=(0,Kr.useRef)(Jv(Ps.map((o,l)=>l))),t=(0,Kr.useRef)(0),[a,r]=(0,Kr.useState)(Ps[e.current[0]]),[i,n]=(0,Kr.useState)(!0);return(0,Kr.useEffect)(()=>{let o=setInterval(()=>{n(!1),window.setTimeout(()=>{t.current++,t.current>=e.current.length&&(e.current=Jv(Ps.map((l,c)=>c)),t.current=0),r(Ps[e.current[t.current]]),n(!0)},600)},md);return()=>clearInterval(o)},[]),(0,Io.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",children:[(0,Io.jsx)(fr,{}),(0,Io.jsx)("p",{className:`banter-message${i?" is-visible":""}`,children:a})]})}var Js=X(Xe());function Fo(e,t){let a=(0,Js.useRef)(t);a.current=t,(0,Js.useEffect)(()=>{if(!e)return;let r=i=>{i.key!=="Escape"||i.defaultPrevented||i.isComposing||(i.preventDefault(),a.current())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e])}var I=X(ie()),I1=[...Cn.schedule,...Cn.photo].join(","),F1={paste:[{title:"Paste List",desc:"Paste your material list straight from a spreadsheet or document."},{title:"Check Matches",desc:"Review the suggested products and adjust any that need changing."},{title:"Review Quote",desc:"Review the matched materials for your quote."}],upload:[{title:"Upload File",desc:"Upload a photo, spreadsheet, Word document or PDF."},{title:"Check Matches",desc:"Review the suggested products and adjust any that need changing."},{title:"Review Quote",desc:"Review the matched materials for your quote."}]},En="#quote-entry",Is="metron-quick-quote-entry";function fd({onPasteSchedule:e,onUploadSchedule:t,onEntryModeChange:a,draft:r,onSubmitDraft:i,onCancelMatch:n}){let[o,l]=(0,Ct.useState)(()=>r&&typeof window<"u"&&window.location.hash===En?r.tab:null),c=Sn(),[p,d]=(0,Ct.useState)(r?.text??""),[g,f]=(0,Ct.useState)(r?.file??null),[h,w]=(0,Ct.useState)(""),[M,D]=(0,Ct.useState)(!1),[m,u]=(0,Ct.useState)(!1),[b,v]=(0,Ct.useState)(null),N=(0,Ct.useRef)(0),A=(0,Ct.useRef)(0),T=(0,Ct.useRef)(null),z=p.split(`
|
|
6782
|
+
`).filter(Z=>Z.trim()).length,G=Kv(p),P=o==="paste"?!!p:!!g;(0,Ct.useEffect)(()=>{if(!g||!qn(g)){v(null);return}let Z=URL.createObjectURL(g);return v(Z),()=>URL.revokeObjectURL(Z)},[g]);let be=(0,Ct.useRef)(o??r?.tab??null);o&&(be.current=o),(0,Ct.useEffect)(()=>{if(r||window.location.hash!==En)return;let Z=null;try{Z=JSON.parse(window.sessionStorage.getItem(Is)??"null")}catch{}if(!Z?.tab){let de=new URL(window.location.href);de.hash="",window.history.replaceState(window.history.state,"",de);return}be.current=Z.tab,l(Z.tab),d(Z.text??"")},[]),(0,Ct.useEffect)(()=>{if(o)try{window.sessionStorage.setItem(Is,JSON.stringify({tab:o,text:p}))}catch{}},[o,p]),(0,Ct.useEffect)(()=>{let Z=()=>{if(window.location.hash===En)return l(be.current);l(null),A.current++,D(!1),n?.()};return window.addEventListener("popstate",Z),()=>window.removeEventListener("popstate",Z)},[]);let De=Z=>{c("method_selected",{method:Z}),l(Z),a(null);let de=window.location.hash;if(de===En)return;let Je=new URL(window.location.href);Je.hash=En;let Ye=de==="#matched-products"||de==="#quote-request";window.history[Ye?"replaceState":"pushState"]({boqQuoteStage:"entry"},"",Je)},Le=()=>{l(null),a(null),window.location.hash===En&&window.history.back()};Fo(!!o&&!M,Le);let He=Z=>{if(!Z?.length)return;if(Z.length>1)return w("Please choose one file at a time.");let de=Z[0],Je=dd(de,qn(de)?1/0:void 0);if(Je)return w(Je);w(""),f(de)},ze=async Z=>{o==="paste"&&f(null),o==="upload"&&d(""),o&&i?.({tab:o,text:o==="paste"?p:"",file:o==="upload"?g:null});let de=++A.current;D(!0);try{await Z()}finally{de===A.current&&D(!1)}},me=async Z=>{let de=A.current;try{let Je=await Pv(Z),Ye=dd(Je);if(Ye)throw new Error(Ye);let pt=new FormData;pt.append("file",Je);let ot=await fetch(jt("/api/schedule/extract-photo"),{method:"POST",body:pt,headers:Ga()}),at=await Jt(ot);if(!ot.ok)throw new Error(at?.error||at?.message||"Failed to extract line items from image");let ge=typeof at?.text=="string"?at.text.trim():"";if(!ge)throw new Error("No line items were extracted from this image.");let W=Array.isArray(at?.lines)?at.lines.filter(k=>!!(k&&typeof k=="object"&&typeof k.text=="string")):void 0;if(de!==A.current)return;await e(ge,W,!1)}catch(Je){if(de!==A.current)return;c("error",{stage:"photo"}),w(Je?.message||"Failed to extract line items from image")}},ce=()=>{if(g)return c("list_submitted",{method:qn(g)?"photo":"upload"}),ze(()=>qn(g)?me(g):t(g))},fe=Z=>Z.dataTransfer.types.includes("Files"),Ee=Z=>{fe(Z)&&(Z.preventDefault(),N.current+=1,u(!0))},ut=Z=>{fe(Z)&&(N.current-=1,N.current<=0&&(N.current=0,u(!1)))},Se=Z=>{fe(Z)&&(Z.preventDefault(),N.current=0,u(!1),He(Z.dataTransfer.files),De("upload"))};return(0,I.jsxs)("div",{className:"wizard-step entry-stage",onDragEnter:Ee,onDragOver:Z=>fe(Z)&&Z.preventDefault(),onDragLeave:ut,onDrop:Se,children:[m&&(0,I.jsx)("div",{className:"entry-drop-overlay","aria-hidden":"true",children:"Drop your file to upload"}),(0,I.jsxs)("div",{className:"quick-order-card",children:[(0,I.jsxs)("div",{className:"quick-order-alt",children:[(0,I.jsxs)("div",{className:"quick-order-entry-copy",children:[(0,I.jsx)("div",{className:"quick-order-alt-title",children:"How would you like to get started?"}),(0,I.jsx)("p",{className:"quick-order-alt-intro",children:"Upload a file or type a list of items and quantities. We'll match them to our products and help you build a quote."})]}),(0,I.jsxs)("div",{className:"entry-options entry-options--workflow entry-options--two",children:[(0,I.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--paste${o==="paste"?" entry-option-card--active":""}`,onClick:()=>De("paste"),children:[(0,I.jsxs)("span",{className:"entry-option-content",children:[(0,I.jsx)("span",{className:"entry-option-title",children:"Type or paste a list"}),(0,I.jsx)("span",{className:"entry-option-desc",children:"Enter your materials and quantities"})]}),(0,I.jsx)("span",{className:"entry-option-media entry-option-media--paste","aria-hidden":"true",children:(0,I.jsx)("img",{className:"fill-img",src:It("/quick-order/paste-list.webp"),alt:""})})]}),(0,I.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--upload${o==="upload"?" entry-option-card--active":""}`,onClick:()=>De("upload"),children:[(0,I.jsxs)("span",{className:"entry-option-content",children:[(0,I.jsx)("span",{className:"entry-option-title",children:"Upload a file"}),(0,I.jsx)("span",{className:"entry-option-desc",children:"A photo, spreadsheet, Word document or PDF"})]}),(0,I.jsx)("span",{className:"entry-option-media entry-option-media--upload","aria-hidden":"true",children:(0,I.jsx)("img",{className:"fill-img",src:It("/quick-order/photo-list.webp"),alt:""})})]})]})]}),o&&(0,I.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"quick-order-workflow-title",onClick:()=>!P&&Le(),children:(0,I.jsxs)("section",{className:`quick-order-workflow-modal${M?" quick-order-workflow-modal--matching":""}`,onClick:Z=>Z.stopPropagation(),children:[(0,I.jsxs)("header",{className:"quick-order-workflow-modal-header",children:[(0,I.jsx)("h2",{id:"quick-order-workflow-title",children:o==="paste"?"Type or paste a list":"Upload a file"}),(0,I.jsx)("button",{type:"button",className:"quick-order-workflow-close",onClick:Le,"aria-label":"Close",children:(0,I.jsx)(Jo,{})})]}),(0,I.jsxs)("div",{className:"quick-order-panel",children:[(0,I.jsxs)("div",{className:"quick-order-body","aria-hidden":M,children:[(0,I.jsx)("div",{className:"quick-order-body-main",children:o==="paste"?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("textarea",{className:"paste-textarea",placeholder:`Paste your line items here, one per line, e.g.
|
|
6783
6783
|
insulated plasterboard 50mm
|
|
6784
|
-
C24 timber 4.8m`,value:p,onChange:Z=>d(Z.target.value),"aria-label":"Paste schedule line items"}),G&&(0,
|
|
6784
|
+
C24 timber 4.8m`,value:p,onChange:Z=>d(Z.target.value),"aria-label":"Paste schedule line items"}),G&&(0,I.jsxs)("div",{className:"error-box",role:"alert",children:[(0,I.jsx)("strong",{children:"Error:"})," ",G]}),(0,I.jsxs)("div",{className:"quick-order-hint",children:[(0,I.jsx)("strong",{children:"Tip:"}),'\xA0Paste one line per item. Include a count, e.g. "x10", to help us find the right stock and pricing.']}),(0,I.jsx)("div",{className:"quick-order-actions",children:(0,I.jsxs)("button",{type:"button",className:"cta-btn",disabled:!z||!!G,onClick:()=>{c("list_submitted",{method:"paste",lines:z}),ze(()=>e(p))},"aria-label":"Match pasted lines",children:[(0,I.jsx)("span",{children:"Match line items"}),(0,I.jsx)("span",{className:"arrow",children:(0,I.jsx)(Qt,{})})]})})]}):(0,I.jsxs)(I.Fragment,{children:[h&&(0,I.jsxs)("div",{className:"error-box",role:"alert",children:[(0,I.jsx)("strong",{children:"Error:"})," ",h]}),(0,I.jsxs)("div",{className:`upload-zone${g?" has-file":""}`,onClick:()=>T.current?.click(),onDragOver:Z=>Z.preventDefault(),onDrop:Se,role:"button",tabIndex:0,onKeyDown:Z=>(Z.key==="Enter"||Z.key===" ")&&T.current?.click(),"aria-label":"Upload zone: click or drag a list or image file here",children:[b?(0,I.jsx)("img",{src:b,alt:g?.name??"Selected photo",className:"upload-zone-photo-preview"}):(0,I.jsx)("div",{className:"upload-zone-icon",children:(0,I.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,I.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,I.jsx)("polyline",{points:"14,2 14,8 20,8"}),(0,I.jsx)("polyline",{points:"9,15 11,17 15,13"})]})}),g?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{className:"upload-zone-subtext",children:g.name}),(0,I.jsx)("button",{type:"button",className:"link-btn link-btn--underline",onClick:Z=>{Z.stopPropagation(),f(null),w(""),T.current&&(T.current.value="")},children:"Remove"})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{className:"upload-zone-text",children:"Drop a photo, spreadsheet, Word document or PDF"}),(0,I.jsx)("div",{className:"upload-zone-subtext",children:"or click to choose a file"})]}),(0,I.jsx)("input",{ref:T,type:"file",accept:I1,className:"visually-hidden",onChange:Z=>He(Z.target.files),tabIndex:-1,"aria-hidden":"true"})]}),(0,I.jsx)("div",{className:"quick-order-actions",children:(0,I.jsxs)("button",{type:"button",className:"cta-btn",disabled:!g,onClick:()=>{ce()},"aria-label":"Match uploaded items",children:[(0,I.jsx)("span",{children:"Match items"}),(0,I.jsx)("span",{className:"arrow",children:(0,I.jsx)(Qt,{})})]})})]})}),(0,I.jsx)("aside",{className:"quick-order-sidebar",children:F1[o].map((Z,de)=>(0,I.jsxs)("div",{className:"quick-order-step quick-order-step--rail",children:[(0,I.jsx)("span",{className:"quick-order-step-dot",children:de+1}),(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"quick-order-step-title",children:Z.title}),(0,I.jsx)("div",{className:"quick-order-step-desc",children:Z.desc})]})]},Z.title))})]}),M&&(0,I.jsx)("div",{className:"quick-order-matching-overlay",children:(0,I.jsx)(Iv,{})})]})]})})]})]})}var Ne=X(Xe());var gd=X(ie());function Pr(){return(0,gd.jsx)("svg",{className:"back-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,gd.jsx)("path",{d:"M13 8H3M3 8L7 4M3 8L7 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var wi=X(ie());function hd(){return(0,wi.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,wi.jsx)("path",{d:"M3 12a9 9 0 0 1 15.36-6.36L21 8"}),(0,wi.jsx)("path",{d:"M21 3v5h-5"}),(0,wi.jsx)("path",{d:"M21 12a9 9 0 0 1-15.36 6.36L3 16"}),(0,wi.jsx)("path",{d:"M3 21v-5h5"})]})}var Wo=X(ie());function bd({unit:e}){return(0,Wo.jsx)(Wo.Fragment,{children:e.split(/([²³])/).map((t,a)=>t==="\xB2"||t==="\xB3"?(0,Wo.jsx)("span",{className:"unit-sup",children:t},a):t)})}var Fv=X(ie());function W1(e,t){return t===1||/^m\d*$/i.test(e)?e:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`}function Na(e,t){let a=(e??"").trim();if(!a||a==="-")return"";let r=/^each$/i.test(a)?"unit":a;return t!=null?W1(r,t):r}function Sa(e,t){let a=Na(e,t);return a?(0,Fv.jsx)(bd,{unit:a}):null}function el(e){let t=(e??"").trim();if(!t)return"";let a=t.match(/^per\s+(.+)$/i);if(!a)return t;let r=Na(a[1]);return r?`per ${r}`:""}function yi(e){return e===0?"-":Number.isInteger(e)?e.toString():e<1?e.toFixed(2):e.toFixed(1)}function nt(e){return`\xA3${e.toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Wv(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}var e_=[{match:["building sand"],path:"/schedule-products/building-sand.webp"},{match:["drywall screw"],path:"/schedule-products/drywall-screws.webp"},{match:["scrim"],path:"/schedule-products/scrim-tape.webp"},{match:["loft insulation","loft roll"],path:"/schedule-products/loft-insulation-roll.webp"},{match:["wall tie"],path:"/schedule-products/wall-ties.webp"},{match:["red multi","multi stock","brick"],path:"/schedule-products/red-multi-stock-bricks.webp"}],t_=[{match:["mortar"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Blue+Circle+Quality+Assured+Mortar+Mix+-+Photo.jpg"},{match:["mot type 1"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/MOT+-+Photo+1.jpg"},{match:["soft sand","building sand"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Soft+Building+Sand+-+Photo+1.jpg"},{match:["cement"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/blue+circle+general+cement+bagged.jpg"},{match:["brick"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/class+B+engineering+brick+smooth+red+perforated+65mm+-+Photo+1+comp.jpg"},{match:["dense block","concrete block"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/100mm+solid+dense+concrete+block+-+Photo+1+-+1920+comp.jpg"},{match:["metal c stud","c stud"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/70mm+c+stud+angle.jpg"},{match:["timber","carcassing","sawn","c24","c16"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/47mm+x+100mm+sawn+treated+c16+-+Photo+1+1920.jpg"},{match:["osb"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/18mm+structural+OSB+-+Photo+1+comp.jpg"},{match:["dpc"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/225mm+damp+proof+course.jpg"},{match:["soil pipe","soil bend","underground","drainage"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/110mm+Soil+Pipe+Single+Socket+Black+3m+-+High+Res.jpg"},{match:["nail"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/galvanised+round+wire+nail+vertical.jpg"},{match:["retaining clip","retaining clips","insulation disc","insulation disks"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/multiple+zinc+insulation+discs.jpg"},{match:["wall tie"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Type+4+Wall+Ties+-+Photo.jpg"},{match:["loft insulation","loft roll","insulation roll"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/200mm+knauf+loft+roll+44+unwrapping.jpg"},{match:["pir insulation","insulation board","celotex","unilin","indiboard"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/100mm+celotex+sheet+logo.jpg"},{match:["plasterboard","wallboard"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/12.5mm+wallboard+tapered+edge+corner.jpg"},{match:["drywall screw"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/close+up+drywall+course+thread.jpg"},{match:["scrim","jointing tape","paper tape"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/50mm+scrim+tape.jpg"},{match:["adhesive","high grab","evostik","stixall","gripfill","sealant","ct1"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Instant+Nails+Solvent+Free+Grab+Adhesive+White+290ml+-+Photo.jpg"}];function Ya(e,t,a){if(a)return a;let r=(e||"").toLowerCase(),i=t_.find(o=>o.match.some(l=>r.includes(l)));if(i)return i.url;let n=e_.find(o=>o.match.some(l=>r.includes(l)));return n?It(n.path):r.includes("insulation")?Wv(`
|
|
6785
6785
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
|
|
6786
6786
|
<rect width="640" height="420" fill="#fbf1cf"/>
|
|
6787
6787
|
<rect x="88" y="78" width="432" height="264" rx="16" fill="#f0c43f"/>
|
|
@@ -6792,7 +6792,7 @@ C24 timber 4.8m`,value:p,onChange:Z=>d(Z.target.value),"aria-label":"Paste sched
|
|
|
6792
6792
|
<line x1="140" y1="240" x2="468" y2="240"/>
|
|
6793
6793
|
</g>
|
|
6794
6794
|
</svg>
|
|
6795
|
-
`):
|
|
6795
|
+
`):Wv(`
|
|
6796
6796
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
|
|
6797
6797
|
<rect width="640" height="420" fill="#edf1f5"/>
|
|
6798
6798
|
<rect x="132" y="108" width="376" height="204" rx="18" fill="#d5dde6"/>
|
|
@@ -6800,9 +6800,9 @@ C24 timber 4.8m`,value:p,onChange:Z=>d(Z.target.value),"aria-label":"Paste sched
|
|
|
6800
6800
|
<rect x="168" y="188" width="250" height="24" rx="12" fill="#aab5c0"/>
|
|
6801
6801
|
<rect x="168" y="232" width="220" height="24" rx="12" fill="#aab5c0"/>
|
|
6802
6802
|
</svg>
|
|
6803
|
-
`)}function Pr(e,t){return{lineId:t.lineId,description:e?.description||t.description||"(no description)",requestedDescription:t.description,productId:e?.product_id??"-",price:e?.price??null,priceBasis:e?.price_basis??null,unit:t.unit,uoi:e?.uoi??t.unit,uoiCount:e?.uoi_count??null,saleUnit:e?.conversion?.sale_unit??null,saleUnitQuantity:e?.conversion?.sale_unit_quantity??null,unitConversions:e?.conversion?.unit_conversions?.map(a=>({requestUom:a.request_uom,quantityPerSaleUnit:a.quantity_per_sale_unit,evidence:a.evidence,confidence:a.confidence})),pdpPhotoUrl:e?.pdp_photo_url??null,measurementsMm:e?.measurements_mm??[],conversionType:e?.conversion?.conversion_type??null,requestUomsSupported:e?.conversion?.request_uoms_supported??null,salesUomNormalised:e?.conversion?.sales_uom_normalised??null,salesUnitSize:e?.conversion?.sales_unit_size??null,salesUnitSizeUom:e?.conversion?.sales_unit_size_uom??null,coverageQty:e?.conversion?.coverage_qty??null,coverageUom:e?.conversion?.coverage_uom??null,itemsPerPallet:e?.conversion?.items_per_pallet??null,itemsPerPack:e?.conversion?.items_per_pack??null,itemsPerBox:e?.conversion?.items_per_box??null,itemsPerM2:e?.conversion?.items_per_m2??null,wasteFactorDefault:e?.conversion?.waste_factor_default??null,roundingRule:e?.conversion?.rounding_rule??null,derivedCoverageM2:e?.conversion?.derived_coverage_m2??null,derivedLengthM:e?.conversion?.derived_length_m??null,quoteQtyFormulaType:e?.conversion?.quote_qty_formula_type??null,conversionConfidence:e?.conversion?.conversion_confidence??null,conversionNotes:e?.conversion?.conversion_notes??null,calculatorWasteIncluded:t.calculatorWasteIncluded,qty:t.qty,linkedContext:t.linkedContext}}var aw=e=>(e??"").trim().toLowerCase(),e_={sqm:"m2","sq m":"m2","m\xB2":"m2",cbm:"m3","cu m":"m3",lm:"m","lin m":"m",metre:"m",meter:"m",each:"each",ea:"each",nr:"each",no:"each",item:"each",unit:"each",units:"each",pc:"each",pcs:"each",board:"sheet",bags:"bag",length:"length",lengths:"length",pallet:"pallet",pallets:"pallet"},vd=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),Iv=new Set(["box","bag","pack","pallet","roll","set","tub"]),Wv=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,ew=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,_i=e=>{let t=aw(e);return e_[t]??t},ct=(e,t)=>{let a=_i(e),r=_i(t);return a.length>0&&a===r},t_=(e,t)=>{let a=aw(t);return a?a.includes("round_up_1000")?Math.ceil(e):a.includes("allow_decimal")?Math.round(e*1e3)/1e3:a.includes("round_up")?Math.ceil(e):e:e},a_=e=>(e??"").split(",").map(t=>_i(t)).filter(Boolean),r_=(e,t)=>{let a=a_(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||ct(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||ct(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||ct(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},tw=(e,t)=>ct(t,"pallet")?e.itemsPerPallet??null:ct(t,"pack")?e.itemsPerPack??null:ct(t,"box")?e.itemsPerBox??null:null,i_=(e,t,a)=>{if(!ct(t,"m2"))return null;let r=e.description.match(/(\d+(?:[.,]\d+)?)\s*(m2|m²|sqm|sq\.?\s*m)\s*(?:\/|per)\s*([a-z]+)/i);if(!r||!ct(r[3],a))return null;let i=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(i)&&i>0?i:null};function Is(e,t){return e.reduce((a,r)=>a+(Dt(r,t).lineTotal??0),0)}function Dt(e,t){let a=e.qty,r=_i(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=_i(e.unit)||(a>0&&vd.has(r)?r:"-"),n=e.saleUnitQuantity??e.salesUnitSize??e.uoiCount??1,o=t?.wasteFactorEnabled===!1?0:t?.wasteFactorOverride??e.wasteFactorOverride??e.wasteFactorDefault??0,l=e.sellUnitsOverride!=null&&Number.isFinite(e.sellUnitsOverride)&&e.sellUnitsOverride>0,c=l?vd.has(r)?Math.ceil(e.sellUnitsOverride):e.sellUnitsOverride:null,p=v=>({requestedAmount:a,requestedUnit:i,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:r,calculatedSellUnits:null,requiredSellUnits:c,unitPrice:e.price,lineTotal:e.price!=null&&c!=null?e.price*c:null,calculation:c!=null?`${v} Manually set to ${c} ${r}.`:v,costingMode:"review"});if(!r_(e,i))return p("Requested unit is not supported by this catalogue conversion.");let d=null,g="review",f=e.roundingRule,h=`Quantity review required, initial request needed ${a} ${i}.`,w=1+o,M=i_(e,i,r),D=e.unitConversions?.find(v=>ct(v.requestUom,i));if(!!e.saleUnit&&(ct(i,r)||!!D||ct(i,"each")&&!Iv.has(r)))if(ct(i,r))d=a*w/n,g="direct",h=`${a} ${i}${o>0?` x ${w}`:""}`;else if(D){d=a*w/D.quantityPerSaleUnit,g="derived";let v=1/D.quantityPerSaleUnit,N=Math.round(v);h=ct(r,"each")&&D.quantityPerSaleUnit<1&&Math.abs(v-N)<1e-9?`${a} ${i}${o>0?` x ${w}`:""} x ${N} per ${i}`:`${a} ${i}${o>0?` x ${w}`:""} / ${D.quantityPerSaleUnit} ${i} per ${r}`}else ct(i,"each")&&!Iv.has(r)&&(d=a*w/n,g="derived",h=`${a} ${r}${o>0?` x ${w}`:""}`);else if(ct(i,r)&&n>0)d=a*w/n,g="direct",h=o>0?`${a} ${i} x ${w} / ${n} ${r} per sell unit`:`${a} ${i} / ${n} ${r} per sell unit`;else if(ct(i,"each")&&n>0&&vd.has(r))d=a*w/n,g="derived",h=o>0?`${a} each x ${w} / ${n} each per ${r}`:`${a} each / ${n} each per ${r}`;else if(tw(e,i)!=null&&n>0){let v=tw(e,i)??0;d=a*v*w/n,g="derived";let N=`${a} ${i} x ${v} each${o>0?` x ${w}`:""}`;h=n===1&&ct(r,"each")?N:`${N} / ${n} each per ${r}`}else if(M!=null)d=a*w/M,g="derived",f??(f="round_up_each"),h=`${a} m2 x ${w} / ${M} m2 per ${r} (from product description)`;else if(e.conversionType==="basket_line_unit")n>0&&(d=a*w/n,g="derived",h=`${a} ${i}${o>0?` x ${w}`:""} / ${n} ${i} per ${r}`);else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${i}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let v=e.coverageQty??e.derivedCoverageM2??null;ct(i,"m2")&&v!=null&&v>0&&(d=a*w/v,g="derived",h=`${a} m2 x ${w} / ${v} m2 per ${r}`)}else if(e.conversionType==="count_per_area"){let v=e.coverageQty??null;ct(i,"m2")&&v!=null&&v>0?(d=a/v,g="derived",h=`${a} m2 / ${v} m2 per sell unit`):ct(i,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&n>0&&(d=a*e.itemsPerM2*w/n,g="derived",h=`${a} m2 x ${e.itemsPerM2} ${r}/m2 x ${w} / ${n}`)}else if(e.conversionType==="length_from_dims"){let v=e.coverageQty??e.derivedLengthM??null;ct(i,"m")&&v!=null&&v>0&&(d=a*w/v,g="derived",h=`${a} m x ${w} / ${v} m per ${r}`)}else if(e.conversionType==="volume_from_description"){let v=Wv(a,i),N=Wv(e.coverageQty??0,_i(e.coverageUom));v!=null&&N!=null&&N>0&&(d=v*w/N,g="derived",h=`${a} ${i} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="weight_from_description"){let v=ew(a,i),N=ew(e.coverageQty??0,_i(e.coverageUom));v!=null&&N!=null&&N>0&&(d=v*w/N,g="derived",h=`${a} ${i} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="same_unit_volume"){let v=e.coverageQty??null;ct(i,"m3")&&v!=null&&v>0&&(d=a/v,g="derived",h=`${a} m3 / ${v} m3 per ${r}`)}}if(d==null||!Number.isFinite(d)||d<0)return p(`Quantity review required, initial request needed ${a} ${i}.`);let u=t_(d,f),b=l?c:u;return{requestedAmount:a,requestedUnit:i,salesUnitSize:n,sellUnit:r,calculatedSellUnits:u,requiredSellUnits:b,unitPrice:e.price,lineTotal:e.price!=null&&b!=null?e.price*b:null,calculation:l?`${h} = ${u} ${r} (manually set to ${b})`:`${h} = ${b} ${r}`,costingMode:g}}var rw=()=>import("./xlsx-K4MOA2QM.js"),al=["Source Line ID","Split Line ID","Description","Section","Qty","Unit","Procurement intent","Procurement aliases","Build-up type","Layer count","Total thickness (mm)","Installation clues","System clues","Component requirements","Technical classification","Include in quote","Approval required","Approval type","Missing information","Adjudicator confidence","Decision reason","Selected candidate ID","Selected candidate description","Price basis","Price","Line total","Confidence","Status"],n_=al.indexOf("Line total");function o_(e){return e.unmatchable?"Not matched (labour/plant/referential)":e.decision?.include_in_quote===!0&&e.decision.approval_required===!0?"Approval required":e.decision?.include_in_quote===!0?"Quoted":e.decision?.technical_classification==="no_suitable_candidate"?"No suitable candidate":(e.best,"No match")}async function iw(e){let t=await rw(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),i=[al],n=0;for(let c of e){let{item:p,best:d,qty:g,band:f,unmatchable:h,decision:w}=c,M=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),D=!h&&d?.price!=null?d.price*g:null;D!=null&&(n+=D),i.push([p.source_line_id,p.line_id,p.description_original||"(no description)",M,g,p.unit,p.procurement_intent||"-",p.procurement_aliases.join(", "),p.build_up_type,p.layer_count,p.total_required_thickness_mm,p.installation_clues.join(", "),p.system_clues.join(", "),p.component_requirements.join(", "),w?.technical_classification??"",w?.include_in_quote==null?"":w.include_in_quote?"yes":"no",w?.approval_required==null?"":w.approval_required?"yes":"no",w?.approval_type??"",w?.missing_information.join(", ")??"",w?.confidence??"",w?.reason??"",h?"-":d?.product_id??w?.selected_candidate_id??"-",h?"-":d?.description??"-",h?"-":d?.price_basis??"-",h?null:d?.price??null,D,h?"-":f,o_(c)])}i.push(Array(al.length).fill(null));let o=Array(al.length).fill(null);o[0]="Estimated total",o[n_]=n,i.push(o),i.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(al.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(i);l["!cols"]=[{wch:12},{wch:12},{wch:44},{wch:24},{wch:8},{wch:8},{wch:28},{wch:28},{wch:16},{wch:10},{wch:12},{wch:24},{wch:24},{wch:24},{wch:22},{wch:14},{wch:14},{wch:18},{wch:24},{wch:16},{wch:48},{wch:16},{wch:40},{wch:10},{wch:10},{wch:12},{wch:11},{wch:26}],t.utils.book_append_sheet(a,l,"Schedule match"),t.writeFile(a,`schedule-quote-${r}.xlsx`)}var tl=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function nw(e,t){let a=await rw(),r=a.utils.book_new(),i=new Date().toISOString().slice(0,10),n=t?[["Account",t.name+" ("+t.id+")"],[],tl]:[tl],o=0;for(let p of e){let d=Dt(p),g=d.lineTotal;g!=null&&(o+=g),n.push([p.productId,p.description,d.costingMode,d.requestedAmount,ka(d.requestedUnit),d.salesUnitSize,ka(d.sellUnit),d.requiredSellUnits,d.unitPrice,g])}n.push(Array(tl.length).fill(null));let l=Array(tl.length).fill(null);l[0]="Estimated total",l[tl.length-1]=o,n.push(l);let c=a.utils.aoa_to_sheet(n);c["!cols"]=[{wch:14},{wch:48},{wch:12},{wch:14},{wch:10},{wch:14},{wch:10},{wch:16},{wch:12},{wch:14}],a.utils.book_append_sheet(r,c,"Basket"),a.writeFile(r,t?`basket-${t.id}-${i}.xlsx`:`basket-${i}.xlsx`)}var s=X(ie()),yd="__none__",rl=24,l_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function cw(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var s_=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function c_(e,t){if(t!==yd){if(t)return e?.candidates.find(a=>a.product_id===t);if(e?.decision?.selected_candidate_id!=null)return e.candidates.find(a=>a.product_id===e.decision.selected_candidate_id)}}function ow(e){return{product_id:e.productId,description:e.description,source_list:null,price:e.price,price_basis:e.priceBasis,uoi_count:e.uoiCount??null,uoi:e.uoi,pdp_photo_url:e.pdpPhotoUrl??null,measurements_mm:e.measurementsMm??[],conversion:{sale_unit:e.saleUnit,sale_unit_quantity:e.saleUnitQuantity,unit_conversions:e.unitConversions?.map(t=>({request_uom:t.requestUom,quantity_per_sale_unit:t.quantityPerSaleUnit,evidence:t.evidence,confidence:t.confidence})),sales_uom_normalised:e.salesUomNormalised,conversion_type:e.conversionType,request_uoms_supported:e.requestUomsSupported,sales_unit_size:e.salesUnitSize,sales_unit_size_uom:e.salesUnitSizeUom,coverage_qty:e.coverageQty,coverage_uom:e.coverageUom,items_per_pallet:e.itemsPerPallet,items_per_pack:e.itemsPerPack,items_per_box:e.itemsPerBox,items_per_m2:e.itemsPerM2,waste_factor_default:e.wasteFactorDefault,rounding_rule:e.roundingRule,derived_coverage_m2:e.derivedCoverageM2,derived_length_m:e.derivedLengthM,quote_qty_formula_type:e.quoteQtyFormulaType,conversion_confidence:e.conversionConfidence,conversion_notes:e.conversionNotes},scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"manual_cart_selection"}}function u_(e){return e?e.replace(/_/g," "):"not stated"}function p_({band:e}){return(0,s.jsx)("span",{className:`status-dot status-dot--${e}`,title:e,children:(0,s.jsx)("span",{className:"status-dot__mark"})})}function Tn(e,t){if(e==null)return"-";let a=el(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function _d(e){return e&&e.length>0?e.join(" x "):"-"}function d_(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Mn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Jr(e,t){let a=typeof e.description_original=="string"?e.description_original.trim():"";return(typeof e.customer_display_label=="string"?e.customer_display_label.trim():"")||a||"(no description)"}var lw=[{background:"#fff7ed",borderColor:"#fdba74",color:"#9a3412"},{background:"#eff6ff",borderColor:"#93c5fd",color:"#1d4ed8"},{background:"#ecfeff",borderColor:"#67e8f9",color:"#0f766e"},{background:"#f0fdf4",borderColor:"#86efac",color:"#166534"},{background:"#fdf4ff",borderColor:"#f0abfc",color:"#a21caf"}];function m_(e){let t=new Map;return[...new Set(e.filter(gr).map(r=>r.linked_group_id))].forEach((r,i)=>{let n=i%26;t.set(r,{token:String.fromCharCode(65+n),bubbleStyle:lw[i%lw.length]})}),t}function gr(e){return!1}function zn(e){if(!e.linked_group_id)return null;let t=e.linked_group_label||"Linked group",a=e.linked_group_role==="anchor"?"anchor":e.linked_group_role==="dependent"?"dependent":"member",r=e.linked_group_shared_width_mm!=null?`, ${e.linked_group_shared_width_mm}mm family`:"";return`${t} (${a}${r})`}function wd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function f_(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,5),l=o.some(c=>c.product_id===a)?void 0:e.find(c=>c.product_id===a);return l?[...o,l]:o}let i=new Map(e.map(o=>[o.product_id,o])),n=r.map(o=>i.get(o)).filter(o=>o!=null);if(a&&!n.some(o=>o.product_id===a)){let o=i.get(a);o&&n.unshift(o)}return[...new Map(n.map(o=>[o.product_id,o])).values()].slice(0,5)}function Ws(e){let t=e?.rerank?.recommendedCandidateIds??[];if(t.length===0||!e)return[];let a=new Map(e.candidates.map(r=>[r.product_id,r]));return t.map(r=>a.get(r)).filter(r=>r!=null)}function ec(e){if(e>=6e4){let t=Math.floor(e/6e4),a=Math.round(e%6e4/1e3);return a===60?`${t+1}m`:`${t}m ${a}s`}return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}s`:`${e}ms`}function g_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:i}){let n=[...t].sort((l,c)=>c.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-n.length);return(0,s.jsxs)("div",{className:"results-detail-block",style:{marginBottom:18},children:[(0,s.jsx)("h3",{style:{margin:"0 0 12px"},children:"Pipeline timings"}),(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:12},children:[(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:ec(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:i})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:ec(r)})," LLM time"]})]}),(0,s.jsxs)("table",{className:"score-breakdown-table",style:{marginBottom:14},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Process stage"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:e.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:ec(l.durationMs)})]},`${l.key}-${c}`))})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{style:{margin:"0 0 10px"},children:"LLM calls"}),(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Call"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:n.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:ec(l.durationMs)})]},`${l.key}-${c}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",n.length," of ",t.length," LLM calls."]})]})]})}function h_({queries:e}){return e.length===0?null:(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Retrieval by procurement query"}),e.map((t,a)=>(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsxs)("div",{className:"results-row-meta",style:{marginBottom:6},children:["Query: ",(0,s.jsx)("strong",{children:t.query})]}),t.candidates.length===0?(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates returned for this query."}):(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Unit"}),(0,s.jsx)("th",{children:"bm25"})]})}),(0,s.jsx)("tbody",{children:t.candidates.slice(0,5).map((r,i)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:r.description}),(0,s.jsx)("div",{className:"results-row-meta",children:r.product_id})]}),(0,s.jsx)("td",{children:_d(r.measurements_mm)}),(0,s.jsx)("td",{children:el(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${i}`))})]})]},`${t.query}-${a}`))]})}function sw({item:e,result:t}){let a=t?.retrieval_debug.map(i=>i.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Mn(e.procurement_aliases)],["Retrieval queries",Mn(a)],["Category",e.attrs.category||"-"],["Fine category",e.attrs.category_fine||"-"],["Brand",e.attrs.brand||"-"],["Material",e.attrs.material||"-"],["Grade / standard",e.attrs.grade_standard||"-"],["Treatment",e.attrs.treatment||"-"],["Supply nature",e.attrs.supply_nature||"-"],["Measurements (mm)",_d(e.attrs.measurements_mm)],["Stock length",d_(e.attrs.stock_length_mm)],["Matching mode",e.matching_mode||"-"],["Build-up type",e.build_up_type||"-"],["Layer count",e.layer_count!=null?String(e.layer_count):"-"],["Required thickness (mm)",e.total_required_thickness_mm!=null?String(e.total_required_thickness_mm):"-"],["Allowed layer thicknesses (mm)",e.acceptable_layer_thicknesses_mm.length>0?e.acceptable_layer_thicknesses_mm.join(", "):"-"],["Installation clues",Mn(e.installation_clues)],["System clues",Mn(e.system_clues)],["Component requirements",Mn(e.component_requirements)],["Linked group",zn(e)||"-"],["Flags",Mn(e.flags)]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Search context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:r.map(([i,n])=>(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:i}),(0,s.jsx)("dd",{children:n})]},i))})]})}function b_({item:e}){let t=e.decomposition_debug;return t?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Decomposition"}),(0,s.jsxs)("dl",{className:"results-detail-grid",children:[(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned intents"}),(0,s.jsx)("dd",{children:t.items.length>0?t.items.map(a=>`${a.intent}${a.inherits_quantity?" (inherits qty)":""}`).join(", "):"-"})]})]})]}):null}function v_({result:e}){let t=e?.adjudication_debug;if(!t)return null;let a=[["Dependent rerank applied",t.dependent_rerank_applied?"yes":"no"],["Linked parent selected product",t.linked_parent_selected_candidate_description||t.linked_parent_selected_candidate_id||"-"],["Dimension reason overridden",t.dimension_reason_overridden?"yes":"no"]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Adjudication context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:a.map(([r,i])=>(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:i})]},r))}),t.rerank_line_item_input?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h5",{style:{margin:"12px 0 8px"},children:"Rerank input"}),(0,s.jsx)("pre",{className:"results-pre",children:JSON.stringify(t.rerank_line_item_input,null,2)})]}):null]})}function w_({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:i=!1,linkedGroupMeta:n}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"Exact match not found:":`AI review (${t.confidence??"confidence not stated"}):`;return i?t.reason?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),gr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",zn(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(sw,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(sw,{item:e,result:a}),r&&(0,s.jsx)(b_,{item:e}),r&&(0,s.jsx)(v_,{result:a}),t.reason&&(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),gr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",zn(e)]}):null]}),r&&(0,s.jsx)(h_,{queries:a?.retrieval_debug??[]})]})}function y_({item:e,candidates:t,result:a,decision:r,unmatchable:i,selectedProductId:n,detailMode:o,onPick:l,onClear:c,showAll:p=!1,internal:d=!1,debugEnabled:g=!1,forceReviewNote:f=!1,linkedGroupMeta:h}){let w=d||o==="detailed",M=g&&o==="detailed",D=w||f?(0,s.jsx)(w_,{item:e,decision:r,result:a,showRetrievalDebug:M,reviewOnly:f&&!w,linkedGroupMeta:h}):null;if(i)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"Classified as labour/plant or referencing another line item - skipped by design."})]});if(t.length===0)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let m=p||d||o==="detailed"?t:f_(t,a,n);return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Price"}),M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("th",{children:"dimension"}),(0,s.jsx)("th",{children:"grade"}),(0,s.jsx)("th",{children:"brand"}),(0,s.jsx)("th",{children:"fuzzy"}),(0,s.jsx)("th",{children:"bm25"}),(0,s.jsx)("th",{children:"overall"})]}),(0,s.jsx)("th",{"aria-label":"Actions"})]})}),(0,s.jsx)("tbody",{children:m.map((u,b)=>{let v=u.product_id===n;return(0,s.jsxs)("tr",{className:v?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:u.description}),(0,s.jsx)("div",{className:"results-row-meta",children:u.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:_d(u.measurements_mm??u.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:Tn(u.price,u.price_basis)}),M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(u.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.bm25??0).toFixed(2)}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(p_,{band:cw(u.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(u.scores?.overall??0).toFixed(2)})]})})]}),(0,s.jsx)("td",{children:(0,s.jsxs)("label",{className:"switch-toggle",title:v?"Currently selected":"Use this candidate",children:[(0,s.jsx)("input",{type:"checkbox",checked:v,onChange:()=>{v?c?.():l(u)},"aria-label":v?`${u.description} selected`:`Use ${u.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${u.product_id}-${b}`)})})]})]})}function xd({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:i,onGoToBasket:n,cartSeeded:o,onCartSeeded:l,reviewGateComplete:c,onReviewGateComplete:p,internal:d=!1}){let g=!d&&Vs()==="QZA6-MRA4",f=g?"quote":"basket",{results:h,lineItems:w,parseReport:M,timings:D}=e,[m,u]=(0,Ne.useState)({}),b=Sn(),[v,N]=(0,Ne.useState)({}),[A,T]=(0,Ne.useState)({}),[z,G]=(0,Ne.useState)(""),[P,be]=(0,Ne.useState)(null),[De,Le]=(0,Ne.useState)(1),He=Ra().debug===!0,[ze,me]=(0,Ne.useState)("simple"),[ce,fe]=(0,Ne.useState)(d?"list":"tile"),[Ee,ut]=(0,Ne.useState)(!1),[Se,Z]=(0,Ne.useState)(null),[de,Je]=(0,Ne.useState)(""),[Ye,pt]=(0,Ne.useState)([]),[ot,at]=(0,Ne.useState)(!1),[ge,W]=(0,Ne.useState)(null),[k,R]=(0,Ne.useState)(!1),[E,O]=(0,Ne.useState)(null),ee=(0,Ne.useRef)(null),[xe,we]=(0,Ne.useState)(new Set),[y,j]=(0,Ne.useState)(new Set),[B,ae]=(0,Ne.useState)(!1);(0,Ne.useEffect)(()=>{Le(1)},[z,P,ce]);let te=new Map(h.map(x=>[x.line_id,x])),q=m_(w),Y=w.map(x=>{let H=te.get(x.line_id),ye=H?.decision,ft=s_(x),Ke=m[x.line_id],Wt=c_(H,Ke),Ti=a[x.line_id],Xw=Ke===yd?void 0:v[x.line_id]??(Ti&&Ti.productId!==Wt?.product_id?ow(Ti):Wt),om=ft?void 0:Xw,Vw=x.qty??0;return{item:x,result:H,decision:ye,unmatchable:ft,best:om,qty:Vw,band:cw(om?.scores?.overall)}}),K=Is(Object.values(a),{wasteFactorEnabled:!1,wasteFactorOverride:0}),pe=0;for(let x of Y){if(x.unmatchable||x.decision?.include_in_quote!==!0||!x.best)continue;let H=a[x.item.line_id];(!H||Dt(H).lineTotal==null)&&(pe+=1)}pe>0&&(K=null);let ke=x=>!x.unmatchable&&!x.best&&x.decision?.technical_classification!=="no_suitable_candidate"&&Ws(x.result).length>0,Fe=x=>x.best??Ws(x.result)[0],ua=Y.filter(x=>!x.unmatchable&&!x.best).filter(x=>!y.has(x.item.line_id)),ul=Y.filter(x=>y.has(x.item.line_id)),pa=Y;if(z.trim()){let x=z.trim().toLowerCase();pa=pa.filter(H=>H.item.description_original?.toLowerCase().includes(x)||Fe(H)?.description?.toLowerCase().includes(x))}if(P){let x=P==="asc"?1:-1;pa=[...pa].sort((H,ye)=>x*(H.item.description_original||"").localeCompare(ye.item.description_original||""))}let Qn=Math.max(1,Math.ceil(pa.length/rl)),It=Math.min(De,Qn),vr=pa.slice((It-1)*rl,It*rl),$a=vr.filter(x=>!x.unmatchable&&x.best),Fd=vr.filter(x=>ke(x)),Gn=vr.filter(x=>!x.unmatchable&&(x.best||ke(x))),Id=vr.filter(x=>x.unmatchable||!x.best&&!ke(x)),J=Se?Y.find(x=>x.item.line_id===Se)??null:null,Bw=!d&&!c&&!J&&ua.length>0,Yn=(0,Ne.useRef)(null),Xn=()=>{let x=ee.current;if(!x)return;let{top:H,left:ye,width:ft,height:Ke}=x.getBoundingClientRect(),Ti=x.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;O({top:H,left:ye,width:Ti?Ti-ye:ft,height:Ke})};(0,Ne.useEffect)(()=>(window.addEventListener("scroll",Xn,!0),window.addEventListener("resize",Xn),()=>{window.removeEventListener("scroll",Xn,!0),window.removeEventListener("resize",Xn)})),(0,Ne.useEffect)(()=>{let x=H=>{Yn.current&&!H.composedPath().includes(Yn.current)&&Yn.current.removeAttribute("open")};return document.addEventListener("click",x),()=>document.removeEventListener("click",x)},[]);let qi=x=>{Z(x),Je("")},Lw=()=>{if(!Se)return;let x=a[Se];if(x){u(H=>({...H,[Se]:x.productId})),N(H=>({...H,[Se]:ow(x)}));return}u(H=>{let ye={...H};return delete ye[Se],ye}),N(H=>{let ye={...H};return delete ye[Se],ye})},Za=(x=!1)=>{let H=Se?a[Se]:void 0;!x&&H&&J?.best&&H.productId!==J.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(x||Lw(),Z(null),ae(!1))};Io(k,()=>R(!1)),Io(!!J&&!k,()=>Za());let Hw=x=>{if(we(H=>new Set(H).add(x)),ua.some(H=>H.item.line_id!==x)){Za(!0);return}p(),Za(!0)},jw=x=>{if(_c(x),j(H=>new Set(H).add(x)),ua.some(H=>H.item.line_id!==x)){Za(!0);return}p(),Za(!0)},Qw=()=>{j(x=>new Set([...x,...ua.map(H=>H.item.line_id)])),p()},Wd=()=>{J?.best&&(tm(J.item.line_id,J.best),r(Ei(J)),B?Hw(J.item.line_id):Za(!0))},em=Id.length>0?(0,s.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,s.jsxs)("div",{className:"results-tile-section__head",children:[(0,s.jsx)("h3",{children:"Require Matching"}),(0,s.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,s.jsx)("div",{className:"results-unmatched-list",children:Id.map(x=>{let{item:H,qty:ye}=x;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>qi(H.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Jr(H,w)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},H.line_id)})})]}):null,_c=x=>{u(H=>({...H,[x]:yd})),N(H=>({...H,[x]:void 0})),T(H=>({...H,[x]:void 0})),i(x)},xc=(x,H)=>{u(ye=>({...ye,[x]:H.product_id})),N(ye=>({...ye,[x]:H}))},tm=(x,H)=>{H.method==="catalogue_search"&&T(ye=>({...ye,[x]:H}))};function sx(){b("downloaded",{type:"schedule",lines:Y.length}),iw(Y.map(({item:x,best:H,qty:ye,band:ft,unmatchable:Ke,decision:Wt})=>({item:x,best:H,qty:ye,band:ft,unmatchable:Ke,decision:Wt})))}function Ei(x){let H=x.best??Ws(x.result)[0];return Pr(H,{lineId:x.item.line_id,description:x.item.description_original,unit:x.item.unit,qty:x.qty,linkedContext:x.item.linked_group_role==="dependent"&&x.item.linked_group_id?w.filter(ye=>ye.linked_group_id===x.item.linked_group_id&&ye.linked_group_role==="anchor").slice(0,1).map(ye=>{let ft=a[ye.line_id];return{line_id:ye.line_id,product_id:ft?.productId??null,measurements_mm:ft?.measurementsMm??ye.attrs.measurements_mm,description:ft?.description??ye.description_original,qty:ye.qty,unit:ye.unit,role:"anchor"}}):void 0})}(0,Ne.useEffect)(()=>{if(!o){for(let x of Y)!x.unmatchable&&x.best&&r(Ei(x));l()}},[o]),(0,Ne.useEffect)(()=>{for(let x of Y)!a[x.item.line_id]&&!x.unmatchable&&x.best&&r(Ei(x))},[e]),(0,Ne.useEffect)(()=>{if(!Se){pt([]),W(null),at(!1);return}let x=de.trim();if(!x){pt([]),W(null),at(!1);return}let H=!1,ye=window.setTimeout(async()=>{try{at(!0),W(null);let ft=await fetch(Ht(`/api/catalogue/search?q=${encodeURIComponent(x)}`),{headers:vi()}),Ke=await Pt(ft);if(!ft.ok)throw new Error(Ke?.error||Ke?.message||"Failed to search catalogue");H||pt(Array.isArray(Ke?.items)?Ke.items:[])}catch(ft){H||(pt([]),W(ft?.message||"Failed to search catalogue"))}finally{H||at(!1)}},250);return()=>{H=!0,window.clearTimeout(ye)}},[de,Se]);let kc=Object.keys(a).length,Ma=de.trim(),am=Ws(J?.result),pl=J?.decision?.technical_classification==="no_suitable_candidate"||!!J&&!J.best,rm=J?.decision?.technical_classification!=null,im=J?.decision?.reason??(pl?"No catalogue candidate found. Refine the request or search the catalogue.":null),Gw=Ye.map(x=>({product_id:x.product_id,description:x.description,source_list:x.source_list,price:x.price,price_basis:x.price_basis,uoi_count:x.uoi_count??null,uoi:x.uoi,pdp_photo_url:x.pdp_photo_url??null,conversion:x.conversion,measurements_mm:x.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"catalogue_search"})),Vn=Ma?Gw:am,Mi=J?A[J.item.line_id]:void 0,$n=!Ma&&Mi&&!Vn.some(x=>x.product_id===Mi.product_id)?[...Vn,Mi]:Vn,nm=(()=>{let x=$n.slice(0,Ma?12:3);return Ma||!Mi||x.some(H=>H.product_id===Mi.product_id)?x:[...x,Mi]})(),dl=!!J?.best&&a[J.item.line_id]?.productId===J.best.product_id,Yw=!!J?.best&&!!a[J.item.line_id]&&!dl;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${d?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${d?"":" quick-order-hero--customer"}`,children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,s.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,s.jsx)("h1",{children:"Your Results"}),(0,s.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,s.jsx)("strong",{children:K==null?"Calculating\u2026":nt(K)})," Est. total"]})]}),(0,s.jsx)("p",{children:"Each line item from your schedule matched against your catalogue, ranked by confidence."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:"Review your matched products"}),(0,s.jsxs)("p",{children:["Check you're happy with these items, then click ",g?"View Quote":"View Basket"," to continue."]})]}),(0,s.jsxs)("button",{type:"button",className:"results-total-action",onClick:n,"aria-label":g?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:g?"View Quote":"View Basket"}),(0,s.jsx)("strong",{children:K==null?"Calculating\u2026":nt(K)})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(jt,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[He&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":Ee,onClick:()=>ut(x=>!x),children:Ee?"Hide timings":"Show timings"})}),He&&Ee&&(0,s.jsx)(g_,{...D}),!g&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!J&&(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:0},children:[pe>0&&(0,s.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,s.jsx)("strong",{children:pe})," need pricing"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:z,onChange:x=>G(x.target.value),"aria-label":"Search line items"}),!d&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${ce==="tile"?" is-active":""}`,"aria-pressed":ce==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>fe("tile"),children:(0,s.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,s.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${ce==="list"?" is-active":""}`,"aria-pressed":ce==="list","aria-label":"List view",title:"List view",onClick:()=>fe("list"),children:(0,s.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,s.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,s.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,s.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),He&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>me(x=>x==="simple"?"detailed":"simple"),children:ze==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:Yn,style:{position:"relative"},children:[(0,s.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort line items",style:{fontSize:16},children:"\u21C5"}),(0,s.jsx)("div",{className:"sort-menu-panel",children:l_.map(x=>{let H=P===x.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${H?" is-active":""}`,onClick:()=>{be(H?null:x.dir),Yn.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:H?"\u2713":""}),x.label]},x.dir)})})]})]})]})}),ce==="tile"||J?(0,s.jsxs)(s.Fragment,{children:[J?(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Product options",onClick:()=>Za(),children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal results-review-modal",onClick:x=>x.stopPropagation(),children:[(0,s.jsx)("button",{type:"button",className:"quick-order-workflow-close results-review-modal__close",onClick:()=>Za(),"aria-label":"Close product options",children:(0,s.jsx)(Jo,{})}),(0,s.jsx)("div",{className:"results-review-page",children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"results-review-page__top",children:[(0,s.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:()=>Za(),children:[(0,s.jsx)(Kr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[He&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>me(x=>x==="simple"?"detailed":"simple"),children:ze==="detailed"?"Hide detailed info":"Show detailed info"}),(0,s.jsx)("div",{className:"results-review-searchbar",children:(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:de,onChange:x=>Je(x.target.value),"aria-label":"Search database candidates"})}),(0,s.jsx)("div",{className:"results-candidate-actions",children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>_c(J.item.line_id),children:"Clear selected product"})})]})]}),(0,s.jsxs)("div",{className:"results-review-page__hero",children:[(0,s.jsx)("div",{className:"results-review-page__image-wrap",children:(0,s.jsx)("img",{className:"fill-img results-review-page__image",src:Ya(Fe(J)?.description||J.item.description_original,Fe(J)?.product_id,Fe(J)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Jr(J.item,w)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[yi(J.qty)," ",Na(J.item.unit,J.qty)]}),J.best?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:J.best.description}),J.best.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Tn(J.best.price,J.best.price_basis)}):null]}):Fe(J)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:Fe(J)?.description}),Fe(J)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Tn(Fe(J)?.price??null,Fe(J)?.price_basis??null)}):null,(0,s.jsx)("div",{className:"results-row-meta",children:"Best reviewed alternative - not yet selected"})]}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),gr(J.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(wd,{meta:q.get(J.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:zn(J.item)})]}):null,(0,s.jsx)("div",{className:"results-review-page__actions",children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[J.item.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[J.item.line_id]?i(J.item.line_id):(J.best&&tm(J.item.line_id,J.best),r(Ei(J)))},disabled:!J.best,"aria-label":a[J.item.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[J.item.line_id]?"\u2713 Added":d?"+ Add to selection":`Add to ${f}`})})]})]}),ot?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!ot&&ge?(0,s.jsx)("div",{className:"results-empty-card",children:ge}):null,!ot&&!ge&&Ma&&Vn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!ot&&!ge?(0,s.jsx)(y_,{item:J.item,candidates:Vn,result:J.result,decision:J.decision,unmatchable:J.unmatchable,selectedProductId:J.best?.product_id??null,detailMode:ze,linkedGroupMeta:gr(J.item)?q.get(J.item.linked_group_id):void 0,onPick:x=>xc(J.item.line_id,x),onClear:()=>_c(J.item.line_id),showAll:d||He||Ma.length>0,internal:d,debugEnabled:He,forceReviewNote:!0}):null]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("section",{className:"customer-review-request",children:[(0,s.jsx)("span",{className:"customer-review-eyebrow",children:"Original request"}),(0,s.jsx)("strong",{children:Jr(J.item,w)||"Original request"})]}),im?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:pl?"Exact match not found:":"AI review:"})," ",im]}):null,(0,s.jsxs)("section",{className:"customer-review-options",children:[(0,s.jsx)("div",{className:"customer-review-options__head",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{children:pl?"We couldn't find a suitable product":rm?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:pl?am.length>0?"These AI-reviewed alternatives may be useful, but need approval.":"Search the catalogue to choose an alternative.":rm?`Select the option you want to add to your ${f}.`:"Search the catalogue to choose a product."})]})}),!Ma&&$n.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:nm.map(x=>{let H=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${H?" is-selected":""}`,onClick:()=>xc(J.item.line_id,x),"aria-pressed":H,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ya(x.description,x.product_id,x.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:x.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:x.price!=null?`\xA3${Tn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:H?"Selected":"Choose"})]},x.product_id)})}):null,$n.length>0&&(0,s.jsx)("div",{className:"customer-review-divider",children:(0,s.jsx)("span",{children:"or"})}),(0,s.jsxs)("label",{className:"customer-review-search",children:[(0,s.jsx)("span",{children:"Search our full catalogue"}),(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products...",value:de,onChange:x=>Je(x.target.value),"aria-label":"Search catalogue"})]}),Ma&&ot?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,Ma&&!ot&&ge?(0,s.jsx)("div",{className:"results-empty-card",children:ge}):null,Ma&&!ot&&!ge&&$n.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,Ma&&!ot&&!ge&&$n.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:nm.map(x=>{let H=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${H?" is-selected":""}`,onClick:()=>xc(J.item.line_id,x),"aria-pressed":H,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ya(x.description,x.product_id,x.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:x.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:x.price!=null?`\xA3${Tn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:H?"Selected":"Choose"})]},x.product_id)})}):null]}),J.best?Yw?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{Wd()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>i(J.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${f}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${dl?" cta-btn-secondary":""}`,onClick:()=>{dl?i(J.item.line_id):Wd()},children:(0,s.jsx)("span",{children:dl?`Remove from ${f}`:`Add selected product to ${f}`})}):null,B?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>jw(J.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[pa.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,Gn.length>0?(0,s.jsx)("section",{className:"results-tile-section","aria-label":"Matched and review items",children:(0,s.jsx)("div",{className:"results-tile-grid",children:Gn.map(x=>{let{item:H,best:ye,qty:ft}=x,Ke=Fe(x),Wt=!ye&&ke(x);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>qi(H.line_id),"aria-label":`Review match for ${Jr(H,w)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[Wt||gr(H)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[gr(H)?(0,s.jsx)(wd,{meta:q.get(H.linked_group_id)}):(0,s.jsx)("span",{}),Wt?(0,s.jsx)("span",{style:{padding:"6px 10px",borderRadius:999,background:"#fef3c7",color:"#92400e",fontSize:12,fontWeight:700,lineHeight:1},children:"Partially matched"}):null]}):null,(0,s.jsx)("img",{className:"fill-img results-tile-card__image",src:Ya(Ke?.description||H.description_original,Ke?.product_id,Ke?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Ke?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"results-tile-card__heading",children:(0,s.jsx)("div",{className:"results-tile-card__title",children:Ke.description})})}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),(0,s.jsx)("div",{className:"results-tile-card__match",children:Ke?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:Wt?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Jr(H,w)}),gr(H)?(0,s.jsx)("div",{className:"results-row-meta",children:zn(H)}):null]}):(0,s.jsx)("span",{className:"results-empty-hint",children:"No matched product selected."})})]}),(0,s.jsx)("span",{className:"results-tile-card__hover-prompt","aria-hidden":"true",children:"Click to view options"})]}),(0,s.jsxs)("div",{className:"results-tile-card__actions",children:[d&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>qi(H.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[H.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[H.line_id]?i(H.line_id):r(Ei(x))},disabled:!Ke,"aria-label":a[H.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[H.line_id]?"\u2713 Added":d?"+ Add":`Add to ${f}`})]})]},H.line_id)})})}):null,em]})]}):(0,s.jsxs)(s.Fragment,{children:[E&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:E,"aria-hidden":"true",children:"Click to view options"}),(0,s.jsx)("div",{className:"bom-table-wrap",children:(0,s.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched line items",children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:"col-item"}),(0,s.jsx)("col",{style:{width:"220px"}}),(0,s.jsx)("col",{style:{width:"100px"}}),ze==="simple"&&(0,s.jsx)("col",{style:{width:"110px"}})]}),(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bom-col-header",children:[(0,s.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,s.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,s.jsx)("th",{style:{textAlign:"center"},children:"Price"}),ze==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:d?"Selection":g?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[pa.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:ze==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),Gn.map(x=>{let{item:H,result:ye,decision:ft,best:Ke}=x;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>qi(H.line_id),onMouseEnter:Wt=>{ee.current=Wt.currentTarget,Xn()},onMouseLeave:()=>{ee.current=null,O(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Jr(H,w)}),gr(H)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(wd,{meta:q.get(H.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:zn(H)})]}):null]}),(0,s.jsx)("td",{children:Ke?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Ke.description,children:Ke.description}),ze==="detailed"&&ft?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[u_(ft.technical_classification),ft.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Ke?.price!=null?Tn(Ke.price,Ke.price_basis):"-"}),ze==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[H.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:Wt=>{Wt.stopPropagation(),a[H.line_id]?i(H.line_id):r(Ei(x))},"aria-label":a[H.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[H.line_id]?"\u2713 Added":d?"+ Add":`Add to ${f}`})})]},H.line_id)})]})]})}),em]}),!J&&Qn>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(It-1)*rl+1,"\u2013",Math.min(It*rl,pa.length)," of ",pa.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Le(It-1),disabled:It===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",It," of ",Qn]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Le(It+1),disabled:It===Qn,children:"Next"})]})]}),(M.itemCount!=null||M.headingCount!=null||M.skippedCount!=null)&&(0,s.jsxs)("div",{className:"results-summary",style:{marginTop:16},children:[M.itemCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.itemCount})," items parsed"]}),M.headingCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.headingCount})," headings"]}),M.skippedCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.skippedCount})," rows skipped"]})]}),(0,s.jsxs)("div",{className:"disclaimer-box",children:[(0,s.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,s.jsx)("p",{className:"disclaimer-text",children:"These matches are generated automatically and should be reviewed before purchase."})]}),!J&&(0,s.jsxs)("div",{className:"btn-row results-actions",children:[(0,s.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:(kc>0,"0 1 30%"),gap:10,justifyContent:"center"},onClick:()=>R(!0),"aria-label":"Start over",children:[(0,s.jsx)(hd,{}),(0,s.jsx)("span",{children:"Start Over"})]}),kc>0&&(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:n,"aria-label":d?"View selection":g?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[d?"View Selection":g?"View Quote":"View Basket"," (",kc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(jt,{})})]})]})]})]}),Bw&&(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop review-gate-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"review-gate-title",children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal review-gate-modal",children:[(0,s.jsxs)("div",{className:"review-gate-modal__header",children:[(0,s.jsx)("h2",{id:"review-gate-title",children:"Choose products for these items"}),(0,s.jsx)("p",{children:"We couldn\u2019t find a clear match for these items, so we need your help. Select an option from the suggestions, search the catalogue, or leave the item out."})]}),(0,s.jsx)("div",{className:"review-gate-list",children:ua.map(x=>{let H=xe.has(x.item.line_id),ye=ke(x);return(0,s.jsx)("div",{className:`review-gate-item${H?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{ae(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Jr(x.item,w)}),(0,s.jsx)("span",{children:x.decision?.reason||(ye?"A close alternative is available but needs confirmation.":"No product has been selected for this item yet.")})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:H?"Choice made":"Choose a product"})]})},x.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:Qw,children:"Skip all"}),ul.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),ul.map(x=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{j(H=>{let ye=new Set(H);return ye.delete(x.item.line_id),ye}),ae(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Jr(x.item,w)}),(0,s.jsx)("span",{children:`Not added to your ${f}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},x.item.line_id))]}):null]})}),k&&(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop start-over-modal",role:"dialog","aria-modal":"true","aria-labelledby":"start-over-modal-title",children:(0,s.jsxs)("div",{className:"modal-card start-over-modal__card",children:[(0,s.jsx)("h2",{id:"start-over-modal-title",className:"modal-title",children:"Start over?"}),(0,s.jsxs)("p",{className:"modal-body",children:["This will clear the current results and ",g?"quote":"basket"," and take you back to the start."]}),(0,s.jsxs)("div",{className:"modal-actions",children:[(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-secondary",onClick:()=>R(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{R(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var _t=X(Xe());var C=X(ie()),__=.2,il=10,uw="Enter a valid email address so we can send your quote.",x_=(e,t)=>{let a=`${t.requestedAmount} ${ka(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${ka(t.sellUnit,t.requiredSellUnits??0)}`,i=e.unitConversions?.find(n=>n.requestUom===t.requestedUnit);return i&&i.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/i.quantityPerSaleUnit)} ${ka(t.sellUnit,2)} per ${ka(t.requestedUnit,1)})`:e.coverageQty&&/^m per /i.test(e.coverageUom??"")?`${a} requested \u2192 order ${r} (${e.coverageQty} ${e.coverageUom})`:`${a} requested \u2192 order ${r}`},k_=e=>["box","pack"].includes(e.requestedUnit)?"Pack size needed to calculate the order quantity.":`This product is sold by ${ka(e.sellUnit,1)}.`;function N_(){return(0,C.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,C.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,C.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,C.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function nl(){return(0,C.jsx)("svg",{width:"8",height:"5",viewBox:"0 0 8 5",fill:"none",children:(0,C.jsx)("path",{d:"M1 4L4 1L7 4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function ol({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:i,onBack:n,onStartNewQuote:o,onQuoteRequested:l,internal:c=!1}){let p=(0,_t.useId)(),d=!c&&Vs()==="QZA6-MRA4",g=Object.values(e),[f,h]=(0,_t.useState)(""),[w,M]=(0,_t.useState)(!1),[D,m]=(0,_t.useState)(!1),u=Sn(),[b,v]=(0,_t.useState)(""),[N,A]=(0,_t.useState)({}),[T,z]=(0,_t.useState)({}),[G,P]=(0,_t.useState)(1),[be,De]=(0,_t.useState)({}),[Le,He]=(0,_t.useState)(!1),[ze,me]=(0,_t.useState)("0"),ce=(0,_t.useRef)(new Set);(0,_t.useEffect)(()=>{if(!r)return;for(let O of Object.values(e))Dt(O).requiredSellUnits!=null&&ce.current.delete(O.lineId);let E=Object.values(e).filter(O=>O.productId!=="-"&&Dt(O).requiredSellUnits==null&&!ce.current.has(O.lineId));E.length!==0&&(E.forEach(O=>ce.current.add(O.lineId)),fetch(Ht("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:E.map(O=>({line_id:O.lineId,product_id:O.productId,requested_description:O.requestedDescription??O.description,requested_qty:O.qty,requested_uom:O.unit||null,linked_context:O.linkedContext??[],selected_description:O.description,selected_uoi:O.uoi,selected_uoi_count:O.uoiCount,selected_conversion:{sales_uom_normalised:O.salesUomNormalised,conversion_type:O.conversionType,sales_unit_size:O.salesUnitSize,sales_unit_size_uom:O.salesUnitSizeUom,coverage_qty:O.coverageQty,coverage_uom:O.coverageUom}}))})}).then(O=>O.ok?Pt(O):null).then(O=>{let ee={};for(let xe of O?.data?.items??O?.items??[]){let we=xe?.conversion;if(!we||typeof xe?.line_id!="string")continue;let y=e[xe.line_id];ee[xe.line_id]={conversionType:we.conversion_type,requestUomsSupported:we.request_uoms_supported,salesUomNormalised:we.sales_uom_normalised,salesUnitSize:we.sales_unit_size,salesUnitSizeUom:we.sales_unit_size_uom,coverageQty:we.coverage_qty,coverageUom:we.coverage_uom,roundingRule:we.rounding_rule,conversionConfidence:we.conversion_confidence,conversionNotes:we.conversion_notes,...y?.qty===0&&Number.isFinite(we.suggested_order_qty)&&we.suggested_order_qty>0?{qty:we.suggested_order_qty,unit:we.suggested_order_uom||y.unit}:{}}}Object.keys(ee).length>0&&r(ee)}).catch(O=>console.error("Catalogue conversion resolution failed",O)))},[e,r]);function fe(E){A(O=>{let ee={...O};return delete ee[E],ee})}function Ee(E,O){let ee=parseFloat(O);!isNaN(ee)&&ee>=0&&t(E,Math.min(ee,1e5)),fe(E)}function ut(E,O,ee){t(E,Math.min(1e5,Math.max(0,O+ee))),fe(E)}function Se(E){z(O=>{let ee={...O};return delete ee[E],ee})}function Z(E,O){let ee=parseFloat(O);!isNaN(ee)&&ee>=0&&a(E,Math.min(ee,1e5)),Se(E)}function de(E,O,ee){a(E,Math.min(1e5,Math.max(0,O+ee))),Se(E)}async function Je(){let E=f.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(E)){v(uw);return}v(""),m(!0);try{let O=await fetch(Ht("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({email:E,items:Ye.map(({item:ee,pricing:xe})=>{let we=xe.requiredSellUnits??xe.requestedAmount,y=xe.requiredSellUnits!=null?xe.sellUnit:xe.requestedUnit;return{product_id:ee.productId,description:ee.description,quantity:we,unit:ka(y,we),unit_price:xe.requiredSellUnits!=null?xe.unitPrice:null,line_total:xe.lineTotal}})})});if(!O.ok){let ee=await Pt(O);console.error("Quote request failed",O.status,ee?.message),v(O.status===429?"You've sent a few requests already. Please try again in a few minutes.":"Your request couldn't be sent. Please try again, or contact us if it keeps happening.");return}u("quote_requested",{items:Ye.length,total:Math.round(at*100)/100}),M(!0),l?.(),window.scrollTo(0,0)}catch{v("Your request couldn't be sent. Check your connection and try again.")}finally{m(!1)}}let Ye=g.map(E=>({item:E,pricing:Dt(E,{wasteFactorEnabled:Le,wasteFactorOverride:Math.max(0,Number.parseFloat(ze)||0)/100})})),pt=Is(g,{wasteFactorEnabled:Le,wasteFactorOverride:Math.max(0,Number.parseFloat(ze)||0)/100}),ot=pt*__,at=pt+ot,ge=(0,_t.useRef)({items:Ye.length,total:Math.round(at*100)/100});(0,_t.useEffect)(()=>{u("basket_viewed",ge.current)},[u]);let W=Math.max(1,Math.ceil(Ye.length/il)),k=Math.min(G,W),R=Ye.slice((k-1)*il,k*il);return w?(0,C.jsx)("div",{className:"wizard-step entry-stage",children:(0,C.jsxs)("div",{className:"quote-request-sent",role:"status",children:[(0,C.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,C.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,C.jsx)("polyline",{points:"5 12.5 10 17.5 19 7"})})}),(0,C.jsx)("h1",{children:"Quote requested"}),(0,C.jsxs)("p",{children:["You're all done. We'll email your sharper price to ",(0,C.jsx)("strong",{children:f.trim()}),", usually within one working day."]}),(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,C.jsx)("span",{children:"Start a new quote"})}),(0,C.jsx)("p",{className:"quote-request-sent-note",children:"Nothing is charged until you approve the quote."})]})}):!c&&g.length===0?(0,C.jsx)("div",{className:"wizard-step entry-stage",children:(0,C.jsxs)("div",{className:"quote-request-sent",children:[(0,C.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,C.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("path",{d:"M3 9h18l-2 11H5z"}),(0,C.jsx)("path",{d:"M8 9l4-6 4 6"})]})}),(0,C.jsx)("h1",{children:d?"Your quote request is empty":"Your basket is empty"}),(0,C.jsx)("p",{children:d?"Start again with your list to build your quote.":"Start again with your list to fill your basket."}),(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,C.jsx)("span",{children:"Back to start"})})]})}):(0,C.jsx)("div",{className:`wizard-step entry-stage${d?" basket-layout--qza6-mra4":""}`,children:(0,C.jsxs)("div",{className:`quick-order-card${c?"":" quick-order-card--customer"}`,children:[(0,C.jsxs)("div",{className:`quick-order-hero${c?"":" quick-order-hero--customer"}`,children:[c&&(0,C.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,C.jsxs)("div",{className:"basket-hero-copy",children:[d&&(0,C.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:n,children:[(0,C.jsx)(Kr,{}),(0,C.jsx)("span",{children:"Back to results"})]}),(0,C.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,C.jsx)("h1",{children:c?"Your Selection":d?"Request a quote":"Your Basket"}),c&&(0,C.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,C.jsx)("strong",{children:g.length})," ",g.length===1?"item":"items"]})]}),(0,C.jsx)("p",{children:c?"Review the items you've added before exporting them for review.":d?"Check your items & quantities below, and we'll do our best to beat list prices.":"Review your quantities and order summary before you buy."})]})]}),(0,C.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:g.length===0?(0,C.jsxs)("div",{className:"quick-order-history-empty",children:[(0,C.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:"\u{1F4CB}"}),(0,C.jsx)("p",{children:"Your selection is empty."}),(0,C.jsx)("p",{className:"basket-empty-hint",children:"Go back to your results and add quoted items."}),(0,C.jsx)("div",{className:"btn-row",style:{marginTop:20,justifyContent:"center"},children:(0,C.jsx)("button",{className:"cta-btn",style:{width:"auto",maxWidth:280},onClick:n,"aria-label":"Back to results",children:(0,C.jsx)("span",{children:"Back to Results"})})})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{className:"basket-layout",children:[(0,C.jsxs)("div",{className:"basket-main",children:[(0,C.jsx)("div",{className:"basket-list","aria-label":c?"Selection items":d?"Quote request items":"Basket items",children:R.map(({item:E,pricing:O})=>{let ee=N[E.lineId]??String(O.requestedAmount),xe=O.requestedUnit===O.sellUnit||O.costingMode==="review",we=O.requiredSellUnits==null||O.requestedAmount!==O.requiredSellUnits||O.requestedUnit!==O.sellUnit;return(0,C.jsxs)("article",{className:"basket-card",children:[(0,C.jsxs)("div",{className:"basket-card-top",children:[(0,C.jsx)("img",{className:"basket-card-thumb",src:Ya(E.description,E.productId,E.pdpPhotoUrl),alt:"",width:48,height:48}),(0,C.jsxs)("div",{className:"basket-card-info",children:[(0,C.jsx)("div",{className:"bom-component-name",children:E.description}),we&&O.costingMode!=="review"&&(0,C.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>De(y=>({...y,[E.lineId]:!y[E.lineId]})),"aria-expanded":!!be[E.lineId],children:["How we calculated this",(0,C.jsx)("span",{className:`basket-calc-toggle-chevron${be[E.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("div",{className:"basket-card-actions",children:(0,C.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>i(E.lineId),"aria-label":`Remove ${E.description}`,children:(0,C.jsx)(N_,{})})})]}),c&&(0,C.jsxs)("div",{className:"results-detail-block basket-internal-detail",children:[(0,C.jsxs)("dl",{className:"results-detail-grid",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Conversion type"}),(0,C.jsx)("dd",{children:E.conversionType??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Conversion confidence"}),(0,C.jsx)("dd",{children:E.conversionConfidence??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Sales unit"}),(0,C.jsx)("dd",{children:E.salesUnitSize!=null?(0,C.jsxs)(C.Fragment,{children:[E.salesUnitSize," ",Na(E.salesUnitSizeUom,E.salesUnitSize)]}):"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Coverage"}),(0,C.jsx)("dd",{children:E.coverageQty!=null?(0,C.jsxs)(C.Fragment,{children:[E.coverageQty," ",Na(E.coverageUom,E.coverageQty)]}):"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Waste factor"}),(0,C.jsx)("dd",{children:E.wasteFactorDefault??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Rounding rule"}),(0,C.jsx)("dd",{children:E.roundingRule??"-"})]})]}),E.conversionNotes&&(0,C.jsx)("p",{className:"results-rerank-note",children:E.conversionNotes})]}),O.costingMode==="review"?(0,C.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,C.jsx)("strong",{children:"Quantity needs confirmation."})," ",k_(O)]}):we&&be[E.lineId]?(0,C.jsx)("p",{className:"basket-calc-text",children:x_(E,O)}):null,(0,C.jsxs)("div",{className:"basket-card-stats",children:[(0,C.jsxs)("div",{className:"basket-stat",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Requested qty"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsxs)("div",{className:"basket-qty-field",children:[(0,C.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:ee,disabled:xe,onChange:y=>A(j=>({...j,[E.lineId]:y.target.value})),onBlur:y=>Ee(E.lineId,y.target.value),onKeyDown:y=>{y.key==="Enter"&&y.target.blur()},"aria-label":`${E.description} requested quantity`}),(0,C.jsxs)("div",{className:"basket-qty-arrows",children:[(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:xe,onClick:()=>ut(E.lineId,parseFloat(ee)||0,1),"aria-label":`Increase ${E.description} quantity`,children:(0,C.jsx)(nl,{})}),(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:xe,onClick:()=>ut(E.lineId,parseFloat(ee)||0,-1),"aria-label":`Decrease ${E.description} quantity`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("span",{className:"basket-metric-unit",children:Na(O.requestedUnit,parseFloat(ee)||0)})]})]}),(0,C.jsxs)("div",{className:"basket-stat basket-stat--right",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Order qty"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsxs)("div",{className:"basket-qty-field",children:[(0,C.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:T[E.lineId]??String(O.requiredSellUnits??""),onChange:y=>z(j=>({...j,[E.lineId]:y.target.value})),onBlur:y=>Z(E.lineId,y.target.value),onKeyDown:y=>{y.key==="Enter"&&y.target.blur()},"aria-label":`${E.description} order quantity`}),(0,C.jsxs)("div",{className:"basket-qty-arrows",children:[(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>de(E.lineId,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${E.description} order quantity`,children:(0,C.jsx)(nl,{})}),(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>de(E.lineId,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${E.description} order quantity`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("span",{className:"basket-metric-unit",children:Na(O.sellUnit,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0)})]})]}),(0,C.jsxs)("div",{className:"basket-stat basket-stat--total",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Total"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsx)("strong",{children:O.lineTotal!=null?nt(O.lineTotal):"-"}),O.lineTotal!=null&&(0,C.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},E.lineId)})}),W>1&&(0,C.jsxs)("div",{className:"results-pagination",children:[(0,C.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(k-1)*il+1,"\u2013",Math.min(k*il,Ye.length)," of ",Ye.length]}),(0,C.jsxs)("div",{className:"results-pagination-controls",children:[(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>P(k-1),disabled:k===1,children:"Previous"}),(0,C.jsxs)("span",{className:"results-pagination-page",children:["Page ",k," of ",W]}),(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>P(k+1),disabled:k===W,children:"Next"})]})]})]}),(0,C.jsxs)("aside",{className:"basket-sidebar",children:[(0,C.jsx)("div",{className:"basket-sidebar-title",children:d?"Quote request summary":"Order summary"}),(0,C.jsxs)("div",{className:"basket-sidebar-row",children:[(0,C.jsx)("span",{children:d?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,C.jsx)("span",{children:nt(pt)})]}),(0,C.jsxs)("div",{className:"basket-sidebar-row",children:[(0,C.jsx)("span",{children:"VAT (20%)"}),(0,C.jsx)("span",{children:nt(ot)})]}),(0,C.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,C.jsx)("span",{children:d?"List price (inc.\xA0VAT)":"Total"}),(0,C.jsx)("span",{children:nt(at)})]}),!d&&(0,C.jsx)("div",{className:"basket-summary-waste",children:(0,C.jsxs)("div",{className:"basket-waste-control",children:[(0,C.jsxs)("label",{className:"basket-global-waste",children:[(0,C.jsx)("input",{type:"checkbox",checked:Le,onChange:E=>He(E.target.checked)}),(0,C.jsx)("span",{children:"Add waste factor"})]}),(0,C.jsxs)("label",{className:"basket-global-waste-percent",children:[(0,C.jsx)("input",{type:"number",inputMode:"decimal",min:"0",step:"0.1",value:ze,onChange:E=>me(E.target.value),disabled:!Le,"aria-label":"Waste factor percent"}),(0,C.jsx)("span",{children:"%"})]})]})}),(0,C.jsx)("label",{htmlFor:`${p}-basket-reference`,className:"basket-sidebar-label",children:d?"Enter email for your sharper quote":"Your reference (optional)"}),(0,C.jsx)("input",{id:`${p}-basket-reference`,type:d?"email":"text",className:"basket-sidebar-input",value:f,onChange:E=>{h(E.target.value),d&&v("")},placeholder:d?"you@example.com":"PO number or job reference","aria-invalid":d&&b===uw,"aria-describedby":d&&b?`${p}-basket-reference-error`:void 0}),d&&b&&(0,C.jsx)("p",{id:`${p}-basket-reference-error`,className:"basket-quote-request-error",role:"alert",children:b}),d?(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{Je()},disabled:D,"aria-busy":D,children:(0,C.jsx)("span",{children:D?"Sending\u2026":"Request our best quote"})}):(0,C.jsx)("button",{className:"cta-btn",onClick:()=>{u("downloaded",{type:"basket",items:g.length}),nw(g)},"aria-label":c?"Download selection":"Download basket",children:(0,C.jsx)("span",{children:c?"Download Quote":"Buy Now"})}),(0,C.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,C.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),d?"This is a quote request, not an order. We'll confirm our best price, availability and delivery before you approve.":"Prices and availability are estimates and should be confirmed before procurement."]})]})]}),(0,C.jsx)("div",{className:"btn-row results-actions",children:(0,C.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:n,"aria-label":"Back to results",children:[(0,C.jsx)(Kr,{}),(0,C.jsx)("span",{children:"Back to results"})]})})]})})]})})}var At=X(Xe()),pw=X(ie());function S_(e,t){let a={...e,[t.lineId]:t};for(let[r,i]of Object.entries(a)){if(!i.linkedContext)continue;let n=i.linkedContext.find(l=>l.role==="anchor"&&l.line_id&&a[l.line_id]),o=n?.line_id?a[n.line_id]:void 0;if(!(!n||!o||n.product_id===o.productId&&n.description===o.description)){if(i.conversionType!=="basket_line_unit"){a[r]={...i,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l)};continue}a[r]={...i,qty:0,sellUnitsOverride:null,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l),conversionType:null,requestUomsSupported:null,salesUomNormalised:null,salesUnitSize:null,salesUnitSizeUom:null,coverageQty:null,coverageUom:null,roundingRule:null,conversionConfidence:null,conversionNotes:null}}}return a}var Nd=(0,At.createContext)(null);function tc({children:e,onOpenBasket:t}){let[a,r]=(0,At.useState)({}),i=(0,At.useCallback)(f=>{r(h=>S_(h,f))},[]),n=(0,At.useCallback)(f=>{r(h=>{let w={...h};for(let M of f)w[M.lineId]=M;return w})},[]),o=(0,At.useCallback)(f=>{r(h=>{let w={...h};return delete w[f],w})},[]),l=(0,At.useCallback)((f,h)=>{r(w=>w[f]?{...w,[f]:{...w[f],qty:h,sellUnitsOverride:null}}:w)},[]),c=(0,At.useCallback)((f,h)=>{r(w=>w[f]?{...w,[f]:{...w[f],sellUnitsOverride:h}}:w)},[]),p=(0,At.useCallback)(f=>{r(h=>{let w=!1,M={...h};for(let[D,m]of Object.entries(f))M[D]&&(M[D]={...M[D],...m},w=!0);return w?M:h})},[]),d=(0,At.useCallback)(()=>r({}),[]),g=(0,At.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:i,addManyToCart:n,removeFromCart:o,updateCartQty:l,updateCartSellUnits:c,updateCartConversions:p,clearCart:d,openBasket:t??(()=>{})}),[a,i,n,o,l,c,p,d,t]);return(0,pw.jsx)(Nd.Provider,{value:g,children:e})}function An(){let e=(0,At.useContext)(Nd);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function ac(){return(0,At.useContext)(Nd)}var Sa=X(ie()),Sd="metron-quick-quote";function rc(e){return(0,Sa.jsx)(tc,{children:(0,Sa.jsx)(C_,{...e})})}function C_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,i]=(0,Re.useState)("entry"),[n,o]=(0,Re.useState)(null),[l,c]=(0,Re.useState)(""),p=(0,Re.useRef)(null),d=(0,Re.useRef)(0),[g,f]=(0,Re.useState)(0),[h,w]=(0,Re.useState)(null),[M,D]=(0,Re.useState)(!1),{cart:m,addToCart:u,addManyToCart:b,removeFromCart:v,updateCartQty:N,updateCartSellUnits:A,updateCartConversions:T,clearCart:z}=An(),[G,P]=(0,Re.useState)(!1),[be,De]=(0,Re.useState)(null),Le=()=>{De(null);try{window.sessionStorage.removeItem(Fs)}catch{}},He=(0,Re.useRef)(new Map),ze=(0,Re.useRef)(null),me=Xs("quick-quote",ze);(0,Re.useEffect)(()=>{me("viewed")},[me]),(0,Re.useEffect)(()=>{for(let W of Object.values(m))Dt(W).requiredSellUnits!=null&&He.current.delete(W.lineId);let ge=Object.values(m).filter(W=>{if(W.productId==="-"||Dt(W).requiredSellUnits!=null)return!1;let k=`${W.productId}|${W.qty}|${W.unit}`;return He.current.get(W.lineId)===k?!1:(He.current.set(W.lineId,k),!0)});ge.length!==0&&fetch(Ht("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:ge.map(W=>({line_id:W.lineId,product_id:W.productId,requested_description:W.requestedDescription??W.description,requested_qty:W.qty,requested_uom:W.unit||null,selected_description:W.description,selected_uoi:W.uoi,selected_uoi_count:W.uoiCount,linked_context:W.linkedContext??[],selected_conversion:{sales_uom_normalised:W.salesUomNormalised,conversion_type:W.conversionType,sales_unit_size:W.salesUnitSize,sales_unit_size_uom:W.salesUnitSizeUom,coverage_qty:W.coverageQty,coverage_uom:W.coverageUom}}))})}).then(W=>W.ok?Pt(W):null).then(W=>{let k={};for(let R of W?.data?.items??W?.items??[]){let E=R?.conversion;if(!E||typeof R?.line_id!="string")continue;let O=m[R.line_id];k[R.line_id]={conversionType:E.conversion_type,requestUomsSupported:E.request_uoms_supported,salesUomNormalised:E.sales_uom_normalised,salesUnitSize:E.sales_unit_size,salesUnitSizeUom:E.sales_unit_size_uom,coverageQty:E.coverage_qty,coverageUom:E.coverage_uom,roundingRule:E.rounding_rule,conversionConfidence:E.conversion_confidence,conversionNotes:E.conversion_notes,...O?.qty===0&&Number.isFinite(E.suggested_order_qty)&&E.suggested_order_qty>0?{qty:E.suggested_order_qty,unit:E.suggested_order_uom||O.unit}:{}}}Object.keys(k).length>0&&T(k)}).catch(W=>console.error("Catalogue conversion resolution failed",W))},[m,T]);let[ce,fe]=(0,Re.useState)(!1);(0,Re.useEffect)(()=>{let ge=window.location.hash,W=null;try{W=JSON.parse(window.sessionStorage.getItem(Sd)??"null")}catch{}if(W?.scheduleResult)o("schedule"),w(W.scheduleResult),D(W.reviewGateComplete),P(W.cartSeeded),b(Object.values(W.cart)),ge==="#quote-request"?i("basket"):ge==="#matched-products"&&i("results");else if(ge==="#matched-products"||ge==="#quote-request"){let k=new URL(window.location.href);k.hash="",window.history.replaceState(window.history.state,"",k)}fe(!0)},[]),(0,Re.useEffect)(()=>{if(ce)try{h?window.sessionStorage.setItem(Sd,JSON.stringify({scheduleResult:h,reviewGateComplete:M,cartSeeded:G,cart:m})):window.sessionStorage.removeItem(Sd)}catch{}},[ce,h,M,G,m]);let Ee=(0,Re.useCallback)(ge=>{if(typeof window>"u")return;let W=new URL(window.location.href);W.hash=ge==="basket"?"quote-request":"matched-products";let k=ge==="results"&&(window.location.hash==="#matched-products"||window.location.hash==="#quote-request");window.history[k?"replaceState":"pushState"]({boqQuoteStage:ge},"",W)},[]),ut=(0,Re.useRef)(!1);(0,Re.useEffect)(()=>{let ge=W=>{ut.current=!1;let k=window.location.hash;k==="#quote-request"?i("basket"):k==="#matched-products"&&h?(o("schedule"),i("results")):i("entry");let R=W.state,E=window.location.href;setTimeout(()=>{if(window.location.href===E){if(k==="#quote-request"||k==="#matched-products"||k==="#quote-entry"){window.history.replaceState({boqQuoteStage:k==="#quote-request"?"basket":k==="#quote-entry"?"entry":"results"},"",E);return}!R?.turbo&&window.history.state?.turbo&&window.history.replaceState(R,"",E)}})};return window.addEventListener("popstate",ge),()=>window.removeEventListener("popstate",ge)},[h]);let Se=(0,Re.useCallback)(()=>{Ee("basket"),i("basket")},[Ee]),Z=(0,Re.useCallback)(()=>{if(window.location.hash==="#quote-request"){if(ut.current)return;ut.current=!0,window.history.back();return}i(h?"results":"entry")},[h]),de=(0,Re.useRef)(r);(0,Re.useEffect)(()=>{de.current!==r&&(de.current=r,window.scrollTo(0,0))},[r]);let Je=()=>{i("entry"),o(null),c(""),f(0),w(null),D(!1),z(),P(!1),Le()},Ye=(0,Re.useCallback)(async(ge,W,k=!0)=>{let R=++d.current;c(""),f(0);let E=0,O=()=>{E=Math.min(E+1,3),f(E)};try{let{jobId:ee}=await nv(ge,W,k);if(R!==d.current)return;let{promise:xe,cancel:we}=lv(()=>ov(ee),5e3,O,"schedule");p.current=we;let y=await xe;if(y.status==="failed"||!y.result)throw new Error(y.error||"Failed to process schedule");let j=y.result.lineItems.length,B=y.result.results.filter(ae=>ae.candidates.length>0).length;me("results_shown",{lines:j,matched:B,unmatched:j-B}),z(),P(!1),D(!1),w(y.result),Ee("results"),i("results")}catch(ee){if(R!==d.current)return;me("error",{stage:"matching"}),c(ee?.message||"Failed to process schedule"),i("entry")}finally{R===d.current&&(p.current?.(),p.current=null)}},[Ee,me,z]),pt=(0,Re.useCallback)(()=>{d.current++,p.current?.(),p.current=null},[]),ot=(0,Re.useCallback)(async(ge,W,k=!0)=>{if(!ge.trim())return;o("schedule");let R=new File([ge],"pasted-schedule.txt",{type:"text/plain"});await Ye(R,W,k)},[Ye]),at=(0,Re.useCallback)(async ge=>{o("schedule"),await Ye(ge)},[Ye]);return(0,Sa.jsx)(Po.Provider,{value:me,children:(0,Sa.jsx)("div",{ref:ze,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:Ra().theme,children:(0,Sa.jsxs)("main",{className:"main-content",children:[l&&(0,Sa.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Sa.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Sa.jsx)(fd,{onPasteSchedule:ot,onUploadSchedule:at,onEntryModeChange:o,draft:be,onSubmitDraft:De,onCancelMatch:pt}),r==="results"&&n==="schedule"&&h&&(0,Sa.jsx)(xd,{scheduleResult:h,onStartOver:Je,cart:m,onAddToCart:u,onRemoveFromCart:v,onGoToBasket:Se,cartSeeded:G,onCartSeeded:()=>P(!0),reviewGateComplete:M,onReviewGateComplete:()=>D(!0),internal:a}),r==="basket"&&(0,Sa.jsx)(ol,{cart:m,onUpdateQty:N,onUpdateSellUnits:A,onRemove:v,onBack:Z,onStartNewQuote:Je,onQuoteRequested:()=>{w(null),D(!1),P(!1),z(),Le()},internal:a})]})})})}var Va=X(Xe());var xi=X(Xe()),re=X(ie()),dw=[{id:"ogee",label:"Ogee",blurb:"Traditional curved profile"},{id:"torus",label:"Torus",blurb:"Soft rounded detail"},{id:"ovolo",label:"Ovolo",blurb:"Traditional rounded profile"},{id:"pencil-round",label:"Pencil round",blurb:"Simple softened edge"},{id:"square-edge",label:"Square edge",blurb:"Clean contemporary edge"}],ic=e=>Number.parseFloat(e)||0,mw=(e,t)=>ic(e)*(t==="m"?1:.3048),Cd=(e,t)=>ic(e.quantity)*(2*mw(e.height,t)+mw(e.width,t)),q_=()=>({quantity:"1",width:"",height:""});function E_({profile:e}){return(0,re.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,re.jsx)("path",{d:{ogee:"M18 62 V38 C18 28 28 22 40 22 H78 C88 22 94 28 94 38 V62",torus:"M18 62 V40 C18 27 30 20 42 20 C54 20 58 30 66 30 C74 30 78 20 90 20 C102 20 94 34 94 40 V62",ovolo:"M18 62 V38 C18 28 30 20 42 20 H70 C82 20 94 28 94 38 V62","pencil-round":"M18 62 V38 C18 28 28 20 40 20 H72 C84 20 94 28 94 38 V62","square-edge":"M18 62 V20 H94 V62"}[e]}),(0,re.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function qd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,xi.useState)("m"),[n,o]=(0,xi.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,c]=(0,xi.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,d]=(0,xi.useState)([]),[g,f]=(0,xi.useState)("ogee"),[h,w]=(0,xi.useState)("2.4"),M=(N,A,T)=>{N(z=>({...z,[A]:T}))},D=Cd(n,r)+Cd(l,r)+p.reduce((N,A)=>N+Cd(A,r),0),m=ic(h)>0?Math.ceil(D/ic(h)):0,u=dw.find(N=>N.id===g)?.label??"",b=[{key:`architrave-${g}`,label:`Architrave (${u})`,qty:D,unit:"m",query:`${u} architrave`,category:"architrave"}],v=(N,A,T,z)=>(0,re.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,re.jsx)("span",{children:N}),(0,re.jsx)("input",{"aria-label":`${N} quantity`,type:"number",min:"0",step:"1",value:A.quantity,onChange:G=>T("quantity",G.target.value)}),(0,re.jsx)("input",{"aria-label":`${N} width`,type:"number",min:"0",step:"0.01",value:A.width,onChange:G=>T("width",G.target.value)}),(0,re.jsx)("input",{"aria-label":`${N} height`,type:"number",min:"0",step:"0.01",value:A.height,onChange:G=>T("height",G.target.value)}),z?(0,re.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:z,children:"Remove"}):null]});return(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)("div",{className:"truss-estimator",children:[(0,re.jsxs)("div",{className:"quick-order-hero",children:[(0,re.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,re.jsx)("h1",{children:"Architrave Calculator"}),(0,re.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,re.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,re.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,re.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter each door or window opening. Mitred corners are allowed for, and board lengths are worked out from the net run."}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,re.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,re.jsx)("span",{children:"Units"}),(0,re.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,re.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metres"}),(0,re.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Feet"})]})]}),(0,re.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,re.jsx)("span",{children:"Opening"}),(0,re.jsx)("span",{children:"Qty"}),(0,re.jsxs)("span",{children:["Width (",r,")"]}),(0,re.jsxs)("span",{children:["Height (",r,")"]}),(0,re.jsx)("span",{})]}),v("Single doors",n,(N,A)=>M(o,N,A)),v("Double doors",l,(N,A)=>M(c,N,A)),p.map((N,A)=>v(`Alternative door ${A+1}`,N,(T,z)=>d(G=>G.map((P,be)=>be===A?{...P,[T]:z}:P)),()=>d(T=>T.filter((z,G)=>G!==A)))),(0,re.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>d(N=>[...N,q_()]),children:"+ Add alternative-sized door"})]}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,re.jsx)("div",{className:"architrave-calculator__profiles",children:dw.map(N=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${g===N.id?" is-selected":""}`,onClick:()=>f(N.id),children:[(0,re.jsx)(E_,{profile:N.id}),(0,re.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,re.jsx)("div",{className:"architrave-calculator__options",children:(0,re.jsxs)("label",{className:"truss-estimator__field",children:[(0,re.jsx)("span",{children:"Board length (m)"}),(0,re.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,re.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,re.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Architrave needed"}),(0,re.jsxs)("strong",{children:[D.toFixed(2)," m"]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Board lengths"}),(0,re.jsx)("strong",{children:m})]})]})]}),(0,re.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,re.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,re.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(b),disabled:D<=0,children:a})]})]})]})})}var ki=X(Xe()),se=X(ie()),fw=60,gw=10,M_=.02,T_=.012,z_=.01,Rn=e=>Number.parseFloat(e)||0,A_=(e,t=2)=>e.toFixed(t);function Ed({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ki.useState)("brick"),[n,o]=(0,ki.useState)("engineering-red"),[l,c]=(0,ki.useState)("metric"),[p,d]=(0,ki.useState)(""),[g,f]=(0,ki.useState)(""),[h,w]=(0,ki.useState)(!0),M=l==="metric"?Rn(p)*Rn(g):Rn(p)*Rn(g)*.092903,m=M*(r==="brick"?fw:gw),u=Math.ceil(m),b=M*(r==="brick"?M_:T_),v=Math.ceil(b/z_),N=l==="metric"?M:M*10.7639,A=[{key:r==="brick"?`brick-${n}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[n]:"Blocks",qty:u,unit:"each",query:r==="brick"?"facing brick":"concrete block",category:"masonry"},...h?[{key:"mortar",label:"Blue Circle Quality Assured Mortar Mix 20kg",qty:v,unit:"bag",query:"ready mixed mortar",category:"mortar"}]:[]],T=z=>{if(z===l)return;let G=z==="imperial"?3.28084:.3048;d((Rn(p)*G).toFixed(2)),f((Rn(g)*G).toFixed(2)),c(z)};return(0,se.jsx)(se.Fragment,{children:(0,se.jsxs)("div",{className:"truss-estimator",children:[(0,se.jsxs)("div",{className:"quick-order-hero",children:[(0,se.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,se.jsx)("h1",{children:"Brick & Block Calculator"}),(0,se.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,se.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,se.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,se.jsx)("p",{className:"truss-estimator__step-sub",children:"Pick brick or block and enter the wall dimensions for unit counts plus ready-mixed mortar."}),(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,se.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([z,G])=>(0,se.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===z?" is-selected":""}`,onClick:()=>i(z),children:[(0,se.jsx)("div",{className:"truss-estimator__option-title",children:G}),(0,se.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",z==="brick"?fw:gw," per m\xB2"]})]},z))})]}),r==="brick"&&(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,se.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:[["common","Common concrete","General-purpose grey concrete brick"],["engineering-red","Engineering red","Class B perforated, 65mm"],["engineering-blue","Engineering blue","Class B solid, 65mm"]].map(([z,G,P])=>(0,se.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n===z?" is-selected":""}`,onClick:()=>o(z),children:[(0,se.jsx)("div",{className:"truss-estimator__option-title",children:G}),(0,se.jsx)("div",{className:"truss-estimator__option-copy",children:P})]},z))})]}),(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,se.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,se.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>T("metric"),children:"Metric"}),(0,se.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>T("imperial"),children:"Imperial"})]}),(0,se.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:z=>d(z.target.value)})]}),(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:g,onChange:z=>f(z.target.value)})]})]})]}),(0,se.jsx)("div",{className:"brick-calculator__options",children:(0,se.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,se.jsx)("input",{type:"checkbox",checked:h,onChange:z=>w(z.target.checked)}),(0,se.jsx)("span",{children:"Include ready-mixed mortar"})]})}),(0,se.jsxs)("div",{className:"brick-calculator__totals",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,se.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:"Wall area"}),(0,se.jsxs)("strong",{children:[A_(N)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,se.jsx)("strong",{children:u.toLocaleString("en-GB")})]}),h?(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:"Ready-mixed mortar"}),(0,se.jsxs)("strong",{children:[v," x 20kg bags"]})]}):null]}),(0,se.jsx)("p",{className:"brick-calculator__note",children:"Estimate based on standard nominal sizes and 10mm joints. Mortar bags are approximate; confirm the required mortar specification before ordering."})]}),(0,se.jsxs)("div",{className:"brick-calculator__actions",children:[(0,se.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,se.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(A),disabled:M<=0,children:a})]})]})]})})}var hr=X(Xe());var hw=new Map;function R_(e){return{product_id:e.product_id,description:e.description,source_list:e.source_list??null,price:e.price??null,list_price:e.list_price,discount:e.discount,price_basis:e.price_basis??null,uoi_count:e.uoi_count??null,uoi:e.uoi??null,pdp_photo_url:e.pdp_photo_url??null,conversion:e.conversion,measurements_mm:e.measurements_mm??e.attrs?.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"estimator_catalogue_search"}}async function Fr(e,t,a=12,r){let i=`${e}||${t??""}||${a}||${r??""}`,n=hw.get(i);if(n)return n;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(Ht(`/api/catalogue/search?${o.toString()}`),{headers:vi()}),c=await Pt(l);if(!l.ok)throw new Error(c?.error||c?.message||"Could not reach the product catalogue");let p=Array.isArray(c?.items)?c.items.map(R_):[];return hw.set(i,p),p}async function bw(e,t){return await Promise.all(e.map(async r=>{try{return{requirement:r,candidates:await Fr(r.query,r.category,void 0,t)}}catch{return{requirement:r,candidates:[]}}}))}async function vw(){let e=await fetch(Ht("/api/catalogue"),{headers:vi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Pt(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var V=X(ie()),U_=1.54,D_=1440,O_=25,Md=800,B_=1500,Td=e=>Number.parseFloat(e)||0,Un={mot:{label:"MOT Type 1",blurb:"Sub-base for patios and driveways",density:1.7,productId:"6001007"},"sharp-sand":{label:"Sharp sand",blurb:"Bedding and general groundwork",density:1.6,productId:"6001012"},gravel:{label:"20mm gravel",blurb:"Drainage and landscaping",density:1.6,productId:"6001004"}};function zd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let r=ac(),[i,n]=(0,hr.useState)("m"),[o,l]=(0,hr.useState)(""),[c,p]=(0,hr.useState)(""),[d,g]=(0,hr.useState)(""),[f,h]=(0,hr.useState)("concrete"),[w,M]=(0,hr.useState)("mot"),[D,m]=(0,hr.useState)(!1),[u,b]=(0,hr.useState)(null),v=i==="m"?1:.3048,N=Td(o)*v*Td(c)*v*Td(d)*(i==="m"?.01:.0254),A=Un[w],T=N*U_/7,z=T*D_,G=T*2,P=T*4,be=Math.ceil(z/O_),De=Math.ceil(G*Un["sharp-sand"].density*1e3/Md),Le=Math.ceil(P*Un.gravel.density*1e3/Md),He=Math.ceil(N*A.density*1e3/Md),ze=f==="concrete"?[{key:"cement",label:"Blue Circle General Purpose Grey Cement 25kg",qty:be,productId:"6003004"},{key:"sharp-sand",label:"Sharp Sand Bulk Bag (800kg)",qty:De,productId:"6001012"},{key:"gravel",label:"20mm Non Decorative Pea Shingle/Gravel Bulk Bag (800kg)",qty:Le,productId:"6001004"}]:[{key:w,label:`${A.label} Bulk Bag (800kg)`,qty:He,productId:A.productId}],me=()=>{if(t){t(ze.map(fe=>({key:fe.key,label:fe.label,qty:fe.qty,unit:"each",query:fe.productId})));return}ce()},ce=async()=>{let fe=Date.now();m(!0),b(null);try{let Ee=await Promise.all(ze.map(async Se=>{let Z=(await Fr(Se.productId)).find(de=>de.product_id===Se.productId);if(!Z)throw new Error(`${Se.label} is no longer available in this catalogue.`);return Pr(Z,{lineId:`concrete-aggregate:${Se.key}`,description:Se.label,unit:"bag",qty:Se.qty})})),ut=B_-(Date.now()-fe);ut>0&&await new Promise(Se=>window.setTimeout(Se,ut)),r?.clearCart(),r?.addManyToCart(Ee),r?.openBasket()}catch(Ee){b(Ee instanceof Error?Ee.message:"Could not add the products to your basket.")}finally{m(!1)}};return D?(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("div",{className:"truss-estimator",children:[(0,V.jsxs)("div",{className:"quick-order-hero",children:[(0,V.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,V.jsx)("h1",{children:"Your Materials"}),(0,V.jsx)("p",{children:"Calculating quantities from the Concrete & Aggregate Calculator."})]}),(0,V.jsx)("div",{className:"truss-estimator__card",children:(0,V.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,V.jsx)(fr,{}),(0,V.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("div",{className:"truss-estimator",children:[(0,V.jsxs)("div",{className:"quick-order-hero",children:[(0,V.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,V.jsx)("h1",{children:"Concrete & Aggregate Calculator"}),(0,V.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,V.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,V.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,V.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the area and depth. The calculator adds the fixed Materials Market products directly to your basket."}),(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,V.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${f==="concrete"?" is-selected":""}`,onClick:()=>h("concrete"),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${f==="aggregate"?" is-selected":""}`,onClick:()=>h("aggregate"),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),f==="aggregate"&&(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,V.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Un).map(fe=>(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===fe?" is-selected":""}`,onClick:()=>M(fe),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:Un[fe].label}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:Un[fe].blurb})]},fe))})]}),(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,V.jsxs)("div",{className:"materials-calculator__unit-row",children:[(0,V.jsx)("span",{children:"Units"}),(0,V.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,V.jsx)("button",{type:"button",className:i==="m"?"is-selected":"",onClick:()=>n("m"),children:"Metric"}),(0,V.jsx)("button",{type:"button",className:i==="ft"?"is-selected":"",onClick:()=>n("ft"),children:"Imperial"})]})]}),(0,V.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsxs)("span",{children:["Length (",i,")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.01",value:o,onChange:fe=>l(fe.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsxs)("span",{children:["Width (",i,")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.01",value:c,onChange:fe=>p(fe.target.value)})]})]}),(0,V.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,V.jsxs)("span",{children:["Depth (",i==="m"?"cm":"inches",")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.1",value:d,onChange:fe=>g(fe.target.value)})]})]}),(0,V.jsxs)("div",{className:"materials-calculator__totals",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,V.jsx)("div",{className:"materials-calculator__result-grid",children:f==="concrete"?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Cement"}),(0,V.jsxs)("strong",{children:[z.toFixed(0)," kg"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Sharp sand"}),(0,V.jsxs)("strong",{children:[G.toFixed(2)," m\xB3"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"20mm aggregate"}),(0,V.jsxs)("strong",{children:[P.toFixed(2)," m\xB3"]})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:A.label}),(0,V.jsxs)("strong",{children:[N.toFixed(2)," m\xB3"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Approx. weight"}),(0,V.jsxs)("strong",{children:[(N*A.density).toFixed(2)," t"]})]}),(0,V.jsx)("div",{})]})}),(0,V.jsx)("p",{className:"materials-calculator__note",children:f==="concrete"?"Based on a 1:2:4 mix. Confirm the mix design for structural work.":"Figures are estimates. Confirm the specification and supplier quantities before ordering."})]}),u&&(0,V.jsx)("p",{className:"results-empty-hint estimator-products__error",children:u}),(0,V.jsxs)("div",{className:"materials-calculator__actions",children:[(0,V.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:me,disabled:N<=0||D,children:D?"Adding products\u2026":a})]})]})]})})}var Xa=X(Xe());var U=X(ie()),Dn=12,On=8,nc=.56,ww=.21,Ca={ranges:{meridian:{label:"Standard grooved timber",blurb:"32 \xD7 125mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.125},summit:{label:"Wide grooved timber",blurb:"32 \xD7 150mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.15}},boardGapM:.006,wastage:{straight:.05,diagonal:.15},pictureFrame:{extraWastage:.08},joist:{lengthM:2.4,spacingOptions:[{id:"300",label:"300mm centres (heavy duty)",spacingM:.3},{id:"400",label:"400mm centres (standard)",spacingM:.4},{id:"450",label:"450mm centres (light use)",spacingM:.45}]}},Ni=["range","grid","pictureFrame","substructure"],L_={range:null,colour:null,deckSizeMode:"quick",quickLengthM:"",quickWidthM:"",points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:"",pictureFrame:null,direction:null,deckHeightMode:"standard",deckHeightCm:"",joistSpacing:null,supportType:null,contact:{name:"",email:""}},oc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),lc=(e,t,a)=>a.x>=Math.min(e.x,t.x)&&a.x<=Math.max(e.x,t.x)&&a.y>=Math.min(e.y,t.y)&&a.y<=Math.max(e.y,t.y),H_=(e,t,a,r)=>{let i=oc(e,t,a),n=oc(e,t,r),o=oc(a,r,e),l=oc(a,r,t);return i===0&&lc(e,t,a)||n===0&&lc(e,t,r)||o===0&&lc(a,r,e)||l===0&&lc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},Ad=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1){let i=e[(r+1)%e.length];for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&H_(e[r],i,e[n],e[(n+1)%e.length]))return!0}return!1};function Rd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Xa.useState)(0),[n,o]=(0,Xa.useState)(L_),[l,c]=(0,Xa.useState)(1),[p,d]=(0,Xa.useState)({x:0,y:0}),[g,f]=(0,Xa.useState)(null),h=(0,Xa.useRef)(null),w=(0,Xa.useRef)(null),M=(0,Xa.useRef)(null),D=Ni[r],m=n.range?Ca.ranges[n.range]:null,u=Dn/l,b=On/l,v=(Dn-u)/2,N=(On-b)/2,A=Math.max(-Dn,Math.min(Dn*2-u,v+p.x)),T=Math.max(-On,Math.min(On*2-b,N+p.y)),z=Number.parseFloat(n.quickLengthM),G=Number.parseFloat(n.quickWidthM),P=z>0&&G>0,be=k=>Math.abs(k.reduce((R,E,O)=>{let ee=k[(O+1)%k.length];return R+E.x*ee.y-ee.x*E.y},0))/2,De=(k,R)=>Math.hypot(R.x-k.x,R.y-k.y),Le=n.isOutlineClosed?be(n.points):0,He=n.isOutlineClosed?n.points.reduce((k,R,E)=>k+De(R,n.points[(E+1)%n.points.length]),0):0,ze=n.isOutlineClosed?n.points.reduce((k,R,E)=>k+(n.wallSegments.has(E)?0:De(R,n.points[(E+1)%n.points.length])),0):0,me=n.points.reduce((k,R)=>({x:k.x+R.x/n.points.length,y:k.y+R.y/n.points.length}),{x:0,y:0}),ce=n.points.length>1?(()=>{let k=n.points[0],R=n.points[1],E=De(k,R),O=E?-(R.y-k.y)/E:0,ee=E?(R.x-k.x)/E:0,xe=(k.x+R.x)/2,we=(k.y+R.y)/2,y=O*(xe-me.x)+ee*(we-me.y)>=0?1:-1;return{x:xe+O*nc*y,y:we+ee*nc*y}})():null,Ee=(()=>{let k=n.range?Ca.ranges[n.range]:Ca.ranges.meridian,R=n.deckSizeMode==="quick"?z*G:Le,E=n.deckSizeMode==="quick"?2*(z+G):ze,O=n.direction==="diagonal"?Ca.wastage.diagonal:Ca.wastage.straight,ee=n.pictureFrame==="yes"?Ca.pictureFrame.extraWastage:0,we=R/(k.boardWidthM+Ca.boardGapM)/k.boardLengthM,y=Math.ceil(we*(1+O+ee)),j=Math.ceil(R*30*(1+O+ee)/200),B=Ca.joist.spacingOptions.find(q=>q.id===n.joistSpacing)??Ca.joist.spacingOptions[1],ae=R/B.spacingM,te=Math.ceil(ae/Ca.joist.lengthM);return{range:k,area:R,boardCount:y,screwBoxes:j,joistLengthsNeeded:te,spacing:B}})(),ut=Ee?[{key:`boards-${n.range??"meridian"}`,label:`Deck boards (${Ee.range.label})`,qty:Ee.boardCount,unit:"each",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:Ee.joistLengthsNeeded,unit:"each",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:Ee.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],Se=()=>D==="range"?!!n.range:D==="grid"?n.deckSizeMode==="quick"?P:n.isOutlineClosed&&Le>0:D==="pictureFrame"?!!n.pictureFrame&&!!n.direction:D==="substructure"?!!n.joistSpacing:!0,Z=r===Ni.length-1?a:"Next",de=(k,R,E=!1)=>{let O=M.current?.getBoundingClientRect();if(!O)return null;let ee=E?1:.25;return{x:Math.round(Math.max(A,Math.min(A+u,A+(k-O.left)/O.width*u))/ee)*ee,y:Math.round(Math.max(T,Math.min(T+b,T+(R-O.top)/O.height*b))/ee)*ee}},Je=k=>{if(n.isOutlineClosed){let E=k.target;if(E!==k.currentTarget&&!E.classList.contains("deck-outline__grid"))return;w.current={startX:k.clientX,startY:k.clientY,startViewX:A,startViewY:T},k.currentTarget.setPointerCapture(k.pointerId);return}if(n.drawMode!=="outline")return;let R=de(k.clientX,k.clientY,!0);R&&(f(null),o(E=>{let O=[...E.points,R];return Ad(O,!1)?{...E,drawError:"Edges cannot cross. Choose another corner."}:{...E,points:O,drawError:""}}))},Ye=(k,R)=>{if(!n.isOutlineClosed){k.stopPropagation(),R===0&&n.points.length>=3&&o(E=>({...E,isOutlineClosed:!0,drawMode:"edges"}));return}k.stopPropagation(),h.current=R,k.currentTarget.setPointerCapture(k.pointerId)},pt=k=>{if(w.current){let O=M.current?.getBoundingClientRect();if(!O)return;let ee=w.current,xe=ee.startViewX-(k.clientX-ee.startX)/O.width*u,we=ee.startViewY-(k.clientY-ee.startY)/O.height*b;d({x:xe-v,y:we-N});return}!n.isOutlineClosed&&n.drawMode==="outline"&&f(de(k.clientX,k.clientY,!0));let R=h.current;if(R===null)return;let E=de(k.clientX,k.clientY);E&&o(O=>{let ee=O.points.map((xe,we)=>we===R?E:xe);return Ad(ee,!0)?{...O,drawError:"Edges cannot cross. Move the corner to a different position."}:{...O,points:ee,drawError:""}})},ot=k=>{w.current=null,h.current=null,k.currentTarget.hasPointerCapture(k.pointerId)&&k.currentTarget.releasePointerCapture(k.pointerId)},at=k=>{o(R=>{let E=new Set(R.wallSegments);return E.has(k)?E.delete(k):E.add(k),{...R,wallSegments:E}})},ge=()=>{r===0?e():i(k=>k-1)},W=()=>{Se()&&(r===Ni.length-1?t?.(ut):i(k=>k+1))};return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:"truss-estimator",children:[(0,U.jsxs)("div",{className:"quick-order-hero",children:[(0,U.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,U.jsx)("h1",{children:"Decking Calculator"}),(0,U.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,U.jsxs)("div",{className:"truss-estimator__card",children:[(0,U.jsxs)("div",{className:"truss-estimator__body",children:[D==="range"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Ca.ranges).map(([k,R])=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===k?" is-selected":""}`,onClick:()=>o(E=>({...E,range:k})),children:[(0,U.jsx)("div",{className:"truss-estimator__option-title",children:R.label}),(0,U.jsx)("div",{className:"truss-estimator__option-copy",children:R.blurb}),(0,U.jsxs)("div",{className:"truss-estimator__option-copy",children:[R.boardLengthM,"m boards"]})]},k))})]}):null,D==="grid"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Start with a quick rectangle estimate, or draw an irregular deck for a more precise result."}),(0,U.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,U.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(k=>({...k,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,U.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(k=>({...k,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),n.deckSizeMode==="quick"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,U.jsxs)("label",{className:"truss-estimator__field",children:[(0,U.jsx)("span",{children:"Length (m)"}),(0,U.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickLengthM,onChange:k=>o(R=>({...R,quickLengthM:k.target.value}))})]}),(0,U.jsxs)("label",{className:"truss-estimator__field",children:[(0,U.jsx)("span",{children:"Width (m)"}),(0,U.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickWidthM,onChange:k=>o(R=>({...R,quickWidthM:k.target.value}))})]})]}),(0,U.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),P?(0,U.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,U.jsxs)("div",{children:[(z*G).toFixed(2)," m\xB2 deck"]}),(0,U.jsxs)("div",{children:[(2*(z+G)).toFixed(2)," m perimeter"]})]}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,U.jsxs)("div",{className:"deck-outline__toolbar",children:[n.isOutlineClosed?(0,U.jsxs)("div",{className:"deck-outline__summary",children:[(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Deck area"}),(0,U.jsxs)("strong",{children:[Le.toFixed(2)," m\xB2"]})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Perimeter"}),(0,U.jsxs)("strong",{children:[He.toFixed(2)," m"]})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Wall edges"}),(0,U.jsx)("strong",{children:n.wallSegments.size>0?n.wallSegments.size:"None"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Visible edge"}),(0,U.jsxs)("strong",{children:[ze.toFixed(2)," m"]})]})]}):null,(0,U.jsxs)("div",{className:"deck-outline__actions",children:[(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,points:k.points.slice(0,-1)})),disabled:n.points.length===0||n.isOutlineClosed,children:"Undo"}),(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f(null),o(k=>({...k,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:n.points.length===0,children:"Clear"}),(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,points:[{x:2,y:2},{x:8,y:2},{x:8,y:5},{x:2,y:5}],isOutlineClosed:!0,wallSegments:new Set,drawMode:"edges",drawError:""})),children:"Start with rectangle"})]})]}),(0,U.jsx)("div",{className:"deck-editor-layout",children:(0,U.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,U.jsxs)("div",{className:"deck-outline",children:[(0,U.jsxs)("svg",{ref:M,className:`deck-outline__canvas${n.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${A} ${T} ${u} ${b}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:Je,onPointerMove:pt,onPointerUp:ot,onPointerLeave:()=>{f(null),w.current||(h.current=null)},children:[(0,U.jsx)("defs",{children:(0,U.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,U.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,U.jsx)("rect",{x:-Dn,y:-On,width:Dn*3,height:On*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),n.points.length>1?(0,U.jsx)("polyline",{className:"deck-outline__preview",points:n.points.map(k=>`${k.x},${k.y}`).join(" ")}):null,n.isOutlineClosed?(0,U.jsx)("polygon",{className:"deck-outline__shape",points:n.points.map(k=>`${k.x},${k.y}`).join(" "),stroke:"none"}):null,n.points.length>1?n.points.slice(0,n.isOutlineClosed?void 0:-1).map((k,R)=>{let E=n.points[n.isOutlineClosed?(R+1)%n.points.length:R+1],O=De(k,E),ee=O?-(E.y-k.y)/O:0,xe=O?(E.x-k.x)/O:0,we=(k.x+E.x)/2,y=(k.y+E.y)/2,j=ee*(we-me.x)+xe*(y-me.y)>=0?1:-1,B=we+ee*nc*j,ae=y+xe*nc*j;return(0,U.jsxs)("g",{children:[(0,U.jsx)("line",{className:"deck-outline__edge-hit",x1:k.x,y1:k.y,x2:E.x,y2:E.y,onClick:n.isOutlineClosed?()=>at(R):void 0}),(0,U.jsx)("line",{className:`deck-outline__edge${n.wallSegments.has(R)?" is-wall":""}`,x1:k.x,y1:k.y,x2:E.x,y2:E.y,pointerEvents:"none"}),(0,U.jsxs)("text",{className:`deck-outline__edge-label${n.wallSegments.has(R)?" is-wall":""}`,x:B,y:ae,textAnchor:"middle",dominantBaseline:"central",fontSize:ww/l,children:[O.toFixed(2)," m"]})]},`segment-${R}`)}):null,!n.isOutlineClosed&&n.points.length>0&&g?(()=>{let k=n.points[n.points.length-1],R=De(k,g);if(!R)return null;let E=-(g.y-k.y)/R,O=(g.x-k.x)/R,ee=(k.x+g.x)/2,xe=(k.y+g.y)/2;return(0,U.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,U.jsx)("line",{x1:k.x,y1:k.y,x2:g.x,y2:g.y}),(0,U.jsxs)("text",{x:ee+E*.34,y:xe+O*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:ww/l,children:[R.toFixed(2)," m"]})]})})():null,n.points.map((k,R)=>(0,U.jsx)("circle",{className:"deck-outline__point",cx:k.x,cy:k.y,r:"0.13",onPointerDown:E=>Ye(E,R)},`point-${R}`))]}),(0,U.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,U.jsx)("button",{type:"button",onClick:()=>c(k=>Math.max(.5,k-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,U.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,U.jsx)("button",{type:"button",onClick:()=>c(k=>Math.min(1,k+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),n.isOutlineClosed&&n.wallSegments.size===0&&ce?(0,U.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(ce.x-A)/u*100}%`,top:`${(ce.y-T)/b*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!n.isOutlineClosed&&n.points.length>=3?(0,U.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(k=>Ad(k.points,!0)?{...k,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...k,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,U.jsxs)("div",{className:"deck-outline__supporting",children:[(0,U.jsx)("div",{className:"truss-estimator__grid-hint",children:n.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),n.drawError?(0,U.jsx)("div",{className:"deck-outline__error",role:"alert",children:n.drawError}):null]})]})})]})]}):null,D==="pictureFrame"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"A picture frame border runs boards around the perimeter for a finished look and uses extra material."}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No border",img:"/decking/boards/no-border.webp"},{id:"yes",label:"Picture frame",img:"/decking/boards/picture-frame.webp"}].map(k=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.pictureFrame===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,pictureFrame:k.id})),children:[(0,U.jsx)("img",{className:"truss-estimator__visual-card-img",src:Jt(k.img),alt:""}),(0,U.jsx)("span",{children:k.label})]},k.id))}),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"straight",label:"Straight",img:"/decking/boards/straight.webp"},{id:"diagonal",label:"Diagonal",img:"/decking/boards/diagonal.webp"}].map(k=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.direction===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,direction:k.id})),children:[(0,U.jsx)("img",{className:"truss-estimator__visual-card-img",src:Jt(k.img),alt:""}),(0,U.jsx)("span",{children:k.label})]},k.id))})]})]}):null,D==="substructure"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the joist spacing. Posts, footings and ground preparation vary by site, so are not included."}),(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Ca.joist.spacingOptions.map(k=>(0,U.jsx)("button",{type:"button",className:`truss-estimator__option-card${n.joistSpacing===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,joistSpacing:k.id})),children:(0,U.jsx)("div",{className:"truss-estimator__option-title",children:k.label})},k.id))})]}):null]}),(0,U.jsxs)("div",{className:"truss-estimator__nav",children:[(0,U.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:ge,children:"Back"}),(0,U.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:W,disabled:!Se(),children:[(0,U.jsx)("span",{children:Z}),(0,U.jsx)("span",{className:"arrow",children:(0,U.jsx)(jt,{})})]})]})]})]})})}var Ea=X(Xe());var Q=X(ie()),yw=12,_w=30,Bn=12,Ln=8,xw=.56,qa={ranges:{boundary:{label:"Horizontal lap",blurb:"Traditional pressure-treated timber panels.",panelWidthM:1.83},skyline:{label:"Feather edge",blurb:"Heavier timber panels for a more solid boundary.",panelWidthM:1.83}},heights:["0.9","1.2","1.5","1.8"],gate:{single:{label:"Single lap gate",widthDefault:.9}},mounting:{concrete:{label:"Concrete posts",blurb:"Slotted concrete posts with matching panels."},postcrete:{label:"Postcrete bags",blurb:"Fast-set post-mix bags in a dug hole.",bagsPerPost:2}}},Si=["range","height","gate","posts"],j_={range:null,colour:null,grid:new Set,excludedEdges:new Set,gridMode:"draw",boundaryMode:"quick",quickLengthM:"",boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set,height:null,gravelBoard:null,gateType:null,gateWidthM:"",mountingType:null,contact:{name:"",email:""}},sc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),cc=(e,t,a)=>a.x>=Math.min(e.x,t.x)&&a.x<=Math.max(e.x,t.x)&&a.y>=Math.min(e.y,t.y)&&a.y<=Math.max(e.y,t.y),Q_=(e,t,a,r)=>{let i=sc(e,t,a),n=sc(e,t,r),o=sc(a,r,e),l=sc(a,r,t);return i===0&&cc(e,t,a)||n===0&&cc(e,t,r)||o===0&&cc(a,r,e)||l===0&&cc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},uc=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&Q_(e[r],e[(r+1)%e.length],e[i],e[(i+1)%e.length]))return!0;return!1};function Ud({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ea.useState)(0),[n,o]=(0,Ea.useState)(j_),l=(0,Ea.useRef)(null),c=(0,Ea.useRef)(null),[p,d]=(0,Ea.useState)(1),[g,f]=(0,Ea.useState)({x:0,y:0}),[h,w]=(0,Ea.useState)(null),M=(0,Ea.useRef)(null),D=(0,Ea.useRef)(null),m=(0,Ea.useRef)(null),u=Si[r],b=n.range?qa.ranges[n.range]:null,v=Bn/p,N=Ln/p,A=(Bn-v)/2,T=(Ln-N)/2,z=Math.max(-Bn,Math.min(Bn*2-v,A+g.x)),G=Math.max(-Ln,Math.min(Ln*2-N,T+g.y)),P=n.boundaryPoints.reduce((y,j)=>({x:y.x+j.x/Math.max(1,n.boundaryPoints.length),y:y.y+j.y/Math.max(1,n.boundaryPoints.length)}),{x:0,y:0}),be=y=>{let j=new Set,B=[];return y.forEach(ae=>{let[te,q]=ae.split(",").map(Number),Y=[{key:`H,${te},${q}`,type:"H",x:te,y:q},{key:`H,${te},${q+1}`,type:"H",x:te,y:q+1},{key:`V,${te},${q}`,type:"V",x:te,y:q},{key:`V,${te+1},${q}`,type:"V",x:te+1,y:q}],K=[!y.has(`${te},${q-1}`),!y.has(`${te},${q+1}`),!y.has(`${te-1},${q}`),!y.has(`${te+1},${q}`)];Y.forEach((pe,ke)=>{K[ke]&&!j.has(pe.key)&&(j.add(pe.key),B.push(pe))})}),B},De=(y,j)=>be(y).filter(B=>!j.has(B.key)),Le=(y,j)=>De(y,j).length,He=(y,j)=>{let B={};De(y,j).forEach(te=>{var q,Y,K,pe;te.type==="H"?((B[q=`${te.x},${te.y}`]||(B[q]=[])).push("H"),(B[Y=`${te.x+1},${te.y}`]||(B[Y]=[])).push("H")):((B[K=`${te.x},${te.y}`]||(B[K]=[])).push("V"),(B[pe=`${te.x},${te.y+1}`]||(B[pe]=[])).push("V"))});let ae=0;return Object.values(B).forEach(te=>{(te.length===1||te.length===2&&te[0]!==te[1]||te.length>=3)&&(ae+=1)}),ae},me=(()=>{let y=n.range?qa.ranges[n.range]:qa.ranges.boundary,j=n.height??"1.8",B=n.boundaryMode==="quick"?Math.max(0,Number.parseFloat(n.quickLengthM)||0):n.boundaryClosed?n.boundaryPoints.slice(0,-1).reduce((It,vr,$a)=>It+(n.excludedBoundaryEdges.has($a)?0:Math.hypot(n.boundaryPoints[$a+1].x-vr.x,n.boundaryPoints[$a+1].y-vr.y)),0):0,ae=n.gateType&&n.gateType!=="none"?Number.parseFloat(n.gateWidthM)||qa.gate[n.gateType].widthDefault:0,te=Math.max(0,B-ae),q=te>0?Math.ceil(te/y.panelWidthM):0,Y=n.boundaryPoints.length>2&&n.boundaryPoints[0].x===n.boundaryPoints[n.boundaryPoints.length-1].x&&n.boundaryPoints[0].y===n.boundaryPoints[n.boundaryPoints.length-1].y,K=n.boundaryMode==="quick"?te>0?2:0:n.boundaryClosed?n.boundaryPoints.slice(0,Y?-1:void 0).reduce((It,vr,$a)=>{let Fd=$a>0&&!n.excludedBoundaryEdges.has($a-1),Gn=$a<n.boundaryPoints.length-1&&!n.excludedBoundaryEdges.has($a);return It+(Fd||Gn?1:0)},0):0,pe=te>0?Math.ceil(te/y.panelWidthM)+1:0,ke=Math.max(0,pe-K),Fe=n.mountingType?qa.mounting[n.mountingType]:qa.mounting.concrete,xt=n.gateType&&n.gateType!=="none"?2:0,ua=ke+K+xt,ul=n.mountingType==="postcrete"?ua*qa.mounting.postcrete.bagsPerPost:0,pa=n.gravelBoard==="yes"?q:0;return{range:y,height:j,totalEdgeM:B,fencedLengthM:te,gateWidthM:ae,panelsCount:q,cornerPostCount:K,intermediatePostCount:ke,gatePostCount:xt,totalPostCount:ua,bagsCount:ul,gravelCount:pa,capCount:ua,mounting:Fe}})(),ce=n.gateType&&n.gateType!=="none"?qa.gate[n.gateType].label:null,fe=Number(me.height)<=1.2?"6":"8",Ee=me?[{key:`panels-${n.range??"boundary"}-${me.height}`,label:`${me.range.label} panels (${me.height}m)`,qty:me.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...n.mountingType==="concrete"?[{key:`concrete-intermediate-${fe}`,label:"Intermediate concrete posts",qty:me.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${fe}`,label:"End and corner concrete posts",qty:me.cornerPostCount+me.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${fe}`,label:"Timber fence posts",qty:me.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:me.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...ce?[{key:"gate",label:ce,qty:1,unit:"each",query:"lap gate",category:"fencing"}]:[],...me.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:me.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],ut=()=>{if(u==="range"){let y=n.boundaryMode==="quick"?(Number.parseFloat(n.quickLengthM)||0)>0:n.boundaryClosed&&n.boundaryPoints.length>=2;return!!n.range&&y}return u==="height"?!!n.height&&!!n.gravelBoard:u==="gate"?!!n.gateType&&(n.gateType==="none"||n.gateWidthM.trim()!==""):u==="posts"?!!n.mountingType:!0},Se=r===Si.length-1?a:"Next",Z=y=>{o(j=>{let B=y(new Set(j.grid)),ae=new Set([...j.excludedEdges].filter(te=>be(B).some(q=>q.key===te)));return{...j,grid:B,excludedEdges:ae}})},de=(y,j,B)=>{Z(ae=>{let te=`${y},${j}`;return B?ae.add(te):ae.delete(te),ae})},Je=(y,j,B,ae,te)=>{let q=y,Y=j,K=Math.abs(B-y),pe=y<B?1:-1,ke=-Math.abs(ae-j),Fe=j<ae?1:-1,xt=K+ke;for(;de(q,Y,te),!(q===B&&Y===ae);){let ua=2*xt;ua>=ke&&(xt+=ke,q+=pe),ua<=K&&(xt+=K,Y+=Fe)}},Ye=(y,j)=>{let B=c.current?.getBoundingClientRect();if(!B)return null;let ae=Math.floor((y-B.left)/_w),te=Math.floor((j-B.top)/_w);return ae<0||te<0||ae>=yw||te>=yw?null:{x:ae,y:te}},pt=y=>{if(n.gridMode!=="draw")return;let j=Ye(y.clientX,y.clientY);if(!j)return;y.preventDefault();let B=`${j.x},${j.y}`,ae=!n.grid.has(B);l.current={active:!0,paintValue:ae,lastX:j.x,lastY:j.y},y.currentTarget.setPointerCapture(y.pointerId),de(j.x,j.y,ae)},ot=y=>{let j=l.current;if(!j?.active)return;let B=Ye(y.clientX,y.clientY);B&&(B.x===j.lastX&&B.y===j.lastY||(Je(j.lastX,j.lastY,B.x,B.y,j.paintValue),l.current={...j,lastX:B.x,lastY:B.y}))},at=y=>{l.current?.active&&(l.current=null,y.currentTarget.releasePointerCapture(y.pointerId))},ge=(y,j,B=!1)=>{let ae=m.current?.getBoundingClientRect();if(!ae)return null;let te=B?1:.25;return{x:Math.round(Math.max(z,Math.min(z+v,z+(y-ae.left)/ae.width*v))/te)*te,y:Math.round(Math.max(G,Math.min(G+N,G+(j-ae.top)/ae.height*N))/te)*te}},W=y=>{if(n.boundaryClosed){let B=y.target;if(B!==y.currentTarget&&!B.classList.contains("fence-boundary__grid"))return;D.current={startX:y.clientX,startY:y.clientY,startViewX:z,startViewY:G},y.currentTarget.setPointerCapture(y.pointerId);return}let j=ge(y.clientX,y.clientY,!0);j&&(w(null),o(B=>{let ae=[...B.boundaryPoints,j];return uc(ae,!1)?{...B}:{...B,boundaryPoints:ae}}))},k=(y,j)=>{if(y.stopPropagation(),!n.boundaryClosed){if(j!==0||n.boundaryPoints.length<3)return;o(B=>uc(B.boundaryPoints,!0)?B:{...B,boundaryPoints:[...B.boundaryPoints,B.boundaryPoints[0]],boundaryClosed:!0});return}M.current=j,y.currentTarget.setPointerCapture(y.pointerId)},R=y=>{if(D.current){let B=m.current?.getBoundingClientRect();if(!B)return;let ae=D.current,te=ae.startViewX-(y.clientX-ae.startX)/B.width*v,q=ae.startViewY-(y.clientY-ae.startY)/B.height*N;f({x:te-A,y:q-T});return}if(n.boundaryClosed||w(ge(y.clientX,y.clientY,!0)),M.current===null)return;let j=ge(y.clientX,y.clientY);j&&o(B=>{let ae=B.boundaryPoints.length>2&&B.boundaryPoints[0].x===B.boundaryPoints[B.boundaryPoints.length-1].x&&B.boundaryPoints[0].y===B.boundaryPoints[B.boundaryPoints.length-1].y,te=B.boundaryPoints.map((q,Y)=>{let K=Y===M.current,pe=ae&&M.current===0&&Y===B.boundaryPoints.length-1;return K||pe?j:q});return uc(te,!1)?B:{...B,boundaryPoints:te}})},E=y=>{D.current=null,M.current=null,y.currentTarget.hasPointerCapture(y.pointerId)&&y.currentTarget.releasePointerCapture(y.pointerId)},O=y=>{o(j=>{let B=new Set(j.excludedBoundaryEdges);return B.has(y)?B.delete(y):B.add(y),{...j,excludedBoundaryEdges:B}})},ee=()=>{r===0?e():i(y=>y-1)},xe=()=>{ut()&&(r===Si.length-1?t?.(Ee):i(y=>y+1))},we=be(n.grid);return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)("div",{className:"truss-estimator",children:[(0,Q.jsxs)("div",{className:"quick-order-hero",children:[(0,Q.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Q.jsx)("h1",{children:"Fencing Calculator"}),(0,Q.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,Q.jsxs)("div",{className:"truss-estimator__card",children:[(0,Q.jsxs)("div",{className:"truss-estimator__body",children:[u==="range"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(qa.ranges).map(([y,j])=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===y?" is-selected":""}`,onClick:()=>o(B=>({...B,range:y})),children:[(0,Q.jsx)("div",{className:"truss-estimator__option-title",children:j.label}),(0,Q.jsx)("div",{className:"truss-estimator__option-copy",children:j.blurb})]},y))})]}):null,u==="range"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Use a quick total, or draw the boundary to mark existing edges that do not need new fencing."}),(0,Q.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,Q.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(y=>({...y,boundaryMode:"quick"})),children:"Quick estimate"}),(0,Q.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(y=>({...y,boundaryMode:"draw"})),children:"Draw your boundary"})]}),n.boundaryMode==="quick"?(0,Q.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,Q.jsx)("span",{children:"Total fence length (m)"}),(0,Q.jsx)("input",{type:"number",min:"0",step:"0.1",value:n.quickLengthM,onChange:y=>o(j=>({...j,quickLengthM:y.target.value}))})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("div",{className:"fence-boundary__toolbar",children:(0,Q.jsxs)("div",{className:"fence-boundary__actions",children:[(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,boundaryPoints:y.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:n.boundaryPoints.length===0||n.boundaryClosed,children:"Undo"}),(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f({x:0,y:0}),w(null),o(y=>({...y,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:n.boundaryPoints.length===0,children:"Clear"}),(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,boundaryPoints:[{x:2,y:2},{x:8,y:2},{x:8,y:5},{x:2,y:5},{x:2,y:2}],boundaryClosed:!0,excludedBoundaryEdges:new Set})),children:"Start with rectangle"})]})}),(0,Q.jsxs)("div",{className:"fence-boundary",children:[(0,Q.jsxs)("svg",{ref:m,className:`fence-boundary__canvas${n.boundaryClosed?" is-pan-mode":""}`,viewBox:`${z} ${G} ${v} ${N}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:W,onPointerMove:R,onPointerUp:E,onPointerLeave:()=>{w(null),D.current||(M.current=null)},children:[(0,Q.jsx)("defs",{children:(0,Q.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,Q.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,Q.jsx)("rect",{x:-Bn,y:-Ln,width:Bn*3,height:Ln*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),n.boundaryPoints.length>1?(0,Q.jsx)("polyline",{className:"fence-boundary__preview",points:n.boundaryPoints.map(y=>`${y.x},${y.y}`).join(" ")}):null,n.boundaryPoints.length>1?n.boundaryPoints.slice(0,-1).map((y,j)=>{let B=n.boundaryPoints[j+1],ae=Math.hypot(B.x-y.x,B.y-y.y),te=ae?-(B.y-y.y)/ae:0,q=ae?(B.x-y.x)/ae:0,Y=(y.x+B.x)/2,K=(y.y+B.y)/2,pe=te*(Y-P.x)+q*(K-P.y)>=0?1:-1,ke=Y+te*xw*pe,Fe=K+q*xw*pe;return(0,Q.jsxs)("g",{children:[(0,Q.jsx)("line",{className:"fence-boundary__edge-hit",x1:y.x,y1:y.y,x2:B.x,y2:B.y,onClick:n.boundaryClosed?()=>O(j):void 0}),(0,Q.jsx)("line",{className:`fence-boundary__edge${n.excludedBoundaryEdges.has(j)?" is-excluded":""}`,x1:y.x,y1:y.y,x2:B.x,y2:B.y,pointerEvents:"none"}),(0,Q.jsxs)("text",{className:`fence-boundary__edge-label${n.excludedBoundaryEdges.has(j)?" is-excluded":""}`,x:ke,y:Fe,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[ae.toFixed(2)," m"]})]},`fence-edge-${j}`)}):null,!n.boundaryClosed&&n.boundaryPoints.length>0&&h?(()=>{let y=n.boundaryPoints[n.boundaryPoints.length-1],j=Math.hypot(h.x-y.x,h.y-y.y);if(!j)return null;let B=-(h.y-y.y)/j,ae=(h.x-y.x)/j,te=(y.x+h.x)/2,q=(y.y+h.y)/2;return(0,Q.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,Q.jsx)("line",{x1:y.x,y1:y.y,x2:h.x,y2:h.y}),(0,Q.jsxs)("text",{x:te+B*.34,y:q+ae*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[j.toFixed(2)," m"]})]})})():null,n.boundaryPoints.map((y,j)=>j>0&&j===n.boundaryPoints.length-1&&y.x===n.boundaryPoints[0]?.x&&y.y===n.boundaryPoints[0]?.y?null:(0,Q.jsx)("circle",{className:`fence-boundary__point${!n.boundaryClosed&&j===0&&n.boundaryPoints.length>=3?" is-close-target":""}`,cx:y.x,cy:y.y,r:"0.13",onPointerDown:B=>k(B,j)},`fence-point-${j}`))]}),(0,Q.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,Q.jsx)("button",{type:"button",onClick:()=>d(y=>Math.max(.5,y-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,Q.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,Q.jsx)("button",{type:"button",onClick:()=>d(y=>Math.min(1,y+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!n.boundaryClosed&&n.boundaryPoints.length>=2?(0,Q.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(y=>uc(y.boundaryPoints,!1)?y:{...y,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,Q.jsx)("div",{className:"truss-estimator__grid-hint",children:n.boundaryClosed?"Drag the blank canvas to pan. Tap an edge to exclude it from the new fence.":"Click to add points, then finish the fence line. The displayed distances update as you draw."})]}),(0,Q.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,Q.jsx)("div",{children:n.boundaryMode==="quick"?`${(Number.parseFloat(n.quickLengthM)||0).toFixed(2)} m fence line`:`${me.totalEdgeM.toFixed(2)} m fence line`}),n.boundaryMode==="draw"&&n.boundaryClosed?(0,Q.jsxs)("div",{children:[me.cornerPostCount," corner/end posts"]}):null]})]}):null,null,u==="height"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:qa.heights.map(y=>(0,Q.jsx)("button",{type:"button",className:`truss-estimator__visual-card${n.height===y?" is-selected":""}`,onClick:()=>o(j=>({...j,height:y})),children:(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:Jt(`/fencing/height/${y}.webp`),alt:""})},y))}),(0,Q.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No gravel board",img:"/fencing/no-gravel-board.webp"},{id:"yes",label:"Add gravel board",img:"/fencing/gravel-board.webp"}].map(y=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.gravelBoard===y.id?" is-selected":""}`,onClick:()=>o(j=>({...j,gravelBoard:y.id})),children:[(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Jt(y.img),alt:""}),(0,Q.jsx)("span",{children:y.label})]},y.id))})]}):null,u==="gate"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"A gate opening replaces part of the panel run and adds a gate kit with heavy-duty posts."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"none",label:"No gate",img:"/fencing/gates/no-gate.webp"},{id:"single",label:"Single gate",img:"/fencing/gates/single-gate.webp"}].map(y=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${n.gateType===y.id?" is-selected":""}`,onClick:()=>o(j=>({...j,gateType:y.id,gateWidthM:y.id==="none"?"":String(qa.gate[y.id].widthDefault)})),children:[(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Jt(y.img),alt:""}),(0,Q.jsx)("span",{children:y.label})]},y.id))}),n.gateType&&n.gateType!=="none"?(0,Q.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,Q.jsx)("span",{children:"Gate width (m)"}),(0,Q.jsx)("input",{type:"text",inputMode:"decimal",value:n.gateWidthM,onChange:y=>o(j=>({...j,gateWidthM:y.target.value}))})]}):null]}):null,u==="posts"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(qa.mounting).map(([y,j])=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.mountingType===y?" is-selected":""}`,onClick:()=>o(B=>({...B,mountingType:y})),children:[(0,Q.jsx)("div",{className:"truss-estimator__option-title",children:j.label}),(0,Q.jsx)("div",{className:"truss-estimator__option-copy",children:j.blurb})]},y))})]}):null]}),(0,Q.jsxs)("div",{className:"truss-estimator__nav",children:[(0,Q.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:ee,children:"Back"}),(0,Q.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:xe,disabled:!ut(),children:[(0,Q.jsx)("span",{children:Se}),(0,Q.jsx)("span",{className:"arrow",children:(0,Q.jsx)(jt,{})})]})]})]})]})})}var pc=X(Xe()),_e=X(ie()),kw={floor:{label:"Floor",product:"Knauf Acoustic Roll",thickness:"100mm",coverage:12.36,salesUnit:"roll"},wall:{label:"Cavity wall",product:"Celotex CW4100",thickness:"100mm",coverage:3.24,salesUnit:"pack"},roof:{label:"Pitched roof",product:"Kingspan K107",thickness:"100mm",coverage:8.64,salesUnit:"pack"},loft:{label:"Loft",product:"Knauf Loft Roll 44",thickness:"100mm",coverage:13.89,salesUnit:"roll"}};function Dd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,pc.useState)("floor"),[n,o]=(0,pc.useState)(""),[l,c]=(0,pc.useState)(""),p=Number.parseFloat(n)*Number.parseFloat(l)||0,d=kw[r],g=Math.ceil(p/d.coverage),f=[{key:`insulation-${r}`,label:`${d.product} ${d.thickness}`,qty:g,unit:d.salesUnit,query:d.product,category:"insulation"}],h=Object.entries(kw);return(0,_e.jsx)(_e.Fragment,{children:(0,_e.jsxs)("div",{className:"truss-estimator",children:[(0,_e.jsxs)("div",{className:"quick-order-hero",children:[(0,_e.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_e.jsx)("h1",{children:"Insulation Calculator"}),(0,_e.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,_e.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,_e.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,_e.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,_e.jsxs)("div",{className:"materials-calculator__section",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,_e.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:h.map(([w,M])=>(0,_e.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===w?" is-selected":""}`,onClick:()=>i(w),children:[(0,_e.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,_e.jsxs)("div",{className:"truss-estimator__option-copy",children:[M.product,", ",M.thickness]})]},w))})]}),(0,_e.jsxs)("div",{className:"materials-calculator__section",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,_e.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,_e.jsxs)("label",{className:"truss-estimator__field",children:[(0,_e.jsx)("span",{children:"Length (m)"}),(0,_e.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:w=>o(w.target.value)})]}),(0,_e.jsxs)("label",{className:"truss-estimator__field",children:[(0,_e.jsx)("span",{children:"Width (m)"}),(0,_e.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:w=>c(w.target.value)})]})]})]}),(0,_e.jsxs)("div",{className:"materials-calculator__totals",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,_e.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,_e.jsxs)("div",{children:[(0,_e.jsx)("span",{children:"Insulated area"}),(0,_e.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,_e.jsxs)("div",{children:[(0,_e.jsx)("span",{children:d.product}),(0,_e.jsxs)("strong",{children:[g," packs"]})]})]}),(0,_e.jsx)("p",{className:"materials-calculator__note",children:"This is a simple product choice, not thermal or Building Regulations advice. Confirm the specification before ordering."})]}),(0,_e.jsxs)("div",{className:"materials-calculator__actions",children:[(0,_e.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,_e.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(f),disabled:p<=0,children:a})]})]})]})})}var Hn=X(Xe()),$=X(ie()),G_=10,Y_=1.9*.762,X_=1.9*1.524,dc=()=>({height:"",width:""}),mc=e=>Number.parseFloat(e)||0,Nw=({height:e,width:t})=>mc(e)*mc(t);function Od({onBack:e}){let[t,a]=(0,Hn.useState)([dc()]),[r,i]=(0,Hn.useState)([dc()]),[n,o]=(0,Hn.useState)("0"),[l,c]=(0,Hn.useState)("0"),[p,d]=(0,Hn.useState)(1),g=t.reduce((m,u)=>m+Nw(u),0),f=r.reduce((m,u)=>m+Nw(u),0),h=mc(n)*Y_+mc(l)*X_,w=Math.max(0,g-f-h),M=w*p/G_,D=(m,u,b,v)=>{m(N=>N.map((A,T)=>T===u?{...A,[b]:v}:A))};return(0,$.jsx)($.Fragment,{children:(0,$.jsxs)("div",{className:"truss-estimator",children:[(0,$.jsxs)("div",{className:"quick-order-hero",children:[(0,$.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,$.jsx)("h1",{children:"Paint Calculator"}),(0,$.jsx)("p",{children:"Estimate how much paint you need for your walls, including multiple coats and excluded areas."})]}),(0,$.jsxs)("div",{className:"truss-estimator__card paint-calculator",children:[(0,$.jsx)("h2",{className:"truss-estimator__step-title",children:"Walls, exclusions and coats"}),(0,$.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter each wall, subtract windows and doors, and choose your number of coats. Quantities assume a coverage of 10 m\xB2 per litre."}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Enter the height and width of each wall you want to paint."}),(0,$.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,$.jsx)("span",{}),(0,$.jsx)("span",{children:"Height (m)"}),(0,$.jsx)("span",{children:"Width (m)"}),(0,$.jsx)("span",{})]}),t.map((m,u)=>(0,$.jsxs)("div",{className:"paint-calculator__row",children:[(0,$.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",u+1]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,$.jsx)("input",{"aria-label":`Wall ${u+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>D(a,u,"height",b.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,$.jsx)("input",{"aria-label":`Wall ${u+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>D(a,u,"width",b.target.value)})]}),t.length>1?(0,$.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>a(b=>b.filter((v,N)=>N!==u)),children:"Remove"}):null]},`wall-${u}`)),(0,$.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>a(m=>[...m,dc()]),children:"+ Add another wall"})]}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Areas to exclude"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Add windows, sockets, skirting boards or other areas that will not be painted."}),(0,$.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,$.jsx)("span",{}),(0,$.jsx)("span",{children:"Height (m)"}),(0,$.jsx)("span",{children:"Width (m)"}),(0,$.jsx)("span",{})]}),r.map((m,u)=>(0,$.jsxs)("div",{className:"paint-calculator__row",children:[(0,$.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",u+1]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,$.jsx)("input",{"aria-label":`Area ${u+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>D(i,u,"height",b.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,$.jsx)("input",{"aria-label":`Area ${u+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>D(i,u,"width",b.target.value)})]}),r.length>1?(0,$.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(b=>b.filter((v,N)=>N!==u)),children:"Remove"}):null]},`excluded-${u}`)),(0,$.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(m=>[...m,dc()]),children:"+ Add another area"})]}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Doors and coats"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Enter the number of standard single and double doors to leave unpainted. Door sizes are estimated automatically."}),(0,$.jsxs)("div",{className:"truss-estimator__field-grid paint-calculator__small-fields",children:[(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Doors"}),(0,$.jsx)("input",{type:"number",min:"0",step:"1",value:n,onChange:m=>o(m.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Double doors"}),(0,$.jsx)("input",{type:"number",min:"0",step:"1",value:l,onChange:m=>c(m.target.value)})]})]}),(0,$.jsxs)("div",{className:"paint-calculator__coat-field",children:[(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Most walls need 2 coats for an even finish. Use 3 coats when changing colour significantly or covering a darker wall."}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Number of coats"}),(0,$.jsxs)("select",{value:p,onChange:m=>d(Number(m.target.value)),children:[(0,$.jsx)("option",{value:"1",children:"1 coat"}),(0,$.jsx)("option",{value:"2",children:"2 coats"}),(0,$.jsx)("option",{value:"3",children:"3 coats"})]})]})]})]}),(0,$.jsxs)("div",{className:"paint-calculator__totals",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,$.jsxs)("div",{className:"paint-calculator__result-grid",children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Paintable area"}),(0,$.jsxs)("strong",{children:[w.toFixed(2)," m\xB2"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Coverage"}),(0,$.jsxs)("strong",{children:[p," ",p===1?"coat":"coats"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Paint required"}),(0,$.jsxs)("strong",{children:[M.toFixed(1)," litres"]})]})]}),(0,$.jsx)("p",{className:"paint-calculator__note",children:"Based on paint coverage of 10 m\xB2 per litre. Decorative paint is not currently stocked in this catalogue, so this remains an estimate only."})]}),(0,$.jsxs)("div",{className:"paint-calculator__actions",children:[(0,$.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,$.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var br=X(Xe()),ne=X(ie()),fc=e=>Number.parseFloat(e)||0,Bd={paving:[{id:"council",label:"Council paving slab (600 \xD7 600mm)"},{id:"raj",label:"Raj blend sandstone (600 \xD7 600mm)"}],block:[{id:"brindle",label:"Brindle block paving (60mm)"},{id:"charcoal",label:"Charcoal block paving (60mm)"}],gravel:[{id:"pea",label:"20mm pea shingle"}]};function Ld({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,br.useState)("paving"),[n,o]=(0,br.useState)("council"),[l,c]=(0,br.useState)(""),[p,d]=(0,br.useState)(""),[g,f]=(0,br.useState)("100"),[h,w]=(0,br.useState)("50"),[M,D]=(0,br.useState)(!0),[m,u]=(0,br.useState)(!0),b=fc(l)*fc(p),v=b,N=b*(fc(g)/1e3),A=b*.04,T=b*(fc(h)/1e3),z=Math.ceil(v/.36),G=Math.ceil(v/.1),P=Math.ceil(N*1700/800),be=Math.ceil(A*1600/800),De=Math.ceil(T*1600/800),Le=r==="paving"?{qty:z,unit:"each"}:r==="block"?{qty:v,unit:"m2"}:{qty:De,unit:"bag"},He={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],ze=[{key:`surface-${n}`,label:Bd[r].find(ce=>ce.id===n)?.label??"Surface material",qty:Le.qty,unit:Le.unit,query:He,category:"landscaping"},...M?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:P,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...m?[{key:"bedding",label:"Sharp sand bedding",qty:be,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];return(0,ne.jsx)(ne.Fragment,{children:(0,ne.jsxs)("div",{className:"truss-estimator",children:[(0,ne.jsxs)("div",{className:"quick-order-hero",children:[(0,ne.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ne.jsx)("h1",{children:"Paving & Driveway Calculator"}),(0,ne.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,ne.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ne.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,ne.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the surface material and enter the area. Sub-base and bedding sand are estimated alongside the surface units."}),(0,ne.jsxs)("div",{className:"materials-calculator__section",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,ne.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:[["paving","Paving slabs","For patios and paths"],["block","Block paving","For driveways and paths"],["gravel","Decorative gravel","For paths and landscaping"]].map(([ce,fe,Ee])=>(0,ne.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===ce?" is-selected":""}`,onClick:()=>{i(ce),o(Bd[ce][0].id)},children:[(0,ne.jsx)("div",{className:"truss-estimator__option-title",children:fe}),(0,ne.jsx)("div",{className:"truss-estimator__option-copy",children:Ee})]},ce))}),(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Finish"}),(0,ne.jsx)("select",{value:n,onChange:ce=>o(ce.target.value),children:Bd[r].map(ce=>(0,ne.jsx)("option",{value:ce.id,children:ce.label},ce.id))})]})]}),(0,ne.jsxs)("div",{className:"materials-calculator__section",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,ne.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ne.jsxs)("label",{className:"truss-estimator__field",children:[(0,ne.jsx)("span",{children:"Length (m)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:ce=>c(ce.target.value)})]}),(0,ne.jsxs)("label",{className:"truss-estimator__field",children:[(0,ne.jsx)("span",{children:"Width (m)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:ce=>d(ce.target.value)})]})]}),r==="gravel"&&(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Gravel depth (mm)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"10",value:h,onChange:ce=>w(ce.target.value)})]}),M&&(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Sub-base depth (mm)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"10",value:g,onChange:ce=>f(ce.target.value)})]}),(0,ne.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ne.jsx)("input",{type:"checkbox",checked:M,onChange:ce=>D(ce.target.checked)}),(0,ne.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,ne.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ne.jsx)("input",{type:"checkbox",checked:m,onChange:ce=>u(ce.target.checked)}),(0,ne.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,ne.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ne.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"Surface area"}),(0,ne.jsxs)("strong",{children:[b.toFixed(2)," m\xB2"]})]}),(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,ne.jsx)("strong",{children:r==="paving"?`${z} slabs`:r==="block"?`${v.toFixed(2)} m\xB2`:`${De} bulk bags`})]}),M&&(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"MOT Type 1"}),(0,ne.jsxs)("strong",{children:[P," bulk bags"]})]}),m&&(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"Sharp sand"}),(0,ne.jsxs)("strong",{children:[be," bulk bags"]})]})]}),(0,ne.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,ne.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ne.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ne.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(ze),disabled:b<=0,children:a})]})]})]})})}var ll=X(Xe()),oe=X(ie()),V_=2.88,Sw=[{id:"standard",label:"Standard wallboard",blurb:"General internal walls and ceilings"},{id:"moisture",label:"Moisture resistant",blurb:"Kitchens, bathrooms and utility rooms"},{id:"fire",label:"Fire resistant",blurb:"Where fire-rated lining is required"},{id:"sound",label:"Sound resistant",blurb:"Improved acoustic performance"}],Cw=()=>({length:"",height:""}),Hd=e=>Number.parseFloat(e)||0;function jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ll.useState)([Cw()]),[n,o]=(0,ll.useState)(""),[l,c]=(0,ll.useState)("standard"),[p,d]=(0,ll.useState)("screws"),g=r.reduce((A,T)=>A+Hd(T.length)*Hd(T.height),0),f=Math.max(0,g-Hd(n)),h=Math.ceil(f/V_),w=Math.ceil(f*12),M=Math.ceil(w/1e3),D=Math.ceil(f*1.2),m=Math.ceil(D/90),u=Math.ceil(f/3.5),b=Sw.find(A=>A.id===l)?.label??"Standard",v=[{key:"board",label:`${b} plasterboard`,qty:h,unit:"sheet",query:`${b} plasterboard`,category:"plasterboard"},...p==="screws"?[{key:"screws",label:"Drywall screws",qty:M,unit:"box",query:"drywall screws",category:"fixings"}]:[{key:"adhesive",label:"Board adhesive",qty:u,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:m,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],N=(A,T,z)=>{i(G=>G.map((P,be)=>be===A?{...P,[T]:z}:P))};return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)("div",{className:"truss-estimator",children:[(0,oe.jsxs)("div",{className:"quick-order-hero",children:[(0,oe.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,oe.jsx)("h1",{children:"Plasterboard & Drylining Calculator"}),(0,oe.jsx)("p",{children:"Estimate boards, fixings and jointing materials for walls and ceilings."})]}),(0,oe.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,oe.jsx)("h2",{className:"truss-estimator__step-title",children:"Boards, fixings and jointing"}),(0,oe.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the surfaces you are lining and the board specification. Screws, tape and adhesive are estimated with the boards."}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Board type"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Sw.map(A=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===A.id?" is-selected":""}`,onClick:()=>c(A.id),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:A.label}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:A.blurb})]},A.id))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Fixing method"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["screws","Drywall screws","For timber or metal framing"],["adhesive","Board adhesive","For masonry dot-and-dab"]].map(([A,T,z])=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===A?" is-selected":""}`,onClick:()=>d(A),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:z})]},A))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall and ceiling areas"}),(0,oe.jsx)("p",{className:"materials-calculator__hint",children:"Add each surface separately so different wall sizes are easy to measure."}),(0,oe.jsxs)("div",{className:"materials-calculator__dimensions-header",children:[(0,oe.jsx)("span",{children:"Surface"}),(0,oe.jsx)("span",{children:"Length (m)"}),(0,oe.jsx)("span",{children:"Height (m)"}),(0,oe.jsx)("span",{})]}),r.map((A,T)=>(0,oe.jsxs)("div",{className:"materials-calculator__surface-row",children:[(0,oe.jsxs)("span",{children:["Surface ",T+1]}),(0,oe.jsx)("input",{"aria-label":`Surface ${T+1} length`,type:"number",min:"0",step:"0.01",value:A.length,onChange:z=>N(T,"length",z.target.value)}),(0,oe.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:A.height,onChange:z=>N(T,"height",z.target.value)}),r.length>1?(0,oe.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(z=>z.filter((G,P)=>P!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,oe.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(A=>[...A,Cw()]),children:"+ Add another surface"}),(0,oe.jsxs)("label",{className:"truss-estimator__field materials-calculator__openings",children:[(0,oe.jsxs)("span",{children:["Openings to deduct (m\xB2) ",(0,oe.jsx)("small",{children:"optional"})]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:A=>o(A.target.value)})]})]}),(0,oe.jsxs)("div",{className:"materials-calculator__totals",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,oe.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Board area"}),(0,oe.jsxs)("strong",{children:[f.toFixed(2)," m\xB2"]})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"2.4 x 1.2 m boards"}),(0,oe.jsx)("strong",{children:h})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:p==="screws"?"Drywall screws":"Board adhesive"}),(0,oe.jsx)("strong",{children:p==="screws"?`${w} (${M} boxes)`:`${u} bags`})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Joint tape"}),(0,oe.jsxs)("strong",{children:[D," m (",m," rolls)"]})]})]}),(0,oe.jsx)("p",{className:"materials-calculator__note",children:"Figures are estimates. Confirm board specification, fixing patterns and fire or acoustic requirements before ordering."})]}),(0,oe.jsxs)("div",{className:"materials-calculator__actions",children:[(0,oe.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,oe.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(v),disabled:f<=0,children:a})]})]})]})})}var sl=X(Xe());var _=X(ie()),Rt={ranges:{standard:{label:"Standard Fink",blurb:"Classic W-shaped truss for standard pitched roofs."},attic:{label:"Attic",blurb:"Room-in-roof truss with usable attic space and clear span."},mono:{label:"Mono-pitch",blurb:"Single-slope truss for lean-to roofs and outbuildings."}},pitches:["15","20","22.5","25","30","35","40","45","50","55"],pitchMultipliers:{15:.95,20:.98,"22.5":1,25:1.02,30:1.05,35:1.1,40:1.18,45:1.27,50:1.38,55:1.52},overhang:{thresholdMM:300,surchargePerTruss:3.5},centresOptions:["400","600"],treatment:{treated:{label:"Treated (tanalised)",surchargePct:.08},untreated:{label:"Untreated",surchargePct:0}},estimate:{design:250,delivery:250,bracingPerMetre:6.5,girderMultiplier:1.8,ranges:{standard:{supplyAt8m:53.33,installPerTruss:30},attic:{supplyAt8m:128.35,installPerTruss:55},mono:{supplyAt8m:60,installPerTruss:38}}}},gc=["range","pitchAndDimensions","quantityAndGirders","bracing"],$_={range:null,pitch:null,spanMM:"",overhangMM:"",roofLengthM:"",centres:null,girderCount:0,bracing:null,treatment:null,contact:{name:"",email:""}};function Z_({degrees:e}){let a=e*Math.PI/180,i=82-Math.min(58,38*Math.tan(a));return(0,_.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,_.jsx)("line",{x1:"6",y1:"82",x2:"94",y2:"82",stroke:"var(--border)",strokeWidth:"2"}),(0,_.jsx)("polygon",{points:`12,82 88,82 50,${i}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function K_({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",i="#d3d8de",n="#7c8494",o=(d,g,f,h,w=8,M)=>{let D=f-d,m=h-g,u=Math.hypot(D,m)||1,b=-m/u,v=D/u,N=w*.2;return(0,_.jsxs)("g",{children:[(0,_.jsx)("line",{x1:d,y1:g,x2:f,y2:h,stroke:a,strokeWidth:w+3,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:d,y1:g,x2:f,y2:h,stroke:t,strokeWidth:w,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:d-b*N,y1:g-v*N,x2:f-b*N,y2:h-v*N,stroke:r,strokeWidth:Math.max(1.5,w*.24),strokeLinecap:"round",opacity:"0.9"})]},M)},l=(d,g,f)=>(0,_.jsxs)("g",{children:[(0,_.jsx)("rect",{x:d-7.5,y:g-5.5,width:"15",height:"11",rx:"2",fill:i,stroke:n,strokeWidth:"1"}),(0,_.jsx)("circle",{cx:d-4,cy:g-2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d+4,cy:g-2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d-4,cy:g+2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d+4,cy:g+2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d,cy:g,r:"1",fill:n})]},f),c=(d,g)=>(0,_.jsx)("rect",{x:d-9,y:"110",width:"18",height:"10",fill:a},g),p=(0,_.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"});return e==="attic"?(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,26,8,"b1"),o(174,112,100,26,8,"b2"),o(26,112,174,112,8,"b3"),o(58,112,58,70,6,"b4"),o(142,112,142,70,6,"b5"),o(58,70,142,70,7,"b6"),(0,_.jsx)("rect",{x:"90",y:"82",width:"20",height:"24",fill:"#cfe3f2",stroke:a,strokeWidth:"2"}),(0,_.jsx)("line",{x1:"100",y1:"82",x2:"100",y2:"106",stroke:a,strokeWidth:"1.5"}),l(26,112,"p1"),l(174,112,"p2"),l(100,26,"p3"),l(58,112,"p4"),l(58,70,"p5"),l(142,112,"p6"),l(142,70,"p7")]}):e==="mono"?(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,174,26,8,"b1"),o(174,26,174,112,8,"b2"),o(26,112,174,112,8,"b3"),o(90,112,90,75,5,"b4"),o(90,75,132,112,5,"b5"),l(26,112,"p1"),l(174,26,"p2"),l(174,112,"p3"),l(90,112,"p4"),l(90,75,"p5"),l(132,112,"p6")]}):(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,34,8,"b1"),o(174,112,100,34,8,"b2"),o(26,112,174,112,8,"b3"),o(63,112,100,34,5,"b4"),o(137,112,100,34,5,"b5"),o(63,112,54,83,5,"b6"),o(137,112,146,83,5,"b7"),(0,_.jsx)("rect",{x:"96",y:"108",width:"8",height:"8",fill:a}),l(26,112,"p1"),l(174,112,"p2"),l(100,34,"p3"),l(63,112,"p4"),l(137,112,"p5"),l(54,83,"p6"),l(146,83,"p7")]})}function P_({enabled:e}){return(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[(0,_.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"}),(0,_.jsx)("rect",{x:"17",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,_.jsx)("rect",{x:"165",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),e?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("line",{x1:"45",y1:"112",x2:"140",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"}),(0,_.jsx)("line",{x1:"155",y1:"112",x2:"60",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"})]}):null,(0,_.jsx)("rect",{x:"18.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,_.jsx)("rect",{x:"166.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,_.jsx)("rect",{x:"92.5",y:"28.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"})]})}function qw({treated:e}){let t=e?"#5a7a4a":"var(--accent)";return(0,_.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,_.jsx)("rect",{x:"10",y:"22",width:"80",height:"14",rx:"2",fill:t}),(0,_.jsx)("rect",{x:"10",y:"43",width:"80",height:"14",rx:"2",fill:e?"#8faf7a":"var(--accent-light)"}),(0,_.jsx)("rect",{x:"10",y:"64",width:"80",height:"14",rx:"2",fill:t})]})}function Qd({onBack:e}){let[t,a]=(0,sl.useState)(0),[r,i]=(0,sl.useState)($_),[n,o]=(0,sl.useState)(!1),[l,c]=(0,sl.useState)(!1),p=()=>{let m=Number.parseFloat(r.roofLengthM)||0,u=Number.parseFloat(r.centres??"");return m<=0||!u?0:Math.ceil(m*1e3/u)+1},g=(()=>{let m=r.range?Rt.ranges[r.range]:Rt.ranges.standard,u=r.pitch??"22.5",b=Rt.pitchMultipliers[u],v=(Number.parseFloat(r.spanMM)||0)/1e3,A=(Number.parseFloat(r.overhangMM)||0)>Rt.overhang.thresholdMM,T=p(),z=T+r.girderCount,G=Number.parseFloat(r.roofLengthM)||0,P=r.treatment?Rt.treatment[r.treatment]:Rt.treatment.untreated,be=Rt.estimate.ranges[r.range??"standard"],De=be.supplyAt8m*Math.max(.7,v/8)*b*(1+P.surchargePct)+(A?Rt.overhang.surchargePerTruss:0),Le=T*De,He=r.girderCount*De*Rt.estimate.girderMultiplier,ze=r.bracing==="yes"?G*Rt.estimate.bracingPerMetre:0,me=Le+He+ze+Rt.estimate.delivery,ce=Rt.estimate.design+T*be.installPerTruss+r.girderCount*40,fe=me+ce,Ee=fe*.2;return{range:m,count:T,girderCount:r.girderCount,overhangApplies:A,overhangUnits:z,roofLengthM:G,treatment:P,trussSupply:Le,bracingMaterials:ze,delivery:Rt.estimate.delivery,labour:ce,subtotal:fe,vat:Ee,total:fe+Ee}})(),f=()=>{let m=gc[t];return m==="range"?!!r.range:m==="pitchAndDimensions"?!!r.pitch&&r.spanMM.trim()!==""&&r.overhangMM.trim()!=="":m==="quantityAndGirders"?r.roofLengthM.trim()!==""&&!!r.centres:m==="bracing"?!!r.bracing&&!!r.treatment:!0},h=t===gc.length-1?"View truss request":"Next",w=()=>{n?o(!1):t===0?e():a(m=>m-1)},M=()=>{f()&&(t===gc.length-1?(c(!1),o(!0)):a(m=>m+1))},D=()=>{let m=gc[t];return m==="range"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 1 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your truss range"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Pricing shown is placeholder. Swap in your real engineering and pricing catalogue."}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--range",children:Object.entries(Rt.ranges).map(([u,b])=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===u?" is-selected":""}`,onClick:()=>i(v=>({...v,range:u})),children:[(0,_.jsx)(K_,{type:u}),(0,_.jsxs)("div",{className:"truss-estimator__option-info",children:[(0,_.jsx)("div",{className:"truss-estimator__option-title",children:b.label}),(0,_.jsx)("div",{className:"truss-estimator__option-copy",children:b.blurb})]})]},u))})]}):m==="pitchAndDimensions"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 2 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Span, overhang and roof pitch"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Span is wall-to-wall, overhang is the eaves tail beyond the wall line. Steeper pitches use more timber per truss."}),(0,_.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,_.jsxs)("label",{className:"truss-estimator__field",children:[(0,_.jsx)("span",{children:"Span (mm)"}),(0,_.jsx)("input",{type:"text",inputMode:"numeric",value:r.spanMM,onChange:u=>i(b=>({...b,spanMM:u.target.value}))})]}),(0,_.jsxs)("label",{className:"truss-estimator__field",children:[(0,_.jsx)("span",{children:"Overhang (mm)"}),(0,_.jsx)("input",{type:"text",inputMode:"numeric",value:r.overhangMM,onChange:u=>i(b=>({...b,overhangMM:u.target.value}))}),(0,_.jsxs)("small",{children:["Overhangs beyond ",Rt.overhang.thresholdMM,"mm add a small surcharge per truss."]})]})]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Roof pitch"}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Rt.pitches.map(u=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===u?" is-selected":""}`,onClick:()=>i(b=>({...b,pitch:u})),children:[(0,_.jsx)(Z_,{degrees:Number.parseFloat(u)}),(0,_.jsxs)("span",{children:[u,"\xB0"]})]},u))})]}):m==="quantityAndGirders"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 3 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Roof length"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Trusses are based on designs at 400mm or 600mm centres wherever possible."}),(0,_.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,_.jsx)("span",{children:"Roof length (m)"}),(0,_.jsx)("input",{type:"text",inputMode:"decimal",value:r.roofLengthM,onChange:u=>i(b=>({...b,roofLengthM:u.target.value}))})]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Truss centres"}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--centres",children:Rt.centresOptions.map(u=>(0,_.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===u?" is-selected":""}`,onClick:()=>i(b=>({...b,centres:u})),children:(0,_.jsxs)("div",{className:"truss-estimator__option-title",children:[u,"mm centres"]})},u))}),(0,_.jsxs)("div",{className:"truss-estimator__stat",children:[p()," trusses estimated"]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Girder trusses"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Heavy-duty girder trusses carry point loads over large openings. Set 0 if you do not need any."}),(0,_.jsxs)("div",{className:"truss-estimator__stepper",children:[(0,_.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.max(0,u.girderCount-1)})),children:"\u2212"}),(0,_.jsx)("span",{children:r.girderCount}),(0,_.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.min(3,u.girderCount+1)})),children:"+"})]})]}):m==="bracing"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 4 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Bracing pack?"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"A timber bracing pack stabilises the roof structure once trusses are erected."}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No bracing pack"},{id:"yes",label:"Add bracing pack"}].map(u=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===u.id?" is-selected":""}`,onClick:()=>i(b=>({...b,bracing:u.id})),children:[(0,_.jsx)(P_,{enabled:u.id==="yes"}),(0,_.jsx)("span",{children:u.label})]},u.id))}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber treatment"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Tanalised timber protects against rot in exposed or damp locations."}),(0,_.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="untreated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"untreated"})),children:[(0,_.jsx)(qw,{treated:!1}),(0,_.jsx)("span",{children:"Untreated"})]}),(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="treated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"treated"})),children:[(0,_.jsx)(qw,{treated:!0}),(0,_.jsx)("span",{children:"Treated (+8% cost)"}),(0,_.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return n?(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)("div",{className:"truss-estimator",children:[(0,_.jsxs)("div",{className:"quick-order-hero",children:[(0,_.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_.jsx)("h1",{children:"Your truss estimate"}),(0,_.jsx)("p",{children:"A provisional quantity and specification based on the dimensions you entered."})]}),(0,_.jsxs)("div",{className:"truss-estimator__card truss-request",style:{minHeight:0},children:[(0,_.jsxs)("div",{className:"truss-request__heading",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Estimated requirement"}),(0,_.jsxs)("h2",{children:[g.range.label," roof trusses"]})]}),(0,_.jsxs)("strong",{children:[g.count,(0,_.jsx)("span",{children:"trusses"})]})]}),(0,_.jsxs)("div",{className:"truss-request__grid",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Span"}),(0,_.jsxs)("strong",{children:[r.spanMM," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Roof length"}),(0,_.jsxs)("strong",{children:[r.roofLengthM," m"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Pitch"}),(0,_.jsxs)("strong",{children:[r.pitch,"\xB0"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Centres"}),(0,_.jsxs)("strong",{children:[r.centres," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Overhang"}),(0,_.jsxs)("strong",{children:[r.overhangMM," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Treatment"}),(0,_.jsx)("strong",{children:g.treatment.label})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Girder trusses"}),(0,_.jsx)("strong",{children:g.girderCount||"None"})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing pack"}),(0,_.jsx)("strong",{children:r.bracing==="yes"?"Included":"Not included"})]})]}),(0,_.jsxs)("div",{className:"truss-request__price",children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Indicative cost estimate"}),(0,_.jsxs)("div",{className:"truss-request__price-grid",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Truss supply allowance"}),(0,_.jsx)("strong",{children:nt(g.trussSupply)})]}),g.bracingMaterials>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing materials allowance"}),(0,_.jsx)("strong",{children:nt(g.bracingMaterials)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Delivery allowance"}),(0,_.jsx)("strong",{children:nt(g.delivery)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Design and installation labour"}),(0,_.jsx)("strong",{children:nt(g.labour)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,_.jsx)("strong",{children:nt(g.subtotal)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"VAT (20%)"}),(0,_.jsx)("strong",{children:nt(g.vat)})]}),(0,_.jsxs)("div",{className:"truss-request__price-total",children:[(0,_.jsx)("span",{children:"Estimated total"}),(0,_.jsx)("strong",{children:nt(g.total)})]})]}),(0,_.jsx)("p",{children:"Trusses are not listed as fixed products in this catalogue, so supply, delivery and labour are benchmark allowances. Confirm the engineered design and final quote before ordering."})]}),(0,_.jsxs)("div",{className:"truss-request__notice",children:[(0,_.jsx)("strong",{children:"Before ordering"}),(0,_.jsx)("span",{children:"Roof trusses must be designed and signed off for the building. Confirm loading, bearings, wind bracing and final drawings with the truss manufacturer."})]}),(0,_.jsxs)("div",{className:"truss-estimator__nav",children:[(0,_.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:w,children:"Back to calculator"}),(0,_.jsx)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",justifyContent:"center",marginTop:0},onClick:()=>c(!0),children:"Request order"})]}),l&&(0,_.jsx)("p",{className:"truss-request__demo",children:"Demo only \u2014 no order has been sent."})]})]})}):(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)("div",{className:"truss-estimator",children:[(0,_.jsxs)("div",{className:"quick-order-hero",children:[(0,_.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_.jsx)("h1",{children:"Roof Truss Calculator"}),(0,_.jsx)("p",{children:"Estimate trusses, girders and cost for your roof in a few steps."})]}),(0,_.jsxs)("div",{className:"truss-estimator__card",children:[(0,_.jsx)("div",{className:"truss-estimator__body",children:D()}),(0,_.jsxs)("div",{className:"truss-estimator__nav",children:[(0,_.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:w,children:"Back"}),(0,_.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:M,disabled:!f(),children:[(0,_.jsx)("span",{children:h}),(0,_.jsx)("span",{className:"arrow",children:(0,_.jsx)(jt,{})})]})]})]})]})})}var Ci=X(Xe()),I=X(ie()),Tw=e=>Number.parseFloat(e)||0,hc=(e,t)=>Tw(e)*(t==="m"?1:.3048),Ew=()=>({length:"",width:""}),Mw=[{id:"chamfered",label:"Chamfered",blurb:"Clean angled edge"},{id:"ogee",label:"Ogee",blurb:"Traditional curved profile"},{id:"pencil-round",label:"Pencil round",blurb:"Simple softened edge"},{id:"torus",label:"Torus",blurb:"Soft rounded detail"}];function J_({profile:e}){return(0,I.jsxs)("svg",{className:"skirting-calculator__profile-diagram",viewBox:"0 0 120 84","aria-hidden":"true",children:[(0,I.jsx)("path",{d:{chamfered:"M16 70V43L43 16H104V70Z",ogee:"M16 70V47C16 36 27 31 40 31C40 21 50 16 63 16H104V70Z","pencil-round":"M16 70V37C16 25 25 16 37 16H104V70Z",torus:"M16 70V49C16 39 25 34 36 34C36 22 47 16 61 16H104V70Z"}[e]}),(0,I.jsx)("line",{x1:"12",y1:"70",x2:"108",y2:"70"})]})}function Gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ci.useState)("total"),[n,o]=(0,Ci.useState)("m"),[l,c]=(0,Ci.useState)(""),[p,d]=(0,Ci.useState)([Ew()]),[g,f]=(0,Ci.useState)(""),[h,w]=(0,Ci.useState)("chamfered"),M="4.2",D=r==="total"?hc(l,n):p.reduce((N,A)=>N+2*(hc(A.length,n)+hc(A.width,n)),0),m=Math.max(0,D-hc(g,n)),u=Math.ceil(m/Tw(M)),b=[{key:`skirting-${h}`,label:`${Mw.find(N=>N.id===h)?.label} skirting board`,qty:m,unit:"m",query:"skirting board",category:"skirting"}],v=(N,A,T)=>{d(z=>z.map((G,P)=>P===N?{...G,[A]:T}:G))};return(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)("div",{className:"truss-estimator",children:[(0,I.jsxs)("div",{className:"quick-order-hero",children:[(0,I.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,I.jsx)("h1",{children:"Skirting Board Calculator"}),(0,I.jsx)("p",{children:"Work out how many skirting board lengths you need for one room or a whole project."})]}),(0,I.jsxs)("div",{className:"truss-estimator__card skirting-calculator",children:[(0,I.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure by room or total length"}),(0,I.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter a single total or work room by room. The run is converted straight into board lengths."}),(0,I.jsxs)("div",{className:"skirting-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"How would you like to measure?"}),(0,I.jsxs)("div",{className:"brick-calculator__unit-toggle skirting-calculator__mode-toggle",role:"group","aria-label":"Calculation method",children:[(0,I.jsx)("button",{type:"button",className:r==="total"?"is-selected":"",onClick:()=>i("total"),children:"Total length"}),(0,I.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>i("rooms"),children:"Room by room"})]})]}),(0,I.jsxs)("div",{className:"skirting-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Measurements"}),(0,I.jsxs)("div",{className:"skirting-calculator__unit-row",children:[(0,I.jsx)("span",{children:"Units"}),(0,I.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,I.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,I.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>o("ft"),children:"Feet"})]})]}),r==="total"?(0,I.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,I.jsxs)("span",{children:["Total skirting length (",n,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:N=>c(N.target.value)})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"skirting-calculator__dimensions-header",children:[(0,I.jsx)("span",{children:"Room"}),(0,I.jsxs)("span",{children:["Length (",n,")"]}),(0,I.jsxs)("span",{children:["Width (",n,")"]}),(0,I.jsx)("span",{})]}),p.map((N,A)=>(0,I.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,I.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",A+1]}),(0,I.jsx)("input",{"aria-label":`Room ${A+1} length in ${n}`,type:"number",min:"0",step:"0.01",value:N.length,onChange:T=>v(A,"length",T.target.value)}),(0,I.jsx)("input",{"aria-label":`Room ${A+1} width in ${n}`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(A,"width",T.target.value)}),p.length>1?(0,I.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>d(T=>T.filter((z,G)=>G!==A)),children:"Remove"}):null]},`room-${A}`)),(0,I.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>d(N=>[...N,Ew()]),children:"+ Add another room"})]}),(0,I.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,I.jsxs)("span",{children:["Openings and doorways to deduct (",n,") ",(0,I.jsx)("small",{children:"optional"})]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:g,onChange:N=>f(N.target.value)})]})]}),(0,I.jsxs)("div",{className:"skirting-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Profile"}),(0,I.jsx)("p",{className:"skirting-calculator__hint",children:"Choose the finish you want for the fixed 4.2m white-primed MDF boards."}),(0,I.jsx)("div",{className:"architrave-calculator__profiles",children:Mw.map(N=>(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${h===N.id?" is-selected":""}`,onClick:()=>w(N.id),children:[(0,I.jsx)(J_,{profile:N.id}),(0,I.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,I.jsxs)("div",{className:"skirting-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,I.jsx)("div",{className:"truss-estimator__field-grid skirting-calculator__options-grid",children:(0,I.jsxs)("label",{className:"truss-estimator__field",children:[(0,I.jsx)("span",{children:"Board length"}),(0,I.jsx)("input",{value:"4.20 m",disabled:!0})]})}),(0,I.jsx)("p",{className:"skirting-calculator__hint",children:"Longer boards can reduce the number of joins, while 10% waste allows for cuts, corners and mistakes."})]}),(0,I.jsxs)("div",{className:"skirting-calculator__totals",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,I.jsxs)("div",{className:"skirting-calculator__result-grid",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Net skirting"}),(0,I.jsxs)("strong",{children:[m.toFixed(2)," m"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Board lengths"}),(0,I.jsx)("strong",{children:u})]})]}),(0,I.jsx)("p",{className:"skirting-calculator__note",children:"Corners and joins vary by room layout. Measure each wall where possible for the most accurate result."})]}),(0,I.jsxs)("div",{className:"skirting-calculator__actions",children:[(0,I.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,I.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(b),disabled:m<=0,children:a})]})]})]})})}var jn=X(Xe()),le=X(ie()),cl=e=>Number.parseFloat(e)||0;function Yd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,jn.useState)("studs"),[n,o]=(0,jn.useState)(""),[l,c]=(0,jn.useState)(""),[p,d]=(0,jn.useState)("600"),[g,f]=(0,jn.useState)("2.4"),h=n&&l&&p?Math.ceil(cl(l)/(cl(p)/1e3))+1:0,w=h*cl(n),M=cl(g)>0?Math.ceil(w/cl(g)):0,D=[{key:r,label:{studs:"Stud timber",joists:"Joist timber",battens:"Batten timber"}[r],qty:w,unit:"m",query:{studs:"cls studwork timber",joists:"timber joist",battens:"roofing batten"}[r],category:"timber"}],m={studs:["Stud wall","Vertical studs along a wall length"],joists:["Joists","Parallel joists across a floor or deck"],battens:["Battens","Regularly spaced battens for lining or cladding"]},b={studs:{member:"Wall height",overall:"Wall length",help:"Studs repeat across the wall length.",count:"Studs"},joists:{member:"Joist span",overall:"Overall width",help:"Joists repeat across the overall floor or deck width.",count:"Joists"},battens:{member:"Batten length",overall:"Overall width",help:"Battens repeat across the overall lining or cladding width.",count:"Battens"}}[r];return(0,le.jsx)(le.Fragment,{children:(0,le.jsxs)("div",{className:"truss-estimator",children:[(0,le.jsxs)("div",{className:"quick-order-hero",children:[(0,le.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,le.jsx)("h1",{children:"Timber Calculator"}),(0,le.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,le.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,le.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,le.jsxs)("p",{className:"truss-estimator__step-sub",children:[b.help," Enter the member length and centres to estimate the number of pieces and stock lengths."]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,le.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(m).map(v=>(0,le.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===v?" is-selected":""}`,onClick:()=>i(v),children:[(0,le.jsx)("div",{className:"truss-estimator__option-title",children:m[v][0]}),(0,le.jsx)("div",{className:"truss-estimator__option-copy",children:m[v][1]})]},v))})]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,le.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsxs)("span",{children:[b.member," (m)"]}),(0,le.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:v=>o(v.target.value)})]}),(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsxs)("span",{children:[b.overall," (m)"]}),(0,le.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:v=>c(v.target.value)})]})]}),(0,le.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsx)("span",{children:"Centres (mm)"}),(0,le.jsxs)("select",{value:p,onChange:v=>d(v.target.value),children:[(0,le.jsx)("option",{value:"300",children:"300 mm"}),(0,le.jsx)("option",{value:"400",children:"400 mm"}),(0,le.jsx)("option",{value:"450",children:"450 mm"}),(0,le.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsx)("span",{children:"Stock length (m)"}),(0,le.jsxs)("select",{value:g,onChange:v=>f(v.target.value),children:[(0,le.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,le.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,le.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(0,le.jsxs)("div",{className:"materials-calculator__totals",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,le.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:b.count}),(0,le.jsx)("strong",{children:h})]}),(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:"Linear metres"}),(0,le.jsxs)("strong",{children:[w.toFixed(2)," m"]})]}),(0,le.jsxs)("div",{children:[(0,le.jsxs)("span",{children:[g," m lengths"]}),(0,le.jsx)("strong",{children:M})]})]}),(0,le.jsx)("p",{className:"materials-calculator__note",children:"Spacing is measured centre-to-centre. Add extra timber for plates, noggins, trimming and openings where required."})]}),(0,le.jsxs)("div",{className:"materials-calculator__actions",children:[(0,le.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,le.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(D),disabled:w<=0,children:a})]})]})]})})}var Xd=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Qd},{id:"fencing",title:"Fencing Calculator",desc:"Estimate fence panels, posts, gravel boards and fixings.",imageUrl:"/tool-images/fencing.webp",Component:Ud},{id:"decking",title:"Decking Calculator",desc:"Estimate boards, substructure and fixing quantities.",imageUrl:"/tool-images/decking.webp",Component:Rd},{id:"brick-block",title:"Brick & Block Calculator",desc:"Estimate masonry units and ready-mixed mortar for a wall.",imageUrl:"/tool-images/brick-block.webp",Component:Ed},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Od},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:Gd},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:qd},{id:"concrete-aggregate",title:"Concrete & Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:zd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:jd},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:Dd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:Yd},{id:"paving",title:"Paving & Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:Ld}];var vc=X(Xe());var Ge=X(Xe());var S=X(ie()),F_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],Vd={wasteFactorEnabled:!0},I_=3e3,zw=null;function bc(e,t){let a=el(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function W_(e){return e&&e.length>0?e.join(" x "):"-"}function $d({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:i}){let n=ac(),o=`${e}~${t.map(q=>`${q.key}|${q.query}|${q.category??""}|${q.qty}`).join("~")}`,l=o!==zw,[c,p]=(0,Ge.useState)(null),[d,g]=(0,Ge.useState)([]),[f,h]=(0,Ge.useState)(l),[w,M]=(0,Ge.useState)(null),[D,m]=(0,Ge.useState)("tile"),[u,b]=(0,Ge.useState)(null),[v,N]=(0,Ge.useState)(""),[A,T]=(0,Ge.useState)(null),[z,G]=(0,Ge.useState)(""),[P,be]=(0,Ge.useState)([]),[De,Le]=(0,Ge.useState)(new Set),[He,ze]=(0,Ge.useState)(null),[me,ce]=(0,Ge.useState)(""),[fe,Ee]=(0,Ge.useState)([]),ut=(0,Ge.useRef)(null),Se=(0,Ge.useRef)(!1),Z=q=>`${e}:${q}`,de=q=>Pr(q.chosen,{lineId:Z(q.requirement.key),description:q.requirement.label,unit:q.requirement.unit,qty:q.requirement.qty}),Je=(0,Ge.useMemo)(()=>t.map(q=>`${q.key}|${q.query}|${q.category??""}`).join("~"),[t]);(0,Ge.useEffect)(()=>{let q=!1;return vw().then(Y=>{q||p(Y.itemCount>0)}).catch(()=>{q||p(!1)}),()=>{q=!0}},[]),(0,Ge.useEffect)(()=>{if(!a||!c)return;let q=!1,Y;l&&h(!0),M(null);let K=Date.now();return(async()=>{let pe=null;try{pe=(await bw(t)).map(({requirement:Fe,candidates:xt})=>({requirement:Fe,candidates:xt,chosen:xt[0]??null}))}catch(ke){q||M(ke instanceof Error?ke.message:"Could not load products")}if(!q){if(zw=o,l){let ke=I_-(Date.now()-K);ke>0&&await new Promise(Fe=>{Y=window.setTimeout(Fe,ke)})}q||(pe&&(g(pe),!Se.current&&n&&(Se.current=!0,n.addManyToCart(pe.filter(ke=>ke.chosen).map(de)))),h(!1))}})(),()=>{q=!0,window.clearTimeout(Y)}},[a,c,Je]),(0,Ge.useEffect)(()=>{if(!A)return;let q=z.trim();if(!q){be([]);return}let Y=!1,K=window.setTimeout(()=>{Fr(q).then(pe=>{Y||be(pe)}).catch(()=>{Y||be([])})},250);return()=>{Y=!0,window.clearTimeout(K)}},[A,z]),(0,Ge.useEffect)(()=>{if(!He)return;let q=me.trim();if(!q){Ee([]);return}let Y=!1,K=window.setTimeout(()=>{Fr(q).then(pe=>{Y||Ee(pe)}).catch(()=>{Y||Ee([])})},250);return()=>{Y=!0,window.clearTimeout(K)}},[He,me]);let Ye=(0,Ge.useMemo)(()=>{let q=v.trim().toLowerCase(),Y=q?d.filter(K=>K.requirement.label.toLowerCase().includes(q)||(K.chosen?.description??"").toLowerCase().includes(q)||(K.chosen?.product_id??"").toLowerCase().includes(q)):d;return u?[...Y].sort((K,pe)=>{let ke=K.requirement.label.localeCompare(pe.requirement.label);return u==="asc"?ke:-ke}):Y},[d,v,u]),pt=Ye.filter(q=>q.chosen),ot=Ye.filter(q=>!q.chosen),at=d.filter(q=>q.chosen),ge=at.filter(q=>q.chosen?.price==null).length,W=at.reduce((q,Y)=>q+(Dt(de(Y),Vd).lineTotal??0),0);if((0,Ge.useEffect)(()=>{i?.(W)},[W,i]),!a||c===!1)return null;let k=n?at.filter(q=>n.cart[Z(q.requirement.key)]).length:0,R=He?d.find(q=>q.requirement.key===He)??null:null,O=me.trim()?fe:R?.candidates??[],ee=q=>{let Y=A===q.requirement.key;T(Y?null:q.requirement.key),G(Y?"":q.requirement.query)},xe=(q,Y)=>{let K=d.find(pe=>pe.requirement.key===q);g(pe=>pe.map(ke=>ke.requirement.key===q?{...ke,chosen:Y}:ke)),n&&K&&n.cart[Z(q)]&&n.addToCart(de({...K,chosen:Y})),T(null),G("")},we=q=>{g(Y=>Y.map(K=>K.requirement.key===q?{...K,chosen:null}:K)),n?.cart[Z(q)]&&n.removeFromCart(Z(q))},y=q=>{ze(q.requirement.key),ce(""),Ee([])},j=()=>{ze(null),ce(""),Ee([])},B=q=>{if(!n)return;let Y=Z(q.requirement.key);n.cart[Y]?n.removeFromCart(Y):n.addToCart(de(q))},ae=q=>{Le(Y=>{let K=new Set(Y);return K.has(q)?K.delete(q):K.add(q),K})},te=q=>{let Y=P.length>0?P:q.candidates;return(0,S.jsxs)("div",{className:"estimator-products__picker",children:[(0,S.jsx)("input",{type:"text",className:"results-search-input",value:z,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:K=>G(K.target.value),"aria-label":`Search a product for ${q.requirement.label}`}),(0,S.jsxs)("div",{className:"estimator-products__options",children:[Y.map(K=>(0,S.jsxs)("button",{type:"button",className:`estimator-products__option${K.product_id===q.chosen?.product_id?" is-selected":""}`,onClick:()=>xe(q.requirement.key,K),children:[(0,S.jsx)("span",{children:K.description}),(0,S.jsxs)("span",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${nt(K.price)}`]})]},K.product_id)),Y.length===0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,S.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!f&&(0,S.jsxs)("div",{className:"estimator-products__head",children:[(0,S.jsxs)("div",{className:"results-tile-section__head",children:[(0,S.jsx)("h3",{children:"Matched Products"}),(0,S.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!R&&(0,S.jsxs)("div",{className:"results-summary estimator-products__toolbar",children:[ge>0&&(0,S.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,S.jsx)("strong",{children:ge})," need pricing"]}),(0,S.jsxs)("div",{className:"estimator-products__controls",children:[(0,S.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:v,onChange:q=>N(q.target.value),"aria-label":"Search matched products"}),(0,S.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,S.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="tile"?" is-active":""}`,"aria-pressed":D==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>m("tile"),children:(0,S.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,S.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,S.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="list"?" is-active":""}`,"aria-pressed":D==="list","aria-label":"List view",title:"List view",onClick:()=>m("list"),children:(0,S.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,S.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,S.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,S.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,S.jsxs)("details",{ref:ut,style:{position:"relative"},children:[(0,S.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,S.jsx)("div",{className:"sort-menu-panel",children:F_.map(q=>{let Y=u===q.dir;return(0,S.jsxs)("button",{type:"button",className:`sort-menu-item${Y?" is-active":""}`,onClick:()=>{b(Y?null:q.dir),ut.current?.removeAttribute("open")},children:[(0,S.jsx)("span",{className:"sort-menu-item__check",children:Y?"\u2713":""}),q.label]},q.dir)})})]})]})]})]}),R&&(0,S.jsxs)("div",{className:"results-review-page",children:[(0,S.jsxs)("div",{className:"results-review-page__top",children:[(0,S.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:j,children:[(0,S.jsx)(Kr,{}),"Back to results"]}),(0,S.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,S.jsx)("div",{className:"results-review-searchbar",children:(0,S.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:me,onChange:q=>ce(q.target.value),"aria-label":`Search a product for ${R.requirement.label}`})}),R.chosen&&(0,S.jsx)("div",{className:"results-candidate-actions",children:(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>we(R.requirement.key),children:"Clear selected product"})})]})]}),(0,S.jsxs)("div",{className:"results-review-page__hero",children:[(0,S.jsx)("div",{className:"results-review-page__image-wrap",children:(0,S.jsx)("img",{className:"fill-img results-review-page__image",src:Ya(R.chosen?.description||R.requirement.label,R.chosen?.product_id,R.chosen?.pdp_photo_url),alt:""})}),(0,S.jsxs)("div",{className:"results-review-page__summary",children:[(0,S.jsx)("h2",{children:R.requirement.label}),(0,S.jsxs)("p",{className:"results-review-page__meta",children:[yi(R.requirement.qty)," ",Na(R.requirement.unit,R.requirement.qty)]}),R.chosen?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"results-review-page__product",children:R.chosen.description}),(0,S.jsxs)("div",{className:"results-row-meta",children:[R.chosen.product_id,R.chosen.price!=null?` \xB7 ${bc(R.chosen.price,R.chosen.price_basis)}`:""]})]}):(0,S.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,S.jsx)("div",{className:"results-review-page__actions",children:(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${n?.cart[Z(R.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(R),disabled:!R.chosen||!n,children:n?.cart[Z(R.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),O.length===0?(0,S.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,S.jsxs)("table",{className:"score-breakdown-table",children:[(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{children:"Product"}),(0,S.jsx)("th",{children:"Dims (mm)"}),(0,S.jsx)("th",{children:"Price"}),(0,S.jsx)("th",{"aria-label":"Actions"})]})}),(0,S.jsx)("tbody",{children:O.map(q=>{let Y=q.product_id===R.chosen?.product_id;return(0,S.jsxs)("tr",{className:Y?"score-breakdown-row--best":"",children:[(0,S.jsxs)("td",{children:[(0,S.jsx)("div",{children:q.description}),(0,S.jsx)("div",{className:"results-row-meta",children:q.product_id})]}),(0,S.jsx)("td",{children:(0,S.jsx)("span",{className:"unit-badge",children:W_(q.measurements_mm)})}),(0,S.jsx)("td",{children:q.price!=null?bc(q.price,q.price_basis):"-"}),(0,S.jsx)("td",{children:(0,S.jsxs)("label",{className:"switch-toggle",title:Y?"Currently selected":"Use this candidate",children:[(0,S.jsx)("input",{type:"checkbox",checked:Y,onChange:()=>{Y?we(R.requirement.key):xe(R.requirement.key,q)},"aria-label":Y?`${q.description} selected`:`Use ${q.description}`}),(0,S.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},q.product_id)})})]})]}),!R&&f&&(0,S.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,S.jsx)(fr,{}),(0,S.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!R&&w&&(0,S.jsx)("p",{className:"results-empty-hint estimator-products__error",children:w}),!R&&!f&&!w&&Ye.length===0&&d.length>0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!R&&!f&&!w&&D==="tile"&&pt.length>0&&(0,S.jsx)("div",{className:"results-tile-grid",children:pt.map(q=>{let{requirement:Y,chosen:K}=q,pe=K?Dt(de(q),Vd):null,ke=n?!!n.cart[Z(Y.key)]:!1;return(0,S.jsxs)("article",{className:"results-tile-card",children:[(0,S.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>y(q),"aria-label":`Review match for ${Y.label}`,children:[(0,S.jsx)("div",{className:"results-tile-card__media",children:(0,S.jsx)("img",{className:"fill-img results-tile-card__image",src:Ya(K?.description||Y.label,K?.product_id,K?.pdp_photo_url),alt:""})}),(0,S.jsxs)("div",{className:"results-tile-card__body",children:[K?(0,S.jsxs)("div",{className:"results-tile-card__heading",children:[(0,S.jsx)("div",{className:"results-tile-card__title",children:K.description}),(0,S.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,S.jsx)("span",{children:K.product_id}),K.price!=null?(0,S.jsx)("span",{children:bc(K.price,K.price_basis)}):null]})]}):(0,S.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,S.jsxs)("div",{className:"results-tile-card__match",children:[(0,S.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,S.jsx)("div",{className:"results-tile-card__match-name",children:Y.label}),(0,S.jsxs)("div",{className:"results-tile-card__meta",children:[yi(Y.qty)," ",Na(Y.unit,Y.qty)]}),pe?.requiredSellUnits!=null?(0,S.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",pe.requiredSellUnits," ",pe.sellUnit,pe.lineTotal!=null?` \xB7 ${nt(pe.lineTotal)}`:""]}):K?(0,S.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,S.jsxs)("div",{className:"results-tile-card__actions",children:[(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>y(q),children:"Review"}),(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(q),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})]})]},Y.key)})}),!R&&!f&&!w&&D==="list"&&pt.length>0&&(0,S.jsx)("div",{className:"bom-table-wrap",children:(0,S.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,S.jsxs)("colgroup",{children:[(0,S.jsx)("col",{style:{width:"56px"}}),(0,S.jsx)("col",{className:"col-item"}),(0,S.jsx)("col",{style:{width:"90px"}}),(0,S.jsx)("col",{style:{width:"80px"}}),(0,S.jsx)("col",{style:{width:"220px"}}),(0,S.jsx)("col",{style:{width:"110px"}})]}),(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{className:"bom-col-header",children:[(0,S.jsx)("th",{"aria-label":"Expand"}),(0,S.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,S.jsx)("tbody",{children:pt.map(q=>{let{requirement:Y,chosen:K}=q,pe=K?Dt(de(q),Vd):null,ke=n?!!n.cart[Z(Y.key)]:!1,Fe=De.has(Y.key);return(0,S.jsxs)(Ge.Fragment,{children:[(0,S.jsxs)("tr",{className:"bom-row",children:[(0,S.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,S.jsx)("button",{type:"button",className:"link-btn",onClick:()=>ae(Y.key),"aria-expanded":Fe,"aria-label":Fe?"Collapse product options":"Expand product options",children:Fe?"\u25BE":"\u25B8"})}),(0,S.jsxs)("td",{style:{paddingLeft:0},children:[(0,S.jsx)("div",{className:"bom-component-name",children:Y.label}),pe?.requiredSellUnits!=null&&(0,S.jsxs)("div",{className:"results-row-meta",children:["Order ",pe.requiredSellUnits," ",pe.sellUnit,pe.lineTotal!=null?` \xB7 ${nt(pe.lineTotal)}`:""]})]}),(0,S.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:yi(Y.qty)}),(0,S.jsx)("td",{style:{textAlign:"center"},children:Na(Y.unit,Y.qty)}),(0,S.jsx)("td",{style:{textAlign:"center"},children:K?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"bom-component-name",children:K.description}),(0,S.jsxs)("div",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${bc(K.price,K.price_basis)}`]})]}):(0,S.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,S.jsx)("td",{style:{textAlign:"center"},children:(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(q),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})})]}),Fe&&(0,S.jsx)("tr",{children:(0,S.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:A===Y.key?te(q):(0,S.jsxs)("div",{className:"estimator-products__picker",children:[(0,S.jsxs)("div",{className:"estimator-products__options",children:[q.candidates.map(xt=>(0,S.jsxs)("button",{type:"button",className:`estimator-products__option${xt.product_id===K?.product_id?" is-selected":""}`,onClick:()=>xe(Y.key,xt),children:[(0,S.jsx)("span",{children:xt.description}),(0,S.jsxs)("span",{className:"results-row-meta",children:[xt.product_id,xt.price!=null&&` \xB7 ${nt(xt.price)}`]})]},xt.product_id)),q.candidates.length===0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>ee(q),children:"Search the catalogue"})]})})})]},Y.key)})})]})}),!R&&!f&&!w&&ot.length>0&&(0,S.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,S.jsxs)("div",{className:"results-tile-section__head",children:[(0,S.jsx)("h3",{children:"Require Matching"}),(0,S.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,S.jsx)("div",{className:"results-unmatched-list",children:ot.map(q=>(0,S.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>y(q),children:[(0,S.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,S.jsx)("span",{className:"results-unmatched-card__title",children:q.requirement.label}),(0,S.jsxs)("span",{className:"results-row-meta",children:[yi(q.requirement.qty)," ",Na(q.requirement.unit,q.requirement.qty)]})]}),(0,S.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},q.requirement.key))})]}),!f&&!w&&d.length>0&&(0,S.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,S.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,S.jsx)("p",{className:"disclaimer-text",children:"These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence."})]}),!R&&!f&&!w&&(r||k>0)&&(0,S.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,S.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),k>0&&n&&(0,S.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:n.openBasket,children:[(0,S.jsxs)("span",{children:["View Basket (",k,")"]}),(0,S.jsx)("span",{className:"arrow",children:(0,S.jsx)(jt,{})})]})]})]})}var Qt=X(ie());function Zd({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[i,n]=(0,vc.useState)(0),o=(0,vc.useCallback)(l=>n(l),[]);return(0,Qt.jsx)(Qt.Fragment,{children:(0,Qt.jsxs)("div",{className:"truss-estimator",children:[(0,Qt.jsxs)("div",{className:"quick-order-hero",children:[(0,Qt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Qt.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Qt.jsx)("h1",{children:"Your Materials"}),i>0&&(0,Qt.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Qt.jsx)("strong",{children:nt(i)})," Est. total"]})]}),(0,Qt.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Qt.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Qt.jsx)($d,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var ex=(e,t)=>{let a=t.key,r={"brick-block":{"brick-common":"5001444","brick-engineering-red":"5002008","brick-engineering-blue":"5001439",block:"5003187",mortar:"6003088"},skirting:{"skirting-chamfered":"4006057","skirting-ogee":"4006045","skirting-pencil-round":"4006048","skirting-torus":"4006042"},architrave:{"architrave-ogee":"4006060","architrave-ovolo":"4006063","architrave-pencil-round":"4006061","architrave-square-edge":"4006062","architrave-torus":"4006059"},plasterboard:{board:"2001035",screws:"2006040",tape:"2007043",adhesive:"2004023"},insulation:{"insulation-floor":"3002110","insulation-wall":"3002012","insulation-roof":"3004047","insulation-loft":"3003046"},timber:{studs:"4001168",joists:"4001201",battens:"4001053"},fencing:{"panels-boundary-0.9":"4001268","panels-boundary-1.2":"4001269","panels-boundary-1.5":"4001270","panels-boundary-1.8":"4001271","panels-skyline-0.9":"4001264","panels-skyline-1.2":"4001265","panels-skyline-1.5":"4001266","panels-skyline-1.8":"4001267","concrete-intermediate-6":"4001290","concrete-intermediate-8":"4001291","concrete-end-6":"4001294","concrete-end-8":"4001295","timber-post-6":"4001242","timber-post-8":"4001243",postcrete:"6003008",gate:"4001630","gravel-boards":"4001284"},decking:{"boards-meridian":"4001251","boards-summit":"4001360",joists:"4001201",screws:"1001103"},paving:{"surface-council":"7003121","surface-raj":"7003003","surface-brindle":"4001621","surface-charcoal":"4001622","surface-pea":"6001004","sub-base":"6001007",bedding:"6001012"}};return e==="plasterboard"?{standard:"2001035",moisture:"2002039",fire:"2002087",sound:"2002044"}[t.label.split(" ")[0].toLowerCase()]??r[e]?.[a]??null:r[e]?.[a]??null};function Aw(e,t){if(e==="paint"||e==="concrete-aggregate")return null;let a=t.map(r=>{let i=ex(e,r);return i?{key:r.key,productId:i,qty:r.qty,unit:r.unit}:null});return a.every(Boolean)?a:null}var Kd=X(Xe());var Ft=X(ie()),tx=1500;function Rw(e){let{addManyToCart:t,clearCart:a,openBasket:r}=An(),[i,n]=(0,Kd.useState)(!1),[o,l]=(0,Kd.useState)(null);return{adding:i,basketError:o,addToBasket:async(p,d)=>{let g=Date.now();n(!0),l(null);try{let f=await Promise.all(p.filter(w=>w.qty>0).map(async w=>{let M=(await Fr(w.productId)).find(D=>D.product_id===w.productId);if(!M)throw new Error("A selected product is no longer available in this catalogue.");return Pr(M,{lineId:`${e}:${w.key}`,description:M.description,unit:w.unit??"each",qty:w.qty,calculatorWasteIncluded:d})})),h=tx-(Date.now()-g);h>0&&await new Promise(w=>window.setTimeout(w,h)),a(),t(f),r()}catch(f){l(f instanceof Error?f.message:"Could not add the products to your basket.")}finally{n(!1)}}}}function Uw({toolTitle:e}){return(0,Ft.jsx)(Ft.Fragment,{children:(0,Ft.jsxs)("div",{className:"truss-estimator",children:[(0,Ft.jsxs)("div",{className:"quick-order-hero",children:[(0,Ft.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Ft.jsx)("h1",{children:"Your Materials"}),(0,Ft.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Ft.jsx)("div",{className:"truss-estimator__card",children:(0,Ft.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Ft.jsx)(fr,{}),(0,Ft.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Ue=X(ie());function wc(e){let[t,a]=(0,Va.useState)(!1);return(0,Ue.jsx)(tc,{onOpenBasket:()=>a(!0),children:(0,Ue.jsx)(ax,{...e,showBasket:t,onShowBasket:a})})}function ax({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:i}){let[n,o]=(0,Va.useState)(null),[l,c]=(0,Va.useState)(null),p=Xd.find(z=>z.id===n),{cart:d,updateCartQty:g,updateCartSellUnits:f,updateCartConversions:h,removeFromCart:w,clearCart:M}=An(),{adding:D,basketError:m,addToBasket:u}=Rw(p?.title??"calculator"),b=(0,Va.useRef)(null),v=Xs("estimating-tools",b);(0,Va.useEffect)(()=>{v("viewed")},[v]);let N=r?"basket":D?"adding":l?"review":n??"list",A=(0,Va.useRef)(N);(0,Va.useEffect)(()=>{A.current!==N&&(A.current=N,window.scrollTo(0,0))},[N]);let T=z=>{if(!p)return;v("estimate_completed",{calculator:p.id,lines:z.length});let G=Aw(p.id,z);G?u(G,z[0]?.calculatorWasteIncluded??!1):c(z)};return(0,Ue.jsx)(Po.Provider,{value:v,children:(0,Ue.jsx)("div",{ref:b,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}`,style:Ra().theme,children:(0,Ue.jsx)("main",{className:"main-content",children:r?(0,Ue.jsx)(ol,{cart:d,onUpdateQty:g,onUpdateSellUnits:f,onResolveConversions:h,onRemove:w,onBack:()=>i(!1),onStartNewQuote:()=>{M(),o(null),c(null),i(!1)},internal:a}):D&&p?(0,Ue.jsx)(Uw,{toolTitle:p.title}):p?(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)("div",{hidden:l!==null,children:(0,Ue.jsx)(p.Component,{onBack:()=>o(null),onReview:T})}),m&&(0,Ue.jsx)("p",{className:"results-empty-hint estimator-products__error",children:m}),l!==null&&(0,Ue.jsx)(Zd,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>c(null)})]}):(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsxs)("div",{className:"quick-order-card",children:[(0,Ue.jsxs)("div",{className:"quick-order-hero",children:[(0,Ue.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,Ue.jsx)("h1",{children:"Estimating Tools"}),(0,Ue.jsx)("p",{children:"Trade-specific calculators for trusses, fencing, decking, masonry and painting. Dial in your specs and get an instant material estimate."})]}),(0,Ue.jsxs)("div",{className:"quick-order-alt",children:[(0,Ue.jsx)("div",{className:"quick-order-alt-title",children:"Choose a Calculator"}),(0,Ue.jsx)("div",{className:"estimator-tools-grid",children:Xd.map(z=>(0,Ue.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{v("calculator_selected",{calculator:z.id}),o(z.id),c(null)},children:[(0,Ue.jsx)("span",{className:"estimator-tool-card__image-wrap",children:(0,Ue.jsx)("img",{className:"fill-img estimator-tool-card__image",src:Jt(z.imageUrl),alt:""})}),(0,Ue.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Ue.jsx)("span",{className:"estimator-tool-card__title",children:z.title}),(0,Ue.jsx)("span",{className:"estimator-tool-card__desc",children:z.desc})]})]},z.id))})]})]})})})})})}var yc=X(ie());function Pd({config:e,children:t}){return Wb(e),(0,yc.jsx)(yc.Fragment,{children:t})}var Jd=X(ie()),rx="https://api.metronlabs.ai",ix=["client","api-key","api-url","theme","hide-header","analytics"],nx=["all","events-only","none"];function Ow(e,t){var a;customElements.get(e)||customElements.define(e,(a=class extends HTMLElement{constructor(){super();this.root=null;this.attachShadow({mode:"open"})}connectedCallback(){if(this.dataset.version="0.1.45",this.id||(this.id=e),this.setAttribute("data-turbo-permanent",""),this.setAttribute("data-turbolinks-permanent",""),!this.root){let i=document.createElement("div"),n=document.createElement("style");n.textContent=`:host { display: block; }
|
|
6803
|
+
`)}function Jr(e,t){return{lineId:t.lineId,description:e?.description||t.description||"(no description)",requestedDescription:t.description,productId:e?.product_id??"-",price:e?.price??null,priceBasis:e?.price_basis??null,unit:t.unit,uoi:e?.uoi??t.unit,uoiCount:e?.uoi_count??null,saleUnit:e?.conversion?.sale_unit??null,saleUnitQuantity:e?.conversion?.sale_unit_quantity??null,unitConversions:e?.conversion?.unit_conversions?.map(a=>({requestUom:a.request_uom,quantityPerSaleUnit:a.quantity_per_sale_unit,evidence:a.evidence,confidence:a.confidence})),pdpPhotoUrl:e?.pdp_photo_url??null,measurementsMm:e?.measurements_mm??[],conversionType:e?.conversion?.conversion_type??null,requestUomsSupported:e?.conversion?.request_uoms_supported??null,salesUomNormalised:e?.conversion?.sales_uom_normalised??null,salesUnitSize:e?.conversion?.sales_unit_size??null,salesUnitSizeUom:e?.conversion?.sales_unit_size_uom??null,coverageQty:e?.conversion?.coverage_qty??null,coverageUom:e?.conversion?.coverage_uom??null,itemsPerPallet:e?.conversion?.items_per_pallet??null,itemsPerPack:e?.conversion?.items_per_pack??null,itemsPerBox:e?.conversion?.items_per_box??null,itemsPerM2:e?.conversion?.items_per_m2??null,wasteFactorDefault:e?.conversion?.waste_factor_default??null,roundingRule:e?.conversion?.rounding_rule??null,derivedCoverageM2:e?.conversion?.derived_coverage_m2??null,derivedLengthM:e?.conversion?.derived_length_m??null,quoteQtyFormulaType:e?.conversion?.quote_qty_formula_type??null,conversionConfidence:e?.conversion?.conversion_confidence??null,conversionNotes:e?.conversion?.conversion_notes??null,calculatorWasteIncluded:t.calculatorWasteIncluded,qty:t.qty,linkedContext:t.linkedContext}}var iw=e=>(e??"").trim().toLowerCase(),a_={sqm:"m2","sq m":"m2","m\xB2":"m2",cbm:"m3","cu m":"m3",lm:"m","lin m":"m",metre:"m",meter:"m",each:"each",ea:"each",nr:"each",no:"each",item:"each",unit:"each",units:"each",pc:"each",pcs:"each",board:"sheet",bags:"bag",length:"length",lengths:"length",pallet:"pallet",pallets:"pallet"},vd=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),ew=new Set(["box","bag","pack","pallet","roll","set","tub"]),tw=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,aw=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,_i=e=>{let t=iw(e);return a_[t]??t},ct=(e,t)=>{let a=_i(e),r=_i(t);return a.length>0&&a===r},r_=(e,t)=>{let a=iw(t);return a?a.includes("round_up_1000")?Math.ceil(e):a.includes("allow_decimal")?Math.round(e*1e3)/1e3:a.includes("round_up")?Math.ceil(e):e:e},i_=e=>(e??"").split(",").map(t=>_i(t)).filter(Boolean),n_=(e,t)=>{let a=i_(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||ct(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||ct(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||ct(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},rw=(e,t)=>ct(t,"pallet")?e.itemsPerPallet??null:ct(t,"pack")?e.itemsPerPack??null:ct(t,"box")?e.itemsPerBox??null:null,o_=(e,t,a)=>{if(!ct(t,"m2"))return null;let r=e.description.match(/(\d+(?:[.,]\d+)?)\s*(m2|m²|sqm|sq\.?\s*m)\s*(?:\/|per)\s*([a-z]+)/i);if(!r||!ct(r[3],a))return null;let i=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(i)&&i>0?i:null};function Fs(e,t){return e.reduce((a,r)=>a+(Dt(r,t).lineTotal??0),0)}function Dt(e,t){let a=e.qty,r=_i(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=_i(e.unit)||(a>0&&vd.has(r)?r:"-"),n=e.saleUnitQuantity??e.salesUnitSize??e.uoiCount??1,o=t?.wasteFactorEnabled===!1?0:t?.wasteFactorOverride??e.wasteFactorOverride??e.wasteFactorDefault??0,l=e.sellUnitsOverride!=null&&Number.isFinite(e.sellUnitsOverride)&&e.sellUnitsOverride>0,c=l?vd.has(r)?Math.ceil(e.sellUnitsOverride):e.sellUnitsOverride:null,p=v=>({requestedAmount:a,requestedUnit:i,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:r,calculatedSellUnits:null,requiredSellUnits:c,unitPrice:e.price,lineTotal:e.price!=null&&c!=null?e.price*c:null,calculation:c!=null?`${v} Manually set to ${c} ${r}.`:v,costingMode:"review"});if(!n_(e,i))return p("Requested unit is not supported by this catalogue conversion.");let d=null,g="review",f=e.roundingRule,h=`Quantity review required, initial request needed ${a} ${i}.`,w=1+o,M=o_(e,i,r),D=e.unitConversions?.find(v=>ct(v.requestUom,i));if(!!e.saleUnit&&(ct(i,r)||!!D||ct(i,"each")&&!ew.has(r)))if(ct(i,r))d=a*w/n,g="direct",h=`${a} ${i}${o>0?` x ${w}`:""}`;else if(D){d=a*w/D.quantityPerSaleUnit,g="derived";let v=1/D.quantityPerSaleUnit,N=Math.round(v);h=ct(r,"each")&&D.quantityPerSaleUnit<1&&Math.abs(v-N)<1e-9?`${a} ${i}${o>0?` x ${w}`:""} x ${N} per ${i}`:`${a} ${i}${o>0?` x ${w}`:""} / ${D.quantityPerSaleUnit} ${i} per ${r}`}else ct(i,"each")&&!ew.has(r)&&(d=a*w/n,g="derived",h=`${a} ${r}${o>0?` x ${w}`:""}`);else if(ct(i,r)&&n>0)d=a*w/n,g="direct",h=o>0?`${a} ${i} x ${w} / ${n} ${r} per sell unit`:`${a} ${i} / ${n} ${r} per sell unit`;else if(ct(i,"each")&&n>0&&vd.has(r))d=a*w/n,g="derived",h=o>0?`${a} each x ${w} / ${n} each per ${r}`:`${a} each / ${n} each per ${r}`;else if(rw(e,i)!=null&&n>0){let v=rw(e,i)??0;d=a*v*w/n,g="derived";let N=`${a} ${i} x ${v} each${o>0?` x ${w}`:""}`;h=n===1&&ct(r,"each")?N:`${N} / ${n} each per ${r}`}else if(M!=null)d=a*w/M,g="derived",f??(f="round_up_each"),h=`${a} m2 x ${w} / ${M} m2 per ${r} (from product description)`;else if(e.conversionType==="basket_line_unit")n>0&&(d=a*w/n,g="derived",h=`${a} ${i}${o>0?` x ${w}`:""} / ${n} ${i} per ${r}`);else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${i}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let v=e.coverageQty??e.derivedCoverageM2??null;ct(i,"m2")&&v!=null&&v>0&&(d=a*w/v,g="derived",h=`${a} m2 x ${w} / ${v} m2 per ${r}`)}else if(e.conversionType==="count_per_area"){let v=e.coverageQty??null;ct(i,"m2")&&v!=null&&v>0?(d=a/v,g="derived",h=`${a} m2 / ${v} m2 per sell unit`):ct(i,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&n>0&&(d=a*e.itemsPerM2*w/n,g="derived",h=`${a} m2 x ${e.itemsPerM2} ${r}/m2 x ${w} / ${n}`)}else if(e.conversionType==="length_from_dims"){let v=e.coverageQty??e.derivedLengthM??null;ct(i,"m")&&v!=null&&v>0&&(d=a*w/v,g="derived",h=`${a} m x ${w} / ${v} m per ${r}`)}else if(e.conversionType==="volume_from_description"){let v=tw(a,i),N=tw(e.coverageQty??0,_i(e.coverageUom));v!=null&&N!=null&&N>0&&(d=v*w/N,g="derived",h=`${a} ${i} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="weight_from_description"){let v=aw(a,i),N=aw(e.coverageQty??0,_i(e.coverageUom));v!=null&&N!=null&&N>0&&(d=v*w/N,g="derived",h=`${a} ${i} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="same_unit_volume"){let v=e.coverageQty??null;ct(i,"m3")&&v!=null&&v>0&&(d=a/v,g="derived",h=`${a} m3 / ${v} m3 per ${r}`)}}if(d==null||!Number.isFinite(d)||d<0)return p(`Quantity review required, initial request needed ${a} ${i}.`);let u=r_(d,f),b=l?c:u;return{requestedAmount:a,requestedUnit:i,salesUnitSize:n,sellUnit:r,calculatedSellUnits:u,requiredSellUnits:b,unitPrice:e.price,lineTotal:e.price!=null&&b!=null?e.price*b:null,calculation:l?`${h} = ${u} ${r} (manually set to ${b})`:`${h} = ${b} ${r}`,costingMode:g}}var nw=()=>import("./xlsx-K4MOA2QM.js"),al=["Source Line ID","Split Line ID","Description","Section","Qty","Unit","Procurement intent","Procurement aliases","Build-up type","Layer count","Total thickness (mm)","Installation clues","System clues","Component requirements","Technical classification","Include in quote","Approval required","Approval type","Missing information","Adjudicator confidence","Decision reason","Selected candidate ID","Selected candidate description","Price basis","Price","Line total","Confidence","Status"],l_=al.indexOf("Line total");function s_(e){return e.unmatchable?"Not matched (labour/plant/referential)":e.decision?.include_in_quote===!0&&e.decision.approval_required===!0?"Approval required":e.decision?.include_in_quote===!0?"Quoted":e.decision?.technical_classification==="no_suitable_candidate"?"No suitable candidate":(e.best,"No match")}async function ow(e){let t=await nw(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),i=[al],n=0;for(let c of e){let{item:p,best:d,qty:g,band:f,unmatchable:h,decision:w}=c,M=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),D=!h&&d?.price!=null?d.price*g:null;D!=null&&(n+=D),i.push([p.source_line_id,p.line_id,p.description_original||"(no description)",M,g,p.unit,p.procurement_intent||"-",p.procurement_aliases.join(", "),p.build_up_type,p.layer_count,p.total_required_thickness_mm,p.installation_clues.join(", "),p.system_clues.join(", "),p.component_requirements.join(", "),w?.technical_classification??"",w?.include_in_quote==null?"":w.include_in_quote?"yes":"no",w?.approval_required==null?"":w.approval_required?"yes":"no",w?.approval_type??"",w?.missing_information.join(", ")??"",w?.confidence??"",w?.reason??"",h?"-":d?.product_id??w?.selected_candidate_id??"-",h?"-":d?.description??"-",h?"-":d?.price_basis??"-",h?null:d?.price??null,D,h?"-":f,s_(c)])}i.push(Array(al.length).fill(null));let o=Array(al.length).fill(null);o[0]="Estimated total",o[l_]=n,i.push(o),i.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(al.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(i);l["!cols"]=[{wch:12},{wch:12},{wch:44},{wch:24},{wch:8},{wch:8},{wch:28},{wch:28},{wch:16},{wch:10},{wch:12},{wch:24},{wch:24},{wch:24},{wch:22},{wch:14},{wch:14},{wch:18},{wch:24},{wch:16},{wch:48},{wch:16},{wch:40},{wch:10},{wch:10},{wch:12},{wch:11},{wch:26}],t.utils.book_append_sheet(a,l,"Schedule match"),t.writeFile(a,`schedule-quote-${r}.xlsx`)}var tl=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function lw(e,t){let a=await nw(),r=a.utils.book_new(),i=new Date().toISOString().slice(0,10),n=t?[["Account",t.name+" ("+t.id+")"],[],tl]:[tl],o=0;for(let p of e){let d=Dt(p),g=d.lineTotal;g!=null&&(o+=g),n.push([p.productId,p.description,d.costingMode,d.requestedAmount,Na(d.requestedUnit),d.salesUnitSize,Na(d.sellUnit),d.requiredSellUnits,d.unitPrice,g])}n.push(Array(tl.length).fill(null));let l=Array(tl.length).fill(null);l[0]="Estimated total",l[tl.length-1]=o,n.push(l);let c=a.utils.aoa_to_sheet(n);c["!cols"]=[{wch:14},{wch:48},{wch:12},{wch:14},{wch:10},{wch:14},{wch:10},{wch:16},{wch:12},{wch:14}],a.utils.book_append_sheet(r,c,"Basket"),a.writeFile(r,t?`basket-${t.id}-${i}.xlsx`:`basket-${i}.xlsx`)}var s=X(ie()),yd="__none__",rl=24,c_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function pw(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var u_=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function p_(e,t){if(t!==yd){if(t)return e?.candidates.find(a=>a.product_id===t);if(e?.decision?.selected_candidate_id!=null)return e.candidates.find(a=>a.product_id===e.decision.selected_candidate_id)}}function sw(e){return{product_id:e.productId,description:e.description,source_list:null,price:e.price,price_basis:e.priceBasis,uoi_count:e.uoiCount??null,uoi:e.uoi,pdp_photo_url:e.pdpPhotoUrl??null,measurements_mm:e.measurementsMm??[],conversion:{sale_unit:e.saleUnit,sale_unit_quantity:e.saleUnitQuantity,unit_conversions:e.unitConversions?.map(t=>({request_uom:t.requestUom,quantity_per_sale_unit:t.quantityPerSaleUnit,evidence:t.evidence,confidence:t.confidence})),sales_uom_normalised:e.salesUomNormalised,conversion_type:e.conversionType,request_uoms_supported:e.requestUomsSupported,sales_unit_size:e.salesUnitSize,sales_unit_size_uom:e.salesUnitSizeUom,coverage_qty:e.coverageQty,coverage_uom:e.coverageUom,items_per_pallet:e.itemsPerPallet,items_per_pack:e.itemsPerPack,items_per_box:e.itemsPerBox,items_per_m2:e.itemsPerM2,waste_factor_default:e.wasteFactorDefault,rounding_rule:e.roundingRule,derived_coverage_m2:e.derivedCoverageM2,derived_length_m:e.derivedLengthM,quote_qty_formula_type:e.quoteQtyFormulaType,conversion_confidence:e.conversionConfidence,conversion_notes:e.conversionNotes},scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"manual_cart_selection"}}function d_(e){return e?e.replace(/_/g," "):"not stated"}function m_({band:e}){return(0,s.jsx)("span",{className:`status-dot status-dot--${e}`,title:e,children:(0,s.jsx)("span",{className:"status-dot__mark"})})}function Tn(e,t){if(e==null)return"-";let a=el(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function _d(e){return e&&e.length>0?e.join(" x "):"-"}function f_(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Mn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Ir(e,t){let a=typeof e.description_original=="string"?e.description_original.trim():"";return(typeof e.customer_display_label=="string"?e.customer_display_label.trim():"")||a||"(no description)"}var cw=[{background:"#fff7ed",borderColor:"#fdba74",color:"#9a3412"},{background:"#eff6ff",borderColor:"#93c5fd",color:"#1d4ed8"},{background:"#ecfeff",borderColor:"#67e8f9",color:"#0f766e"},{background:"#f0fdf4",borderColor:"#86efac",color:"#166534"},{background:"#fdf4ff",borderColor:"#f0abfc",color:"#a21caf"}];function g_(e){let t=new Map;return[...new Set(e.filter(gr).map(r=>r.linked_group_id))].forEach((r,i)=>{let n=i%26;t.set(r,{token:String.fromCharCode(65+n),bubbleStyle:cw[i%cw.length]})}),t}function gr(e){return!1}function zn(e){if(!e.linked_group_id)return null;let t=e.linked_group_label||"Linked group",a=e.linked_group_role==="anchor"?"anchor":e.linked_group_role==="dependent"?"dependent":"member",r=e.linked_group_shared_width_mm!=null?`, ${e.linked_group_shared_width_mm}mm family`:"";return`${t} (${a}${r})`}function wd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function h_(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,5),l=o.some(c=>c.product_id===a)?void 0:e.find(c=>c.product_id===a);return l?[...o,l]:o}let i=new Map(e.map(o=>[o.product_id,o])),n=r.map(o=>i.get(o)).filter(o=>o!=null);if(a&&!n.some(o=>o.product_id===a)){let o=i.get(a);o&&n.unshift(o)}return[...new Map(n.map(o=>[o.product_id,o])).values()].slice(0,5)}function Ws(e){let t=e?.rerank?.recommendedCandidateIds??[];if(t.length===0||!e)return[];let a=new Map(e.candidates.map(r=>[r.product_id,r]));return t.map(r=>a.get(r)).filter(r=>r!=null)}function ec(e){if(e>=6e4){let t=Math.floor(e/6e4),a=Math.round(e%6e4/1e3);return a===60?`${t+1}m`:`${t}m ${a}s`}return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}s`:`${e}ms`}function b_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:i}){let n=[...t].sort((l,c)=>c.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-n.length);return(0,s.jsxs)("div",{className:"results-detail-block",style:{marginBottom:18},children:[(0,s.jsx)("h3",{style:{margin:"0 0 12px"},children:"Pipeline timings"}),(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:12},children:[(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:ec(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:i})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:ec(r)})," LLM time"]})]}),(0,s.jsxs)("table",{className:"score-breakdown-table",style:{marginBottom:14},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Process stage"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:e.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:ec(l.durationMs)})]},`${l.key}-${c}`))})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{style:{margin:"0 0 10px"},children:"LLM calls"}),(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Call"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:n.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:ec(l.durationMs)})]},`${l.key}-${c}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",n.length," of ",t.length," LLM calls."]})]})]})}function v_({queries:e}){return e.length===0?null:(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Retrieval by procurement query"}),e.map((t,a)=>(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsxs)("div",{className:"results-row-meta",style:{marginBottom:6},children:["Query: ",(0,s.jsx)("strong",{children:t.query})]}),t.candidates.length===0?(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates returned for this query."}):(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Unit"}),(0,s.jsx)("th",{children:"bm25"})]})}),(0,s.jsx)("tbody",{children:t.candidates.slice(0,5).map((r,i)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:r.description}),(0,s.jsx)("div",{className:"results-row-meta",children:r.product_id})]}),(0,s.jsx)("td",{children:_d(r.measurements_mm)}),(0,s.jsx)("td",{children:el(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${i}`))})]})]},`${t.query}-${a}`))]})}function uw({item:e,result:t}){let a=t?.retrieval_debug.map(i=>i.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Mn(e.procurement_aliases)],["Retrieval queries",Mn(a)],["Category",e.attrs.category||"-"],["Fine category",e.attrs.category_fine||"-"],["Brand",e.attrs.brand||"-"],["Material",e.attrs.material||"-"],["Grade / standard",e.attrs.grade_standard||"-"],["Treatment",e.attrs.treatment||"-"],["Supply nature",e.attrs.supply_nature||"-"],["Measurements (mm)",_d(e.attrs.measurements_mm)],["Stock length",f_(e.attrs.stock_length_mm)],["Matching mode",e.matching_mode||"-"],["Build-up type",e.build_up_type||"-"],["Layer count",e.layer_count!=null?String(e.layer_count):"-"],["Required thickness (mm)",e.total_required_thickness_mm!=null?String(e.total_required_thickness_mm):"-"],["Allowed layer thicknesses (mm)",e.acceptable_layer_thicknesses_mm.length>0?e.acceptable_layer_thicknesses_mm.join(", "):"-"],["Installation clues",Mn(e.installation_clues)],["System clues",Mn(e.system_clues)],["Component requirements",Mn(e.component_requirements)],["Linked group",zn(e)||"-"],["Flags",Mn(e.flags)]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Search context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:r.map(([i,n])=>(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:i}),(0,s.jsx)("dd",{children:n})]},i))})]})}function w_({item:e}){let t=e.decomposition_debug;return t?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Decomposition"}),(0,s.jsxs)("dl",{className:"results-detail-grid",children:[(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned intents"}),(0,s.jsx)("dd",{children:t.items.length>0?t.items.map(a=>`${a.intent}${a.inherits_quantity?" (inherits qty)":""}`).join(", "):"-"})]})]})]}):null}function y_({result:e}){let t=e?.adjudication_debug;if(!t)return null;let a=[["Dependent rerank applied",t.dependent_rerank_applied?"yes":"no"],["Linked parent selected product",t.linked_parent_selected_candidate_description||t.linked_parent_selected_candidate_id||"-"],["Dimension reason overridden",t.dimension_reason_overridden?"yes":"no"]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Adjudication context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:a.map(([r,i])=>(0,s.jsxs)(Ne.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:i})]},r))}),t.rerank_line_item_input?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h5",{style:{margin:"12px 0 8px"},children:"Rerank input"}),(0,s.jsx)("pre",{className:"results-pre",children:JSON.stringify(t.rerank_line_item_input,null,2)})]}):null]})}function __({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:i=!1,linkedGroupMeta:n}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"Exact match not found:":`AI review (${t.confidence??"confidence not stated"}):`;return i?t.reason?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),gr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",zn(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(uw,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(uw,{item:e,result:a}),r&&(0,s.jsx)(w_,{item:e}),r&&(0,s.jsx)(y_,{result:a}),t.reason&&(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),gr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",zn(e)]}):null]}),r&&(0,s.jsx)(v_,{queries:a?.retrieval_debug??[]})]})}function x_({item:e,candidates:t,result:a,decision:r,unmatchable:i,selectedProductId:n,detailMode:o,onPick:l,onClear:c,showAll:p=!1,internal:d=!1,debugEnabled:g=!1,forceReviewNote:f=!1,linkedGroupMeta:h}){let w=d||o==="detailed",M=g&&o==="detailed",D=w||f?(0,s.jsx)(__,{item:e,decision:r,result:a,showRetrievalDebug:M,reviewOnly:f&&!w,linkedGroupMeta:h}):null;if(i)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"Classified as labour/plant or referencing another line item - skipped by design."})]});if(t.length===0)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let m=p||d||o==="detailed"?t:h_(t,a,n);return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Price"}),M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("th",{children:"dimension"}),(0,s.jsx)("th",{children:"grade"}),(0,s.jsx)("th",{children:"brand"}),(0,s.jsx)("th",{children:"fuzzy"}),(0,s.jsx)("th",{children:"bm25"}),(0,s.jsx)("th",{children:"overall"})]}),(0,s.jsx)("th",{"aria-label":"Actions"})]})}),(0,s.jsx)("tbody",{children:m.map((u,b)=>{let v=u.product_id===n;return(0,s.jsxs)("tr",{className:v?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:u.description}),(0,s.jsx)("div",{className:"results-row-meta",children:u.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:_d(u.measurements_mm??u.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:Tn(u.price,u.price_basis)}),M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(u.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.bm25??0).toFixed(2)}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(m_,{band:pw(u.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(u.scores?.overall??0).toFixed(2)})]})})]}),(0,s.jsx)("td",{children:(0,s.jsxs)("label",{className:"switch-toggle",title:v?"Currently selected":"Use this candidate",children:[(0,s.jsx)("input",{type:"checkbox",checked:v,onChange:()=>{v?c?.():l(u)},"aria-label":v?`${u.description} selected`:`Use ${u.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${u.product_id}-${b}`)})})]})]})}function xd({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:i,onGoToBasket:n,cartSeeded:o,onCartSeeded:l,reviewGateComplete:c,onReviewGateComplete:p,internal:d=!1}){let g=!d&&Vs()==="QZA6-MRA4",f=g?"quote":"basket",{results:h,lineItems:w,parseReport:M,timings:D}=e,[m,u]=(0,Ne.useState)({}),b=Sn(),[v,N]=(0,Ne.useState)({}),[A,T]=(0,Ne.useState)({}),[z,G]=(0,Ne.useState)(""),[P,be]=(0,Ne.useState)(null),[De,Le]=(0,Ne.useState)(1),He=Ht().debug===!0,[ze,me]=(0,Ne.useState)("simple"),[ce,fe]=(0,Ne.useState)(d?"list":"tile"),[Ee,ut]=(0,Ne.useState)(!1),[Se,Z]=(0,Ne.useState)(null),[de,Je]=(0,Ne.useState)(""),[Ye,pt]=(0,Ne.useState)([]),[ot,at]=(0,Ne.useState)(!1),[ge,W]=(0,Ne.useState)(null),[k,R]=(0,Ne.useState)(!1),[E,O]=(0,Ne.useState)(null),ee=(0,Ne.useRef)(null),[xe,we]=(0,Ne.useState)(new Set),[y,j]=(0,Ne.useState)(new Set),[B,ae]=(0,Ne.useState)(!1);(0,Ne.useEffect)(()=>{Le(1)},[z,P,ce]);let te=new Map(h.map(x=>[x.line_id,x])),q=g_(w),Y=w.map(x=>{let H=te.get(x.line_id),ye=H?.decision,ft=u_(x),Ke=m[x.line_id],ea=p_(H,Ke),Ti=a[x.line_id],$w=Ke===yd?void 0:v[x.line_id]??(Ti&&Ti.productId!==ea?.product_id?sw(Ti):ea),sm=ft?void 0:$w,Zw=x.qty??0;return{item:x,result:H,decision:ye,unmatchable:ft,best:sm,qty:Zw,band:pw(sm?.scores?.overall)}}),K=Fs(Object.values(a),{wasteFactorEnabled:!1,wasteFactorOverride:0}),pe=0;for(let x of Y){if(x.unmatchable||x.decision?.include_in_quote!==!0||!x.best)continue;let H=a[x.item.line_id];(!H||Dt(H).lineTotal==null)&&(pe+=1)}pe>0&&(K=null);let ke=x=>!x.unmatchable&&!x.best&&x.decision?.technical_classification!=="no_suitable_candidate"&&Ws(x.result).length>0,Ie=x=>x.best??Ws(x.result)[0],pa=Y.filter(x=>!x.unmatchable&&!x.best).filter(x=>!y.has(x.item.line_id)),ul=Y.filter(x=>y.has(x.item.line_id)),da=Y;if(z.trim()){let x=z.trim().toLowerCase();da=da.filter(H=>H.item.description_original?.toLowerCase().includes(x)||Ie(H)?.description?.toLowerCase().includes(x))}if(P){let x=P==="asc"?1:-1;da=[...da].sort((H,ye)=>x*(H.item.description_original||"").localeCompare(ye.item.description_original||""))}let Qn=Math.max(1,Math.ceil(da.length/rl)),Wt=Math.min(De,Qn),wr=da.slice((Wt-1)*rl,Wt*rl),$a=wr.filter(x=>!x.unmatchable&&x.best),Wd=wr.filter(x=>ke(x)),Gn=wr.filter(x=>!x.unmatchable&&(x.best||ke(x))),em=wr.filter(x=>x.unmatchable||!x.best&&!ke(x)),J=Se?Y.find(x=>x.item.line_id===Se)??null:null,Hw=!d&&!c&&!J&&pa.length>0,Yn=(0,Ne.useRef)(null),Xn=()=>{let x=ee.current;if(!x)return;let{top:H,left:ye,width:ft,height:Ke}=x.getBoundingClientRect(),Ti=x.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;O({top:H,left:ye,width:Ti?Ti-ye:ft,height:Ke})};(0,Ne.useEffect)(()=>(window.addEventListener("scroll",Xn,!0),window.addEventListener("resize",Xn),()=>{window.removeEventListener("scroll",Xn,!0),window.removeEventListener("resize",Xn)})),(0,Ne.useEffect)(()=>{let x=H=>{Yn.current&&!H.composedPath().includes(Yn.current)&&Yn.current.removeAttribute("open")};return document.addEventListener("click",x),()=>document.removeEventListener("click",x)},[]);let qi=x=>{Z(x),Je("")},jw=()=>{if(!Se)return;let x=a[Se];if(x){u(H=>({...H,[Se]:x.productId})),N(H=>({...H,[Se]:sw(x)}));return}u(H=>{let ye={...H};return delete ye[Se],ye}),N(H=>{let ye={...H};return delete ye[Se],ye})},Za=(x=!1)=>{let H=Se?a[Se]:void 0;!x&&H&&J?.best&&H.productId!==J.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(x||jw(),Z(null),ae(!1))};Fo(k,()=>R(!1)),Fo(!!J&&!k,()=>Za());let Qw=x=>{if(we(H=>new Set(H).add(x)),pa.some(H=>H.item.line_id!==x)){Za(!0);return}p(),Za(!0)},Gw=x=>{if(_c(x),j(H=>new Set(H).add(x)),pa.some(H=>H.item.line_id!==x)){Za(!0);return}p(),Za(!0)},Yw=()=>{j(x=>new Set([...x,...pa.map(H=>H.item.line_id)])),p()},tm=()=>{J?.best&&(rm(J.item.line_id,J.best),r(Ei(J)),B?Qw(J.item.line_id):Za(!0))},am=em.length>0?(0,s.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,s.jsxs)("div",{className:"results-tile-section__head",children:[(0,s.jsx)("h3",{children:"Require Matching"}),(0,s.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,s.jsx)("div",{className:"results-unmatched-list",children:em.map(x=>{let{item:H,qty:ye}=x;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>qi(H.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Ir(H,w)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},H.line_id)})})]}):null,_c=x=>{u(H=>({...H,[x]:yd})),N(H=>({...H,[x]:void 0})),T(H=>({...H,[x]:void 0})),i(x)},xc=(x,H)=>{u(ye=>({...ye,[x]:H.product_id})),N(ye=>({...ye,[x]:H}))},rm=(x,H)=>{H.method==="catalogue_search"&&T(ye=>({...ye,[x]:H}))};function dx(){b("downloaded",{type:"schedule",lines:Y.length}),ow(Y.map(({item:x,best:H,qty:ye,band:ft,unmatchable:Ke,decision:ea})=>({item:x,best:H,qty:ye,band:ft,unmatchable:Ke,decision:ea})))}function Ei(x){let H=x.best??Ws(x.result)[0];return Jr(H,{lineId:x.item.line_id,description:x.item.description_original,unit:x.item.unit,qty:x.qty,linkedContext:x.item.linked_group_role==="dependent"&&x.item.linked_group_id?w.filter(ye=>ye.linked_group_id===x.item.linked_group_id&&ye.linked_group_role==="anchor").slice(0,1).map(ye=>{let ft=a[ye.line_id];return{line_id:ye.line_id,product_id:ft?.productId??null,measurements_mm:ft?.measurementsMm??ye.attrs.measurements_mm,description:ft?.description??ye.description_original,qty:ye.qty,unit:ye.unit,role:"anchor"}}):void 0})}(0,Ne.useEffect)(()=>{if(!o){for(let x of Y)!x.unmatchable&&x.best&&r(Ei(x));l()}},[o]),(0,Ne.useEffect)(()=>{for(let x of Y)!a[x.item.line_id]&&!x.unmatchable&&x.best&&r(Ei(x))},[e]),(0,Ne.useEffect)(()=>{if(!Se){pt([]),W(null),at(!1);return}let x=de.trim();if(!x){pt([]),W(null),at(!1);return}let H=!1,ye=window.setTimeout(async()=>{try{at(!0),W(null);let ft=await fetch(jt(`/api/catalogue/search?q=${encodeURIComponent(x)}`),{headers:vi()}),Ke=await Jt(ft);if(!ft.ok)throw new Error(Ke?.error||Ke?.message||"Failed to search catalogue");H||pt(Array.isArray(Ke?.items)?Ke.items:[])}catch(ft){H||(pt([]),W(ft?.message||"Failed to search catalogue"))}finally{H||at(!1)}},250);return()=>{H=!0,window.clearTimeout(ye)}},[de,Se]);let kc=Object.keys(a).length,Ma=de.trim(),im=Ws(J?.result),pl=J?.decision?.technical_classification==="no_suitable_candidate"||!!J&&!J.best,nm=J?.decision?.technical_classification!=null,om=J?.decision?.reason??(pl?"No catalogue candidate found. Refine the request or search the catalogue.":null),Xw=Ye.map(x=>({product_id:x.product_id,description:x.description,source_list:x.source_list,price:x.price,price_basis:x.price_basis,uoi_count:x.uoi_count??null,uoi:x.uoi,pdp_photo_url:x.pdp_photo_url??null,conversion:x.conversion,measurements_mm:x.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"catalogue_search"})),Vn=Ma?Xw:im,Mi=J?A[J.item.line_id]:void 0,$n=!Ma&&Mi&&!Vn.some(x=>x.product_id===Mi.product_id)?[...Vn,Mi]:Vn,lm=(()=>{let x=$n.slice(0,Ma?12:3);return Ma||!Mi||x.some(H=>H.product_id===Mi.product_id)?x:[...x,Mi]})(),dl=!!J?.best&&a[J.item.line_id]?.productId===J.best.product_id,Vw=!!J?.best&&!!a[J.item.line_id]&&!dl;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${d?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${d?"":" quick-order-hero--customer"}`,children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,s.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,s.jsx)("h1",{children:"Your Results"}),(0,s.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,s.jsx)("strong",{children:K==null?"Calculating\u2026":nt(K)})," Est. total"]})]}),(0,s.jsx)("p",{children:"Each line item from your schedule matched against your catalogue, ranked by confidence."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:"Review your matched products"}),(0,s.jsxs)("p",{children:["Check you're happy with these items, then click ",g?"View Quote":"View Basket"," to continue."]})]}),(0,s.jsxs)("button",{type:"button",className:"results-total-action",onClick:n,"aria-label":g?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:g?"View Quote":"View Basket"}),(0,s.jsx)("strong",{children:K==null?"Calculating\u2026":nt(K)})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[He&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":Ee,onClick:()=>ut(x=>!x),children:Ee?"Hide timings":"Show timings"})}),He&&Ee&&(0,s.jsx)(b_,{...D}),!g&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!J&&(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:0},children:[pe>0&&(0,s.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,s.jsx)("strong",{children:pe})," need pricing"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:z,onChange:x=>G(x.target.value),"aria-label":"Search line items"}),!d&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${ce==="tile"?" is-active":""}`,"aria-pressed":ce==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>fe("tile"),children:(0,s.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,s.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,s.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${ce==="list"?" is-active":""}`,"aria-pressed":ce==="list","aria-label":"List view",title:"List view",onClick:()=>fe("list"),children:(0,s.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,s.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,s.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,s.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),He&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>me(x=>x==="simple"?"detailed":"simple"),children:ze==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:Yn,style:{position:"relative"},children:[(0,s.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort line items",style:{fontSize:16},children:"\u21C5"}),(0,s.jsx)("div",{className:"sort-menu-panel",children:c_.map(x=>{let H=P===x.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${H?" is-active":""}`,onClick:()=>{be(H?null:x.dir),Yn.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:H?"\u2713":""}),x.label]},x.dir)})})]})]})]})}),ce==="tile"||J?(0,s.jsxs)(s.Fragment,{children:[J?(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Product options",onClick:()=>Za(),children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal results-review-modal",onClick:x=>x.stopPropagation(),children:[(0,s.jsx)("button",{type:"button",className:"quick-order-workflow-close results-review-modal__close",onClick:()=>Za(),"aria-label":"Close product options",children:(0,s.jsx)(Jo,{})}),(0,s.jsx)("div",{className:"results-review-page",children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"results-review-page__top",children:[(0,s.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:()=>Za(),children:[(0,s.jsx)(Pr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[He&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>me(x=>x==="simple"?"detailed":"simple"),children:ze==="detailed"?"Hide detailed info":"Show detailed info"}),(0,s.jsx)("div",{className:"results-review-searchbar",children:(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:de,onChange:x=>Je(x.target.value),"aria-label":"Search database candidates"})}),(0,s.jsx)("div",{className:"results-candidate-actions",children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>_c(J.item.line_id),children:"Clear selected product"})})]})]}),(0,s.jsxs)("div",{className:"results-review-page__hero",children:[(0,s.jsx)("div",{className:"results-review-page__image-wrap",children:(0,s.jsx)("img",{className:"fill-img results-review-page__image",src:Ya(Ie(J)?.description||J.item.description_original,Ie(J)?.product_id,Ie(J)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Ir(J.item,w)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[yi(J.qty)," ",Sa(J.item.unit,J.qty)]}),J.best?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:J.best.description}),J.best.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Tn(J.best.price,J.best.price_basis)}):null]}):Ie(J)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:Ie(J)?.description}),Ie(J)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Tn(Ie(J)?.price??null,Ie(J)?.price_basis??null)}):null,(0,s.jsx)("div",{className:"results-row-meta",children:"Best reviewed alternative - not yet selected"})]}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),gr(J.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(wd,{meta:q.get(J.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:zn(J.item)})]}):null,(0,s.jsx)("div",{className:"results-review-page__actions",children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[J.item.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[J.item.line_id]?i(J.item.line_id):(J.best&&rm(J.item.line_id,J.best),r(Ei(J)))},disabled:!J.best,"aria-label":a[J.item.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[J.item.line_id]?"\u2713 Added":d?"+ Add to selection":`Add to ${f}`})})]})]}),ot?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!ot&&ge?(0,s.jsx)("div",{className:"results-empty-card",children:ge}):null,!ot&&!ge&&Ma&&Vn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!ot&&!ge?(0,s.jsx)(x_,{item:J.item,candidates:Vn,result:J.result,decision:J.decision,unmatchable:J.unmatchable,selectedProductId:J.best?.product_id??null,detailMode:ze,linkedGroupMeta:gr(J.item)?q.get(J.item.linked_group_id):void 0,onPick:x=>xc(J.item.line_id,x),onClear:()=>_c(J.item.line_id),showAll:d||He||Ma.length>0,internal:d,debugEnabled:He,forceReviewNote:!0}):null]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("section",{className:"customer-review-request",children:[(0,s.jsx)("span",{className:"customer-review-eyebrow",children:"Original request"}),(0,s.jsx)("strong",{children:Ir(J.item,w)||"Original request"})]}),om?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:pl?"Exact match not found:":"AI review:"})," ",om]}):null,(0,s.jsxs)("section",{className:"customer-review-options",children:[(0,s.jsx)("div",{className:"customer-review-options__head",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{children:pl?"We couldn't find a suitable product":nm?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:pl?im.length>0?"These AI-reviewed alternatives may be useful, but need approval.":"Search the catalogue to choose an alternative.":nm?`Select the option you want to add to your ${f}.`:"Search the catalogue to choose a product."})]})}),!Ma&&$n.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:lm.map(x=>{let H=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${H?" is-selected":""}`,onClick:()=>xc(J.item.line_id,x),"aria-pressed":H,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ya(x.description,x.product_id,x.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:x.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:x.price!=null?`\xA3${Tn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:H?"Selected":"Choose"})]},x.product_id)})}):null,$n.length>0&&(0,s.jsx)("div",{className:"customer-review-divider",children:(0,s.jsx)("span",{children:"or"})}),(0,s.jsxs)("label",{className:"customer-review-search",children:[(0,s.jsx)("span",{children:"Search our full catalogue"}),(0,s.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products...",value:de,onChange:x=>Je(x.target.value),"aria-label":"Search catalogue"})]}),Ma&&ot?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,Ma&&!ot&&ge?(0,s.jsx)("div",{className:"results-empty-card",children:ge}):null,Ma&&!ot&&!ge&&$n.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,Ma&&!ot&&!ge&&$n.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:lm.map(x=>{let H=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${H?" is-selected":""}`,onClick:()=>xc(J.item.line_id,x),"aria-pressed":H,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ya(x.description,x.product_id,x.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:x.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:x.price!=null?`\xA3${Tn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:H?"Selected":"Choose"})]},x.product_id)})}):null]}),J.best?Vw?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{tm()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>i(J.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${f}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${dl?" cta-btn-secondary":""}`,onClick:()=>{dl?i(J.item.line_id):tm()},children:(0,s.jsx)("span",{children:dl?`Remove from ${f}`:`Add selected product to ${f}`})}):null,B?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>Gw(J.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[da.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,Gn.length>0?(0,s.jsx)("section",{className:"results-tile-section","aria-label":"Matched and review items",children:(0,s.jsx)("div",{className:"results-tile-grid",children:Gn.map(x=>{let{item:H,best:ye,qty:ft}=x,Ke=Ie(x),ea=!ye&&ke(x);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>qi(H.line_id),"aria-label":`Review match for ${Ir(H,w)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[ea||gr(H)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[gr(H)?(0,s.jsx)(wd,{meta:q.get(H.linked_group_id)}):(0,s.jsx)("span",{}),ea?(0,s.jsx)("span",{style:{padding:"6px 10px",borderRadius:999,background:"#fef3c7",color:"#92400e",fontSize:12,fontWeight:700,lineHeight:1},children:"Partially matched"}):null]}):null,(0,s.jsx)("img",{className:"fill-img results-tile-card__image",src:Ya(Ke?.description||H.description_original,Ke?.product_id,Ke?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Ke?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"results-tile-card__heading",children:(0,s.jsx)("div",{className:"results-tile-card__title",children:Ke.description})})}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),(0,s.jsx)("div",{className:"results-tile-card__match",children:Ke?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:ea?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Ir(H,w)}),gr(H)?(0,s.jsx)("div",{className:"results-row-meta",children:zn(H)}):null]}):(0,s.jsx)("span",{className:"results-empty-hint",children:"No matched product selected."})})]}),(0,s.jsx)("span",{className:"results-tile-card__hover-prompt","aria-hidden":"true",children:"Click to view options"})]}),(0,s.jsxs)("div",{className:"results-tile-card__actions",children:[d&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>qi(H.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[H.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[H.line_id]?i(H.line_id):r(Ei(x))},disabled:!Ke,"aria-label":a[H.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[H.line_id]?"\u2713 Added":d?"+ Add":`Add to ${f}`})]})]},H.line_id)})})}):null,am]})]}):(0,s.jsxs)(s.Fragment,{children:[E&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:E,"aria-hidden":"true",children:"Click to view options"}),(0,s.jsx)("div",{className:"bom-table-wrap",children:(0,s.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched line items",children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:"col-item"}),(0,s.jsx)("col",{style:{width:"220px"}}),(0,s.jsx)("col",{style:{width:"100px"}}),ze==="simple"&&(0,s.jsx)("col",{style:{width:"110px"}})]}),(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bom-col-header",children:[(0,s.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,s.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,s.jsx)("th",{style:{textAlign:"center"},children:"Price"}),ze==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:d?"Selection":g?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[da.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:ze==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),Gn.map(x=>{let{item:H,result:ye,decision:ft,best:Ke}=x;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>qi(H.line_id),onMouseEnter:ea=>{ee.current=ea.currentTarget,Xn()},onMouseLeave:()=>{ee.current=null,O(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Ir(H,w)}),gr(H)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(wd,{meta:q.get(H.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:zn(H)})]}):null]}),(0,s.jsx)("td",{children:Ke?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Ke.description,children:Ke.description}),ze==="detailed"&&ft?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[d_(ft.technical_classification),ft.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Ke?.price!=null?Tn(Ke.price,Ke.price_basis):"-"}),ze==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[H.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:ea=>{ea.stopPropagation(),a[H.line_id]?i(H.line_id):r(Ei(x))},"aria-label":a[H.line_id]?d?"Remove from selection":`Remove from ${f}`:d?"Add to selection":`Add to ${f}`,children:a[H.line_id]?"\u2713 Added":d?"+ Add":`Add to ${f}`})})]},H.line_id)})]})]})}),am]}),!J&&Qn>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(Wt-1)*rl+1,"\u2013",Math.min(Wt*rl,da.length)," of ",da.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Le(Wt-1),disabled:Wt===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",Wt," of ",Qn]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Le(Wt+1),disabled:Wt===Qn,children:"Next"})]})]}),(M.itemCount!=null||M.headingCount!=null||M.skippedCount!=null)&&(0,s.jsxs)("div",{className:"results-summary",style:{marginTop:16},children:[M.itemCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.itemCount})," items parsed"]}),M.headingCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.headingCount})," headings"]}),M.skippedCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:M.skippedCount})," rows skipped"]})]}),(0,s.jsxs)("div",{className:"disclaimer-box",children:[(0,s.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,s.jsx)("p",{className:"disclaimer-text",children:"These matches are generated automatically and should be reviewed before purchase."})]}),!J&&(0,s.jsxs)("div",{className:"btn-row results-actions",children:[(0,s.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:(kc>0,"0 1 30%"),gap:10,justifyContent:"center"},onClick:()=>R(!0),"aria-label":"Start over",children:[(0,s.jsx)(hd,{}),(0,s.jsx)("span",{children:"Start Over"})]}),kc>0&&(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:n,"aria-label":d?"View selection":g?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[d?"View Selection":g?"View Quote":"View Basket"," (",kc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})]})]}),Hw&&(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop review-gate-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"review-gate-title",children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal review-gate-modal",children:[(0,s.jsxs)("div",{className:"review-gate-modal__header",children:[(0,s.jsx)("h2",{id:"review-gate-title",children:"Choose products for these items"}),(0,s.jsx)("p",{children:"We couldn\u2019t find a clear match for these items, so we need your help. Select an option from the suggestions, search the catalogue, or leave the item out."})]}),(0,s.jsx)("div",{className:"review-gate-list",children:pa.map(x=>{let H=xe.has(x.item.line_id),ye=ke(x);return(0,s.jsx)("div",{className:`review-gate-item${H?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{ae(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Ir(x.item,w)}),(0,s.jsx)("span",{children:x.decision?.reason||(ye?"A close alternative is available but needs confirmation.":"No product has been selected for this item yet.")})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:H?"Choice made":"Choose a product"})]})},x.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:Yw,children:"Skip all"}),ul.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),ul.map(x=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{j(H=>{let ye=new Set(H);return ye.delete(x.item.line_id),ye}),ae(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Ir(x.item,w)}),(0,s.jsx)("span",{children:`Not added to your ${f}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},x.item.line_id))]}):null]})}),k&&(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop start-over-modal",role:"dialog","aria-modal":"true","aria-labelledby":"start-over-modal-title",children:(0,s.jsxs)("div",{className:"modal-card start-over-modal__card",children:[(0,s.jsx)("h2",{id:"start-over-modal-title",className:"modal-title",children:"Start over?"}),(0,s.jsxs)("p",{className:"modal-body",children:["This will clear the current results and ",g?"quote":"basket"," and take you back to the start."]}),(0,s.jsxs)("div",{className:"modal-actions",children:[(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-secondary",onClick:()=>R(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{R(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var _t=X(Xe());var C=X(ie()),k_=.2,il=10,dw="Enter a valid email address so we can send your quote.",N_=(e,t)=>{let a=`${t.requestedAmount} ${Na(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${Na(t.sellUnit,t.requiredSellUnits??0)}`,i=e.unitConversions?.find(n=>n.requestUom===t.requestedUnit);return i&&i.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/i.quantityPerSaleUnit)} ${Na(t.sellUnit,2)} per ${Na(t.requestedUnit,1)})`:e.coverageQty&&/^m per /i.test(e.coverageUom??"")?`${a} requested \u2192 order ${r} (${e.coverageQty} ${e.coverageUom})`:`${a} requested \u2192 order ${r}`},S_=e=>["box","pack"].includes(e.requestedUnit)?"Pack size needed to calculate the order quantity.":`This product is sold by ${Na(e.sellUnit,1)}.`;function C_(){return(0,C.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,C.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,C.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,C.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function nl(){return(0,C.jsx)("svg",{width:"8",height:"5",viewBox:"0 0 8 5",fill:"none",children:(0,C.jsx)("path",{d:"M1 4L4 1L7 4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function ol({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:i,onBack:n,onStartNewQuote:o,onQuoteRequested:l,internal:c=!1}){let p=(0,_t.useId)(),d=!c&&Vs()==="QZA6-MRA4",g=Object.values(e),[f,h]=(0,_t.useState)(""),[w,M]=(0,_t.useState)(!1),[D,m]=(0,_t.useState)(!1),u=Sn(),[b,v]=(0,_t.useState)(""),[N,A]=(0,_t.useState)({}),[T,z]=(0,_t.useState)({}),[G,P]=(0,_t.useState)(1),[be,De]=(0,_t.useState)({}),[Le,He]=(0,_t.useState)(!1),[ze,me]=(0,_t.useState)("0"),ce=(0,_t.useRef)(new Set);(0,_t.useEffect)(()=>{if(!r)return;for(let O of Object.values(e))Dt(O).requiredSellUnits!=null&&ce.current.delete(O.lineId);let E=Object.values(e).filter(O=>O.productId!=="-"&&Dt(O).requiredSellUnits==null&&!ce.current.has(O.lineId));E.length!==0&&(E.forEach(O=>ce.current.add(O.lineId)),fetch(jt("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:E.map(O=>({line_id:O.lineId,product_id:O.productId,requested_description:O.requestedDescription??O.description,requested_qty:O.qty,requested_uom:O.unit||null,linked_context:O.linkedContext??[],selected_description:O.description,selected_uoi:O.uoi,selected_uoi_count:O.uoiCount,selected_conversion:{sales_uom_normalised:O.salesUomNormalised,conversion_type:O.conversionType,sales_unit_size:O.salesUnitSize,sales_unit_size_uom:O.salesUnitSizeUom,coverage_qty:O.coverageQty,coverage_uom:O.coverageUom}}))})}).then(O=>O.ok?Jt(O):null).then(O=>{let ee={};for(let xe of O?.data?.items??O?.items??[]){let we=xe?.conversion;if(!we||typeof xe?.line_id!="string")continue;let y=e[xe.line_id];ee[xe.line_id]={conversionType:we.conversion_type,requestUomsSupported:we.request_uoms_supported,salesUomNormalised:we.sales_uom_normalised,salesUnitSize:we.sales_unit_size,salesUnitSizeUom:we.sales_unit_size_uom,coverageQty:we.coverage_qty,coverageUom:we.coverage_uom,roundingRule:we.rounding_rule,conversionConfidence:we.conversion_confidence,conversionNotes:we.conversion_notes,...y?.qty===0&&Number.isFinite(we.suggested_order_qty)&&we.suggested_order_qty>0?{qty:we.suggested_order_qty,unit:we.suggested_order_uom||y.unit}:{}}}Object.keys(ee).length>0&&r(ee)}).catch(O=>console.error("Catalogue conversion resolution failed",O)))},[e,r]);function fe(E){A(O=>{let ee={...O};return delete ee[E],ee})}function Ee(E,O){let ee=parseFloat(O);!isNaN(ee)&&ee>=0&&t(E,Math.min(ee,1e5)),fe(E)}function ut(E,O,ee){t(E,Math.min(1e5,Math.max(0,O+ee))),fe(E)}function Se(E){z(O=>{let ee={...O};return delete ee[E],ee})}function Z(E,O){let ee=parseFloat(O);!isNaN(ee)&&ee>=0&&a(E,Math.min(ee,1e5)),Se(E)}function de(E,O,ee){a(E,Math.min(1e5,Math.max(0,O+ee))),Se(E)}async function Je(){let E=f.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(E)){v(dw);return}v(""),m(!0);try{let O=await fetch(jt("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({email:E,items:Ye.map(({item:ee,pricing:xe})=>{let we=xe.requiredSellUnits??xe.requestedAmount,y=xe.requiredSellUnits!=null?xe.sellUnit:xe.requestedUnit;return{product_id:ee.productId,description:ee.description,quantity:we,unit:Na(y,we),unit_price:xe.requiredSellUnits!=null?xe.unitPrice:null,line_total:xe.lineTotal}})})});if(!O.ok){let ee=await Jt(O);console.error("Quote request failed",O.status,ee?.message),v(O.status===429?"You've sent a few requests already. Please try again in a few minutes.":"Your request couldn't be sent. Please try again, or contact us if it keeps happening.");return}u("quote_requested",{items:Ye.length,total:Math.round(at*100)/100}),M(!0),l?.(),window.scrollTo(0,0)}catch{v("Your request couldn't be sent. Check your connection and try again.")}finally{m(!1)}}let Ye=g.map(E=>({item:E,pricing:Dt(E,{wasteFactorEnabled:Le,wasteFactorOverride:Math.max(0,Number.parseFloat(ze)||0)/100})})),pt=Fs(g,{wasteFactorEnabled:Le,wasteFactorOverride:Math.max(0,Number.parseFloat(ze)||0)/100}),ot=pt*k_,at=pt+ot,ge=(0,_t.useRef)({items:Ye.length,total:Math.round(at*100)/100});(0,_t.useEffect)(()=>{u("basket_viewed",ge.current)},[u]);let W=Math.max(1,Math.ceil(Ye.length/il)),k=Math.min(G,W),R=Ye.slice((k-1)*il,k*il);return w?(0,C.jsx)("div",{className:"wizard-step entry-stage",children:(0,C.jsxs)("div",{className:"quote-request-sent",role:"status",children:[(0,C.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,C.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,C.jsx)("polyline",{points:"5 12.5 10 17.5 19 7"})})}),(0,C.jsx)("h1",{children:"Quote requested"}),(0,C.jsxs)("p",{children:["You're all done. We'll email your sharper price to ",(0,C.jsx)("strong",{children:f.trim()}),", usually within one working day."]}),(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,C.jsx)("span",{children:"Start a new quote"})}),(0,C.jsx)("p",{className:"quote-request-sent-note",children:"Nothing is charged until you approve the quote."})]})}):!c&&g.length===0?(0,C.jsx)("div",{className:"wizard-step entry-stage",children:(0,C.jsxs)("div",{className:"quote-request-sent",children:[(0,C.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,C.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("path",{d:"M3 9h18l-2 11H5z"}),(0,C.jsx)("path",{d:"M8 9l4-6 4 6"})]})}),(0,C.jsx)("h1",{children:d?"Your quote request is empty":"Your basket is empty"}),(0,C.jsx)("p",{children:d?"Start again with your list to build your quote.":"Start again with your list to fill your basket."}),(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,C.jsx)("span",{children:"Back to start"})})]})}):(0,C.jsx)("div",{className:`wizard-step entry-stage${d?" basket-layout--qza6-mra4":""}`,children:(0,C.jsxs)("div",{className:`quick-order-card${c?"":" quick-order-card--customer"}`,children:[(0,C.jsxs)("div",{className:`quick-order-hero${c?"":" quick-order-hero--customer"}`,children:[c&&(0,C.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,C.jsxs)("div",{className:"basket-hero-copy",children:[d&&(0,C.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:n,children:[(0,C.jsx)(Pr,{}),(0,C.jsx)("span",{children:"Back to results"})]}),(0,C.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,C.jsx)("h1",{children:c?"Your Selection":d?"Request a quote":"Your Basket"}),c&&(0,C.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,C.jsx)("strong",{children:g.length})," ",g.length===1?"item":"items"]})]}),(0,C.jsx)("p",{children:c?"Review the items you've added before exporting them for review.":d?"Check your items and quantities below, and we'll do our best to beat list prices.":"Review your quantities and order summary before you buy."})]})]}),(0,C.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:g.length===0?(0,C.jsxs)("div",{className:"quick-order-history-empty",children:[(0,C.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:"\u{1F4CB}"}),(0,C.jsx)("p",{children:"Your selection is empty."}),(0,C.jsx)("p",{className:"basket-empty-hint",children:"Go back to your results and add quoted items."}),(0,C.jsx)("div",{className:"btn-row",style:{marginTop:20,justifyContent:"center"},children:(0,C.jsx)("button",{className:"cta-btn",style:{width:"auto",maxWidth:280},onClick:n,"aria-label":"Back to results",children:(0,C.jsx)("span",{children:"Back to Results"})})})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{className:"basket-layout",children:[(0,C.jsxs)("div",{className:"basket-main",children:[(0,C.jsx)("div",{className:"basket-list","aria-label":c?"Selection items":d?"Quote request items":"Basket items",children:R.map(({item:E,pricing:O})=>{let ee=N[E.lineId]??String(O.requestedAmount),xe=O.requestedUnit===O.sellUnit||O.costingMode==="review",we=O.requiredSellUnits==null||O.requestedAmount!==O.requiredSellUnits||O.requestedUnit!==O.sellUnit;return(0,C.jsxs)("article",{className:"basket-card",children:[(0,C.jsxs)("div",{className:"basket-card-top",children:[(0,C.jsx)("img",{className:"basket-card-thumb",src:Ya(E.description,E.productId,E.pdpPhotoUrl),alt:"",width:48,height:48}),(0,C.jsxs)("div",{className:"basket-card-info",children:[(0,C.jsx)("div",{className:"bom-component-name",children:E.description}),we&&O.costingMode!=="review"&&(0,C.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>De(y=>({...y,[E.lineId]:!y[E.lineId]})),"aria-expanded":!!be[E.lineId],children:["How we calculated this",(0,C.jsx)("span",{className:`basket-calc-toggle-chevron${be[E.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("div",{className:"basket-card-actions",children:(0,C.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>i(E.lineId),"aria-label":`Remove ${E.description}`,children:(0,C.jsx)(C_,{})})})]}),c&&(0,C.jsxs)("div",{className:"results-detail-block basket-internal-detail",children:[(0,C.jsxs)("dl",{className:"results-detail-grid",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Conversion type"}),(0,C.jsx)("dd",{children:E.conversionType??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Conversion confidence"}),(0,C.jsx)("dd",{children:E.conversionConfidence??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Sales unit"}),(0,C.jsx)("dd",{children:E.salesUnitSize!=null?(0,C.jsxs)(C.Fragment,{children:[E.salesUnitSize," ",Sa(E.salesUnitSizeUom,E.salesUnitSize)]}):"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Coverage"}),(0,C.jsx)("dd",{children:E.coverageQty!=null?(0,C.jsxs)(C.Fragment,{children:[E.coverageQty," ",Sa(E.coverageUom,E.coverageQty)]}):"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Waste factor"}),(0,C.jsx)("dd",{children:E.wasteFactorDefault??"-"})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("dt",{children:"Rounding rule"}),(0,C.jsx)("dd",{children:E.roundingRule??"-"})]})]}),E.conversionNotes&&(0,C.jsx)("p",{className:"results-rerank-note",children:E.conversionNotes})]}),O.costingMode==="review"?(0,C.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,C.jsx)("strong",{children:"Quantity needs confirmation."})," ",S_(O)]}):we&&be[E.lineId]?(0,C.jsx)("p",{className:"basket-calc-text",children:N_(E,O)}):null,(0,C.jsxs)("div",{className:"basket-card-stats",children:[(0,C.jsxs)("div",{className:"basket-stat",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Requested qty"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsxs)("div",{className:"basket-qty-field",children:[(0,C.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:ee,disabled:xe,onChange:y=>A(j=>({...j,[E.lineId]:y.target.value})),onBlur:y=>Ee(E.lineId,y.target.value),onKeyDown:y=>{y.key==="Enter"&&y.target.blur()},"aria-label":`${E.description} requested quantity`}),(0,C.jsxs)("div",{className:"basket-qty-arrows",children:[(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:xe,onClick:()=>ut(E.lineId,parseFloat(ee)||0,1),"aria-label":`Increase ${E.description} quantity`,children:(0,C.jsx)(nl,{})}),(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:xe,onClick:()=>ut(E.lineId,parseFloat(ee)||0,-1),"aria-label":`Decrease ${E.description} quantity`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("span",{className:"basket-metric-unit",children:Sa(O.requestedUnit,parseFloat(ee)||0)})]})]}),(0,C.jsxs)("div",{className:"basket-stat basket-stat--right",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Order qty"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsxs)("div",{className:"basket-qty-field",children:[(0,C.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:T[E.lineId]??String(O.requiredSellUnits??""),onChange:y=>z(j=>({...j,[E.lineId]:y.target.value})),onBlur:y=>Z(E.lineId,y.target.value),onKeyDown:y=>{y.key==="Enter"&&y.target.blur()},"aria-label":`${E.description} order quantity`}),(0,C.jsxs)("div",{className:"basket-qty-arrows",children:[(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>de(E.lineId,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${E.description} order quantity`,children:(0,C.jsx)(nl,{})}),(0,C.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>de(E.lineId,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${E.description} order quantity`,children:(0,C.jsx)(nl,{})})]})]}),(0,C.jsx)("span",{className:"basket-metric-unit",children:Sa(O.sellUnit,parseFloat(T[E.lineId]??String(O.requiredSellUnits??"0"))||0)})]})]}),(0,C.jsxs)("div",{className:"basket-stat basket-stat--total",children:[(0,C.jsx)("span",{className:"basket-stat-label",children:"Total"}),(0,C.jsxs)("div",{className:"basket-stat-value",children:[(0,C.jsx)("strong",{children:O.lineTotal!=null?nt(O.lineTotal):"-"}),O.lineTotal!=null&&(0,C.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},E.lineId)})}),W>1&&(0,C.jsxs)("div",{className:"results-pagination",children:[(0,C.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(k-1)*il+1,"\u2013",Math.min(k*il,Ye.length)," of ",Ye.length]}),(0,C.jsxs)("div",{className:"results-pagination-controls",children:[(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>P(k-1),disabled:k===1,children:"Previous"}),(0,C.jsxs)("span",{className:"results-pagination-page",children:["Page ",k," of ",W]}),(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>P(k+1),disabled:k===W,children:"Next"})]})]})]}),(0,C.jsxs)("aside",{className:"basket-sidebar",children:[(0,C.jsx)("div",{className:"basket-sidebar-title",children:d?"Quote request summary":"Order summary"}),(0,C.jsxs)("div",{className:"basket-sidebar-row",children:[(0,C.jsx)("span",{children:d?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,C.jsx)("span",{children:nt(pt)})]}),(0,C.jsxs)("div",{className:"basket-sidebar-row",children:[(0,C.jsx)("span",{children:"VAT (20%)"}),(0,C.jsx)("span",{children:nt(ot)})]}),(0,C.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,C.jsx)("span",{children:d?"List price (inc.\xA0VAT)":"Total"}),(0,C.jsx)("span",{children:nt(at)})]}),!d&&(0,C.jsx)("div",{className:"basket-summary-waste",children:(0,C.jsxs)("div",{className:"basket-waste-control",children:[(0,C.jsxs)("label",{className:"basket-global-waste",children:[(0,C.jsx)("input",{type:"checkbox",checked:Le,onChange:E=>He(E.target.checked)}),(0,C.jsx)("span",{children:"Add waste factor"})]}),(0,C.jsxs)("label",{className:"basket-global-waste-percent",children:[(0,C.jsx)("input",{type:"number",inputMode:"decimal",min:"0",step:"0.1",value:ze,onChange:E=>me(E.target.value),disabled:!Le,"aria-label":"Waste factor percent"}),(0,C.jsx)("span",{children:"%"})]})]})}),(0,C.jsx)("label",{htmlFor:`${p}-basket-reference`,className:"basket-sidebar-label",children:d?"Enter email for your sharper quote":"Your reference (optional)"}),(0,C.jsx)("input",{id:`${p}-basket-reference`,type:d?"email":"text",className:"basket-sidebar-input",value:f,onChange:E=>{h(E.target.value),d&&v("")},placeholder:d?"you@example.com":"PO number or job reference","aria-invalid":d&&b===dw,"aria-describedby":d&&b?`${p}-basket-reference-error`:void 0}),d&&b&&(0,C.jsx)("p",{id:`${p}-basket-reference-error`,className:"basket-quote-request-error",role:"alert",children:b}),d?(0,C.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{Je()},disabled:D,"aria-busy":D,children:(0,C.jsx)("span",{children:D?"Sending\u2026":"Request our best quote"})}):(0,C.jsx)("button",{className:"cta-btn",onClick:()=>{u("downloaded",{type:"basket",items:g.length}),lw(g)},"aria-label":c?"Download selection":"Download basket",children:(0,C.jsx)("span",{children:c?"Download Quote":"Buy Now"})}),(0,C.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,C.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),d?"This is a quote request, not an order. We'll confirm our best price, availability and delivery before you approve.":"Prices and availability are estimates and should be confirmed before procurement."]})]})]}),(0,C.jsx)("div",{className:"btn-row results-actions",children:(0,C.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:n,"aria-label":"Back to results",children:[(0,C.jsx)(Pr,{}),(0,C.jsx)("span",{children:"Back to results"})]})})]})})]})})}var At=X(Xe()),mw=X(ie());function q_(e,t){let a={...e,[t.lineId]:t};for(let[r,i]of Object.entries(a)){if(!i.linkedContext)continue;let n=i.linkedContext.find(l=>l.role==="anchor"&&l.line_id&&a[l.line_id]),o=n?.line_id?a[n.line_id]:void 0;if(!(!n||!o||n.product_id===o.productId&&n.description===o.description)){if(i.conversionType!=="basket_line_unit"){a[r]={...i,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l)};continue}a[r]={...i,qty:0,sellUnitsOverride:null,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l),conversionType:null,requestUomsSupported:null,salesUomNormalised:null,salesUnitSize:null,salesUnitSizeUom:null,coverageQty:null,coverageUom:null,roundingRule:null,conversionConfidence:null,conversionNotes:null}}}return a}var Nd=(0,At.createContext)(null);function tc({children:e,onOpenBasket:t}){let[a,r]=(0,At.useState)({}),i=(0,At.useCallback)(f=>{r(h=>q_(h,f))},[]),n=(0,At.useCallback)(f=>{r(h=>{let w={...h};for(let M of f)w[M.lineId]=M;return w})},[]),o=(0,At.useCallback)(f=>{r(h=>{let w={...h};return delete w[f],w})},[]),l=(0,At.useCallback)((f,h)=>{r(w=>w[f]?{...w,[f]:{...w[f],qty:h,sellUnitsOverride:null}}:w)},[]),c=(0,At.useCallback)((f,h)=>{r(w=>w[f]?{...w,[f]:{...w[f],sellUnitsOverride:h}}:w)},[]),p=(0,At.useCallback)(f=>{r(h=>{let w=!1,M={...h};for(let[D,m]of Object.entries(f))M[D]&&(M[D]={...M[D],...m},w=!0);return w?M:h})},[]),d=(0,At.useCallback)(()=>r({}),[]),g=(0,At.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:i,addManyToCart:n,removeFromCart:o,updateCartQty:l,updateCartSellUnits:c,updateCartConversions:p,clearCart:d,openBasket:t??(()=>{})}),[a,i,n,o,l,c,p,d,t]);return(0,mw.jsx)(Nd.Provider,{value:g,children:e})}function An(){let e=(0,At.useContext)(Nd);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function ac(){return(0,At.useContext)(Nd)}var Ca=X(ie()),Sd="metron-quick-quote";function rc(e){return(0,Ca.jsx)(tc,{children:(0,Ca.jsx)(E_,{...e})})}function E_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,i]=(0,Re.useState)("entry"),[n,o]=(0,Re.useState)(null),[l,c]=(0,Re.useState)(""),p=(0,Re.useRef)(null),d=(0,Re.useRef)(0),[g,f]=(0,Re.useState)(0),[h,w]=(0,Re.useState)(null),[M,D]=(0,Re.useState)(!1),{cart:m,addToCart:u,addManyToCart:b,removeFromCart:v,updateCartQty:N,updateCartSellUnits:A,updateCartConversions:T,clearCart:z}=An(),[G,P]=(0,Re.useState)(!1),[be,De]=(0,Re.useState)(null),Le=()=>{De(null);try{window.sessionStorage.removeItem(Is)}catch{}},He=(0,Re.useRef)(new Map),ze=(0,Re.useRef)(null),me=Xs("quick-quote",ze);(0,Re.useEffect)(()=>{me("viewed")},[me]),(0,Re.useEffect)(()=>{for(let W of Object.values(m))Dt(W).requiredSellUnits!=null&&He.current.delete(W.lineId);let ge=Object.values(m).filter(W=>{if(W.productId==="-"||Dt(W).requiredSellUnits!=null)return!1;let k=`${W.productId}|${W.qty}|${W.unit}`;return He.current.get(W.lineId)===k?!1:(He.current.set(W.lineId,k),!0)});ge.length!==0&&fetch(jt("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:ge.map(W=>({line_id:W.lineId,product_id:W.productId,requested_description:W.requestedDescription??W.description,requested_qty:W.qty,requested_uom:W.unit||null,selected_description:W.description,selected_uoi:W.uoi,selected_uoi_count:W.uoiCount,linked_context:W.linkedContext??[],selected_conversion:{sales_uom_normalised:W.salesUomNormalised,conversion_type:W.conversionType,sales_unit_size:W.salesUnitSize,sales_unit_size_uom:W.salesUnitSizeUom,coverage_qty:W.coverageQty,coverage_uom:W.coverageUom}}))})}).then(W=>W.ok?Jt(W):null).then(W=>{let k={};for(let R of W?.data?.items??W?.items??[]){let E=R?.conversion;if(!E||typeof R?.line_id!="string")continue;let O=m[R.line_id];k[R.line_id]={conversionType:E.conversion_type,requestUomsSupported:E.request_uoms_supported,salesUomNormalised:E.sales_uom_normalised,salesUnitSize:E.sales_unit_size,salesUnitSizeUom:E.sales_unit_size_uom,coverageQty:E.coverage_qty,coverageUom:E.coverage_uom,roundingRule:E.rounding_rule,conversionConfidence:E.conversion_confidence,conversionNotes:E.conversion_notes,...O?.qty===0&&Number.isFinite(E.suggested_order_qty)&&E.suggested_order_qty>0?{qty:E.suggested_order_qty,unit:E.suggested_order_uom||O.unit}:{}}}Object.keys(k).length>0&&T(k)}).catch(W=>console.error("Catalogue conversion resolution failed",W))},[m,T]);let[ce,fe]=(0,Re.useState)(!1);(0,Re.useEffect)(()=>{let ge=window.location.hash,W=null;try{W=JSON.parse(window.sessionStorage.getItem(Sd)??"null")}catch{}if(W?.scheduleResult)o("schedule"),w(W.scheduleResult),D(W.reviewGateComplete),P(W.cartSeeded),b(Object.values(W.cart)),ge==="#quote-request"?i("basket"):ge==="#matched-products"&&i("results");else if(ge==="#matched-products"||ge==="#quote-request"){let k=new URL(window.location.href);k.hash="",window.history.replaceState(window.history.state,"",k)}fe(!0)},[]),(0,Re.useEffect)(()=>{if(ce)try{h?window.sessionStorage.setItem(Sd,JSON.stringify({scheduleResult:h,reviewGateComplete:M,cartSeeded:G,cart:m})):window.sessionStorage.removeItem(Sd)}catch{}},[ce,h,M,G,m]);let Ee=(0,Re.useCallback)(ge=>{if(typeof window>"u")return;let W=new URL(window.location.href);W.hash=ge==="basket"?"quote-request":"matched-products";let k=ge==="results"&&(window.location.hash==="#matched-products"||window.location.hash==="#quote-request");window.history[k?"replaceState":"pushState"]({boqQuoteStage:ge},"",W)},[]),ut=(0,Re.useRef)(!1);(0,Re.useEffect)(()=>{let ge=W=>{ut.current=!1;let k=window.location.hash;k==="#quote-request"?i("basket"):k==="#matched-products"&&h?(o("schedule"),i("results")):i("entry");let R=W.state,E=window.location.href;setTimeout(()=>{if(window.location.href===E){if(k==="#quote-request"||k==="#matched-products"||k==="#quote-entry"){window.history.replaceState({boqQuoteStage:k==="#quote-request"?"basket":k==="#quote-entry"?"entry":"results"},"",E);return}!R?.turbo&&window.history.state?.turbo&&window.history.replaceState(R,"",E)}})};return window.addEventListener("popstate",ge),()=>window.removeEventListener("popstate",ge)},[h]);let Se=(0,Re.useCallback)(()=>{Ee("basket"),i("basket")},[Ee]),Z=(0,Re.useCallback)(()=>{if(window.location.hash==="#quote-request"){if(ut.current)return;ut.current=!0,window.history.back();return}i(h?"results":"entry")},[h]),de=(0,Re.useRef)(r);(0,Re.useEffect)(()=>{de.current!==r&&(de.current=r,window.scrollTo(0,0))},[r]);let Je=()=>{i("entry"),o(null),c(""),f(0),w(null),D(!1),z(),P(!1),Le()},Ye=(0,Re.useCallback)(async(ge,W,k=!0)=>{let R=++d.current;c(""),f(0);let E=0,O=()=>{E=Math.min(E+1,3),f(E)};try{let{jobId:ee}=await lv(ge,W,k);if(R!==d.current)return;let{promise:xe,cancel:we}=cv(()=>sv(ee),5e3,O,"schedule");p.current=we;let y=await xe;if(y.status==="failed"||!y.result)throw new Error(y.error||"Failed to process schedule");let j=y.result.lineItems.length,B=y.result.results.filter(ae=>ae.candidates.length>0).length;me("results_shown",{lines:j,matched:B,unmatched:j-B}),z(),P(!1),D(!1),w(y.result),Ee("results"),i("results")}catch(ee){if(R!==d.current)return;me("error",{stage:"matching"}),c(ee?.message||"Failed to process schedule"),i("entry")}finally{R===d.current&&(p.current?.(),p.current=null)}},[Ee,me,z]),pt=(0,Re.useCallback)(()=>{d.current++,p.current?.(),p.current=null},[]),ot=(0,Re.useCallback)(async(ge,W,k=!0)=>{if(!ge.trim())return;o("schedule");let R=new File([ge],"pasted-schedule.txt",{type:"text/plain"});await Ye(R,W,k)},[Ye]),at=(0,Re.useCallback)(async ge=>{o("schedule"),await Ye(ge)},[Ye]);return(0,Ca.jsx)(Po.Provider,{value:me,children:(0,Ca.jsx)("div",{ref:ze,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:Ht().theme,children:(0,Ca.jsxs)("main",{className:"main-content",children:[l&&(0,Ca.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Ca.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Ca.jsx)(fd,{onPasteSchedule:ot,onUploadSchedule:at,onEntryModeChange:o,draft:be,onSubmitDraft:De,onCancelMatch:pt}),r==="results"&&n==="schedule"&&h&&(0,Ca.jsx)(xd,{scheduleResult:h,onStartOver:Je,cart:m,onAddToCart:u,onRemoveFromCart:v,onGoToBasket:Se,cartSeeded:G,onCartSeeded:()=>P(!0),reviewGateComplete:M,onReviewGateComplete:()=>D(!0),internal:a}),r==="basket"&&(0,Ca.jsx)(ol,{cart:m,onUpdateQty:N,onUpdateSellUnits:A,onRemove:v,onBack:Z,onStartNewQuote:Je,onQuoteRequested:()=>{w(null),D(!1),P(!1),z(),Le()},internal:a})]})})})}var Va=X(Xe());var xi=X(Xe()),re=X(ie()),fw=[{id:"ogee",label:"Ogee",blurb:"Traditional curved profile"},{id:"torus",label:"Torus",blurb:"Soft rounded detail"},{id:"ovolo",label:"Ovolo",blurb:"Traditional rounded profile"},{id:"pencil-round",label:"Pencil round",blurb:"Simple softened edge"},{id:"square-edge",label:"Square edge",blurb:"Clean contemporary edge"}],ic=e=>Number.parseFloat(e)||0,gw=(e,t)=>ic(e)*(t==="m"?1:.3048),Cd=(e,t)=>ic(e.quantity)*(2*gw(e.height,t)+gw(e.width,t)),M_=()=>({quantity:"1",width:"",height:""});function T_({profile:e}){return(0,re.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,re.jsx)("path",{d:{ogee:"M18 62 V38 C18 28 28 22 40 22 H78 C88 22 94 28 94 38 V62",torus:"M18 62 V40 C18 27 30 20 42 20 C54 20 58 30 66 30 C74 30 78 20 90 20 C102 20 94 34 94 40 V62",ovolo:"M18 62 V38 C18 28 30 20 42 20 H70 C82 20 94 28 94 38 V62","pencil-round":"M18 62 V38 C18 28 28 20 40 20 H72 C84 20 94 28 94 38 V62","square-edge":"M18 62 V20 H94 V62"}[e]}),(0,re.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function qd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,xi.useState)("m"),[n,o]=(0,xi.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,c]=(0,xi.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,d]=(0,xi.useState)([]),[g,f]=(0,xi.useState)("ogee"),[h,w]=(0,xi.useState)("2.4"),M=(N,A,T)=>{N(z=>({...z,[A]:T}))},D=Cd(n,r)+Cd(l,r)+p.reduce((N,A)=>N+Cd(A,r),0),m=ic(h)>0?Math.ceil(D/ic(h)):0,u=fw.find(N=>N.id===g)?.label??"",b=[{key:`architrave-${g}`,label:`Architrave (${u})`,qty:D,unit:"m",query:`${u} architrave`,category:"architrave"}],v=(N,A,T,z)=>(0,re.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,re.jsx)("span",{children:N}),(0,re.jsx)("input",{"aria-label":`${N} quantity`,type:"number",min:"0",step:"1",value:A.quantity,onChange:G=>T("quantity",G.target.value)}),(0,re.jsx)("input",{"aria-label":`${N} width`,type:"number",min:"0",step:"0.01",value:A.width,onChange:G=>T("width",G.target.value)}),(0,re.jsx)("input",{"aria-label":`${N} height`,type:"number",min:"0",step:"0.01",value:A.height,onChange:G=>T("height",G.target.value)}),z?(0,re.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:z,children:"Remove"}):null]});return(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)("div",{className:"truss-estimator",children:[(0,re.jsxs)("div",{className:"quick-order-hero",children:[(0,re.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,re.jsx)("h1",{children:"Architrave Calculator"}),(0,re.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,re.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,re.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,re.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter each door or window opening. Mitred corners are allowed for, and board lengths are worked out from the net run."}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,re.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,re.jsx)("span",{children:"Units"}),(0,re.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,re.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metres"}),(0,re.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Feet"})]})]}),(0,re.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,re.jsx)("span",{children:"Opening"}),(0,re.jsx)("span",{children:"Qty"}),(0,re.jsxs)("span",{children:["Width (",r,")"]}),(0,re.jsxs)("span",{children:["Height (",r,")"]}),(0,re.jsx)("span",{})]}),v("Single doors",n,(N,A)=>M(o,N,A)),v("Double doors",l,(N,A)=>M(c,N,A)),p.map((N,A)=>v(`Alternative door ${A+1}`,N,(T,z)=>d(G=>G.map((P,be)=>be===A?{...P,[T]:z}:P)),()=>d(T=>T.filter((z,G)=>G!==A)))),(0,re.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>d(N=>[...N,M_()]),children:"+ Add alternative-sized door"})]}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,re.jsx)("div",{className:"architrave-calculator__profiles",children:fw.map(N=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${g===N.id?" is-selected":""}`,onClick:()=>f(N.id),children:[(0,re.jsx)(T_,{profile:N.id}),(0,re.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,re.jsxs)("div",{className:"architrave-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,re.jsx)("div",{className:"architrave-calculator__options",children:(0,re.jsxs)("label",{className:"truss-estimator__field",children:[(0,re.jsx)("span",{children:"Board length (m)"}),(0,re.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,re.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,re.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,re.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Architrave needed"}),(0,re.jsxs)("strong",{children:[D.toFixed(2)," m"]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Board lengths"}),(0,re.jsx)("strong",{children:m})]})]})]}),(0,re.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,re.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,re.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(b),disabled:D<=0,children:a})]})]})]})})}var ki=X(Xe()),se=X(ie()),hw=60,bw=10,z_=.02,A_=.012,R_=.01,Rn=e=>Number.parseFloat(e)||0,U_=(e,t=2)=>e.toFixed(t);function Ed({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ki.useState)("brick"),[n,o]=(0,ki.useState)("engineering-red"),[l,c]=(0,ki.useState)("metric"),[p,d]=(0,ki.useState)(""),[g,f]=(0,ki.useState)(""),[h,w]=(0,ki.useState)(!0),M=l==="metric"?Rn(p)*Rn(g):Rn(p)*Rn(g)*.092903,m=M*(r==="brick"?hw:bw),u=Math.ceil(m),b=M*(r==="brick"?z_:A_),v=Math.ceil(b/R_),N=l==="metric"?M:M*10.7639,A=[{key:r==="brick"?`brick-${n}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[n]:"Blocks",qty:u,unit:"each",query:r==="brick"?"facing brick":"concrete block",category:"masonry"},...h?[{key:"mortar",label:"Blue Circle Quality Assured Mortar Mix 20kg",qty:v,unit:"bag",query:"ready mixed mortar",category:"mortar"}]:[]],T=z=>{if(z===l)return;let G=z==="imperial"?3.28084:.3048;d((Rn(p)*G).toFixed(2)),f((Rn(g)*G).toFixed(2)),c(z)};return(0,se.jsx)(se.Fragment,{children:(0,se.jsxs)("div",{className:"truss-estimator",children:[(0,se.jsxs)("div",{className:"quick-order-hero",children:[(0,se.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,se.jsx)("h1",{children:"Brick and Block Calculator"}),(0,se.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,se.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,se.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,se.jsx)("p",{className:"truss-estimator__step-sub",children:"Pick brick or block and enter the wall dimensions for unit counts plus ready-mixed mortar."}),(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,se.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([z,G])=>(0,se.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===z?" is-selected":""}`,onClick:()=>i(z),children:[(0,se.jsx)("div",{className:"truss-estimator__option-title",children:G}),(0,se.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",z==="brick"?hw:bw," per m\xB2"]})]},z))})]}),r==="brick"&&(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,se.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:[["common","Common concrete","General-purpose grey concrete brick"],["engineering-red","Engineering red","Class B perforated, 65mm"],["engineering-blue","Engineering blue","Class B solid, 65mm"]].map(([z,G,P])=>(0,se.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n===z?" is-selected":""}`,onClick:()=>o(z),children:[(0,se.jsx)("div",{className:"truss-estimator__option-title",children:G}),(0,se.jsx)("div",{className:"truss-estimator__option-copy",children:P})]},z))})]}),(0,se.jsxs)("div",{className:"brick-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,se.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,se.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>T("metric"),children:"Metric"}),(0,se.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>T("imperial"),children:"Imperial"})]}),(0,se.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:z=>d(z.target.value)})]}),(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:g,onChange:z=>f(z.target.value)})]})]})]}),(0,se.jsx)("div",{className:"brick-calculator__options",children:(0,se.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,se.jsx)("input",{type:"checkbox",checked:h,onChange:z=>w(z.target.checked)}),(0,se.jsx)("span",{children:"Include ready-mixed mortar"})]})}),(0,se.jsxs)("div",{className:"brick-calculator__totals",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,se.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:"Wall area"}),(0,se.jsxs)("strong",{children:[U_(N)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,se.jsx)("strong",{children:u.toLocaleString("en-GB")})]}),h?(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:"Ready-mixed mortar"}),(0,se.jsxs)("strong",{children:[v," x 20kg bags"]})]}):null]}),(0,se.jsx)("p",{className:"brick-calculator__note",children:"Estimate based on standard nominal sizes and 10mm joints. Mortar bags are approximate; confirm the required mortar specification before ordering."})]}),(0,se.jsxs)("div",{className:"brick-calculator__actions",children:[(0,se.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,se.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(A),disabled:M<=0,children:a})]})]})]})})}var br=X(Xe());var D_={"NZ4Y-ZMSQ":{"brick-block":{"brick-common":"105499","brick-engineering-red":"1654","brick-engineering-blue":"1723",block:"501",mortar:"646"},skirting:{"skirting-chamfered":"1525","skirting-ogee":"135 primed mdf ogee","skirting-pencil-round":"892","skirting-torus":"1941"},architrave:{"architrave-ogee":"134 primed mdf ogee","architrave-ovolo":"1531","architrave-pencil-round":"1896","architrave-square-edge":"118 primed mdf square","architrave-torus":"1531"},plasterboard:{standard:"1647",moisture:"11 moisture plasterboard",fire:"14 fire plasterboard",sound:"1769",screws:"131160",tape:"1766",adhesive:"108439"},insulation:{"insulation-floor":"152187","insulation-wall":"147","insulation-roof":"442","insulation-loft":"152180"},timber:{studs:"1213",joists:"208",battens:"1729"},fencing:{"panels-boundary-0.9":"66 lap fence panel","panels-boundary-1.2":"1450","panels-boundary-1.5":"1449","panels-boundary-1.8":"1448","panels-skyline-1.8":"1475","concrete-intermediate-8":"40197","concrete-end-8":"40198","timber-post-6":"141411","timber-post-8":"1709",postcrete:"12142",gate:"1984","gravel-boards":"40200"},decking:{"boards-summit":"24322",joists:"208",screws:"131079"},paving:{"surface-council":"23995","surface-raj":"12369","surface-brindle":"304","surface-charcoal":"296","surface-pea":"431","sub-base":"569",bedding:"563"}}};function Md(e,t){let a=D_[Ht().client??""]?.[e];if(!a)return null;let r=e==="plasterboard"&&t.key==="board"?t.label.split(" ")[0].toLowerCase():t.key;return a[r]??null}function vw(e,t){let a=t.map(r=>{let i=Md(e,r);return i?{key:r.key,productId:i.split(" ")[0],search:i,qty:r.qty,unit:r.unit}:null});return a.length>0&&a.every(Boolean)?a:null}var ww=new Map;function O_(e){return{product_id:e.product_id,description:e.description,source_list:e.source_list??null,price:e.price??null,list_price:e.list_price,discount:e.discount,price_basis:e.price_basis??null,uoi_count:e.uoi_count??null,uoi:e.uoi??null,pdp_photo_url:e.pdp_photo_url??null,conversion:e.conversion,measurements_mm:e.measurements_mm??e.attrs?.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"estimator_catalogue_search"}}async function hr(e,t,a=12,r){let i=`${Ht().client??""}||${e}||${t??""}||${a}||${r??""}`,n=ww.get(i);if(n)return n;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(jt(`/api/catalogue/search?${o.toString()}`),{headers:vi()}),c=await Jt(l);if(!l.ok)throw new Error(c?.error||c?.message||"Could not reach the product catalogue");let p=Array.isArray(c?.items)?c.items.map(O_):[];return ww.set(i,p),p}var B_=new Set(["bag","box","roll","pack"]),L_=new Set(["each","bag","box","roll","pack","tub"]);function Td(e,t){let a=t?.uoi,r=a!=null&&L_.has(a.toLowerCase())&&(t?.uoi_count??1)===1;return B_.has(e)&&r?a:e}async function yw(e,t,a){return await Promise.all(e.map(async i=>{try{let n=a?Md(a,i):null,[o,l]=await Promise.all([n?hr(n,void 0,void 0,t).then(p=>p.find(d=>d.product_id===n.split(" ")[0]),()=>{}):void 0,hr(i.query,i.category,void 0,t)]),c=o?[o,...l.filter(p=>p.product_id!==o.product_id)]:l;return{requirement:{...i,unit:Td(i.unit,c[0])},candidates:c}}catch{return{requirement:i,candidates:[]}}}))}async function _w(){let e=await fetch(jt("/api/catalogue"),{headers:vi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Jt(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var V=X(ie()),H_=1.54,j_=1440,Q_=25,zd=800,G_=1500,Ad=e=>Number.parseFloat(e)||0,Un={mot:{label:"MOT Type 1",blurb:"Sub-base for patios and driveways",density:1.7,productId:"6001007"},"sharp-sand":{label:"Sharp sand",blurb:"Bedding and general groundwork",density:1.6,productId:"6001012"},gravel:{label:"20mm gravel",blurb:"Drainage and landscaping",density:1.6,productId:"6001004"}};function Rd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let r=ac(),[i,n]=(0,br.useState)("m"),[o,l]=(0,br.useState)(""),[c,p]=(0,br.useState)(""),[d,g]=(0,br.useState)(""),[f,h]=(0,br.useState)("concrete"),[w,M]=(0,br.useState)("mot"),[D,m]=(0,br.useState)(!1),[u,b]=(0,br.useState)(null),v=i==="m"?1:.3048,N=Ad(o)*v*Ad(c)*v*Ad(d)*(i==="m"?.01:.0254),A=Un[w],T=N*H_/7,z=T*j_,G=T*2,P=T*4,be=Math.ceil(z/Q_),De=Math.ceil(G*Un["sharp-sand"].density*1e3/zd),Le=Math.ceil(P*Un.gravel.density*1e3/zd),He=Math.ceil(N*A.density*1e3/zd),ze=f==="concrete"?[{key:"cement",label:"Blue Circle General Purpose Grey Cement 25kg",qty:be,productId:"6003004"},{key:"sharp-sand",label:"Sharp Sand Bulk Bag (800kg)",qty:De,productId:"6001012"},{key:"gravel",label:"20mm Non Decorative Pea Shingle/Gravel Bulk Bag (800kg)",qty:Le,productId:"6001004"}]:[{key:w,label:`${A.label} Bulk Bag (800kg)`,qty:He,productId:A.productId}],me=()=>{if(t){t(ze.map(fe=>({key:fe.key,label:fe.label,qty:fe.qty,unit:"each",query:fe.productId})));return}ce()},ce=async()=>{let fe=Date.now();m(!0),b(null);try{let Ee=await Promise.all(ze.map(async Se=>{let Z=(await hr(Se.productId)).find(de=>de.product_id===Se.productId);if(!Z)throw new Error(`${Se.label} is no longer available in this catalogue.`);return Jr(Z,{lineId:`concrete-aggregate:${Se.key}`,description:Se.label,unit:"bag",qty:Se.qty})})),ut=G_-(Date.now()-fe);ut>0&&await new Promise(Se=>window.setTimeout(Se,ut)),r?.clearCart(),r?.addManyToCart(Ee),r?.openBasket()}catch(Ee){b(Ee instanceof Error?Ee.message:"Could not add the products to your basket.")}finally{m(!1)}};return D?(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("div",{className:"truss-estimator",children:[(0,V.jsxs)("div",{className:"quick-order-hero",children:[(0,V.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,V.jsx)("h1",{children:"Your Materials"}),(0,V.jsx)("p",{children:"Calculating quantities from the Concrete and Aggregate Calculator."})]}),(0,V.jsx)("div",{className:"truss-estimator__card",children:(0,V.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,V.jsx)(fr,{}),(0,V.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("div",{className:"truss-estimator",children:[(0,V.jsxs)("div",{className:"quick-order-hero",children:[(0,V.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,V.jsx)("h1",{children:"Concrete and Aggregate Calculator"}),(0,V.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,V.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,V.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,V.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the area and depth. The calculator adds the fixed Materials Market products directly to your basket."}),(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,V.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${f==="concrete"?" is-selected":""}`,onClick:()=>h("concrete"),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${f==="aggregate"?" is-selected":""}`,onClick:()=>h("aggregate"),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),f==="aggregate"&&(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,V.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Un).map(fe=>(0,V.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===fe?" is-selected":""}`,onClick:()=>M(fe),children:[(0,V.jsx)("div",{className:"truss-estimator__option-title",children:Un[fe].label}),(0,V.jsx)("div",{className:"truss-estimator__option-copy",children:Un[fe].blurb})]},fe))})]}),(0,V.jsxs)("div",{className:"materials-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,V.jsxs)("div",{className:"materials-calculator__unit-row",children:[(0,V.jsx)("span",{children:"Units"}),(0,V.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,V.jsx)("button",{type:"button",className:i==="m"?"is-selected":"",onClick:()=>n("m"),children:"Metric"}),(0,V.jsx)("button",{type:"button",className:i==="ft"?"is-selected":"",onClick:()=>n("ft"),children:"Imperial"})]})]}),(0,V.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsxs)("span",{children:["Length (",i,")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.01",value:o,onChange:fe=>l(fe.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsxs)("span",{children:["Width (",i,")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.01",value:c,onChange:fe=>p(fe.target.value)})]})]}),(0,V.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,V.jsxs)("span",{children:["Depth (",i==="m"?"cm":"inches",")"]}),(0,V.jsx)("input",{type:"number",min:"0",step:"0.1",value:d,onChange:fe=>g(fe.target.value)})]})]}),(0,V.jsxs)("div",{className:"materials-calculator__totals",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,V.jsx)("div",{className:"materials-calculator__result-grid",children:f==="concrete"?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Cement"}),(0,V.jsxs)("strong",{children:[z.toFixed(0)," kg"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Sharp sand"}),(0,V.jsxs)("strong",{children:[G.toFixed(2)," m\xB3"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"20mm aggregate"}),(0,V.jsxs)("strong",{children:[P.toFixed(2)," m\xB3"]})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:A.label}),(0,V.jsxs)("strong",{children:[N.toFixed(2)," m\xB3"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Approx. weight"}),(0,V.jsxs)("strong",{children:[(N*A.density).toFixed(2)," t"]})]}),(0,V.jsx)("div",{})]})}),(0,V.jsx)("p",{className:"materials-calculator__note",children:f==="concrete"?"Based on a 1:2:4 mix. Confirm the mix design for structural work.":"Figures are estimates. Confirm the specification and supplier quantities before ordering."})]}),u&&(0,V.jsx)("p",{className:"results-empty-hint estimator-products__error",children:u}),(0,V.jsxs)("div",{className:"materials-calculator__actions",children:[(0,V.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:me,disabled:N<=0||D,children:D?"Adding products\u2026":a})]})]})]})})}var Xa=X(Xe());var U=X(ie()),Dn=12,On=8,nc=.56,xw=.21,Ra={ranges:{meridian:{label:"Standard grooved timber",blurb:"32 \xD7 125mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.125},summit:{label:"Wide grooved timber",blurb:"32 \xD7 150mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.15}},boardGapM:.006,wastage:{straight:.05,diagonal:.15},pictureFrame:{extraWastage:.08},joist:{spacingOptions:[{id:"300",label:"300mm centres (heavy duty)",spacingM:.3},{id:"400",label:"400mm centres (standard)",spacingM:.4},{id:"450",label:"450mm centres (light use)",spacingM:.45}]}},Ni=["range","grid","pictureFrame","substructure"],Y_={range:null,colour:null,deckSizeMode:"quick",quickLengthM:"",quickWidthM:"",points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:"",pictureFrame:null,direction:null,deckHeightMode:"standard",deckHeightCm:"",joistSpacing:null,supportType:null,contact:{name:"",email:""}},oc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),lc=(e,t,a)=>a.x>=Math.min(e.x,t.x)&&a.x<=Math.max(e.x,t.x)&&a.y>=Math.min(e.y,t.y)&&a.y<=Math.max(e.y,t.y),X_=(e,t,a,r)=>{let i=oc(e,t,a),n=oc(e,t,r),o=oc(a,r,e),l=oc(a,r,t);return i===0&&lc(e,t,a)||n===0&&lc(e,t,r)||o===0&&lc(a,r,e)||l===0&&lc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},Ud=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1){let i=e[(r+1)%e.length];for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&X_(e[r],i,e[n],e[(n+1)%e.length]))return!0}return!1};function Dd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Xa.useState)(0),[n,o]=(0,Xa.useState)(Y_),[l,c]=(0,Xa.useState)(1),[p,d]=(0,Xa.useState)({x:0,y:0}),[g,f]=(0,Xa.useState)(null),h=(0,Xa.useRef)(null),w=(0,Xa.useRef)(null),M=(0,Xa.useRef)(null),D=Ni[r],m=n.range?Ra.ranges[n.range]:null,u=Dn/l,b=On/l,v=(Dn-u)/2,N=(On-b)/2,A=Math.max(-Dn,Math.min(Dn*2-u,v+p.x)),T=Math.max(-On,Math.min(On*2-b,N+p.y)),z=Number.parseFloat(n.quickLengthM),G=Number.parseFloat(n.quickWidthM),P=z>0&&G>0,be=k=>Math.abs(k.reduce((R,E,O)=>{let ee=k[(O+1)%k.length];return R+E.x*ee.y-ee.x*E.y},0))/2,De=(k,R)=>Math.hypot(R.x-k.x,R.y-k.y),Le=n.isOutlineClosed?be(n.points):0,He=n.isOutlineClosed?n.points.reduce((k,R,E)=>k+De(R,n.points[(E+1)%n.points.length]),0):0,ze=n.isOutlineClosed?n.points.reduce((k,R,E)=>k+(n.wallSegments.has(E)?0:De(R,n.points[(E+1)%n.points.length])),0):0,me=n.points.reduce((k,R)=>({x:k.x+R.x/n.points.length,y:k.y+R.y/n.points.length}),{x:0,y:0}),ce=n.points.length>1?(()=>{let k=n.points[0],R=n.points[1],E=De(k,R),O=E?-(R.y-k.y)/E:0,ee=E?(R.x-k.x)/E:0,xe=(k.x+R.x)/2,we=(k.y+R.y)/2,y=O*(xe-me.x)+ee*(we-me.y)>=0?1:-1;return{x:xe+O*nc*y,y:we+ee*nc*y}})():null,Ee=(()=>{let k=n.range?Ra.ranges[n.range]:Ra.ranges.meridian,R=n.deckSizeMode==="quick"?z*G:Le,E=n.deckSizeMode==="quick"?2*(z+G):ze,O=n.direction==="diagonal"?Ra.wastage.diagonal:Ra.wastage.straight,ee=n.pictureFrame==="yes"?Ra.pictureFrame.extraWastage:0,we=R/(k.boardWidthM+Ra.boardGapM)/k.boardLengthM,y=Math.ceil(we*(1+O+ee)),j=Math.ceil(R*30*(1+O+ee)/200),B=Ra.joist.spacingOptions.find(q=>q.id===n.joistSpacing)??Ra.joist.spacingOptions[1],ae=R/B.spacingM,te=Math.ceil(ae);return{range:k,area:R,boardCount:y,screwBoxes:j,joistMetres:te,spacing:B}})(),ut=Ee?[{key:`boards-${n.range??"meridian"}`,label:`Deck boards (${Ee.range.label})`,qty:Ee.boardCount,unit:"each",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:Ee.joistMetres,unit:"m",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:Ee.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],Se=()=>D==="range"?!!n.range:D==="grid"?n.deckSizeMode==="quick"?P:n.isOutlineClosed&&Le>0:D==="pictureFrame"?!!n.pictureFrame&&!!n.direction:D==="substructure"?!!n.joistSpacing:!0,Z=r===Ni.length-1?a:"Next",de=(k,R,E=!1)=>{let O=M.current?.getBoundingClientRect();if(!O)return null;let ee=E?1:.25;return{x:Math.round(Math.max(A,Math.min(A+u,A+(k-O.left)/O.width*u))/ee)*ee,y:Math.round(Math.max(T,Math.min(T+b,T+(R-O.top)/O.height*b))/ee)*ee}},Je=k=>{if(n.isOutlineClosed){let E=k.target;if(E!==k.currentTarget&&!E.classList.contains("deck-outline__grid"))return;w.current={startX:k.clientX,startY:k.clientY,startViewX:A,startViewY:T},k.currentTarget.setPointerCapture(k.pointerId);return}if(n.drawMode!=="outline")return;let R=de(k.clientX,k.clientY,!0);R&&(f(null),o(E=>{let O=[...E.points,R];return Ud(O,!1)?{...E,drawError:"Edges cannot cross. Choose another corner."}:{...E,points:O,drawError:""}}))},Ye=(k,R)=>{if(!n.isOutlineClosed){k.stopPropagation(),R===0&&n.points.length>=3&&o(E=>({...E,isOutlineClosed:!0,drawMode:"edges"}));return}k.stopPropagation(),h.current=R,k.currentTarget.setPointerCapture(k.pointerId)},pt=k=>{if(w.current){let O=M.current?.getBoundingClientRect();if(!O)return;let ee=w.current,xe=ee.startViewX-(k.clientX-ee.startX)/O.width*u,we=ee.startViewY-(k.clientY-ee.startY)/O.height*b;d({x:xe-v,y:we-N});return}!n.isOutlineClosed&&n.drawMode==="outline"&&f(de(k.clientX,k.clientY,!0));let R=h.current;if(R===null)return;let E=de(k.clientX,k.clientY);E&&o(O=>{let ee=O.points.map((xe,we)=>we===R?E:xe);return Ud(ee,!0)?{...O,drawError:"Edges cannot cross. Move the corner to a different position."}:{...O,points:ee,drawError:""}})},ot=k=>{w.current=null,h.current=null,k.currentTarget.hasPointerCapture(k.pointerId)&&k.currentTarget.releasePointerCapture(k.pointerId)},at=k=>{o(R=>{let E=new Set(R.wallSegments);return E.has(k)?E.delete(k):E.add(k),{...R,wallSegments:E}})},ge=()=>{r===0?e():i(k=>k-1)},W=()=>{Se()&&(r===Ni.length-1?t?.(ut):i(k=>k+1))};return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:"truss-estimator",children:[(0,U.jsxs)("div",{className:"quick-order-hero",children:[(0,U.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,U.jsx)("h1",{children:"Decking Calculator"}),(0,U.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,U.jsxs)("div",{className:"truss-estimator__card",children:[(0,U.jsxs)("div",{className:"truss-estimator__body",children:[D==="range"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Ra.ranges).map(([k,R])=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===k?" is-selected":""}`,onClick:()=>o(E=>({...E,range:k})),children:[(0,U.jsx)("div",{className:"truss-estimator__option-title",children:R.label}),(0,U.jsx)("div",{className:"truss-estimator__option-copy",children:R.blurb}),(0,U.jsxs)("div",{className:"truss-estimator__option-copy",children:[R.boardLengthM,"m boards"]})]},k))})]}):null,D==="grid"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Start with a quick rectangle estimate, or draw an irregular deck for a more precise result."}),(0,U.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,U.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(k=>({...k,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,U.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(k=>({...k,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),n.deckSizeMode==="quick"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,U.jsxs)("label",{className:"truss-estimator__field",children:[(0,U.jsx)("span",{children:"Length (m)"}),(0,U.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickLengthM,onChange:k=>o(R=>({...R,quickLengthM:k.target.value}))})]}),(0,U.jsxs)("label",{className:"truss-estimator__field",children:[(0,U.jsx)("span",{children:"Width (m)"}),(0,U.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickWidthM,onChange:k=>o(R=>({...R,quickWidthM:k.target.value}))})]})]}),(0,U.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),P?(0,U.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,U.jsxs)("div",{children:[(z*G).toFixed(2)," m\xB2 deck"]}),(0,U.jsxs)("div",{children:[(2*(z+G)).toFixed(2)," m perimeter"]})]}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,U.jsxs)("div",{className:"deck-outline__toolbar",children:[n.isOutlineClosed?(0,U.jsxs)("div",{className:"deck-outline__summary",children:[(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Deck area"}),(0,U.jsxs)("strong",{children:[Le.toFixed(2)," m\xB2"]})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Perimeter"}),(0,U.jsxs)("strong",{children:[He.toFixed(2)," m"]})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Wall edges"}),(0,U.jsx)("strong",{children:n.wallSegments.size>0?n.wallSegments.size:"None"})]}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{children:"Visible edge"}),(0,U.jsxs)("strong",{children:[ze.toFixed(2)," m"]})]})]}):null,(0,U.jsxs)("div",{className:"deck-outline__actions",children:[(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,points:k.points.slice(0,-1)})),disabled:n.points.length===0||n.isOutlineClosed,children:"Undo"}),(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f(null),o(k=>({...k,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:n.points.length===0,children:"Clear"}),(0,U.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,points:[{x:2,y:2},{x:8,y:2},{x:8,y:5},{x:2,y:5}],isOutlineClosed:!0,wallSegments:new Set,drawMode:"edges",drawError:""})),children:"Start with rectangle"})]})]}),(0,U.jsx)("div",{className:"deck-editor-layout",children:(0,U.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,U.jsxs)("div",{className:"deck-outline",children:[(0,U.jsxs)("svg",{ref:M,className:`deck-outline__canvas${n.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${A} ${T} ${u} ${b}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:Je,onPointerMove:pt,onPointerUp:ot,onPointerLeave:()=>{f(null),w.current||(h.current=null)},children:[(0,U.jsx)("defs",{children:(0,U.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,U.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,U.jsx)("rect",{x:-Dn,y:-On,width:Dn*3,height:On*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),n.points.length>1?(0,U.jsx)("polyline",{className:"deck-outline__preview",points:n.points.map(k=>`${k.x},${k.y}`).join(" ")}):null,n.isOutlineClosed?(0,U.jsx)("polygon",{className:"deck-outline__shape",points:n.points.map(k=>`${k.x},${k.y}`).join(" "),stroke:"none"}):null,n.points.length>1?n.points.slice(0,n.isOutlineClosed?void 0:-1).map((k,R)=>{let E=n.points[n.isOutlineClosed?(R+1)%n.points.length:R+1],O=De(k,E),ee=O?-(E.y-k.y)/O:0,xe=O?(E.x-k.x)/O:0,we=(k.x+E.x)/2,y=(k.y+E.y)/2,j=ee*(we-me.x)+xe*(y-me.y)>=0?1:-1,B=we+ee*nc*j,ae=y+xe*nc*j;return(0,U.jsxs)("g",{children:[(0,U.jsx)("line",{className:"deck-outline__edge-hit",x1:k.x,y1:k.y,x2:E.x,y2:E.y,onClick:n.isOutlineClosed?()=>at(R):void 0}),(0,U.jsx)("line",{className:`deck-outline__edge${n.wallSegments.has(R)?" is-wall":""}`,x1:k.x,y1:k.y,x2:E.x,y2:E.y,pointerEvents:"none"}),(0,U.jsxs)("text",{className:`deck-outline__edge-label${n.wallSegments.has(R)?" is-wall":""}`,x:B,y:ae,textAnchor:"middle",dominantBaseline:"central",fontSize:xw/l,children:[O.toFixed(2)," m"]})]},`segment-${R}`)}):null,!n.isOutlineClosed&&n.points.length>0&&g?(()=>{let k=n.points[n.points.length-1],R=De(k,g);if(!R)return null;let E=-(g.y-k.y)/R,O=(g.x-k.x)/R,ee=(k.x+g.x)/2,xe=(k.y+g.y)/2;return(0,U.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,U.jsx)("line",{x1:k.x,y1:k.y,x2:g.x,y2:g.y}),(0,U.jsxs)("text",{x:ee+E*.34,y:xe+O*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:xw/l,children:[R.toFixed(2)," m"]})]})})():null,n.points.map((k,R)=>(0,U.jsx)("circle",{className:"deck-outline__point",cx:k.x,cy:k.y,r:"0.13",onPointerDown:E=>Ye(E,R)},`point-${R}`))]}),(0,U.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,U.jsx)("button",{type:"button",onClick:()=>c(k=>Math.max(.5,k-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,U.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,U.jsx)("button",{type:"button",onClick:()=>c(k=>Math.min(1,k+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),n.isOutlineClosed&&n.wallSegments.size===0&&ce?(0,U.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(ce.x-A)/u*100}%`,top:`${(ce.y-T)/b*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!n.isOutlineClosed&&n.points.length>=3?(0,U.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(k=>Ud(k.points,!0)?{...k,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...k,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,U.jsxs)("div",{className:"deck-outline__supporting",children:[(0,U.jsx)("div",{className:"truss-estimator__grid-hint",children:n.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),n.drawError?(0,U.jsx)("div",{className:"deck-outline__error",role:"alert",children:n.drawError}):null]})]})})]})]}):null,D==="pictureFrame"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"A picture frame border runs boards around the perimeter for a finished look and uses extra material."}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No border",img:"/decking/boards/no-border.webp"},{id:"yes",label:"Picture frame",img:"/decking/boards/picture-frame.webp"}].map(k=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.pictureFrame===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,pictureFrame:k.id})),children:[(0,U.jsx)("img",{className:"truss-estimator__visual-card-img",src:It(k.img),alt:""}),(0,U.jsx)("span",{children:k.label})]},k.id))}),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"straight",label:"Straight",img:"/decking/boards/straight.webp"},{id:"diagonal",label:"Diagonal",img:"/decking/boards/diagonal.webp"}].map(k=>(0,U.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.direction===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,direction:k.id})),children:[(0,U.jsx)("img",{className:"truss-estimator__visual-card-img",src:It(k.img),alt:""}),(0,U.jsx)("span",{children:k.label})]},k.id))})]})]}):null,D==="substructure"?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,U.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,U.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the joist spacing. Posts, footings and ground preparation vary by site, so are not included."}),(0,U.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,U.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Ra.joist.spacingOptions.map(k=>(0,U.jsx)("button",{type:"button",className:`truss-estimator__option-card${n.joistSpacing===k.id?" is-selected":""}`,onClick:()=>o(R=>({...R,joistSpacing:k.id})),children:(0,U.jsx)("div",{className:"truss-estimator__option-title",children:k.label})},k.id))})]}):null]}),(0,U.jsxs)("div",{className:"truss-estimator__nav",children:[(0,U.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:ge,children:"Back"}),(0,U.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:W,disabled:!Se(),children:[(0,U.jsx)("span",{children:Z}),(0,U.jsx)("span",{className:"arrow",children:(0,U.jsx)(Qt,{})})]})]})]})]})})}var Ea=X(Xe());var Q=X(ie()),kw=12,Nw=30,Bn=12,Ln=8,Sw=.56,qa={ranges:{boundary:{label:"Horizontal lap",blurb:"Traditional pressure-treated timber panels.",panelWidthM:1.83},skyline:{label:"Feather edge",blurb:"Heavier timber panels for a more solid boundary.",panelWidthM:1.83}},heights:["0.9","1.2","1.5","1.8"],gate:{single:{label:"Single lap gate",widthDefault:.9}},mounting:{concrete:{label:"Concrete posts",blurb:"Slotted concrete posts with matching panels."},postcrete:{label:"Postcrete bags",blurb:"Fast-set post-mix bags in a dug hole.",bagsPerPost:2}}},Si=["range","height","gate","posts"],V_={range:null,colour:null,grid:new Set,excludedEdges:new Set,gridMode:"draw",boundaryMode:"quick",quickLengthM:"",boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set,height:null,gravelBoard:null,gateType:null,gateWidthM:"",mountingType:null,contact:{name:"",email:""}},sc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),cc=(e,t,a)=>a.x>=Math.min(e.x,t.x)&&a.x<=Math.max(e.x,t.x)&&a.y>=Math.min(e.y,t.y)&&a.y<=Math.max(e.y,t.y),$_=(e,t,a,r)=>{let i=sc(e,t,a),n=sc(e,t,r),o=sc(a,r,e),l=sc(a,r,t);return i===0&&cc(e,t,a)||n===0&&cc(e,t,r)||o===0&&cc(a,r,e)||l===0&&cc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},uc=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&$_(e[r],e[(r+1)%e.length],e[i],e[(i+1)%e.length]))return!0;return!1};function Od({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ea.useState)(0),[n,o]=(0,Ea.useState)(V_),l=(0,Ea.useRef)(null),c=(0,Ea.useRef)(null),[p,d]=(0,Ea.useState)(1),[g,f]=(0,Ea.useState)({x:0,y:0}),[h,w]=(0,Ea.useState)(null),M=(0,Ea.useRef)(null),D=(0,Ea.useRef)(null),m=(0,Ea.useRef)(null),u=Si[r],b=n.range?qa.ranges[n.range]:null,v=Bn/p,N=Ln/p,A=(Bn-v)/2,T=(Ln-N)/2,z=Math.max(-Bn,Math.min(Bn*2-v,A+g.x)),G=Math.max(-Ln,Math.min(Ln*2-N,T+g.y)),P=n.boundaryPoints.reduce((y,j)=>({x:y.x+j.x/Math.max(1,n.boundaryPoints.length),y:y.y+j.y/Math.max(1,n.boundaryPoints.length)}),{x:0,y:0}),be=y=>{let j=new Set,B=[];return y.forEach(ae=>{let[te,q]=ae.split(",").map(Number),Y=[{key:`H,${te},${q}`,type:"H",x:te,y:q},{key:`H,${te},${q+1}`,type:"H",x:te,y:q+1},{key:`V,${te},${q}`,type:"V",x:te,y:q},{key:`V,${te+1},${q}`,type:"V",x:te+1,y:q}],K=[!y.has(`${te},${q-1}`),!y.has(`${te},${q+1}`),!y.has(`${te-1},${q}`),!y.has(`${te+1},${q}`)];Y.forEach((pe,ke)=>{K[ke]&&!j.has(pe.key)&&(j.add(pe.key),B.push(pe))})}),B},De=(y,j)=>be(y).filter(B=>!j.has(B.key)),Le=(y,j)=>De(y,j).length,He=(y,j)=>{let B={};De(y,j).forEach(te=>{var q,Y,K,pe;te.type==="H"?((B[q=`${te.x},${te.y}`]||(B[q]=[])).push("H"),(B[Y=`${te.x+1},${te.y}`]||(B[Y]=[])).push("H")):((B[K=`${te.x},${te.y}`]||(B[K]=[])).push("V"),(B[pe=`${te.x},${te.y+1}`]||(B[pe]=[])).push("V"))});let ae=0;return Object.values(B).forEach(te=>{(te.length===1||te.length===2&&te[0]!==te[1]||te.length>=3)&&(ae+=1)}),ae},me=(()=>{let y=n.range?qa.ranges[n.range]:qa.ranges.boundary,j=n.height??"1.8",B=n.boundaryMode==="quick"?Math.max(0,Number.parseFloat(n.quickLengthM)||0):n.boundaryClosed?n.boundaryPoints.slice(0,-1).reduce((Wt,wr,$a)=>Wt+(n.excludedBoundaryEdges.has($a)?0:Math.hypot(n.boundaryPoints[$a+1].x-wr.x,n.boundaryPoints[$a+1].y-wr.y)),0):0,ae=n.gateType&&n.gateType!=="none"?Number.parseFloat(n.gateWidthM)||qa.gate[n.gateType].widthDefault:0,te=Math.max(0,B-ae),q=te>0?Math.ceil(te/y.panelWidthM):0,Y=n.boundaryPoints.length>2&&n.boundaryPoints[0].x===n.boundaryPoints[n.boundaryPoints.length-1].x&&n.boundaryPoints[0].y===n.boundaryPoints[n.boundaryPoints.length-1].y,K=n.boundaryMode==="quick"?te>0?2:0:n.boundaryClosed?n.boundaryPoints.slice(0,Y?-1:void 0).reduce((Wt,wr,$a)=>{let Wd=$a>0&&!n.excludedBoundaryEdges.has($a-1),Gn=$a<n.boundaryPoints.length-1&&!n.excludedBoundaryEdges.has($a);return Wt+(Wd||Gn?1:0)},0):0,pe=te>0?Math.ceil(te/y.panelWidthM)+1:0,ke=Math.max(0,pe-K),Ie=n.mountingType?qa.mounting[n.mountingType]:qa.mounting.concrete,xt=n.gateType&&n.gateType!=="none"?2:0,pa=ke+K+xt,ul=n.mountingType==="postcrete"?pa*qa.mounting.postcrete.bagsPerPost:0,da=n.gravelBoard==="yes"?q:0;return{range:y,height:j,totalEdgeM:B,fencedLengthM:te,gateWidthM:ae,panelsCount:q,cornerPostCount:K,intermediatePostCount:ke,gatePostCount:xt,totalPostCount:pa,bagsCount:ul,gravelCount:da,capCount:pa,mounting:Ie}})(),ce=n.gateType&&n.gateType!=="none"?qa.gate[n.gateType].label:null,fe=Number(me.height)<=1.2?"6":"8",Ee=me?[{key:`panels-${n.range??"boundary"}-${me.height}`,label:`${me.range.label} panels (${me.height}m)`,qty:me.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...n.mountingType==="concrete"?[{key:`concrete-intermediate-${fe}`,label:"Intermediate concrete posts",qty:me.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${fe}`,label:"End and corner concrete posts",qty:me.cornerPostCount+me.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${fe}`,label:"Timber fence posts",qty:me.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:me.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...ce?[{key:"gate",label:ce,qty:1,unit:"each",query:"lap gate",category:"fencing"}]:[],...me.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:me.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],ut=()=>{if(u==="range"){let y=n.boundaryMode==="quick"?(Number.parseFloat(n.quickLengthM)||0)>0:n.boundaryClosed&&n.boundaryPoints.length>=2;return!!n.range&&y}return u==="height"?!!n.height&&!!n.gravelBoard:u==="gate"?!!n.gateType&&(n.gateType==="none"||n.gateWidthM.trim()!==""):u==="posts"?!!n.mountingType:!0},Se=r===Si.length-1?a:"Next",Z=y=>{o(j=>{let B=y(new Set(j.grid)),ae=new Set([...j.excludedEdges].filter(te=>be(B).some(q=>q.key===te)));return{...j,grid:B,excludedEdges:ae}})},de=(y,j,B)=>{Z(ae=>{let te=`${y},${j}`;return B?ae.add(te):ae.delete(te),ae})},Je=(y,j,B,ae,te)=>{let q=y,Y=j,K=Math.abs(B-y),pe=y<B?1:-1,ke=-Math.abs(ae-j),Ie=j<ae?1:-1,xt=K+ke;for(;de(q,Y,te),!(q===B&&Y===ae);){let pa=2*xt;pa>=ke&&(xt+=ke,q+=pe),pa<=K&&(xt+=K,Y+=Ie)}},Ye=(y,j)=>{let B=c.current?.getBoundingClientRect();if(!B)return null;let ae=Math.floor((y-B.left)/Nw),te=Math.floor((j-B.top)/Nw);return ae<0||te<0||ae>=kw||te>=kw?null:{x:ae,y:te}},pt=y=>{if(n.gridMode!=="draw")return;let j=Ye(y.clientX,y.clientY);if(!j)return;y.preventDefault();let B=`${j.x},${j.y}`,ae=!n.grid.has(B);l.current={active:!0,paintValue:ae,lastX:j.x,lastY:j.y},y.currentTarget.setPointerCapture(y.pointerId),de(j.x,j.y,ae)},ot=y=>{let j=l.current;if(!j?.active)return;let B=Ye(y.clientX,y.clientY);B&&(B.x===j.lastX&&B.y===j.lastY||(Je(j.lastX,j.lastY,B.x,B.y,j.paintValue),l.current={...j,lastX:B.x,lastY:B.y}))},at=y=>{l.current?.active&&(l.current=null,y.currentTarget.releasePointerCapture(y.pointerId))},ge=(y,j,B=!1)=>{let ae=m.current?.getBoundingClientRect();if(!ae)return null;let te=B?1:.25;return{x:Math.round(Math.max(z,Math.min(z+v,z+(y-ae.left)/ae.width*v))/te)*te,y:Math.round(Math.max(G,Math.min(G+N,G+(j-ae.top)/ae.height*N))/te)*te}},W=y=>{if(n.boundaryClosed){let B=y.target;if(B!==y.currentTarget&&!B.classList.contains("fence-boundary__grid"))return;D.current={startX:y.clientX,startY:y.clientY,startViewX:z,startViewY:G},y.currentTarget.setPointerCapture(y.pointerId);return}let j=ge(y.clientX,y.clientY,!0);j&&(w(null),o(B=>{let ae=[...B.boundaryPoints,j];return uc(ae,!1)?{...B}:{...B,boundaryPoints:ae}}))},k=(y,j)=>{if(y.stopPropagation(),!n.boundaryClosed){if(j!==0||n.boundaryPoints.length<3)return;o(B=>uc(B.boundaryPoints,!0)?B:{...B,boundaryPoints:[...B.boundaryPoints,B.boundaryPoints[0]],boundaryClosed:!0});return}M.current=j,y.currentTarget.setPointerCapture(y.pointerId)},R=y=>{if(D.current){let B=m.current?.getBoundingClientRect();if(!B)return;let ae=D.current,te=ae.startViewX-(y.clientX-ae.startX)/B.width*v,q=ae.startViewY-(y.clientY-ae.startY)/B.height*N;f({x:te-A,y:q-T});return}if(n.boundaryClosed||w(ge(y.clientX,y.clientY,!0)),M.current===null)return;let j=ge(y.clientX,y.clientY);j&&o(B=>{let ae=B.boundaryPoints.length>2&&B.boundaryPoints[0].x===B.boundaryPoints[B.boundaryPoints.length-1].x&&B.boundaryPoints[0].y===B.boundaryPoints[B.boundaryPoints.length-1].y,te=B.boundaryPoints.map((q,Y)=>{let K=Y===M.current,pe=ae&&M.current===0&&Y===B.boundaryPoints.length-1;return K||pe?j:q});return uc(te,!1)?B:{...B,boundaryPoints:te}})},E=y=>{D.current=null,M.current=null,y.currentTarget.hasPointerCapture(y.pointerId)&&y.currentTarget.releasePointerCapture(y.pointerId)},O=y=>{o(j=>{let B=new Set(j.excludedBoundaryEdges);return B.has(y)?B.delete(y):B.add(y),{...j,excludedBoundaryEdges:B}})},ee=()=>{r===0?e():i(y=>y-1)},xe=()=>{ut()&&(r===Si.length-1?t?.(Ee):i(y=>y+1))},we=be(n.grid);return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)("div",{className:"truss-estimator",children:[(0,Q.jsxs)("div",{className:"quick-order-hero",children:[(0,Q.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Q.jsx)("h1",{children:"Fencing Calculator"}),(0,Q.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,Q.jsxs)("div",{className:"truss-estimator__card",children:[(0,Q.jsxs)("div",{className:"truss-estimator__body",children:[u==="range"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(qa.ranges).map(([y,j])=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===y?" is-selected":""}`,onClick:()=>o(B=>({...B,range:y})),children:[(0,Q.jsx)("div",{className:"truss-estimator__option-title",children:j.label}),(0,Q.jsx)("div",{className:"truss-estimator__option-copy",children:j.blurb})]},y))})]}):null,u==="range"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Use a quick total, or draw the boundary to mark existing edges that do not need new fencing."}),(0,Q.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,Q.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(y=>({...y,boundaryMode:"quick"})),children:"Quick estimate"}),(0,Q.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(y=>({...y,boundaryMode:"draw"})),children:"Draw your boundary"})]}),n.boundaryMode==="quick"?(0,Q.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,Q.jsx)("span",{children:"Total fence length (m)"}),(0,Q.jsx)("input",{type:"number",min:"0",step:"0.1",value:n.quickLengthM,onChange:y=>o(j=>({...j,quickLengthM:y.target.value}))})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("div",{className:"fence-boundary__toolbar",children:(0,Q.jsxs)("div",{className:"fence-boundary__actions",children:[(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,boundaryPoints:y.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:n.boundaryPoints.length===0||n.boundaryClosed,children:"Undo"}),(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f({x:0,y:0}),w(null),o(y=>({...y,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:n.boundaryPoints.length===0,children:"Clear"}),(0,Q.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,boundaryPoints:[{x:2,y:2},{x:8,y:2},{x:8,y:5},{x:2,y:5},{x:2,y:2}],boundaryClosed:!0,excludedBoundaryEdges:new Set})),children:"Start with rectangle"})]})}),(0,Q.jsxs)("div",{className:"fence-boundary",children:[(0,Q.jsxs)("svg",{ref:m,className:`fence-boundary__canvas${n.boundaryClosed?" is-pan-mode":""}`,viewBox:`${z} ${G} ${v} ${N}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:W,onPointerMove:R,onPointerUp:E,onPointerLeave:()=>{w(null),D.current||(M.current=null)},children:[(0,Q.jsx)("defs",{children:(0,Q.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,Q.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,Q.jsx)("rect",{x:-Bn,y:-Ln,width:Bn*3,height:Ln*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),n.boundaryPoints.length>1?(0,Q.jsx)("polyline",{className:"fence-boundary__preview",points:n.boundaryPoints.map(y=>`${y.x},${y.y}`).join(" ")}):null,n.boundaryPoints.length>1?n.boundaryPoints.slice(0,-1).map((y,j)=>{let B=n.boundaryPoints[j+1],ae=Math.hypot(B.x-y.x,B.y-y.y),te=ae?-(B.y-y.y)/ae:0,q=ae?(B.x-y.x)/ae:0,Y=(y.x+B.x)/2,K=(y.y+B.y)/2,pe=te*(Y-P.x)+q*(K-P.y)>=0?1:-1,ke=Y+te*Sw*pe,Ie=K+q*Sw*pe;return(0,Q.jsxs)("g",{children:[(0,Q.jsx)("line",{className:"fence-boundary__edge-hit",x1:y.x,y1:y.y,x2:B.x,y2:B.y,onClick:n.boundaryClosed?()=>O(j):void 0}),(0,Q.jsx)("line",{className:`fence-boundary__edge${n.excludedBoundaryEdges.has(j)?" is-excluded":""}`,x1:y.x,y1:y.y,x2:B.x,y2:B.y,pointerEvents:"none"}),(0,Q.jsxs)("text",{className:`fence-boundary__edge-label${n.excludedBoundaryEdges.has(j)?" is-excluded":""}`,x:ke,y:Ie,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[ae.toFixed(2)," m"]})]},`fence-edge-${j}`)}):null,!n.boundaryClosed&&n.boundaryPoints.length>0&&h?(()=>{let y=n.boundaryPoints[n.boundaryPoints.length-1],j=Math.hypot(h.x-y.x,h.y-y.y);if(!j)return null;let B=-(h.y-y.y)/j,ae=(h.x-y.x)/j,te=(y.x+h.x)/2,q=(y.y+h.y)/2;return(0,Q.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,Q.jsx)("line",{x1:y.x,y1:y.y,x2:h.x,y2:h.y}),(0,Q.jsxs)("text",{x:te+B*.34,y:q+ae*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[j.toFixed(2)," m"]})]})})():null,n.boundaryPoints.map((y,j)=>j>0&&j===n.boundaryPoints.length-1&&y.x===n.boundaryPoints[0]?.x&&y.y===n.boundaryPoints[0]?.y?null:(0,Q.jsx)("circle",{className:`fence-boundary__point${!n.boundaryClosed&&j===0&&n.boundaryPoints.length>=3?" is-close-target":""}`,cx:y.x,cy:y.y,r:"0.13",onPointerDown:B=>k(B,j)},`fence-point-${j}`))]}),(0,Q.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,Q.jsx)("button",{type:"button",onClick:()=>d(y=>Math.max(.5,y-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,Q.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,Q.jsx)("button",{type:"button",onClick:()=>d(y=>Math.min(1,y+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!n.boundaryClosed&&n.boundaryPoints.length>=2?(0,Q.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(y=>uc(y.boundaryPoints,!1)?y:{...y,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,Q.jsx)("div",{className:"truss-estimator__grid-hint",children:n.boundaryClosed?"Drag the blank canvas to pan. Tap an edge to exclude it from the new fence.":"Click to add points, then finish the fence line. The displayed distances update as you draw."})]}),(0,Q.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,Q.jsx)("div",{children:n.boundaryMode==="quick"?`${(Number.parseFloat(n.quickLengthM)||0).toFixed(2)} m fence line`:`${me.totalEdgeM.toFixed(2)} m fence line`}),n.boundaryMode==="draw"&&n.boundaryClosed?(0,Q.jsxs)("div",{children:[me.cornerPostCount," corner/end posts"]}):null]})]}):null,null,u==="height"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:qa.heights.map(y=>(0,Q.jsx)("button",{type:"button",className:`truss-estimator__visual-card${n.height===y?" is-selected":""}`,onClick:()=>o(j=>({...j,height:y})),children:(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:It(`/fencing/height/${y}.webp`),alt:""})},y))}),(0,Q.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No gravel board",img:"/fencing/no-gravel-board.webp"},{id:"yes",label:"Add gravel board",img:"/fencing/gravel-board.webp"}].map(y=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.gravelBoard===y.id?" is-selected":""}`,onClick:()=>o(j=>({...j,gravelBoard:y.id})),children:[(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:It(y.img),alt:""}),(0,Q.jsx)("span",{children:y.label})]},y.id))})]}):null,u==="gate"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"A gate opening replaces part of the panel run and adds a gate kit with heavy-duty posts."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"none",label:"No gate",img:"/fencing/gates/no-gate.webp"},{id:"single",label:"Single gate",img:"/fencing/gates/single-gate.webp"}].map(y=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${n.gateType===y.id?" is-selected":""}`,onClick:()=>o(j=>({...j,gateType:y.id,gateWidthM:y.id==="none"?"":String(qa.gate[y.id].widthDefault)})),children:[(0,Q.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:It(y.img),alt:""}),(0,Q.jsx)("span",{children:y.label})]},y.id))}),n.gateType&&n.gateType!=="none"?(0,Q.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,Q.jsx)("span",{children:"Gate width (m)"}),(0,Q.jsx)("input",{type:"text",inputMode:"decimal",value:n.gateWidthM,onChange:y=>o(j=>({...j,gateWidthM:y.target.value}))})]}):null]}):null,u==="posts"?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,Q.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,Q.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,Q.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(qa.mounting).map(([y,j])=>(0,Q.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.mountingType===y?" is-selected":""}`,onClick:()=>o(B=>({...B,mountingType:y})),children:[(0,Q.jsx)("div",{className:"truss-estimator__option-title",children:j.label}),(0,Q.jsx)("div",{className:"truss-estimator__option-copy",children:j.blurb})]},y))})]}):null]}),(0,Q.jsxs)("div",{className:"truss-estimator__nav",children:[(0,Q.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:ee,children:"Back"}),(0,Q.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:xe,disabled:!ut(),children:[(0,Q.jsx)("span",{children:Se}),(0,Q.jsx)("span",{className:"arrow",children:(0,Q.jsx)(Qt,{})})]})]})]})]})})}var pc=X(Xe()),_e=X(ie()),Cw={floor:{label:"Floor",product:"Knauf Acoustic Roll",thickness:"100mm",coverage:12.36,salesUnit:"roll"},wall:{label:"Cavity wall",product:"Celotex CW4100",thickness:"100mm",coverage:3.24,salesUnit:"pack"},roof:{label:"Pitched roof",product:"Kingspan K107",thickness:"100mm",coverage:8.64,salesUnit:"pack",byArea:!0},loft:{label:"Loft",product:"Knauf Loft Roll 44",thickness:"100mm",coverage:13.89,salesUnit:"roll",byArea:!0}};function Bd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,pc.useState)("floor"),[n,o]=(0,pc.useState)(""),[l,c]=(0,pc.useState)(""),p=Number.parseFloat(n)*Number.parseFloat(l)||0,d=Cw[r],g=Math.ceil(p/d.coverage),f=[{key:`insulation-${r}`,label:`${d.product} ${d.thickness}`,qty:d.byArea?Math.round(p*100)/100:g,unit:d.byArea?"m2":d.salesUnit,query:d.product,category:"insulation"}],h=Object.entries(Cw);return(0,_e.jsx)(_e.Fragment,{children:(0,_e.jsxs)("div",{className:"truss-estimator",children:[(0,_e.jsxs)("div",{className:"quick-order-hero",children:[(0,_e.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_e.jsx)("h1",{children:"Insulation Calculator"}),(0,_e.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,_e.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,_e.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,_e.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,_e.jsxs)("div",{className:"materials-calculator__section",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,_e.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:h.map(([w,M])=>(0,_e.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===w?" is-selected":""}`,onClick:()=>i(w),children:[(0,_e.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,_e.jsxs)("div",{className:"truss-estimator__option-copy",children:[M.product,", ",M.thickness]})]},w))})]}),(0,_e.jsxs)("div",{className:"materials-calculator__section",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,_e.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,_e.jsxs)("label",{className:"truss-estimator__field",children:[(0,_e.jsx)("span",{children:"Length (m)"}),(0,_e.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:w=>o(w.target.value)})]}),(0,_e.jsxs)("label",{className:"truss-estimator__field",children:[(0,_e.jsx)("span",{children:"Width (m)"}),(0,_e.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:w=>c(w.target.value)})]})]})]}),(0,_e.jsxs)("div",{className:"materials-calculator__totals",children:[(0,_e.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,_e.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,_e.jsxs)("div",{children:[(0,_e.jsx)("span",{children:"Insulated area"}),(0,_e.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,_e.jsxs)("div",{children:[(0,_e.jsx)("span",{children:d.product}),(0,_e.jsxs)("strong",{children:[g," packs"]})]})]}),(0,_e.jsx)("p",{className:"materials-calculator__note",children:"This is a simple product choice, not thermal or Building Regulations advice. Confirm the specification before ordering."})]}),(0,_e.jsxs)("div",{className:"materials-calculator__actions",children:[(0,_e.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,_e.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(f),disabled:p<=0,children:a})]})]})]})})}var Hn=X(Xe()),$=X(ie()),Z_=10,K_=1.9*.762,P_=1.9*1.524,dc=()=>({height:"",width:""}),mc=e=>Number.parseFloat(e)||0,qw=({height:e,width:t})=>mc(e)*mc(t);function Ld({onBack:e}){let[t,a]=(0,Hn.useState)([dc()]),[r,i]=(0,Hn.useState)([dc()]),[n,o]=(0,Hn.useState)("0"),[l,c]=(0,Hn.useState)("0"),[p,d]=(0,Hn.useState)(1),g=t.reduce((m,u)=>m+qw(u),0),f=r.reduce((m,u)=>m+qw(u),0),h=mc(n)*K_+mc(l)*P_,w=Math.max(0,g-f-h),M=w*p/Z_,D=(m,u,b,v)=>{m(N=>N.map((A,T)=>T===u?{...A,[b]:v}:A))};return(0,$.jsx)($.Fragment,{children:(0,$.jsxs)("div",{className:"truss-estimator",children:[(0,$.jsxs)("div",{className:"quick-order-hero",children:[(0,$.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,$.jsx)("h1",{children:"Paint Calculator"}),(0,$.jsx)("p",{children:"Estimate how much paint you need for your walls, including multiple coats and excluded areas."})]}),(0,$.jsxs)("div",{className:"truss-estimator__card paint-calculator",children:[(0,$.jsx)("h2",{className:"truss-estimator__step-title",children:"Walls, exclusions and coats"}),(0,$.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter each wall, subtract windows and doors, and choose your number of coats. Quantities assume a coverage of 10 m\xB2 per litre."}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Enter the height and width of each wall you want to paint."}),(0,$.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,$.jsx)("span",{}),(0,$.jsx)("span",{children:"Height (m)"}),(0,$.jsx)("span",{children:"Width (m)"}),(0,$.jsx)("span",{})]}),t.map((m,u)=>(0,$.jsxs)("div",{className:"paint-calculator__row",children:[(0,$.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",u+1]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,$.jsx)("input",{"aria-label":`Wall ${u+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>D(a,u,"height",b.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,$.jsx)("input",{"aria-label":`Wall ${u+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>D(a,u,"width",b.target.value)})]}),t.length>1?(0,$.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>a(b=>b.filter((v,N)=>N!==u)),children:"Remove"}):null]},`wall-${u}`)),(0,$.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>a(m=>[...m,dc()]),children:"+ Add another wall"})]}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Areas to exclude"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Add windows, sockets, skirting boards or other areas that will not be painted."}),(0,$.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,$.jsx)("span",{}),(0,$.jsx)("span",{children:"Height (m)"}),(0,$.jsx)("span",{children:"Width (m)"}),(0,$.jsx)("span",{})]}),r.map((m,u)=>(0,$.jsxs)("div",{className:"paint-calculator__row",children:[(0,$.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",u+1]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,$.jsx)("input",{"aria-label":`Area ${u+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>D(i,u,"height",b.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,$.jsx)("input",{"aria-label":`Area ${u+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>D(i,u,"width",b.target.value)})]}),r.length>1?(0,$.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(b=>b.filter((v,N)=>N!==u)),children:"Remove"}):null]},`excluded-${u}`)),(0,$.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(m=>[...m,dc()]),children:"+ Add another area"})]}),(0,$.jsxs)("div",{className:"paint-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Doors and coats"}),(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Enter the number of standard single and double doors to leave unpainted. Door sizes are estimated automatically."}),(0,$.jsxs)("div",{className:"truss-estimator__field-grid paint-calculator__small-fields",children:[(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Doors"}),(0,$.jsx)("input",{type:"number",min:"0",step:"1",value:n,onChange:m=>o(m.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Double doors"}),(0,$.jsx)("input",{type:"number",min:"0",step:"1",value:l,onChange:m=>c(m.target.value)})]})]}),(0,$.jsxs)("div",{className:"paint-calculator__coat-field",children:[(0,$.jsx)("p",{className:"paint-calculator__hint",children:"Most walls need 2 coats for an even finish. Use 3 coats when changing colour significantly or covering a darker wall."}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsx)("span",{children:"Number of coats"}),(0,$.jsxs)("select",{value:p,onChange:m=>d(Number(m.target.value)),children:[(0,$.jsx)("option",{value:"1",children:"1 coat"}),(0,$.jsx)("option",{value:"2",children:"2 coats"}),(0,$.jsx)("option",{value:"3",children:"3 coats"})]})]})]})]}),(0,$.jsxs)("div",{className:"paint-calculator__totals",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,$.jsxs)("div",{className:"paint-calculator__result-grid",children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Paintable area"}),(0,$.jsxs)("strong",{children:[w.toFixed(2)," m\xB2"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Coverage"}),(0,$.jsxs)("strong",{children:[p," ",p===1?"coat":"coats"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Paint required"}),(0,$.jsxs)("strong",{children:[M.toFixed(1)," litres"]})]})]}),(0,$.jsx)("p",{className:"paint-calculator__note",children:"Based on paint coverage of 10 m\xB2 per litre. Decorative paint is not currently stocked in this catalogue, so this remains an estimate only."})]}),(0,$.jsxs)("div",{className:"paint-calculator__actions",children:[(0,$.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,$.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var vr=X(Xe()),ne=X(ie()),fc=e=>Number.parseFloat(e)||0,Hd={paving:[{id:"council",label:"Council paving slab (600 \xD7 600mm)"},{id:"raj",label:"Raj blend sandstone (600 \xD7 600mm)"}],block:[{id:"brindle",label:"Brindle block paving (60mm)"},{id:"charcoal",label:"Charcoal block paving (60mm)"}],gravel:[{id:"pea",label:"20mm pea shingle"}]};function jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,vr.useState)("paving"),[n,o]=(0,vr.useState)("council"),[l,c]=(0,vr.useState)(""),[p,d]=(0,vr.useState)(""),[g,f]=(0,vr.useState)("100"),[h,w]=(0,vr.useState)("50"),[M,D]=(0,vr.useState)(!0),[m,u]=(0,vr.useState)(!0),b=fc(l)*fc(p),v=b,N=b*(fc(g)/1e3),A=b*.04,T=b*(fc(h)/1e3),z=Math.ceil(v/.36),G=Math.ceil(v/.1),P=Math.ceil(N*1700/800),be=Math.ceil(A*1600/800),De=Math.ceil(T*1600/800),Le=r==="paving"?{qty:z,unit:"each"}:r==="block"?{qty:v,unit:"m2"}:{qty:De,unit:"bag"},He={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],ze=[{key:`surface-${n}`,label:Hd[r].find(ce=>ce.id===n)?.label??"Surface material",qty:Le.qty,unit:Le.unit,query:He,category:"landscaping"},...M?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:P,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...m?[{key:"bedding",label:"Sharp sand bedding",qty:be,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];return(0,ne.jsx)(ne.Fragment,{children:(0,ne.jsxs)("div",{className:"truss-estimator",children:[(0,ne.jsxs)("div",{className:"quick-order-hero",children:[(0,ne.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ne.jsx)("h1",{children:"Paving and Driveway Calculator"}),(0,ne.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,ne.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ne.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,ne.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the surface material and enter the area. Sub-base and bedding sand are estimated alongside the surface units."}),(0,ne.jsxs)("div",{className:"materials-calculator__section",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,ne.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:[["paving","Paving slabs","For patios and paths"],["block","Block paving","For driveways and paths"],["gravel","Decorative gravel","For paths and landscaping"]].map(([ce,fe,Ee])=>(0,ne.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===ce?" is-selected":""}`,onClick:()=>{i(ce),o(Hd[ce][0].id)},children:[(0,ne.jsx)("div",{className:"truss-estimator__option-title",children:fe}),(0,ne.jsx)("div",{className:"truss-estimator__option-copy",children:Ee})]},ce))}),(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Finish"}),(0,ne.jsx)("select",{value:n,onChange:ce=>o(ce.target.value),children:Hd[r].map(ce=>(0,ne.jsx)("option",{value:ce.id,children:ce.label},ce.id))})]})]}),(0,ne.jsxs)("div",{className:"materials-calculator__section",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,ne.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ne.jsxs)("label",{className:"truss-estimator__field",children:[(0,ne.jsx)("span",{children:"Length (m)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:ce=>c(ce.target.value)})]}),(0,ne.jsxs)("label",{className:"truss-estimator__field",children:[(0,ne.jsx)("span",{children:"Width (m)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:ce=>d(ce.target.value)})]})]}),r==="gravel"&&(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Gravel depth (mm)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"10",value:h,onChange:ce=>w(ce.target.value)})]}),M&&(0,ne.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ne.jsx)("span",{children:"Sub-base depth (mm)"}),(0,ne.jsx)("input",{type:"number",min:"0",step:"10",value:g,onChange:ce=>f(ce.target.value)})]}),(0,ne.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ne.jsx)("input",{type:"checkbox",checked:M,onChange:ce=>D(ce.target.checked)}),(0,ne.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,ne.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ne.jsx)("input",{type:"checkbox",checked:m,onChange:ce=>u(ce.target.checked)}),(0,ne.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,ne.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ne.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ne.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"Surface area"}),(0,ne.jsxs)("strong",{children:[b.toFixed(2)," m\xB2"]})]}),(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,ne.jsx)("strong",{children:r==="paving"?`${z} slabs`:r==="block"?`${v.toFixed(2)} m\xB2`:`${De} bulk bags`})]}),M&&(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"MOT Type 1"}),(0,ne.jsxs)("strong",{children:[P," bulk bags"]})]}),m&&(0,ne.jsxs)("div",{children:[(0,ne.jsx)("span",{children:"Sharp sand"}),(0,ne.jsxs)("strong",{children:[be," bulk bags"]})]})]}),(0,ne.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,ne.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ne.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ne.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(ze),disabled:b<=0,children:a})]})]})]})})}var ll=X(Xe()),oe=X(ie()),J_=2.88,Ew=[{id:"standard",label:"Standard wallboard",blurb:"General internal walls and ceilings"},{id:"moisture",label:"Moisture resistant",blurb:"Kitchens, bathrooms and utility rooms"},{id:"fire",label:"Fire resistant",blurb:"Where fire-rated lining is required"},{id:"sound",label:"Sound resistant",blurb:"Improved acoustic performance"}],Mw=()=>({length:"",height:""}),Qd=e=>Number.parseFloat(e)||0;function Gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ll.useState)([Mw()]),[n,o]=(0,ll.useState)(""),[l,c]=(0,ll.useState)("standard"),[p,d]=(0,ll.useState)("screws"),g=r.reduce((A,T)=>A+Qd(T.length)*Qd(T.height),0),f=Math.max(0,g-Qd(n)),h=Math.ceil(f/J_),w=Math.ceil(f*12),M=Math.ceil(w/1e3),D=Math.ceil(f*1.2),m=Math.ceil(D/90),u=Math.ceil(f/3.5),b=Ew.find(A=>A.id===l)?.label??"Standard",v=[{key:"board",label:`${b} plasterboard`,qty:h,unit:"sheet",query:`${b} plasterboard`,category:"plasterboard"},...p==="screws"?[{key:"screws",label:"Drywall screws",qty:M,unit:"box",query:"drywall screws",category:"fixings"}]:[{key:"adhesive",label:"Board adhesive",qty:u,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:m,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],N=(A,T,z)=>{i(G=>G.map((P,be)=>be===A?{...P,[T]:z}:P))};return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)("div",{className:"truss-estimator",children:[(0,oe.jsxs)("div",{className:"quick-order-hero",children:[(0,oe.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,oe.jsx)("h1",{children:"Plasterboard and Drylining Calculator"}),(0,oe.jsx)("p",{children:"Estimate boards, fixings and jointing materials for walls and ceilings."})]}),(0,oe.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,oe.jsx)("h2",{className:"truss-estimator__step-title",children:"Boards, fixings and jointing"}),(0,oe.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the surfaces you are lining and the board specification. Screws, tape and adhesive are estimated with the boards."}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Board type"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Ew.map(A=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===A.id?" is-selected":""}`,onClick:()=>c(A.id),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:A.label}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:A.blurb})]},A.id))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Fixing method"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["screws","Drywall screws","For timber or metal framing"],["adhesive","Board adhesive","For masonry dot-and-dab"]].map(([A,T,z])=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===A?" is-selected":""}`,onClick:()=>d(A),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:z})]},A))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall and ceiling areas"}),(0,oe.jsx)("p",{className:"materials-calculator__hint",children:"Add each surface separately so different wall sizes are easy to measure."}),(0,oe.jsxs)("div",{className:"materials-calculator__dimensions-header",children:[(0,oe.jsx)("span",{children:"Surface"}),(0,oe.jsx)("span",{children:"Length (m)"}),(0,oe.jsx)("span",{children:"Height (m)"}),(0,oe.jsx)("span",{})]}),r.map((A,T)=>(0,oe.jsxs)("div",{className:"materials-calculator__surface-row",children:[(0,oe.jsxs)("span",{children:["Surface ",T+1]}),(0,oe.jsx)("input",{"aria-label":`Surface ${T+1} length`,type:"number",min:"0",step:"0.01",value:A.length,onChange:z=>N(T,"length",z.target.value)}),(0,oe.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:A.height,onChange:z=>N(T,"height",z.target.value)}),r.length>1?(0,oe.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(z=>z.filter((G,P)=>P!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,oe.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(A=>[...A,Mw()]),children:"+ Add another surface"}),(0,oe.jsxs)("label",{className:"truss-estimator__field materials-calculator__openings",children:[(0,oe.jsxs)("span",{children:["Openings to deduct (m\xB2) ",(0,oe.jsx)("small",{children:"optional"})]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:A=>o(A.target.value)})]})]}),(0,oe.jsxs)("div",{className:"materials-calculator__totals",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,oe.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Board area"}),(0,oe.jsxs)("strong",{children:[f.toFixed(2)," m\xB2"]})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"2.4 x 1.2 m boards"}),(0,oe.jsx)("strong",{children:h})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:p==="screws"?"Drywall screws":"Board adhesive"}),(0,oe.jsx)("strong",{children:p==="screws"?`${w} (${M} boxes)`:`${u} bags`})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Joint tape"}),(0,oe.jsxs)("strong",{children:[D," m (",m," rolls)"]})]})]}),(0,oe.jsx)("p",{className:"materials-calculator__note",children:"Figures are estimates. Confirm board specification, fixing patterns and fire or acoustic requirements before ordering."})]}),(0,oe.jsxs)("div",{className:"materials-calculator__actions",children:[(0,oe.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,oe.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(v),disabled:f<=0,children:a})]})]})]})})}var sl=X(Xe());var _=X(ie()),Rt={ranges:{standard:{label:"Standard Fink",blurb:"Classic W-shaped truss for standard pitched roofs."},attic:{label:"Attic",blurb:"Room-in-roof truss with usable attic space and clear span."},mono:{label:"Mono-pitch",blurb:"Single-slope truss for lean-to roofs and outbuildings."}},pitches:["15","20","22.5","25","30","35","40","45","50","55"],pitchMultipliers:{15:.95,20:.98,"22.5":1,25:1.02,30:1.05,35:1.1,40:1.18,45:1.27,50:1.38,55:1.52},overhang:{thresholdMM:300,surchargePerTruss:3.5},centresOptions:["400","600"],treatment:{treated:{label:"Treated (tanalised)",surchargePct:.08},untreated:{label:"Untreated",surchargePct:0}},estimate:{design:250,delivery:250,bracingPerMetre:6.5,girderMultiplier:1.8,ranges:{standard:{supplyAt8m:53.33,installPerTruss:30},attic:{supplyAt8m:128.35,installPerTruss:55},mono:{supplyAt8m:60,installPerTruss:38}}}},gc=["range","pitchAndDimensions","quantityAndGirders","bracing"],I_={range:null,pitch:null,spanMM:"",overhangMM:"",roofLengthM:"",centres:null,girderCount:0,bracing:null,treatment:null,contact:{name:"",email:""}};function F_({degrees:e}){let a=e*Math.PI/180,i=82-Math.min(58,38*Math.tan(a));return(0,_.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,_.jsx)("line",{x1:"6",y1:"82",x2:"94",y2:"82",stroke:"var(--border)",strokeWidth:"2"}),(0,_.jsx)("polygon",{points:`12,82 88,82 50,${i}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function W_({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",i="#d3d8de",n="#7c8494",o=(d,g,f,h,w=8,M)=>{let D=f-d,m=h-g,u=Math.hypot(D,m)||1,b=-m/u,v=D/u,N=w*.2;return(0,_.jsxs)("g",{children:[(0,_.jsx)("line",{x1:d,y1:g,x2:f,y2:h,stroke:a,strokeWidth:w+3,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:d,y1:g,x2:f,y2:h,stroke:t,strokeWidth:w,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:d-b*N,y1:g-v*N,x2:f-b*N,y2:h-v*N,stroke:r,strokeWidth:Math.max(1.5,w*.24),strokeLinecap:"round",opacity:"0.9"})]},M)},l=(d,g,f)=>(0,_.jsxs)("g",{children:[(0,_.jsx)("rect",{x:d-7.5,y:g-5.5,width:"15",height:"11",rx:"2",fill:i,stroke:n,strokeWidth:"1"}),(0,_.jsx)("circle",{cx:d-4,cy:g-2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d+4,cy:g-2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d-4,cy:g+2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d+4,cy:g+2.5,r:"1",fill:n}),(0,_.jsx)("circle",{cx:d,cy:g,r:"1",fill:n})]},f),c=(d,g)=>(0,_.jsx)("rect",{x:d-9,y:"110",width:"18",height:"10",fill:a},g),p=(0,_.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"});return e==="attic"?(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,26,8,"b1"),o(174,112,100,26,8,"b2"),o(26,112,174,112,8,"b3"),o(58,112,58,70,6,"b4"),o(142,112,142,70,6,"b5"),o(58,70,142,70,7,"b6"),(0,_.jsx)("rect",{x:"90",y:"82",width:"20",height:"24",fill:"#cfe3f2",stroke:a,strokeWidth:"2"}),(0,_.jsx)("line",{x1:"100",y1:"82",x2:"100",y2:"106",stroke:a,strokeWidth:"1.5"}),l(26,112,"p1"),l(174,112,"p2"),l(100,26,"p3"),l(58,112,"p4"),l(58,70,"p5"),l(142,112,"p6"),l(142,70,"p7")]}):e==="mono"?(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,174,26,8,"b1"),o(174,26,174,112,8,"b2"),o(26,112,174,112,8,"b3"),o(90,112,90,75,5,"b4"),o(90,75,132,112,5,"b5"),l(26,112,"p1"),l(174,26,"p2"),l(174,112,"p3"),l(90,112,"p4"),l(90,75,"p5"),l(132,112,"p6")]}):(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,34,8,"b1"),o(174,112,100,34,8,"b2"),o(26,112,174,112,8,"b3"),o(63,112,100,34,5,"b4"),o(137,112,100,34,5,"b5"),o(63,112,54,83,5,"b6"),o(137,112,146,83,5,"b7"),(0,_.jsx)("rect",{x:"96",y:"108",width:"8",height:"8",fill:a}),l(26,112,"p1"),l(174,112,"p2"),l(100,34,"p3"),l(63,112,"p4"),l(137,112,"p5"),l(54,83,"p6"),l(146,83,"p7")]})}function ex({enabled:e}){return(0,_.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[(0,_.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"}),(0,_.jsx)("rect",{x:"17",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,_.jsx)("rect",{x:"165",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,_.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),e?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("line",{x1:"45",y1:"112",x2:"140",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"}),(0,_.jsx)("line",{x1:"155",y1:"112",x2:"60",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"})]}):null,(0,_.jsx)("rect",{x:"18.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,_.jsx)("rect",{x:"166.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,_.jsx)("rect",{x:"92.5",y:"28.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"})]})}function Tw({treated:e}){let t=e?"#5a7a4a":"var(--accent)";return(0,_.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,_.jsx)("rect",{x:"10",y:"22",width:"80",height:"14",rx:"2",fill:t}),(0,_.jsx)("rect",{x:"10",y:"43",width:"80",height:"14",rx:"2",fill:e?"#8faf7a":"var(--accent-light)"}),(0,_.jsx)("rect",{x:"10",y:"64",width:"80",height:"14",rx:"2",fill:t})]})}function Yd({onBack:e}){let[t,a]=(0,sl.useState)(0),[r,i]=(0,sl.useState)(I_),[n,o]=(0,sl.useState)(!1),[l,c]=(0,sl.useState)(!1),p=()=>{let m=Number.parseFloat(r.roofLengthM)||0,u=Number.parseFloat(r.centres??"");return m<=0||!u?0:Math.ceil(m*1e3/u)+1},g=(()=>{let m=r.range?Rt.ranges[r.range]:Rt.ranges.standard,u=r.pitch??"22.5",b=Rt.pitchMultipliers[u],v=(Number.parseFloat(r.spanMM)||0)/1e3,A=(Number.parseFloat(r.overhangMM)||0)>Rt.overhang.thresholdMM,T=p(),z=T+r.girderCount,G=Number.parseFloat(r.roofLengthM)||0,P=r.treatment?Rt.treatment[r.treatment]:Rt.treatment.untreated,be=Rt.estimate.ranges[r.range??"standard"],De=be.supplyAt8m*Math.max(.7,v/8)*b*(1+P.surchargePct)+(A?Rt.overhang.surchargePerTruss:0),Le=T*De,He=r.girderCount*De*Rt.estimate.girderMultiplier,ze=r.bracing==="yes"?G*Rt.estimate.bracingPerMetre:0,me=Le+He+ze+Rt.estimate.delivery,ce=Rt.estimate.design+T*be.installPerTruss+r.girderCount*40,fe=me+ce,Ee=fe*.2;return{range:m,count:T,girderCount:r.girderCount,overhangApplies:A,overhangUnits:z,roofLengthM:G,treatment:P,trussSupply:Le,bracingMaterials:ze,delivery:Rt.estimate.delivery,labour:ce,subtotal:fe,vat:Ee,total:fe+Ee}})(),f=()=>{let m=gc[t];return m==="range"?!!r.range:m==="pitchAndDimensions"?!!r.pitch&&r.spanMM.trim()!==""&&r.overhangMM.trim()!=="":m==="quantityAndGirders"?r.roofLengthM.trim()!==""&&!!r.centres:m==="bracing"?!!r.bracing&&!!r.treatment:!0},h=t===gc.length-1?"View truss request":"Next",w=()=>{n?o(!1):t===0?e():a(m=>m-1)},M=()=>{f()&&(t===gc.length-1?(c(!1),o(!0)):a(m=>m+1))},D=()=>{let m=gc[t];return m==="range"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 1 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your truss range"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Pricing shown is placeholder. Swap in your real engineering and pricing catalogue."}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--range",children:Object.entries(Rt.ranges).map(([u,b])=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===u?" is-selected":""}`,onClick:()=>i(v=>({...v,range:u})),children:[(0,_.jsx)(W_,{type:u}),(0,_.jsxs)("div",{className:"truss-estimator__option-info",children:[(0,_.jsx)("div",{className:"truss-estimator__option-title",children:b.label}),(0,_.jsx)("div",{className:"truss-estimator__option-copy",children:b.blurb})]})]},u))})]}):m==="pitchAndDimensions"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 2 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Span, overhang and roof pitch"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Span is wall-to-wall, overhang is the eaves tail beyond the wall line. Steeper pitches use more timber per truss."}),(0,_.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,_.jsxs)("label",{className:"truss-estimator__field",children:[(0,_.jsx)("span",{children:"Span (mm)"}),(0,_.jsx)("input",{type:"text",inputMode:"numeric",value:r.spanMM,onChange:u=>i(b=>({...b,spanMM:u.target.value}))})]}),(0,_.jsxs)("label",{className:"truss-estimator__field",children:[(0,_.jsx)("span",{children:"Overhang (mm)"}),(0,_.jsx)("input",{type:"text",inputMode:"numeric",value:r.overhangMM,onChange:u=>i(b=>({...b,overhangMM:u.target.value}))}),(0,_.jsxs)("small",{children:["Overhangs beyond ",Rt.overhang.thresholdMM,"mm add a small surcharge per truss."]})]})]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Roof pitch"}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Rt.pitches.map(u=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===u?" is-selected":""}`,onClick:()=>i(b=>({...b,pitch:u})),children:[(0,_.jsx)(F_,{degrees:Number.parseFloat(u)}),(0,_.jsxs)("span",{children:[u,"\xB0"]})]},u))})]}):m==="quantityAndGirders"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 3 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Roof length"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Trusses are based on designs at 400mm or 600mm centres wherever possible."}),(0,_.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,_.jsx)("span",{children:"Roof length (m)"}),(0,_.jsx)("input",{type:"text",inputMode:"decimal",value:r.roofLengthM,onChange:u=>i(b=>({...b,roofLengthM:u.target.value}))})]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Truss centres"}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--centres",children:Rt.centresOptions.map(u=>(0,_.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===u?" is-selected":""}`,onClick:()=>i(b=>({...b,centres:u})),children:(0,_.jsxs)("div",{className:"truss-estimator__option-title",children:[u,"mm centres"]})},u))}),(0,_.jsxs)("div",{className:"truss-estimator__stat",children:[p()," trusses estimated"]}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Girder trusses"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Heavy-duty girder trusses carry point loads over large openings. Set 0 if you do not need any."}),(0,_.jsxs)("div",{className:"truss-estimator__stepper",children:[(0,_.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.max(0,u.girderCount-1)})),children:"\u2212"}),(0,_.jsx)("span",{children:r.girderCount}),(0,_.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.min(3,u.girderCount+1)})),children:"+"})]})]}):m==="bracing"?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Step 4 of 4"}),(0,_.jsx)("h2",{className:"truss-estimator__step-title",children:"Bracing pack?"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"A timber bracing pack stabilises the roof structure once trusses are erected."}),(0,_.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No bracing pack"},{id:"yes",label:"Add bracing pack"}].map(u=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===u.id?" is-selected":""}`,onClick:()=>i(b=>({...b,bracing:u.id})),children:[(0,_.jsx)(ex,{enabled:u.id==="yes"}),(0,_.jsx)("span",{children:u.label})]},u.id))}),(0,_.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber treatment"}),(0,_.jsx)("p",{className:"truss-estimator__step-sub",children:"Tanalised timber protects against rot in exposed or damp locations."}),(0,_.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="untreated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"untreated"})),children:[(0,_.jsx)(Tw,{treated:!1}),(0,_.jsx)("span",{children:"Untreated"})]}),(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="treated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"treated"})),children:[(0,_.jsx)(Tw,{treated:!0}),(0,_.jsx)("span",{children:"Treated (+8% cost)"}),(0,_.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return n?(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)("div",{className:"truss-estimator",children:[(0,_.jsxs)("div",{className:"quick-order-hero",children:[(0,_.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_.jsx)("h1",{children:"Your truss estimate"}),(0,_.jsx)("p",{children:"A provisional quantity and specification based on the dimensions you entered."})]}),(0,_.jsxs)("div",{className:"truss-estimator__card truss-request",style:{minHeight:0},children:[(0,_.jsxs)("div",{className:"truss-request__heading",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Estimated requirement"}),(0,_.jsxs)("h2",{children:[g.range.label," roof trusses"]})]}),(0,_.jsxs)("strong",{children:[g.count,(0,_.jsx)("span",{children:"trusses"})]})]}),(0,_.jsxs)("div",{className:"truss-request__grid",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Span"}),(0,_.jsxs)("strong",{children:[r.spanMM," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Roof length"}),(0,_.jsxs)("strong",{children:[r.roofLengthM," m"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Pitch"}),(0,_.jsxs)("strong",{children:[r.pitch,"\xB0"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Centres"}),(0,_.jsxs)("strong",{children:[r.centres," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Overhang"}),(0,_.jsxs)("strong",{children:[r.overhangMM," mm"]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Treatment"}),(0,_.jsx)("strong",{children:g.treatment.label})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Girder trusses"}),(0,_.jsx)("strong",{children:g.girderCount||"None"})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing pack"}),(0,_.jsx)("strong",{children:r.bracing==="yes"?"Included":"Not included"})]})]}),(0,_.jsxs)("div",{className:"truss-request__price",children:[(0,_.jsx)("div",{className:"truss-estimator__step-label",children:"Indicative cost estimate"}),(0,_.jsxs)("div",{className:"truss-request__price-grid",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Truss supply allowance"}),(0,_.jsx)("strong",{children:nt(g.trussSupply)})]}),g.bracingMaterials>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing materials allowance"}),(0,_.jsx)("strong",{children:nt(g.bracingMaterials)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Delivery allowance"}),(0,_.jsx)("strong",{children:nt(g.delivery)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Design and installation labour"}),(0,_.jsx)("strong",{children:nt(g.labour)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,_.jsx)("strong",{children:nt(g.subtotal)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"VAT (20%)"}),(0,_.jsx)("strong",{children:nt(g.vat)})]}),(0,_.jsxs)("div",{className:"truss-request__price-total",children:[(0,_.jsx)("span",{children:"Estimated total"}),(0,_.jsx)("strong",{children:nt(g.total)})]})]}),(0,_.jsx)("p",{children:"Trusses are not listed as fixed products in this catalogue, so supply, delivery and labour are benchmark allowances. Confirm the engineered design and final quote before ordering."})]}),(0,_.jsxs)("div",{className:"truss-request__notice",children:[(0,_.jsx)("strong",{children:"Before ordering"}),(0,_.jsx)("span",{children:"Roof trusses must be designed and signed off for the building. Confirm loading, bearings, wind bracing and final drawings with the truss manufacturer."})]}),(0,_.jsxs)("div",{className:"truss-estimator__nav",children:[(0,_.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:w,children:"Back to calculator"}),(0,_.jsx)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",justifyContent:"center",marginTop:0},onClick:()=>c(!0),children:"Request order"})]}),l&&(0,_.jsx)("p",{className:"truss-request__demo",children:"Demo only \u2014 no order has been sent."})]})]})}):(0,_.jsx)(_.Fragment,{children:(0,_.jsxs)("div",{className:"truss-estimator",children:[(0,_.jsxs)("div",{className:"quick-order-hero",children:[(0,_.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,_.jsx)("h1",{children:"Roof Truss Calculator"}),(0,_.jsx)("p",{children:"Estimate trusses, girders and cost for your roof in a few steps."})]}),(0,_.jsxs)("div",{className:"truss-estimator__card",children:[(0,_.jsx)("div",{className:"truss-estimator__body",children:D()}),(0,_.jsxs)("div",{className:"truss-estimator__nav",children:[(0,_.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:w,children:"Back"}),(0,_.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:M,disabled:!f(),children:[(0,_.jsx)("span",{children:h}),(0,_.jsx)("span",{className:"arrow",children:(0,_.jsx)(Qt,{})})]})]})]})]})})}var Ci=X(Xe()),F=X(ie()),Rw=e=>Number.parseFloat(e)||0,hc=(e,t)=>Rw(e)*(t==="m"?1:.3048),zw=()=>({length:"",width:""}),Aw=[{id:"chamfered",label:"Chamfered",blurb:"Clean angled edge"},{id:"ogee",label:"Ogee",blurb:"Traditional curved profile"},{id:"pencil-round",label:"Pencil round",blurb:"Simple softened edge"},{id:"torus",label:"Torus",blurb:"Soft rounded detail"}];function tx({profile:e}){return(0,F.jsxs)("svg",{className:"skirting-calculator__profile-diagram",viewBox:"0 0 120 84","aria-hidden":"true",children:[(0,F.jsx)("path",{d:{chamfered:"M16 70V43L43 16H104V70Z",ogee:"M16 70V47C16 36 27 31 40 31C40 21 50 16 63 16H104V70Z","pencil-round":"M16 70V37C16 25 25 16 37 16H104V70Z",torus:"M16 70V49C16 39 25 34 36 34C36 22 47 16 61 16H104V70Z"}[e]}),(0,F.jsx)("line",{x1:"12",y1:"70",x2:"108",y2:"70"})]})}function Xd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ci.useState)("total"),[n,o]=(0,Ci.useState)("m"),[l,c]=(0,Ci.useState)(""),[p,d]=(0,Ci.useState)([zw()]),[g,f]=(0,Ci.useState)(""),[h,w]=(0,Ci.useState)("chamfered"),M="4.4",D=r==="total"?hc(l,n):p.reduce((N,A)=>N+2*(hc(A.length,n)+hc(A.width,n)),0),m=Math.max(0,D-hc(g,n)),u=Math.ceil(m/Rw(M)),b=[{key:`skirting-${h}`,label:`${Aw.find(N=>N.id===h)?.label} skirting board`,qty:m,unit:"m",query:"skirting board",category:"skirting"}],v=(N,A,T)=>{d(z=>z.map((G,P)=>P===N?{...G,[A]:T}:G))};return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)("div",{className:"truss-estimator",children:[(0,F.jsxs)("div",{className:"quick-order-hero",children:[(0,F.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,F.jsx)("h1",{children:"Skirting Board Calculator"}),(0,F.jsx)("p",{children:"Work out how many skirting board lengths you need for one room or a whole project."})]}),(0,F.jsxs)("div",{className:"truss-estimator__card skirting-calculator",children:[(0,F.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure by room or total length"}),(0,F.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter a single total or work room by room. The run is converted straight into board lengths."}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"How would you like to measure?"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle skirting-calculator__mode-toggle",role:"group","aria-label":"Calculation method",children:[(0,F.jsx)("button",{type:"button",className:r==="total"?"is-selected":"",onClick:()=>i("total"),children:"Total length"}),(0,F.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>i("rooms"),children:"Room by room"})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Measurements"}),(0,F.jsxs)("div",{className:"skirting-calculator__unit-row",children:[(0,F.jsx)("span",{children:"Units"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,F.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,F.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>o("ft"),children:"Feet"})]})]}),r==="total"?(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Total skirting length (",n,")"]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:N=>c(N.target.value)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"skirting-calculator__dimensions-header",children:[(0,F.jsx)("span",{children:"Room"}),(0,F.jsxs)("span",{children:["Length (",n,")"]}),(0,F.jsxs)("span",{children:["Width (",n,")"]}),(0,F.jsx)("span",{})]}),p.map((N,A)=>(0,F.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,F.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",A+1]}),(0,F.jsx)("input",{"aria-label":`Room ${A+1} length in ${n}`,type:"number",min:"0",step:"0.01",value:N.length,onChange:T=>v(A,"length",T.target.value)}),(0,F.jsx)("input",{"aria-label":`Room ${A+1} width in ${n}`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(A,"width",T.target.value)}),p.length>1?(0,F.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>d(T=>T.filter((z,G)=>G!==A)),children:"Remove"}):null]},`room-${A}`)),(0,F.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>d(N=>[...N,zw()]),children:"+ Add another room"})]}),(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Openings and doorways to deduct (",n,") ",(0,F.jsx)("small",{children:"optional"})]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:g,onChange:N=>f(N.target.value)})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Profile"}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Choose the finish you want for the fixed 4.4m white-primed MDF boards."}),(0,F.jsx)("div",{className:"architrave-calculator__profiles",children:Aw.map(N=>(0,F.jsxs)("button",{type:"button",className:`truss-estimator__option-card${h===N.id?" is-selected":""}`,onClick:()=>w(N.id),children:[(0,F.jsx)(tx,{profile:N.id}),(0,F.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,F.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,F.jsx)("div",{className:"truss-estimator__field-grid skirting-calculator__options-grid",children:(0,F.jsxs)("label",{className:"truss-estimator__field",children:[(0,F.jsx)("span",{children:"Board length"}),(0,F.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Longer boards can reduce the number of joins, while 10% waste allows for cuts, corners and mistakes."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__totals",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,F.jsxs)("div",{className:"skirting-calculator__result-grid",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Net skirting"}),(0,F.jsxs)("strong",{children:[m.toFixed(2)," m"]})]}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Board lengths"}),(0,F.jsx)("strong",{children:u})]})]}),(0,F.jsx)("p",{className:"skirting-calculator__note",children:"Corners and joins vary by room layout. Measure each wall where possible for the most accurate result."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__actions",children:[(0,F.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,F.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(b),disabled:m<=0,children:a})]})]})]})})}var jn=X(Xe()),le=X(ie()),cl=e=>Number.parseFloat(e)||0;function Vd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,jn.useState)("studs"),[n,o]=(0,jn.useState)(""),[l,c]=(0,jn.useState)(""),[p,d]=(0,jn.useState)("600"),[g,f]=(0,jn.useState)("2.4"),h=n&&l&&p?Math.ceil(cl(l)/(cl(p)/1e3))+1:0,w=h*cl(n),M=cl(g)>0?Math.ceil(w/cl(g)):0,D=[{key:r,label:{studs:"Stud timber",joists:"Joist timber",battens:"Batten timber"}[r],qty:w,unit:"m",query:{studs:"cls studwork timber",joists:"timber joist",battens:"roofing batten"}[r],category:"timber"}],m={studs:["Stud wall","Vertical studs along a wall length"],joists:["Joists","Parallel joists across a floor or deck"],battens:["Battens","Regularly spaced battens for lining or cladding"]},b={studs:{member:"Wall height",overall:"Wall length",help:"Studs repeat across the wall length.",count:"Studs"},joists:{member:"Joist span",overall:"Overall width",help:"Joists repeat across the overall floor or deck width.",count:"Joists"},battens:{member:"Batten length",overall:"Overall width",help:"Battens repeat across the overall lining or cladding width.",count:"Battens"}}[r];return(0,le.jsx)(le.Fragment,{children:(0,le.jsxs)("div",{className:"truss-estimator",children:[(0,le.jsxs)("div",{className:"quick-order-hero",children:[(0,le.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,le.jsx)("h1",{children:"Timber Calculator"}),(0,le.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,le.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,le.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,le.jsxs)("p",{className:"truss-estimator__step-sub",children:[b.help," Enter the member length and centres to estimate the number of pieces and stock lengths."]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,le.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(m).map(v=>(0,le.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===v?" is-selected":""}`,onClick:()=>i(v),children:[(0,le.jsx)("div",{className:"truss-estimator__option-title",children:m[v][0]}),(0,le.jsx)("div",{className:"truss-estimator__option-copy",children:m[v][1]})]},v))})]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,le.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsxs)("span",{children:[b.member," (m)"]}),(0,le.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:v=>o(v.target.value)})]}),(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsxs)("span",{children:[b.overall," (m)"]}),(0,le.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:v=>c(v.target.value)})]})]}),(0,le.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsx)("span",{children:"Centres (mm)"}),(0,le.jsxs)("select",{value:p,onChange:v=>d(v.target.value),children:[(0,le.jsx)("option",{value:"300",children:"300 mm"}),(0,le.jsx)("option",{value:"400",children:"400 mm"}),(0,le.jsx)("option",{value:"450",children:"450 mm"}),(0,le.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,le.jsxs)("label",{className:"truss-estimator__field",children:[(0,le.jsx)("span",{children:"Stock length (m)"}),(0,le.jsxs)("select",{value:g,onChange:v=>f(v.target.value),children:[(0,le.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,le.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,le.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(0,le.jsxs)("div",{className:"materials-calculator__totals",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,le.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:b.count}),(0,le.jsx)("strong",{children:h})]}),(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:"Linear metres"}),(0,le.jsxs)("strong",{children:[w.toFixed(2)," m"]})]}),(0,le.jsxs)("div",{children:[(0,le.jsxs)("span",{children:[g," m lengths"]}),(0,le.jsx)("strong",{children:M})]})]}),(0,le.jsx)("p",{className:"materials-calculator__note",children:"Spacing is measured centre-to-centre. Add extra timber for plates, noggins, trimming and openings where required."})]}),(0,le.jsxs)("div",{className:"materials-calculator__actions",children:[(0,le.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,le.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(D),disabled:w<=0,children:a})]})]})]})})}var $d=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Yd},{id:"fencing",title:"Fencing Calculator",desc:"Estimate fence panels, posts, gravel boards and fixings.",imageUrl:"/tool-images/fencing.webp",Component:Od},{id:"decking",title:"Decking Calculator",desc:"Estimate boards, substructure and fixing quantities.",imageUrl:"/tool-images/decking.webp",Component:Dd},{id:"brick-block",title:"Brick and Block Calculator",desc:"Estimate masonry units and ready-mixed mortar for a wall.",imageUrl:"/tool-images/brick-block.webp",Component:Ed},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Ld},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:Xd},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:qd},{id:"concrete-aggregate",title:"Concrete and Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:Rd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:Gd},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:Bd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:Vd},{id:"paving",title:"Paving and Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:jd}];var vc=X(Xe());var Ge=X(Xe());var S=X(ie()),ax=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],Zd={wasteFactorEnabled:!0},rx=3e3,Uw=null;function bc(e,t){let a=el(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function ix(e){return e&&e.length>0?e.join(" x "):"-"}function Kd({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:i}){let n=ac(),o=`${e}~${t.map(q=>`${q.key}|${q.query}|${q.category??""}|${q.qty}`).join("~")}`,l=o!==Uw,[c,p]=(0,Ge.useState)(null),[d,g]=(0,Ge.useState)([]),[f,h]=(0,Ge.useState)(l),[w,M]=(0,Ge.useState)(null),[D,m]=(0,Ge.useState)("tile"),[u,b]=(0,Ge.useState)(null),[v,N]=(0,Ge.useState)(""),[A,T]=(0,Ge.useState)(null),[z,G]=(0,Ge.useState)(""),[P,be]=(0,Ge.useState)([]),[De,Le]=(0,Ge.useState)(new Set),[He,ze]=(0,Ge.useState)(null),[me,ce]=(0,Ge.useState)(""),[fe,Ee]=(0,Ge.useState)([]),ut=(0,Ge.useRef)(null),Se=(0,Ge.useRef)(!1),Z=q=>`${e}:${q}`,de=q=>Jr(q.chosen,{lineId:Z(q.requirement.key),description:q.requirement.label,unit:q.requirement.unit,qty:q.requirement.qty}),Je=(0,Ge.useMemo)(()=>t.map(q=>`${q.key}|${q.query}|${q.category??""}`).join("~"),[t]);(0,Ge.useEffect)(()=>{let q=!1;return _w().then(Y=>{q||p(Y.itemCount>0)}).catch(()=>{q||p(!1)}),()=>{q=!0}},[]),(0,Ge.useEffect)(()=>{if(!a||!c)return;let q=!1,Y;l&&h(!0),M(null);let K=Date.now();return(async()=>{let pe=null;try{pe=(await yw(t,void 0,e)).map(({requirement:Ie,candidates:xt})=>({requirement:Ie,candidates:xt,chosen:xt[0]??null}))}catch(ke){q||M(ke instanceof Error?ke.message:"Could not load products")}if(!q){if(Uw=o,l){let ke=rx-(Date.now()-K);ke>0&&await new Promise(Ie=>{Y=window.setTimeout(Ie,ke)})}q||(pe&&(g(pe),!Se.current&&n&&(Se.current=!0,n.addManyToCart(pe.filter(ke=>ke.chosen).map(de)))),h(!1))}})(),()=>{q=!0,window.clearTimeout(Y)}},[a,c,Je]),(0,Ge.useEffect)(()=>{if(!A)return;let q=z.trim();if(!q){be([]);return}let Y=!1,K=window.setTimeout(()=>{hr(q).then(pe=>{Y||be(pe)}).catch(()=>{Y||be([])})},250);return()=>{Y=!0,window.clearTimeout(K)}},[A,z]),(0,Ge.useEffect)(()=>{if(!He)return;let q=me.trim();if(!q){Ee([]);return}let Y=!1,K=window.setTimeout(()=>{hr(q).then(pe=>{Y||Ee(pe)}).catch(()=>{Y||Ee([])})},250);return()=>{Y=!0,window.clearTimeout(K)}},[He,me]);let Ye=(0,Ge.useMemo)(()=>{let q=v.trim().toLowerCase(),Y=q?d.filter(K=>K.requirement.label.toLowerCase().includes(q)||(K.chosen?.description??"").toLowerCase().includes(q)||(K.chosen?.product_id??"").toLowerCase().includes(q)):d;return u?[...Y].sort((K,pe)=>{let ke=K.requirement.label.localeCompare(pe.requirement.label);return u==="asc"?ke:-ke}):Y},[d,v,u]),pt=Ye.filter(q=>q.chosen),ot=Ye.filter(q=>!q.chosen),at=d.filter(q=>q.chosen),ge=at.filter(q=>q.chosen?.price==null).length,W=at.reduce((q,Y)=>q+(Dt(de(Y),Zd).lineTotal??0),0);if((0,Ge.useEffect)(()=>{i?.(W)},[W,i]),!a||c===!1)return null;let k=n?at.filter(q=>n.cart[Z(q.requirement.key)]).length:0,R=He?d.find(q=>q.requirement.key===He)??null:null,O=me.trim()?fe:R?.candidates??[],ee=q=>{let Y=A===q.requirement.key;T(Y?null:q.requirement.key),G(Y?"":q.requirement.query)},xe=(q,Y)=>{let K=d.find(pe=>pe.requirement.key===q);g(pe=>pe.map(ke=>ke.requirement.key===q?{...ke,chosen:Y}:ke)),n&&K&&n.cart[Z(q)]&&n.addToCart(de({...K,chosen:Y})),T(null),G("")},we=q=>{g(Y=>Y.map(K=>K.requirement.key===q?{...K,chosen:null}:K)),n?.cart[Z(q)]&&n.removeFromCart(Z(q))},y=q=>{ze(q.requirement.key),ce(""),Ee([])},j=()=>{ze(null),ce(""),Ee([])},B=q=>{if(!n)return;let Y=Z(q.requirement.key);n.cart[Y]?n.removeFromCart(Y):n.addToCart(de(q))},ae=q=>{Le(Y=>{let K=new Set(Y);return K.has(q)?K.delete(q):K.add(q),K})},te=q=>{let Y=P.length>0?P:q.candidates;return(0,S.jsxs)("div",{className:"estimator-products__picker",children:[(0,S.jsx)("input",{type:"text",className:"results-search-input",value:z,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:K=>G(K.target.value),"aria-label":`Search a product for ${q.requirement.label}`}),(0,S.jsxs)("div",{className:"estimator-products__options",children:[Y.map(K=>(0,S.jsxs)("button",{type:"button",className:`estimator-products__option${K.product_id===q.chosen?.product_id?" is-selected":""}`,onClick:()=>xe(q.requirement.key,K),children:[(0,S.jsx)("span",{children:K.description}),(0,S.jsxs)("span",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${nt(K.price)}`]})]},K.product_id)),Y.length===0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,S.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!f&&(0,S.jsxs)("div",{className:"estimator-products__head",children:[(0,S.jsxs)("div",{className:"results-tile-section__head",children:[(0,S.jsx)("h3",{children:"Matched Products"}),(0,S.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!R&&(0,S.jsxs)("div",{className:"results-summary estimator-products__toolbar",children:[ge>0&&(0,S.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,S.jsx)("strong",{children:ge})," need pricing"]}),(0,S.jsxs)("div",{className:"estimator-products__controls",children:[(0,S.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:v,onChange:q=>N(q.target.value),"aria-label":"Search matched products"}),(0,S.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,S.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="tile"?" is-active":""}`,"aria-pressed":D==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>m("tile"),children:(0,S.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,S.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,S.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,S.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="list"?" is-active":""}`,"aria-pressed":D==="list","aria-label":"List view",title:"List view",onClick:()=>m("list"),children:(0,S.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,S.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,S.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,S.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,S.jsxs)("details",{ref:ut,style:{position:"relative"},children:[(0,S.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,S.jsx)("div",{className:"sort-menu-panel",children:ax.map(q=>{let Y=u===q.dir;return(0,S.jsxs)("button",{type:"button",className:`sort-menu-item${Y?" is-active":""}`,onClick:()=>{b(Y?null:q.dir),ut.current?.removeAttribute("open")},children:[(0,S.jsx)("span",{className:"sort-menu-item__check",children:Y?"\u2713":""}),q.label]},q.dir)})})]})]})]})]}),R&&(0,S.jsxs)("div",{className:"results-review-page",children:[(0,S.jsxs)("div",{className:"results-review-page__top",children:[(0,S.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:j,children:[(0,S.jsx)(Pr,{}),"Back to results"]}),(0,S.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,S.jsx)("div",{className:"results-review-searchbar",children:(0,S.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:me,onChange:q=>ce(q.target.value),"aria-label":`Search a product for ${R.requirement.label}`})}),R.chosen&&(0,S.jsx)("div",{className:"results-candidate-actions",children:(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>we(R.requirement.key),children:"Clear selected product"})})]})]}),(0,S.jsxs)("div",{className:"results-review-page__hero",children:[(0,S.jsx)("div",{className:"results-review-page__image-wrap",children:(0,S.jsx)("img",{className:"fill-img results-review-page__image",src:Ya(R.chosen?.description||R.requirement.label,R.chosen?.product_id,R.chosen?.pdp_photo_url),alt:""})}),(0,S.jsxs)("div",{className:"results-review-page__summary",children:[(0,S.jsx)("h2",{children:R.requirement.label}),(0,S.jsxs)("p",{className:"results-review-page__meta",children:[yi(R.requirement.qty)," ",Sa(R.requirement.unit,R.requirement.qty)]}),R.chosen?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"results-review-page__product",children:R.chosen.description}),(0,S.jsxs)("div",{className:"results-row-meta",children:[R.chosen.product_id,R.chosen.price!=null?` \xB7 ${bc(R.chosen.price,R.chosen.price_basis)}`:""]})]}):(0,S.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,S.jsx)("div",{className:"results-review-page__actions",children:(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${n?.cart[Z(R.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(R),disabled:!R.chosen||!n,children:n?.cart[Z(R.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),O.length===0?(0,S.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,S.jsxs)("table",{className:"score-breakdown-table",children:[(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{children:"Product"}),(0,S.jsx)("th",{children:"Dims (mm)"}),(0,S.jsx)("th",{children:"Price"}),(0,S.jsx)("th",{"aria-label":"Actions"})]})}),(0,S.jsx)("tbody",{children:O.map(q=>{let Y=q.product_id===R.chosen?.product_id;return(0,S.jsxs)("tr",{className:Y?"score-breakdown-row--best":"",children:[(0,S.jsxs)("td",{children:[(0,S.jsx)("div",{children:q.description}),(0,S.jsx)("div",{className:"results-row-meta",children:q.product_id})]}),(0,S.jsx)("td",{children:(0,S.jsx)("span",{className:"unit-badge",children:ix(q.measurements_mm)})}),(0,S.jsx)("td",{children:q.price!=null?bc(q.price,q.price_basis):"-"}),(0,S.jsx)("td",{children:(0,S.jsxs)("label",{className:"switch-toggle",title:Y?"Currently selected":"Use this candidate",children:[(0,S.jsx)("input",{type:"checkbox",checked:Y,onChange:()=>{Y?we(R.requirement.key):xe(R.requirement.key,q)},"aria-label":Y?`${q.description} selected`:`Use ${q.description}`}),(0,S.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},q.product_id)})})]})]}),!R&&f&&(0,S.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,S.jsx)(fr,{}),(0,S.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!R&&w&&(0,S.jsx)("p",{className:"results-empty-hint estimator-products__error",children:w}),!R&&!f&&!w&&Ye.length===0&&d.length>0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!R&&!f&&!w&&D==="tile"&&pt.length>0&&(0,S.jsx)("div",{className:"results-tile-grid",children:pt.map(q=>{let{requirement:Y,chosen:K}=q,pe=K?Dt(de(q),Zd):null,ke=n?!!n.cart[Z(Y.key)]:!1;return(0,S.jsxs)("article",{className:"results-tile-card",children:[(0,S.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>y(q),"aria-label":`Review match for ${Y.label}`,children:[(0,S.jsx)("div",{className:"results-tile-card__media",children:(0,S.jsx)("img",{className:"fill-img results-tile-card__image",src:Ya(K?.description||Y.label,K?.product_id,K?.pdp_photo_url),alt:""})}),(0,S.jsxs)("div",{className:"results-tile-card__body",children:[K?(0,S.jsxs)("div",{className:"results-tile-card__heading",children:[(0,S.jsx)("div",{className:"results-tile-card__title",children:K.description}),(0,S.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,S.jsx)("span",{children:K.product_id}),K.price!=null?(0,S.jsx)("span",{children:bc(K.price,K.price_basis)}):null]})]}):(0,S.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,S.jsxs)("div",{className:"results-tile-card__match",children:[(0,S.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,S.jsx)("div",{className:"results-tile-card__match-name",children:Y.label}),(0,S.jsxs)("div",{className:"results-tile-card__meta",children:[yi(Y.qty)," ",Sa(Y.unit,Y.qty)]}),pe?.requiredSellUnits!=null?(0,S.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",pe.requiredSellUnits," ",pe.sellUnit,pe.lineTotal!=null?` \xB7 ${nt(pe.lineTotal)}`:""]}):K?(0,S.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,S.jsxs)("div",{className:"results-tile-card__actions",children:[(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>y(q),children:"Review"}),(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(q),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})]})]},Y.key)})}),!R&&!f&&!w&&D==="list"&&pt.length>0&&(0,S.jsx)("div",{className:"bom-table-wrap",children:(0,S.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,S.jsxs)("colgroup",{children:[(0,S.jsx)("col",{style:{width:"56px"}}),(0,S.jsx)("col",{className:"col-item"}),(0,S.jsx)("col",{style:{width:"90px"}}),(0,S.jsx)("col",{style:{width:"80px"}}),(0,S.jsx)("col",{style:{width:"220px"}}),(0,S.jsx)("col",{style:{width:"110px"}})]}),(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{className:"bom-col-header",children:[(0,S.jsx)("th",{"aria-label":"Expand"}),(0,S.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,S.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,S.jsx)("tbody",{children:pt.map(q=>{let{requirement:Y,chosen:K}=q,pe=K?Dt(de(q),Zd):null,ke=n?!!n.cart[Z(Y.key)]:!1,Ie=De.has(Y.key);return(0,S.jsxs)(Ge.Fragment,{children:[(0,S.jsxs)("tr",{className:"bom-row",children:[(0,S.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,S.jsx)("button",{type:"button",className:"link-btn",onClick:()=>ae(Y.key),"aria-expanded":Ie,"aria-label":Ie?"Collapse product options":"Expand product options",children:Ie?"\u25BE":"\u25B8"})}),(0,S.jsxs)("td",{style:{paddingLeft:0},children:[(0,S.jsx)("div",{className:"bom-component-name",children:Y.label}),pe?.requiredSellUnits!=null&&(0,S.jsxs)("div",{className:"results-row-meta",children:["Order ",pe.requiredSellUnits," ",pe.sellUnit,pe.lineTotal!=null?` \xB7 ${nt(pe.lineTotal)}`:""]})]}),(0,S.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:yi(Y.qty)}),(0,S.jsx)("td",{style:{textAlign:"center"},children:Sa(Y.unit,Y.qty)}),(0,S.jsx)("td",{style:{textAlign:"center"},children:K?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"bom-component-name",children:K.description}),(0,S.jsxs)("div",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${bc(K.price,K.price_basis)}`]})]}):(0,S.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,S.jsx)("td",{style:{textAlign:"center"},children:(0,S.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(q),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})})]}),Ie&&(0,S.jsx)("tr",{children:(0,S.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:A===Y.key?te(q):(0,S.jsxs)("div",{className:"estimator-products__picker",children:[(0,S.jsxs)("div",{className:"estimator-products__options",children:[q.candidates.map(xt=>(0,S.jsxs)("button",{type:"button",className:`estimator-products__option${xt.product_id===K?.product_id?" is-selected":""}`,onClick:()=>xe(Y.key,xt),children:[(0,S.jsx)("span",{children:xt.description}),(0,S.jsxs)("span",{className:"results-row-meta",children:[xt.product_id,xt.price!=null&&` \xB7 ${nt(xt.price)}`]})]},xt.product_id)),q.candidates.length===0&&(0,S.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,S.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>ee(q),children:"Search the catalogue"})]})})})]},Y.key)})})]})}),!R&&!f&&!w&&ot.length>0&&(0,S.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,S.jsxs)("div",{className:"results-tile-section__head",children:[(0,S.jsx)("h3",{children:"Require Matching"}),(0,S.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,S.jsx)("div",{className:"results-unmatched-list",children:ot.map(q=>(0,S.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>y(q),children:[(0,S.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,S.jsx)("span",{className:"results-unmatched-card__title",children:q.requirement.label}),(0,S.jsxs)("span",{className:"results-row-meta",children:[yi(q.requirement.qty)," ",Sa(q.requirement.unit,q.requirement.qty)]})]}),(0,S.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},q.requirement.key))})]}),!f&&!w&&d.length>0&&(0,S.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,S.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,S.jsx)("p",{className:"disclaimer-text",children:"These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence."})]}),!R&&!f&&!w&&(r||k>0)&&(0,S.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,S.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),k>0&&n&&(0,S.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:n.openBasket,children:[(0,S.jsxs)("span",{children:["View Basket (",k,")"]}),(0,S.jsx)("span",{className:"arrow",children:(0,S.jsx)(Qt,{})})]})]})]})}var Gt=X(ie());function Pd({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[i,n]=(0,vc.useState)(0),o=(0,vc.useCallback)(l=>n(l),[]);return(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsxs)("div",{className:"truss-estimator",children:[(0,Gt.jsxs)("div",{className:"quick-order-hero",children:[(0,Gt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Gt.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Gt.jsx)("h1",{children:"Your Materials"}),i>0&&(0,Gt.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Gt.jsx)("strong",{children:nt(i)})," Est. total"]})]}),(0,Gt.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Gt.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Gt.jsx)(Kd,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var Jd=X(Xe());var Ft=X(ie()),nx=1500;function Dw(e){let{addManyToCart:t,clearCart:a,openBasket:r}=An(),[i,n]=(0,Jd.useState)(!1),[o,l]=(0,Jd.useState)(null);return{adding:i,basketError:o,addToBasket:async(p,d)=>{let g=Date.now();n(!0),l(null);try{let f=await Promise.all(p.filter(w=>w.qty>0).map(async w=>{let M=(await hr(w.search)).find(D=>D.product_id===w.productId);if(!M)throw new Error("A selected product is no longer available in this catalogue.");return Jr(M,{lineId:`${e}:${w.key}`,description:M.description,unit:Td(w.unit??"each",M),qty:w.qty,calculatorWasteIncluded:d})})),h=nx-(Date.now()-g);h>0&&await new Promise(w=>window.setTimeout(w,h)),a(),t(f),r()}catch(f){l(f instanceof Error?f.message:"Could not add the products to your basket.")}finally{n(!1)}}}}function Ow({toolTitle:e}){return(0,Ft.jsx)(Ft.Fragment,{children:(0,Ft.jsxs)("div",{className:"truss-estimator",children:[(0,Ft.jsxs)("div",{className:"quick-order-hero",children:[(0,Ft.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Ft.jsx)("h1",{children:"Your Materials"}),(0,Ft.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Ft.jsx)("div",{className:"truss-estimator__card",children:(0,Ft.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Ft.jsx)(fr,{}),(0,Ft.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Ue=X(ie());function wc(e){let[t,a]=(0,Va.useState)(!1);return(0,Ue.jsx)(tc,{onOpenBasket:()=>a(!0),children:(0,Ue.jsx)(ox,{...e,showBasket:t,onShowBasket:a})})}function ox({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:i}){let[n,o]=(0,Va.useState)(null),[l,c]=(0,Va.useState)(null),p=$d.find(z=>z.id===n),{cart:d,updateCartQty:g,updateCartSellUnits:f,updateCartConversions:h,removeFromCart:w,clearCart:M}=An(),{adding:D,basketError:m,addToBasket:u}=Dw(p?.title??"calculator"),b=(0,Va.useRef)(null),v=Xs("estimating-tools",b);(0,Va.useEffect)(()=>{v("viewed")},[v]);let N=r?"basket":D?"adding":l?"review":n??"list",A=(0,Va.useRef)(N);(0,Va.useEffect)(()=>{A.current!==N&&(A.current=N,window.scrollTo(0,0))},[N]);let T=z=>{if(!p)return;v("estimate_completed",{calculator:p.id,lines:z.length});let G=vw(p.id,z);G?u(G,z[0]?.calculatorWasteIncluded??!1):c(z)};return(0,Ue.jsx)(Po.Provider,{value:v,children:(0,Ue.jsx)("div",{ref:b,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}`,style:Ht().theme,children:(0,Ue.jsx)("main",{className:"main-content",children:r?(0,Ue.jsx)(ol,{cart:d,onUpdateQty:g,onUpdateSellUnits:f,onResolveConversions:h,onRemove:w,onBack:()=>i(!1),onStartNewQuote:()=>{M(),o(null),c(null),i(!1)},internal:a}):D&&p?(0,Ue.jsx)(Ow,{toolTitle:p.title}):p?(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)("div",{hidden:l!==null,children:(0,Ue.jsx)(p.Component,{onBack:()=>o(null),onReview:T})}),m&&(0,Ue.jsx)("p",{className:"results-empty-hint estimator-products__error",children:m}),l!==null&&(0,Ue.jsx)(Pd,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>c(null)})]}):(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsxs)("div",{className:"quick-order-card",children:[(0,Ue.jsxs)("div",{className:"quick-order-hero",children:[(0,Ue.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,Ue.jsx)("h1",{children:"Estimating Tools"}),(0,Ue.jsx)("p",{children:"Trade-specific calculators for trusses, fencing, decking, masonry and painting. Dial in your specs and get an instant material estimate."})]}),(0,Ue.jsxs)("div",{className:"quick-order-alt",children:[(0,Ue.jsx)("div",{className:"quick-order-alt-title",children:"Choose a Calculator"}),(0,Ue.jsx)("div",{className:"estimator-tools-grid",children:$d.map(z=>(0,Ue.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{v("calculator_selected",{calculator:z.id}),o(z.id),c(null)},children:[(0,Ue.jsx)("span",{className:"estimator-tool-card__image-wrap",children:(0,Ue.jsx)("img",{className:"fill-img estimator-tool-card__image",src:It(z.imageUrl),alt:""})}),(0,Ue.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Ue.jsx)("span",{className:"estimator-tool-card__title",children:z.title}),(0,Ue.jsx)("span",{className:"estimator-tool-card__desc",children:z.desc})]})]},z.id))})]})]})})})})})}var yc=X(ie());function Id({config:e,children:t}){return tv(e),(0,yc.jsx)(yc.Fragment,{children:t})}var Fd=X(ie()),lx="https://api.metronlabs.ai",sx=["client","api-key","api-url","theme","hide-header","analytics"],cx=["all","events-only","none"];function Lw(e,t){var a;customElements.get(e)||customElements.define(e,(a=class extends HTMLElement{constructor(){super();this.root=null;this.attachShadow({mode:"open"})}connectedCallback(){if(this.dataset.version="0.1.47",this.id||(this.id=e),this.setAttribute("data-turbo-permanent",""),this.setAttribute("data-turbolinks-permanent",""),!this.root){let i=document.createElement("div"),n=document.createElement("style");n.textContent=`:host { display: block; }
|
|
6804
6804
|
:host > div { all: initial; display: block; }
|
|
6805
|
-
${
|
|
6805
|
+
${ev}`,this.shadowRoot.replaceChildren(n,i),this.root=(0,Bw.createRoot)(i)}this.renderWidget()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||!this.root||(this.root.unmount(),this.root=null)})}attributeChangedCallback(){this.root&&this.renderWidget()}renderWidget(){let i=this.getAttribute("client")??void 0,n=this.getAttribute("api-key")??void 0;(!i||!n)&&console.error(`<${e}> needs client and api-key attributes.`);let o={apiBaseUrl:this.getAttribute("api-url")||lx,client:i,apiKey:n,theme:px(e,this.getAttribute("theme")),analytics:ux(this.getAttribute("analytics"))};this.root.render((0,Fd.jsx)(Id,{config:o,children:(0,Fd.jsx)(t,{hideHeader:this.hasAttribute("hide-header")})}))}},a.observedAttributes=sx,a))}function ux(e){return cx.find(t=>t===e)??"all"}function px(e,t){if(t)try{return JSON.parse(t)}catch{console.error(`<${e}> theme attribute isn't valid JSON; using the default colours.`);return}}Lw("metron-labs-quick-quote",rc);Lw("metron-labs-estimating-tools",wc);
|
|
6806
6806
|
/*! Bundled license information:
|
|
6807
6807
|
|
|
6808
6808
|
scheduler/cjs/scheduler.production.js:
|