@metron-labs/quote-react 0.1.19 → 0.1.21

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.
@@ -1,12 +1,12 @@
1
- import{a as Ra,b as Y}from"./chunk-SQE76S5B.js";var im=Ra(Ie=>{"use strict";function vc(e,t){var a=e.length;e.push(t);e:for(;0<a;){var r=a-1>>>1,n=e[r];if(0<ll(n,t))e[r]=t,e[a]=n,a=r;else break e}}function Ua(e){return e.length===0?null:e[0]}function cl(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,n=e.length,i=n>>>1;r<i;){var o=2*(r+1)-1,l=e[o],u=o+1,p=e[u];if(0>ll(l,a))u<n&&0>ll(p,l)?(e[r]=p,e[u]=a,r=u):(e[r]=l,e[o]=a,r=o);else if(u<n&&0>ll(p,a))e[r]=p,e[u]=a,r=u;else break e}}return t}function ll(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}Ie.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Jd=performance,Ie.unstable_now=function(){return Jd.now()}):(gc=Date,Pd=gc.now(),Ie.unstable_now=function(){return gc.now()-Pd});var Jd,gc,Pd,$a=[],br=[],Rw=1,pa=null,At=3,wc=!1,Qn=!1,Yn=!1,yc=!1,Wd=typeof setTimeout=="function"?setTimeout:null,em=typeof clearTimeout=="function"?clearTimeout:null,Fd=typeof setImmediate<"u"?setImmediate:null;function sl(e){for(var t=Ua(br);t!==null;){if(t.callback===null)cl(br);else if(t.startTime<=e)cl(br),t.sortIndex=t.expirationTime,vc($a,t);else break;t=Ua(br)}}function _c(e){if(Yn=!1,sl(e),!Qn)if(Ua($a)!==null)Qn=!0,zi||(zi=!0,Ti());else{var t=Ua(br);t!==null&&xc(_c,t.startTime-e)}}var zi=!1,Xn=-1,tm=5,am=-1;function rm(){return yc?!0:!(Ie.unstable_now()-am<tm)}function hc(){if(yc=!1,zi){var e=Ie.unstable_now();am=e;var t=!0;try{e:{Qn=!1,Yn&&(Yn=!1,em(Xn),Xn=-1),wc=!0;var a=At;try{t:{for(sl(e),pa=Ua($a);pa!==null&&!(pa.expirationTime>e&&rm());){var r=pa.callback;if(typeof r=="function"){pa.callback=null,At=pa.priorityLevel;var n=r(pa.expirationTime<=e);if(e=Ie.unstable_now(),typeof n=="function"){pa.callback=n,sl(e),t=!0;break t}pa===Ua($a)&&cl($a),sl(e)}else cl($a);pa=Ua($a)}if(pa!==null)t=!0;else{var i=Ua(br);i!==null&&xc(_c,i.startTime-e),t=!1}}break e}finally{pa=null,At=a,wc=!1}t=void 0}}finally{t?Ti():zi=!1}}}var Ti;typeof Fd=="function"?Ti=function(){Fd(hc)}:typeof MessageChannel<"u"?(bc=new MessageChannel,Id=bc.port2,bc.port1.onmessage=hc,Ti=function(){Id.postMessage(null)}):Ti=function(){Wd(hc,0)};var bc,Id;function xc(e,t){Xn=Wd(function(){e(Ie.unstable_now())},t)}Ie.unstable_IdlePriority=5;Ie.unstable_ImmediatePriority=1;Ie.unstable_LowPriority=4;Ie.unstable_NormalPriority=3;Ie.unstable_Profiling=null;Ie.unstable_UserBlockingPriority=2;Ie.unstable_cancelCallback=function(e){e.callback=null};Ie.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"):tm=0<e?Math.floor(1e3/e):5};Ie.unstable_getCurrentPriorityLevel=function(){return At};Ie.unstable_next=function(e){switch(At){case 1:case 2:case 3:var t=3;break;default:t=At}var a=At;At=t;try{return e()}finally{At=a}};Ie.unstable_requestPaint=function(){yc=!0};Ie.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=At;At=e;try{return t()}finally{At=a}};Ie.unstable_scheduleCallback=function(e,t,a){var r=Ie.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 n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,e={id:Rw++,callback:t,priorityLevel:e,startTime:a,expirationTime:n,sortIndex:-1},a>r?(e.sortIndex=a,vc(br,e),Ua($a)===null&&e===Ua(br)&&(Yn?(em(Xn),Xn=-1):Yn=!0,xc(_c,a-r))):(e.sortIndex=n,vc($a,e),Qn||wc||(Qn=!0,zi||(zi=!0,Ti()))),e};Ie.unstable_shouldYield=rm;Ie.unstable_wrapCallback=function(e){var t=At;return function(){var a=At;At=t;try{return e.apply(this,arguments)}finally{At=a}}}});var om=Ra((V_,nm)=>{"use strict";nm.exports=im()});var bm=Ra(ge=>{"use strict";var Sc=Symbol.for("react.transitional.element"),Uw=Symbol.for("react.portal"),Dw=Symbol.for("react.fragment"),Bw=Symbol.for("react.strict_mode"),Ow=Symbol.for("react.profiler"),Lw=Symbol.for("react.consumer"),Hw=Symbol.for("react.context"),jw=Symbol.for("react.forward_ref"),Gw=Symbol.for("react.suspense"),Qw=Symbol.for("react.memo"),pm=Symbol.for("react.lazy"),Yw=Symbol.for("react.activity"),lm=Symbol.iterator;function Xw(e){return e===null||typeof e!="object"?null:(e=lm&&e[lm]||e["@@iterator"],typeof e=="function"?e:null)}var dm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mm=Object.assign,fm={};function Ri(e,t,a){this.props=e,this.context=t,this.refs=fm,this.updater=a||dm}Ri.prototype.isReactComponent={};Ri.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")};Ri.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gm(){}gm.prototype=Ri.prototype;function Cc(e,t,a){this.props=e,this.context=t,this.refs=fm,this.updater=a||dm}var qc=Cc.prototype=new gm;qc.constructor=Cc;mm(qc,Ri.prototype);qc.isPureReactComponent=!0;var sm=Array.isArray;function Nc(){}var Ve={H:null,A:null,T:null,S:null},hm=Object.prototype.hasOwnProperty;function Ec(e,t,a){var r=a.ref;return{$$typeof:Sc,type:e,key:t,ref:r!==void 0?r:null,props:a}}function $w(e,t){return Ec(e.type,t,e.props)}function Mc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Sc}function Vw(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var cm=/\/+/g;function kc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Vw(""+e.key):t.toString(36)}function Zw(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Nc,Nc):(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 Ai(e,t,a,r,n){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Sc:case Uw:o=!0;break;case pm:return o=e._init,Ai(o(e._payload),t,a,r,n)}}if(o)return n=n(e),o=r===""?"."+kc(e,0):r,sm(n)?(a="",o!=null&&(a=o.replace(cm,"$&/")+"/"),Ai(n,t,a,"",function(p){return p})):n!=null&&(Mc(n)&&(n=$w(n,a+(n.key==null||e&&e.key===n.key?"":(""+n.key).replace(cm,"$&/")+"/")+o)),t.push(n)),1;o=0;var l=r===""?".":r+":";if(sm(e))for(var u=0;u<e.length;u++)r=e[u],i=l+kc(r,u),o+=Ai(r,t,a,i,n);else if(u=Xw(e),typeof u=="function")for(e=u.call(e),u=0;!(r=e.next()).done;)r=r.value,i=l+kc(r,u++),o+=Ai(r,t,a,i,n);else if(i==="object"){if(typeof e.then=="function")return Ai(Zw(e),t,a,r,n);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 ul(e,t,a){if(e==null)return e;var r=[],n=0;return Ai(e,r,"","",function(i){return t.call(a,i,n++)}),r}function Kw(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 um=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)},Jw={map:ul,forEach:function(e,t,a){ul(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return ul(e,function(){t++}),t},toArray:function(e){return ul(e,function(t){return t})||[]},only:function(e){if(!Mc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ge.Activity=Yw;ge.Children=Jw;ge.Component=Ri;ge.Fragment=Dw;ge.Profiler=Ow;ge.PureComponent=Cc;ge.StrictMode=Bw;ge.Suspense=Gw;ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ve;ge.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ve.H.useMemoCache(e)}};ge.cache=function(e){return function(){return e.apply(null,arguments)}};ge.cacheSignal=function(){return null};ge.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=mm({},e.props),n=e.key;if(t!=null)for(i in t.key!==void 0&&(n=""+t.key),t)!hm.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=a;else if(1<i){for(var o=Array(i),l=0;l<i;l++)o[l]=arguments[l+2];r.children=o}return Ec(e.type,n,r)};ge.createContext=function(e){return e={$$typeof:Hw,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Lw,_context:e},e};ge.createElement=function(e,t,a){var r,n={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)hm.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(n[r]=t[r]);var o=arguments.length-2;if(o===1)n.children=a;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];n.children=l}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)n[r]===void 0&&(n[r]=o[r]);return Ec(e,i,n)};ge.createRef=function(){return{current:null}};ge.forwardRef=function(e){return{$$typeof:jw,render:e}};ge.isValidElement=Mc;ge.lazy=function(e){return{$$typeof:pm,_payload:{_status:-1,_result:e},_init:Kw}};ge.memo=function(e,t){return{$$typeof:Qw,type:e,compare:t===void 0?null:t}};ge.startTransition=function(e){var t=Ve.T,a={};Ve.T=a;try{var r=e(),n=Ve.S;n!==null&&n(a,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Nc,um)}catch(i){um(i)}finally{t!==null&&a.types!==null&&(t.types=a.types),Ve.T=t}};ge.unstable_useCacheRefresh=function(){return Ve.H.useCacheRefresh()};ge.use=function(e){return Ve.H.use(e)};ge.useActionState=function(e,t,a){return Ve.H.useActionState(e,t,a)};ge.useCallback=function(e,t){return Ve.H.useCallback(e,t)};ge.useContext=function(e){return Ve.H.useContext(e)};ge.useDebugValue=function(){};ge.useDeferredValue=function(e,t){return Ve.H.useDeferredValue(e,t)};ge.useEffect=function(e,t){return Ve.H.useEffect(e,t)};ge.useEffectEvent=function(e){return Ve.H.useEffectEvent(e)};ge.useId=function(){return Ve.H.useId()};ge.useImperativeHandle=function(e,t,a){return Ve.H.useImperativeHandle(e,t,a)};ge.useInsertionEffect=function(e,t){return Ve.H.useInsertionEffect(e,t)};ge.useLayoutEffect=function(e,t){return Ve.H.useLayoutEffect(e,t)};ge.useMemo=function(e,t){return Ve.H.useMemo(e,t)};ge.useOptimistic=function(e,t){return Ve.H.useOptimistic(e,t)};ge.useReducer=function(e,t,a){return Ve.H.useReducer(e,t,a)};ge.useRef=function(e){return Ve.H.useRef(e)};ge.useState=function(e){return Ve.H.useState(e)};ge.useSyncExternalStore=function(e,t,a){return Ve.H.useSyncExternalStore(e,t,a)};ge.useTransition=function(){return Ve.H.useTransition()};ge.version="19.2.3"});var Ye=Ra((K_,vm)=>{"use strict";vm.exports=bm()});var ym=Ra(Ut=>{"use strict";var Pw=Ye();function wm(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 vr(){}var Rt={d:{f:vr,r:function(){throw Error(wm(522))},D:vr,C:vr,L:vr,m:vr,X:vr,S:vr,M:vr},p:0,findDOMNode:null},Fw=Symbol.for("react.portal");function Iw(e,t,a){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Fw,key:r==null?null:""+r,children:e,containerInfo:t,implementation:a}}var $n=Pw.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function pl(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Rt;Ut.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(wm(299));return Iw(e,t,null,a)};Ut.flushSync=function(e){var t=$n.T,a=Rt.p;try{if($n.T=null,Rt.p=2,e)return e()}finally{$n.T=t,Rt.p=a,Rt.d.f()}};Ut.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Rt.d.C(e,t))};Ut.prefetchDNS=function(e){typeof e=="string"&&Rt.d.D(e)};Ut.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,r=pl(a,t.crossOrigin),n=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?Rt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:n,fetchPriority:i}):a==="script"&&Rt.d.X(e,{crossOrigin:r,integrity:n,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ut.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=pl(t.as,t.crossOrigin);Rt.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&&Rt.d.M(e)};Ut.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,r=pl(a,t.crossOrigin);Rt.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})}};Ut.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=pl(t.as,t.crossOrigin);Rt.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 Rt.d.m(e)};Ut.requestFormReset=function(e){Rt.d.r(e)};Ut.unstable_batchedUpdates=function(e,t){return e(t)};Ut.useFormState=function(e,t,a){return $n.H.useFormState(e,t,a)};Ut.useFormStatus=function(){return $n.H.useHostTransitionStatus()};Ut.version="19.2.3"});var km=Ra((P_,xm)=>{"use strict";function _m(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_m)}catch(e){console.error(e)}}_m(),xm.exports=ym()});var Bb=Ra(Bs=>{"use strict";var ht=om(),Pf=Ye(),Ww=km();function D(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 Ff(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ao(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 If(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 Wf(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 Nm(e){if(Ao(e)!==e)throw Error(D(188))}function e0(e){var t=e.alternate;if(!t){if(t=Ao(e),t===null)throw Error(D(188));return t!==e?null:e}for(var a=e,r=t;;){var n=a.return;if(n===null)break;var i=n.alternate;if(i===null){if(r=n.return,r!==null){a=r;continue}break}if(n.child===i.child){for(i=n.child;i;){if(i===a)return Nm(n),e;if(i===r)return Nm(n),t;i=i.sibling}throw Error(D(188))}if(a.return!==r.return)a=n,r=i;else{for(var o=!1,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){for(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)throw Error(D(189))}}if(a.alternate!==r)throw Error(D(190))}if(a.tag!==3)throw Error(D(188));return a.stateNode.current===a?e:t}function eg(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=eg(e),t!==null)return t;e=e.sibling}return null}var Je=Object.assign,t0=Symbol.for("react.element"),dl=Symbol.for("react.transitional.element"),Wn=Symbol.for("react.portal"),Hi=Symbol.for("react.fragment"),tg=Symbol.for("react.strict_mode"),cu=Symbol.for("react.profiler"),ag=Symbol.for("react.consumer"),Wa=Symbol.for("react.context"),ip=Symbol.for("react.forward_ref"),uu=Symbol.for("react.suspense"),pu=Symbol.for("react.suspense_list"),np=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),du=Symbol.for("react.activity"),a0=Symbol.for("react.memo_cache_sentinel"),Sm=Symbol.iterator;function Vn(e){return e===null||typeof e!="object"?null:(e=Sm&&e[Sm]||e["@@iterator"],typeof e=="function"?e:null)}var r0=Symbol.for("react.client.reference");function mu(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===r0?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Hi:return"Fragment";case cu:return"Profiler";case tg:return"StrictMode";case uu:return"Suspense";case pu:return"SuspenseList";case du:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Wn:return"Portal";case Wa:return e.displayName||"Context";case ag:return(e._context.displayName||"Context")+".Consumer";case ip:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case np:return t=e.displayName||null,t!==null?t:mu(e.type)||"Memo";case wr:t=e._payload,e=e._init;try{return mu(e(t))}catch{}}return null}var eo=Array.isArray,me=Pf.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ze=Ww.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ti={pending:!1,data:null,method:null,action:null},fu=[],ji=-1;function Ha(e){return{current:e}}function _t(e){0>ji||(e.current=fu[ji],fu[ji]=null,ji--)}function Xe(e,t){ji++,fu[ji]=e.current,e.current=t}var La=Ha(null),vo=Ha(null),Tr=Ha(null),$l=Ha(null);function Vl(e,t){switch(Xe(Tr,t),Xe(vo,e),Xe(La,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rf(t),e=xb(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_t(La),Xe(La,e)}function nn(){_t(La),_t(vo),_t(Tr)}function gu(e){e.memoizedState!==null&&Xe($l,e);var t=La.current,a=xb(t,e.type);t!==a&&(Xe(vo,e),Xe(La,a))}function Zl(e){vo.current===e&&(_t(La),_t(vo)),$l.current===e&&(_t($l),Mo._currentValue=ti)}var Tc,Cm;function Fr(e){if(Tc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Tc=t&&t[1]||"",Cm=-1<a.stack.indexOf(`
1
+ import{a as Ra,b as Y}from"./chunk-SQE76S5B.js";var im=Ra(Fe=>{"use strict";function vc(e,t){var a=e.length;e.push(t);e:for(;0<a;){var r=a-1>>>1,n=e[r];if(0<sl(n,t))e[r]=t,e[a]=n,a=r;else break e}}function Ua(e){return e.length===0?null:e[0]}function ul(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,n=e.length,i=n>>>1;r<i;){var o=2*(r+1)-1,l=e[o],u=o+1,p=e[u];if(0>sl(l,a))u<n&&0>sl(p,l)?(e[r]=p,e[u]=a,r=u):(e[r]=l,e[o]=a,r=o);else if(u<n&&0>sl(p,a))e[r]=p,e[u]=a,r=u;else break e}}return t}function sl(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}Fe.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Jd=performance,Fe.unstable_now=function(){return Jd.now()}):(gc=Date,Pd=gc.now(),Fe.unstable_now=function(){return gc.now()-Pd});var Jd,gc,Pd,$a=[],br=[],Uw=1,pa=null,At=3,wc=!1,Yn=!1,Xn=!1,yc=!1,Wd=typeof setTimeout=="function"?setTimeout:null,em=typeof clearTimeout=="function"?clearTimeout:null,Fd=typeof setImmediate<"u"?setImmediate:null;function cl(e){for(var t=Ua(br);t!==null;){if(t.callback===null)ul(br);else if(t.startTime<=e)ul(br),t.sortIndex=t.expirationTime,vc($a,t);else break;t=Ua(br)}}function _c(e){if(Xn=!1,cl(e),!Yn)if(Ua($a)!==null)Yn=!0,Ai||(Ai=!0,zi());else{var t=Ua(br);t!==null&&xc(_c,t.startTime-e)}}var Ai=!1,$n=-1,tm=5,am=-1;function rm(){return yc?!0:!(Fe.unstable_now()-am<tm)}function hc(){if(yc=!1,Ai){var e=Fe.unstable_now();am=e;var t=!0;try{e:{Yn=!1,Xn&&(Xn=!1,em($n),$n=-1),wc=!0;var a=At;try{t:{for(cl(e),pa=Ua($a);pa!==null&&!(pa.expirationTime>e&&rm());){var r=pa.callback;if(typeof r=="function"){pa.callback=null,At=pa.priorityLevel;var n=r(pa.expirationTime<=e);if(e=Fe.unstable_now(),typeof n=="function"){pa.callback=n,cl(e),t=!0;break t}pa===Ua($a)&&ul($a),cl(e)}else ul($a);pa=Ua($a)}if(pa!==null)t=!0;else{var i=Ua(br);i!==null&&xc(_c,i.startTime-e),t=!1}}break e}finally{pa=null,At=a,wc=!1}t=void 0}}finally{t?zi():Ai=!1}}}var zi;typeof Fd=="function"?zi=function(){Fd(hc)}:typeof MessageChannel<"u"?(bc=new MessageChannel,Id=bc.port2,bc.port1.onmessage=hc,zi=function(){Id.postMessage(null)}):zi=function(){Wd(hc,0)};var bc,Id;function xc(e,t){$n=Wd(function(){e(Fe.unstable_now())},t)}Fe.unstable_IdlePriority=5;Fe.unstable_ImmediatePriority=1;Fe.unstable_LowPriority=4;Fe.unstable_NormalPriority=3;Fe.unstable_Profiling=null;Fe.unstable_UserBlockingPriority=2;Fe.unstable_cancelCallback=function(e){e.callback=null};Fe.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"):tm=0<e?Math.floor(1e3/e):5};Fe.unstable_getCurrentPriorityLevel=function(){return At};Fe.unstable_next=function(e){switch(At){case 1:case 2:case 3:var t=3;break;default:t=At}var a=At;At=t;try{return e()}finally{At=a}};Fe.unstable_requestPaint=function(){yc=!0};Fe.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=At;At=e;try{return t()}finally{At=a}};Fe.unstable_scheduleCallback=function(e,t,a){var r=Fe.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 n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,e={id:Uw++,callback:t,priorityLevel:e,startTime:a,expirationTime:n,sortIndex:-1},a>r?(e.sortIndex=a,vc(br,e),Ua($a)===null&&e===Ua(br)&&(Xn?(em($n),$n=-1):Xn=!0,xc(_c,a-r))):(e.sortIndex=n,vc($a,e),Yn||wc||(Yn=!0,Ai||(Ai=!0,zi()))),e};Fe.unstable_shouldYield=rm;Fe.unstable_wrapCallback=function(e){var t=At;return function(){var a=At;At=t;try{return e.apply(this,arguments)}finally{At=a}}}});var om=Ra((Z_,nm)=>{"use strict";nm.exports=im()});var bm=Ra(ge=>{"use strict";var Sc=Symbol.for("react.transitional.element"),Dw=Symbol.for("react.portal"),Bw=Symbol.for("react.fragment"),Ow=Symbol.for("react.strict_mode"),Lw=Symbol.for("react.profiler"),Hw=Symbol.for("react.consumer"),jw=Symbol.for("react.context"),Gw=Symbol.for("react.forward_ref"),Qw=Symbol.for("react.suspense"),Yw=Symbol.for("react.memo"),pm=Symbol.for("react.lazy"),Xw=Symbol.for("react.activity"),lm=Symbol.iterator;function $w(e){return e===null||typeof e!="object"?null:(e=lm&&e[lm]||e["@@iterator"],typeof e=="function"?e:null)}var dm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mm=Object.assign,fm={};function Ui(e,t,a){this.props=e,this.context=t,this.refs=fm,this.updater=a||dm}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 gm(){}gm.prototype=Ui.prototype;function Cc(e,t,a){this.props=e,this.context=t,this.refs=fm,this.updater=a||dm}var qc=Cc.prototype=new gm;qc.constructor=Cc;mm(qc,Ui.prototype);qc.isPureReactComponent=!0;var sm=Array.isArray;function Nc(){}var Ve={H:null,A:null,T:null,S:null},hm=Object.prototype.hasOwnProperty;function Ec(e,t,a){var r=a.ref;return{$$typeof:Sc,type:e,key:t,ref:r!==void 0?r:null,props:a}}function Vw(e,t){return Ec(e.type,t,e.props)}function Mc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Sc}function Zw(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var cm=/\/+/g;function kc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zw(""+e.key):t.toString(36)}function Kw(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Nc,Nc):(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,n){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Sc:case Dw:o=!0;break;case pm:return o=e._init,Ri(o(e._payload),t,a,r,n)}}if(o)return n=n(e),o=r===""?"."+kc(e,0):r,sm(n)?(a="",o!=null&&(a=o.replace(cm,"$&/")+"/"),Ri(n,t,a,"",function(p){return p})):n!=null&&(Mc(n)&&(n=Vw(n,a+(n.key==null||e&&e.key===n.key?"":(""+n.key).replace(cm,"$&/")+"/")+o)),t.push(n)),1;o=0;var l=r===""?".":r+":";if(sm(e))for(var u=0;u<e.length;u++)r=e[u],i=l+kc(r,u),o+=Ri(r,t,a,i,n);else if(u=$w(e),typeof u=="function")for(e=u.call(e),u=0;!(r=e.next()).done;)r=r.value,i=l+kc(r,u++),o+=Ri(r,t,a,i,n);else if(i==="object"){if(typeof e.then=="function")return Ri(Kw(e),t,a,r,n);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 pl(e,t,a){if(e==null)return e;var r=[],n=0;return Ri(e,r,"","",function(i){return t.call(a,i,n++)}),r}function Jw(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 um=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)},Pw={map:pl,forEach:function(e,t,a){pl(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return pl(e,function(){t++}),t},toArray:function(e){return pl(e,function(t){return t})||[]},only:function(e){if(!Mc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ge.Activity=Xw;ge.Children=Pw;ge.Component=Ui;ge.Fragment=Bw;ge.Profiler=Lw;ge.PureComponent=Cc;ge.StrictMode=Ow;ge.Suspense=Qw;ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ve;ge.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ve.H.useMemoCache(e)}};ge.cache=function(e){return function(){return e.apply(null,arguments)}};ge.cacheSignal=function(){return null};ge.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=mm({},e.props),n=e.key;if(t!=null)for(i in t.key!==void 0&&(n=""+t.key),t)!hm.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=a;else if(1<i){for(var o=Array(i),l=0;l<i;l++)o[l]=arguments[l+2];r.children=o}return Ec(e.type,n,r)};ge.createContext=function(e){return e={$$typeof:jw,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Hw,_context:e},e};ge.createElement=function(e,t,a){var r,n={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)hm.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(n[r]=t[r]);var o=arguments.length-2;if(o===1)n.children=a;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];n.children=l}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)n[r]===void 0&&(n[r]=o[r]);return Ec(e,i,n)};ge.createRef=function(){return{current:null}};ge.forwardRef=function(e){return{$$typeof:Gw,render:e}};ge.isValidElement=Mc;ge.lazy=function(e){return{$$typeof:pm,_payload:{_status:-1,_result:e},_init:Jw}};ge.memo=function(e,t){return{$$typeof:Yw,type:e,compare:t===void 0?null:t}};ge.startTransition=function(e){var t=Ve.T,a={};Ve.T=a;try{var r=e(),n=Ve.S;n!==null&&n(a,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Nc,um)}catch(i){um(i)}finally{t!==null&&a.types!==null&&(t.types=a.types),Ve.T=t}};ge.unstable_useCacheRefresh=function(){return Ve.H.useCacheRefresh()};ge.use=function(e){return Ve.H.use(e)};ge.useActionState=function(e,t,a){return Ve.H.useActionState(e,t,a)};ge.useCallback=function(e,t){return Ve.H.useCallback(e,t)};ge.useContext=function(e){return Ve.H.useContext(e)};ge.useDebugValue=function(){};ge.useDeferredValue=function(e,t){return Ve.H.useDeferredValue(e,t)};ge.useEffect=function(e,t){return Ve.H.useEffect(e,t)};ge.useEffectEvent=function(e){return Ve.H.useEffectEvent(e)};ge.useId=function(){return Ve.H.useId()};ge.useImperativeHandle=function(e,t,a){return Ve.H.useImperativeHandle(e,t,a)};ge.useInsertionEffect=function(e,t){return Ve.H.useInsertionEffect(e,t)};ge.useLayoutEffect=function(e,t){return Ve.H.useLayoutEffect(e,t)};ge.useMemo=function(e,t){return Ve.H.useMemo(e,t)};ge.useOptimistic=function(e,t){return Ve.H.useOptimistic(e,t)};ge.useReducer=function(e,t,a){return Ve.H.useReducer(e,t,a)};ge.useRef=function(e){return Ve.H.useRef(e)};ge.useState=function(e){return Ve.H.useState(e)};ge.useSyncExternalStore=function(e,t,a){return Ve.H.useSyncExternalStore(e,t,a)};ge.useTransition=function(){return Ve.H.useTransition()};ge.version="19.2.3"});var Ye=Ra((J_,vm)=>{"use strict";vm.exports=bm()});var ym=Ra(Dt=>{"use strict";var Fw=Ye();function wm(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 vr(){}var Ut={d:{f:vr,r:function(){throw Error(wm(522))},D:vr,C:vr,L:vr,m:vr,X:vr,S:vr,M:vr},p:0,findDOMNode:null},Iw=Symbol.for("react.portal");function Ww(e,t,a){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Iw,key:r==null?null:""+r,children:e,containerInfo:t,implementation:a}}var Vn=Fw.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function dl(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Dt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ut;Dt.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(wm(299));return Ww(e,t,null,a)};Dt.flushSync=function(e){var t=Vn.T,a=Ut.p;try{if(Vn.T=null,Ut.p=2,e)return e()}finally{Vn.T=t,Ut.p=a,Ut.d.f()}};Dt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ut.d.C(e,t))};Dt.prefetchDNS=function(e){typeof e=="string"&&Ut.d.D(e)};Dt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,r=dl(a,t.crossOrigin),n=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?Ut.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:n,fetchPriority:i}):a==="script"&&Ut.d.X(e,{crossOrigin:r,integrity:n,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Dt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=dl(t.as,t.crossOrigin);Ut.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&&Ut.d.M(e)};Dt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,r=dl(a,t.crossOrigin);Ut.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})}};Dt.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=dl(t.as,t.crossOrigin);Ut.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 Ut.d.m(e)};Dt.requestFormReset=function(e){Ut.d.r(e)};Dt.unstable_batchedUpdates=function(e,t){return e(t)};Dt.useFormState=function(e,t,a){return Vn.H.useFormState(e,t,a)};Dt.useFormStatus=function(){return Vn.H.useHostTransitionStatus()};Dt.version="19.2.3"});var km=Ra((F_,xm)=>{"use strict";function _m(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_m)}catch(e){console.error(e)}}_m(),xm.exports=ym()});var Bb=Ra(Os=>{"use strict";var bt=om(),Pf=Ye(),e0=km();function D(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 Ff(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ro(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 If(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 Wf(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 Nm(e){if(Ro(e)!==e)throw Error(D(188))}function t0(e){var t=e.alternate;if(!t){if(t=Ro(e),t===null)throw Error(D(188));return t!==e?null:e}for(var a=e,r=t;;){var n=a.return;if(n===null)break;var i=n.alternate;if(i===null){if(r=n.return,r!==null){a=r;continue}break}if(n.child===i.child){for(i=n.child;i;){if(i===a)return Nm(n),e;if(i===r)return Nm(n),t;i=i.sibling}throw Error(D(188))}if(a.return!==r.return)a=n,r=i;else{for(var o=!1,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){for(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)throw Error(D(189))}}if(a.alternate!==r)throw Error(D(190))}if(a.tag!==3)throw Error(D(188));return a.stateNode.current===a?e:t}function eg(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=eg(e),t!==null)return t;e=e.sibling}return null}var Je=Object.assign,a0=Symbol.for("react.element"),ml=Symbol.for("react.transitional.element"),eo=Symbol.for("react.portal"),ji=Symbol.for("react.fragment"),tg=Symbol.for("react.strict_mode"),cu=Symbol.for("react.profiler"),ag=Symbol.for("react.consumer"),Wa=Symbol.for("react.context"),ip=Symbol.for("react.forward_ref"),uu=Symbol.for("react.suspense"),pu=Symbol.for("react.suspense_list"),np=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),du=Symbol.for("react.activity"),r0=Symbol.for("react.memo_cache_sentinel"),Sm=Symbol.iterator;function Zn(e){return e===null||typeof e!="object"?null:(e=Sm&&e[Sm]||e["@@iterator"],typeof e=="function"?e:null)}var i0=Symbol.for("react.client.reference");function mu(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===i0?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ji:return"Fragment";case cu:return"Profiler";case tg:return"StrictMode";case uu:return"Suspense";case pu:return"SuspenseList";case du:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case eo:return"Portal";case Wa:return e.displayName||"Context";case ag:return(e._context.displayName||"Context")+".Consumer";case ip:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case np:return t=e.displayName||null,t!==null?t:mu(e.type)||"Memo";case wr:t=e._payload,e=e._init;try{return mu(e(t))}catch{}}return null}var to=Array.isArray,me=Pf.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=e0.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ai={pending:!1,data:null,method:null,action:null},fu=[],Gi=-1;function Ha(e){return{current:e}}function _t(e){0>Gi||(e.current=fu[Gi],fu[Gi]=null,Gi--)}function Xe(e,t){Gi++,fu[Gi]=e.current,e.current=t}var La=Ha(null),wo=Ha(null),Tr=Ha(null),Vl=Ha(null);function Zl(e,t){switch(Xe(Tr,t),Xe(wo,e),Xe(La,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rf(t),e=xb(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_t(La),Xe(La,e)}function on(){_t(La),_t(wo),_t(Tr)}function gu(e){e.memoizedState!==null&&Xe(Vl,e);var t=La.current,a=xb(t,e.type);t!==a&&(Xe(wo,e),Xe(La,a))}function Kl(e){wo.current===e&&(_t(La),_t(wo)),Vl.current===e&&(_t(Vl),To._currentValue=ai)}var Tc,Cm;function Ir(e){if(Tc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Tc=t&&t[1]||"",Cm=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Tc+e+Cm}var zc=!1;function Ac(e,t){if(!e||zc)return"";zc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(h){var d=h}Reflect.construct(e,[],v)}else{try{v.call()}catch(h){d=h}e.call(v.prototype)}}else{try{throw Error()}catch(h){d=h}(v=e())&&typeof v.catch=="function"&&v.catch(function(){})}}catch(h){if(h&&d&&typeof h.stack=="string")return[h.stack,d.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var u=o.split(`
3
+ `+Tc+e+Cm}var zc=!1;function Ac(e,t){if(!e||zc)return"";zc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var b=function(){throw Error()};if(Object.defineProperty(b.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(h){var m=h}Reflect.construct(e,[],b)}else{try{b.call()}catch(h){m=h}e.call(b.prototype)}}else{try{throw Error()}catch(h){m=h}(b=e())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(h){if(h&&m&&typeof h.stack=="string")return[h.stack,m.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var u=o.split(`
4
4
  `),p=l.split(`
5
5
  `);for(n=r=0;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;for(;n<p.length&&!p[n].includes("DetermineComponentFrameRoot");)n++;if(r===u.length||n===p.length)for(r=u.length-1,n=p.length-1;1<=r&&0<=n&&u[r]!==p[n];)n--;for(;1<=r&&0<=n;r--,n--)if(u[r]!==p[n]){if(r!==1||n!==1)do if(r--,n--,0>n||u[r]!==p[n]){var f=`
6
- `+u[r].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=r&&0<=n);break}}}finally{zc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Fr(a):""}function i0(e,t){switch(e.tag){case 26:case 27:case 5:return Fr(e.type);case 16:return Fr("Lazy");case 13:return e.child!==t&&t!==null?Fr("Suspense Fallback"):Fr("Suspense");case 19:return Fr("SuspenseList");case 0:case 15:return Ac(e.type,!1);case 11:return Ac(e.type.render,!1);case 1:return Ac(e.type,!0);case 31:return Fr("Activity");default:return""}}function qm(e){try{var t="",a=null;do t+=i0(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
6
+ `+u[r].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=r&&0<=n);break}}}finally{zc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ir(a):""}function n0(e,t){switch(e.tag){case 26:case 27:case 5:return Ir(e.type);case 16:return Ir("Lazy");case 13:return e.child!==t&&t!==null?Ir("Suspense Fallback"):Ir("Suspense");case 19:return Ir("SuspenseList");case 0:case 15:return Ac(e.type,!1);case 11:return Ac(e.type.render,!1);case 1:return Ac(e.type,!0);case 31:return Ir("Activity");default:return""}}function qm(e){try{var t="",a=null;do t+=n0(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 hu=Object.prototype.hasOwnProperty,op=ht.unstable_scheduleCallback,Rc=ht.unstable_cancelCallback,n0=ht.unstable_shouldYield,o0=ht.unstable_requestPaint,aa=ht.unstable_now,l0=ht.unstable_getCurrentPriorityLevel,rg=ht.unstable_ImmediatePriority,ig=ht.unstable_UserBlockingPriority,Kl=ht.unstable_NormalPriority,s0=ht.unstable_LowPriority,ng=ht.unstable_IdlePriority,c0=ht.log,u0=ht.unstable_setDisableYieldValue,Ro=null,ra=null;function Sr(e){if(typeof c0=="function"&&u0(e),ra&&typeof ra.setStrictMode=="function")try{ra.setStrictMode(Ro,e)}catch{}}var ia=Math.clz32?Math.clz32:m0,p0=Math.log,d0=Math.LN2;function m0(e){return e>>>=0,e===0?32:31-(p0(e)/d0|0)|0}var ml=256,fl=262144,gl=4194304;function Ir(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 ys(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~i,r!==0?n=Ir(r):(o&=l,o!==0?n=Ir(o):a||(a=l&~e,a!==0&&(n=Ir(a))))):(l=r&~i,l!==0?n=Ir(l):o!==0?n=Ir(o):a||(a=r&~e,a!==0&&(n=Ir(a)))),n===0?0:t!==0&&t!==n&&(t&i)===0&&(i=n&-n,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:n}function Uo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function f0(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 og(){var e=gl;return gl<<=1,(gl&62914560)===0&&(gl=4194304),e}function Uc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Do(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function g0(e,t,a,r,n,i){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,u=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var f=31-ia(a),v=1<<f;l[f]=0,u[f]=-1;var d=p[f];if(d!==null)for(p[f]=null,f=0;f<d.length;f++){var h=d[f];h!==null&&(h.lane&=-536870913)}a&=~v}r!==0&&lg(e,r,0),i!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function lg(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ia(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function sg(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-ia(a),n=1<<r;n&t|e[r]&t&&(e[r]|=t),a&=~n}}function cg(e,t){var a=t&-t;return a=(a&42)!==0?1:lp(a),(a&(e.suspendedLanes|t))!==0?0:a}function lp(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 sp(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ug(){var e=ze.p;return e!==0?e:(e=window.event,e===void 0?32:Rb(e.type))}function Em(e,t){var a=ze.p;try{return ze.p=e,t()}finally{ze.p=a}}var Yr=Math.random().toString(36).slice(2),Nt="__reactFiber$"+Yr,$t="__reactProps$"+Yr,hn="__reactContainer$"+Yr,bu="__reactEvents$"+Yr,h0="__reactListeners$"+Yr,b0="__reactHandles$"+Yr,Mm="__reactResources$"+Yr,Bo="__reactMarker$"+Yr;function cp(e){delete e[Nt],delete e[$t],delete e[bu],delete e[h0],delete e[b0]}function Gi(e){var t=e[Nt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[hn]||a[Nt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Lf(e);e!==null;){if(a=e[Nt])return a;e=Lf(e)}return t}e=a,a=e.parentNode}return null}function bn(e){if(e=e[Nt]||e[hn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function to(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(D(33))}function Fi(e){var t=e[Mm];return t||(t=e[Mm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[Bo]=!0}var pg=new Set,dg={};function pi(e,t){on(e,t),on(e+"Capture",t)}function on(e,t){for(dg[e]=t,e=0;e<t.length;e++)pg.add(t[e])}var v0=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]*$"),Tm={},zm={};function w0(e){return hu.call(zm,e)?!0:hu.call(Tm,e)?!1:v0.test(e)?zm[e]=!0:(Tm[e]=!0,!1)}function Tl(e,t,a){if(w0(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 hl(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 Va(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 ma(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function y0(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 n=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){a=""+o,i.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 vu(e){if(!e._valueTracker){var t=mg(e)?"checked":"value";e._valueTracker=y0(e,t,""+e[t])}}function fg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=mg(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Jl(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 _0=/[\n"\\]/g;function ha(e){return e.replace(_0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wu(e,t,a,r,n,i,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=""+ma(t)):e.value!==""+ma(t)&&(e.value=""+ma(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?yu(e,o,ma(t)):a!=null?yu(e,o,ma(a)):r!=null&&e.removeAttribute("value"),n==null&&i!=null&&(e.defaultChecked=!!i),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+ma(l):e.removeAttribute("name")}function gg(e,t,a,r,n,i,o,l){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){vu(e);return}a=a!=null?""+ma(a):"",t=t!=null?""+ma(t):a,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??n,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),vu(e)}function yu(e,t,a){t==="number"&&Jl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,t,a,r){if(e=e.options,t){t={};for(var n=0;n<a.length;n++)t["$"+a[n]]=!0;for(a=0;a<e.length;a++)n=t.hasOwnProperty("$"+e[a].value),e[a].selected!==n&&(e[a].selected=n),n&&r&&(e[a].defaultSelected=!0)}else{for(a=""+ma(a),t=null,n=0;n<e.length;n++){if(e[n].value===a){e[n].selected=!0,r&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function hg(e,t,a){if(t!=null&&(t=""+ma(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+ma(a):""}function bg(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(D(92));if(eo(r)){if(1<r.length)throw Error(D(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=ma(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),vu(e)}function ln(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var x0=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 Am(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||x0.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function vg(e,t,a){if(t!=null&&typeof t!="object")throw Error(D(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 n in t)r=t[n],t.hasOwnProperty(n)&&a[n]!==r&&Am(e,n,r)}else for(var i in t)t.hasOwnProperty(i)&&Am(e,i,t[i])}function up(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 k0=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"]]),N0=/^[\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 zl(e){return N0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function er(){}var _u=null;function pp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qi=null,Wi=null;function Rm(e){var t=bn(e);if(t&&(e=t.stateNode)){var a=e[$t]||null;e:switch(e=t.stateNode,t.type){case"input":if(wu(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="'+ha(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var n=r[$t]||null;if(!n)throw Error(D(90));wu(r,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&fg(r)}break e;case"textarea":hg(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Ii(e,!!a.multiple,t,!1)}}}var Dc=!1;function wg(e,t,a){if(Dc)return e(t,a);Dc=!0;try{var r=e(t);return r}finally{if(Dc=!1,(Qi!==null||Wi!==null)&&(As(),Qi&&(t=Qi,e=Wi,Wi=Qi=null,Rm(t),e)))for(t=0;t<e.length;t++)Rm(e[t])}}function wo(e,t){var a=e.stateNode;if(a===null)return null;var r=a[$t]||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(D(231,t,typeof a));return a}var nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xu=!1;if(nr)try{Ui={},Object.defineProperty(Ui,"passive",{get:function(){xu=!0}}),window.addEventListener("test",Ui,Ui),window.removeEventListener("test",Ui,Ui)}catch{xu=!1}var Ui,Cr=null,dp=null,Al=null;function yg(){if(Al)return Al;var e,t=dp,a=t.length,r,n="value"in Cr?Cr.value:Cr.textContent,i=n.length;for(e=0;e<a&&t[e]===n[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===n[i-r];r++);return Al=n.slice(e,1<r?1-r:void 0)}function Rl(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 bl(){return!0}function Um(){return!1}function Vt(e){function t(a,r,n,i,o){this._reactName=a,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?bl:Um,this.isPropagationStopped=Um,this}return Je(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=bl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=bl)},persist:function(){},isPersistent:bl}),t}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_s=Vt(di),Oo=Je({},di,{view:0,detail:0}),S0=Vt(Oo),Bc,Oc,Zn,xs=Je({},Oo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mp,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!==Zn&&(Zn&&e.type==="mousemove"?(Bc=e.screenX-Zn.screenX,Oc=e.screenY-Zn.screenY):Oc=Bc=0,Zn=e),Bc)},movementY:function(e){return"movementY"in e?e.movementY:Oc}}),Dm=Vt(xs),C0=Je({},xs,{dataTransfer:0}),q0=Vt(C0),E0=Je({},Oo,{relatedTarget:0}),Lc=Vt(E0),M0=Je({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),T0=Vt(M0),z0=Je({},di,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),A0=Vt(z0),R0=Je({},di,{data:0}),Bm=Vt(R0),U0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},D0={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"},B0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function O0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=B0[e])?!!t[e]:!1}function mp(){return O0}var L0=Je({},Oo,{key:function(e){if(e.key){var t=U0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?D0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mp,charCode:function(e){return e.type==="keypress"?Rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),H0=Vt(L0),j0=Je({},xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Om=Vt(j0),G0=Je({},Oo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mp}),Q0=Vt(G0),Y0=Je({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),X0=Vt(Y0),$0=Je({},xs,{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}),V0=Vt($0),Z0=Je({},di,{newState:0,oldState:0}),K0=Vt(Z0),J0=[9,13,27,32],fp=nr&&"CompositionEvent"in window,io=null;nr&&"documentMode"in document&&(io=document.documentMode);var P0=nr&&"TextEvent"in window&&!io,_g=nr&&(!fp||io&&8<io&&11>=io),Lm=" ",Hm=!1;function xg(e,t){switch(e){case"keyup":return J0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yi=!1;function F0(e,t){switch(e){case"compositionend":return kg(t);case"keypress":return t.which!==32?null:(Hm=!0,Lm);case"textInput":return e=t.data,e===Lm&&Hm?null:e;default:return null}}function I0(e,t){if(Yi)return e==="compositionend"||!fp&&xg(e,t)?(e=yg(),Al=dp=Cr=null,Yi=!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 _g&&t.locale!=="ko"?null:t.data;default:return null}}var W0={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 jm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!W0[e.type]:t==="textarea"}function Ng(e,t,a,r){Qi?Wi?Wi.push(r):Wi=[r]:Qi=r,t=ms(t,"onChange"),0<t.length&&(a=new _s("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var no=null,yo=null;function ey(e){wb(e,0)}function ks(e){var t=to(e);if(fg(t))return e}function Gm(e,t){if(e==="change")return t}var Sg=!1;nr&&(nr?(wl="oninput"in document,wl||(Hc=document.createElement("div"),Hc.setAttribute("oninput","return;"),wl=typeof Hc.oninput=="function"),vl=wl):vl=!1,Sg=vl&&(!document.documentMode||9<document.documentMode));var vl,wl,Hc;function Qm(){no&&(no.detachEvent("onpropertychange",Cg),yo=no=null)}function Cg(e){if(e.propertyName==="value"&&ks(yo)){var t=[];Ng(t,yo,e,pp(e)),wg(ey,t)}}function ty(e,t,a){e==="focusin"?(Qm(),no=t,yo=a,no.attachEvent("onpropertychange",Cg)):e==="focusout"&&Qm()}function ay(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ks(yo)}function ry(e,t){if(e==="click")return ks(t)}function iy(e,t){if(e==="input"||e==="change")return ks(t)}function ny(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oa=typeof Object.is=="function"?Object.is:ny;function _o(e,t){if(oa(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 n=a[r];if(!hu.call(t,n)||!oa(e[n],t[n]))return!1}return!0}function Ym(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xm(e,t){var a=Ym(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=Ym(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 Eg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jl(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=Jl(e.document)}return t}function gp(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 oy=nr&&"documentMode"in document&&11>=document.documentMode,Xi=null,ku=null,oo=null,Nu=!1;function $m(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nu||Xi==null||Xi!==Jl(r)||(r=Xi,"selectionStart"in r&&gp(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}),oo&&_o(oo,r)||(oo=r,r=ms(ku,"onSelect"),0<r.length&&(t=new _s("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Xi)))}function Pr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var $i={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionrun:Pr("Transition","TransitionRun"),transitionstart:Pr("Transition","TransitionStart"),transitioncancel:Pr("Transition","TransitionCancel"),transitionend:Pr("Transition","TransitionEnd")},jc={},Mg={};nr&&(Mg=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 mi(e){if(jc[e])return jc[e];if(!$i[e])return e;var t=$i[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Mg)return jc[e]=t[a];return e}var Tg=mi("animationend"),zg=mi("animationiteration"),Ag=mi("animationstart"),ly=mi("transitionrun"),sy=mi("transitionstart"),cy=mi("transitioncancel"),Rg=mi("transitionend"),Ug=new Map,Su="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(" ");Su.push("scrollEnd");function Ta(e,t){Ug.set(e,t),pi(t,[e])}var Pl=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)},da=[],Vi=0,hp=0;function Ns(){for(var e=Vi,t=hp=Vi=0;t<e;){var a=da[t];da[t++]=null;var r=da[t];da[t++]=null;var n=da[t];da[t++]=null;var i=da[t];if(da[t++]=null,r!==null&&n!==null){var o=r.pending;o===null?n.next=n:(n.next=o.next,o.next=n),r.pending=n}i!==0&&Dg(a,n,i)}}function Ss(e,t,a,r){da[Vi++]=e,da[Vi++]=t,da[Vi++]=a,da[Vi++]=r,hp|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function bp(e,t,a,r){return Ss(e,t,a,r),Fl(e)}function fi(e,t){return Ss(e,null,null,t),Fl(e)}function Dg(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var n=!1,i=e.return;i!==null;)i.childLanes|=a,r=i.alternate,r!==null&&(r.childLanes|=a),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(n=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,n&&t!==null&&(n=31-ia(a),e=i.hiddenUpdates,r=e[n],r===null?e[n]=[t]:r.push(t),t.lane=a|536870912),i):null}function Fl(e){if(50<ho)throw ho=0,Vu=null,Error(D(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zi={};function uy(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 ea(e,t,a,r){return new uy(e,t,a,r)}function vp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ar(e,t){var a=e.alternate;return a===null?(a=ea(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 Bg(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 Ul(e,t,a,r,n,i){var o=0;if(r=e,typeof e=="function")vp(e)&&(o=1);else if(typeof e=="string")o=m1(e,a,La.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case du:return e=ea(31,a,t,n),e.elementType=du,e.lanes=i,e;case Hi:return ai(a.children,n,i,t);case tg:o=8,n|=24;break;case cu:return e=ea(12,a,t,n|2),e.elementType=cu,e.lanes=i,e;case uu:return e=ea(13,a,t,n),e.elementType=uu,e.lanes=i,e;case pu:return e=ea(19,a,t,n),e.elementType=pu,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wa:o=10;break e;case ag:o=9;break e;case ip:o=11;break e;case np:o=14;break e;case wr:o=16,r=null;break e}o=29,a=Error(D(130,e===null?"null":typeof e,"")),r=null}return t=ea(o,a,t,n),t.elementType=e,t.type=r,t.lanes=i,t}function ai(e,t,a,r){return e=ea(7,e,r,t),e.lanes=a,e}function Gc(e,t,a){return e=ea(6,e,null,t),e.lanes=a,e}function Og(e){var t=ea(18,null,null,0);return t.stateNode=e,t}function Qc(e,t,a){return t=ea(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vm=new WeakMap;function ba(e,t){if(typeof e=="object"&&e!==null){var a=Vm.get(e);return a!==void 0?a:(t={value:e,source:t,stack:qm(t)},Vm.set(e,t),t)}return{value:e,source:t,stack:qm(t)}}var Ki=[],Ji=0,Il=null,xo=0,fa=[],ga=0,Hr=null,Da=1,Ba="";function Fa(e,t){Ki[Ji++]=xo,Ki[Ji++]=Il,Il=e,xo=t}function Lg(e,t,a){fa[ga++]=Da,fa[ga++]=Ba,fa[ga++]=Hr,Hr=e;var r=Da;e=Ba;var n=32-ia(r)-1;r&=~(1<<n),a+=1;var i=32-ia(t)+n;if(30<i){var o=n-n%5;i=(r&(1<<o)-1).toString(32),r>>=o,n-=o,Da=1<<32-ia(t)+n|a<<n|r,Ba=i+e}else Da=1<<i|a<<n|r,Ba=e}function wp(e){e.return!==null&&(Fa(e,1),Lg(e,1,0))}function yp(e){for(;e===Il;)Il=Ki[--Ji],Ki[Ji]=null,xo=Ki[--Ji],Ki[Ji]=null;for(;e===Hr;)Hr=fa[--ga],fa[ga]=null,Ba=fa[--ga],fa[ga]=null,Da=fa[--ga],fa[ga]=null}function Hg(e,t){fa[ga++]=Da,fa[ga++]=Ba,fa[ga++]=Hr,Da=t.id,Ba=t.overflow,Hr=e}var St=null,Ke=null,Ne=!1,zr=null,va=!1,Cu=Error(D(519));function jr(e){var t=Error(D(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ko(ba(t,e)),Cu}function Zm(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Nt]=e,t[$t]=r,a){case"dialog":_e("cancel",t),_e("close",t);break;case"iframe":case"object":case"embed":_e("load",t);break;case"video":case"audio":for(a=0;a<qo.length;a++)_e(qo[a],t);break;case"source":_e("error",t);break;case"img":case"image":case"link":_e("error",t),_e("load",t);break;case"details":_e("toggle",t);break;case"input":_e("invalid",t),gg(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":_e("invalid",t);break;case"textarea":_e("invalid",t),bg(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||_b(t.textContent,a)?(r.popover!=null&&(_e("beforetoggle",t),_e("toggle",t)),r.onScroll!=null&&_e("scroll",t),r.onScrollEnd!=null&&_e("scrollend",t),r.onClick!=null&&(t.onclick=er),t=!0):t=!1,t||jr(e,!0)}function Km(e){for(St=e.return;St;)switch(St.tag){case 5:case 31:case 13:va=!1;return;case 27:case 3:va=!0;return;default:St=St.return}}function Di(e){if(e!==St)return!1;if(!Ne)return Km(e),Ne=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Fu(e.type,e.memoizedProps)),a=!a),a&&Ke&&jr(e),Km(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(317));Ke=Of(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(317));Ke=Of(e)}else t===27?(t=Ke,Xr(e.type)?(e=tp,tp=null,Ke=e):Ke=t):Ke=St?ya(e.stateNode.nextSibling):null;return!0}function oi(){Ke=St=null,Ne=!1}function Yc(){var e=zr;return e!==null&&(Yt===null?Yt=e:Yt.push.apply(Yt,e),zr=null),e}function ko(e){zr===null?zr=[e]:zr.push(e)}var qu=Ha(null),gi=null,tr=null;function _r(e,t,a){Xe(qu,t._currentValue),t._currentValue=a}function rr(e){e._currentValue=qu.current,_t(qu)}function Eu(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 Mu(e,t,a,r){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var i=n.dependencies;if(i!==null){var o=n.child;i=i.firstContext;e:for(;i!==null;){var l=i;i=n;for(var u=0;u<t.length;u++)if(l.context===t[u]){i.lanes|=a,l=i.alternate,l!==null&&(l.lanes|=a),Eu(i.return,a,e),r||(o=null);break e}i=l.next}}else if(n.tag===18){if(o=n.return,o===null)throw Error(D(341));o.lanes|=a,i=o.alternate,i!==null&&(i.lanes|=a),Eu(o,a,e),o=null}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===e){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}}function vn(e,t,a,r){e=null;for(var n=t,i=!1;n!==null;){if(!i){if((n.flags&524288)!==0)i=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var o=n.alternate;if(o===null)throw Error(D(387));if(o=o.memoizedProps,o!==null){var l=n.type;oa(n.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(n===$l.current){if(o=n.alternate,o===null)throw Error(D(387));o.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(Mo):e=[Mo])}n=n.return}e!==null&&Mu(t,e,a,r),t.flags|=262144}function Wl(e){for(e=e.firstContext;e!==null;){if(!oa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function li(e){gi=e,tr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return jg(gi,e)}function yl(e,t){return gi===null&&li(e),jg(e,t)}function jg(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},tr===null){if(e===null)throw Error(D(308));tr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else tr=tr.next=t;return a}var py=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()})}},dy=ht.unstable_scheduleCallback,my=ht.unstable_NormalPriority,ut={$$typeof:Wa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _p(){return{controller:new py,data:new Map,refCount:0}}function Lo(e){e.refCount--,e.refCount===0&&dy(my,function(){e.controller.abort()})}var lo=null,Tu=0,sn=0,en=null;function fy(e,t){if(lo===null){var a=lo=[];Tu=0,sn=Vp(),en={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Tu++,t.then(Jm,Jm),t}function Jm(){if(--Tu===0&&lo!==null){en!==null&&(en.status="fulfilled");var e=lo;lo=null,sn=0,en=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function gy(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(n){a.push(n)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var n=0;n<a.length;n++)(0,a[n])(t)},function(n){for(r.status="rejected",r.reason=n,n=0;n<a.length;n++)(0,a[n])(void 0)}),r}var Pm=me.S;me.S=function(e,t){eb=aa(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&fy(e,t),Pm!==null&&Pm(e,t)};var ri=Ha(null);function xp(){var e=ri.current;return e!==null?e:Ge.pooledCache}function Dl(e,t){t===null?Xe(ri,ri.current):Xe(ri,t.pool)}function Gg(){var e=xp();return e===null?null:{parent:ut._currentValue,pool:e}}var wn=Error(D(460)),kp=Error(D(474)),Cs=Error(D(542)),es={then:function(){}};function Fm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qg(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(er,er),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Wm(e),e;default:if(typeof t.status=="string")t.then(er,er);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(D(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=r}},function(r){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Wm(e),e}throw ii=t,wn}}function Wr(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ii=a,wn):a}}var ii=null;function Im(){if(ii===null)throw Error(D(459));var e=ii;return ii=null,e}function Wm(e){if(e===wn||e===Cs)throw Error(D(483))}var tn=null,No=0;function _l(e){var t=No;return No+=1,tn===null&&(tn=[]),Qg(tn,e,t)}function Kn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xl(e,t){throw t.$$typeof===t0?Error(D(525)):(e=Object.prototype.toString.call(t),Error(D(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yg(e){function t(m,c){if(e){var b=m.deletions;b===null?(m.deletions=[c],m.flags|=16):b.push(c)}}function a(m,c){if(!e)return null;for(;c!==null;)t(m,c),c=c.sibling;return null}function r(m){for(var c=new Map;m!==null;)m.key!==null?c.set(m.key,m):c.set(m.index,m),m=m.sibling;return c}function n(m,c){return m=ar(m,c),m.index=0,m.sibling=null,m}function i(m,c,b){return m.index=b,e?(b=m.alternate,b!==null?(b=b.index,b<c?(m.flags|=67108866,c):b):(m.flags|=67108866,c)):(m.flags|=1048576,c)}function o(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function l(m,c,b,g){return c===null||c.tag!==6?(c=Gc(b,m.mode,g),c.return=m,c):(c=n(c,b),c.return=m,c)}function u(m,c,b,g){var S=b.type;return S===Hi?f(m,c,b.props.children,g,b.key):c!==null&&(c.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===wr&&Wr(S)===c.type)?(c=n(c,b.props),Kn(c,b),c.return=m,c):(c=Ul(b.type,b.key,b.props,null,m.mode,g),Kn(c,b),c.return=m,c)}function p(m,c,b,g){return c===null||c.tag!==4||c.stateNode.containerInfo!==b.containerInfo||c.stateNode.implementation!==b.implementation?(c=Qc(b,m.mode,g),c.return=m,c):(c=n(c,b.children||[]),c.return=m,c)}function f(m,c,b,g,S){return c===null||c.tag!==7?(c=ai(b,m.mode,g,S),c.return=m,c):(c=n(c,b),c.return=m,c)}function v(m,c,b){if(typeof c=="string"&&c!==""||typeof c=="number"||typeof c=="bigint")return c=Gc(""+c,m.mode,b),c.return=m,c;if(typeof c=="object"&&c!==null){switch(c.$$typeof){case dl:return b=Ul(c.type,c.key,c.props,null,m.mode,b),Kn(b,c),b.return=m,b;case Wn:return c=Qc(c,m.mode,b),c.return=m,c;case wr:return c=Wr(c),v(m,c,b)}if(eo(c)||Vn(c))return c=ai(c,m.mode,b,null),c.return=m,c;if(typeof c.then=="function")return v(m,_l(c),b);if(c.$$typeof===Wa)return v(m,yl(m,c),b);xl(m,c)}return null}function d(m,c,b,g){var S=c!==null?c.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:l(m,c,""+b,g);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case dl:return b.key===S?u(m,c,b,g):null;case Wn:return b.key===S?p(m,c,b,g):null;case wr:return b=Wr(b),d(m,c,b,g)}if(eo(b)||Vn(b))return S!==null?null:f(m,c,b,g,null);if(typeof b.then=="function")return d(m,c,_l(b),g);if(b.$$typeof===Wa)return d(m,c,yl(m,b),g);xl(m,b)}return null}function h(m,c,b,g,S){if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return m=m.get(b)||null,l(c,m,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case dl:return m=m.get(g.key===null?b:g.key)||null,u(c,m,g,S);case Wn:return m=m.get(g.key===null?b:g.key)||null,p(c,m,g,S);case wr:return g=Wr(g),h(m,c,b,g,S)}if(eo(g)||Vn(g))return m=m.get(b)||null,f(c,m,g,S,null);if(typeof g.then=="function")return h(m,c,b,_l(g),S);if(g.$$typeof===Wa)return h(m,c,b,yl(c,g),S);xl(c,g)}return null}function w(m,c,b,g){for(var S=null,z=null,T=c,R=c=0,j=null;T!==null&&R<b.length;R++){T.index>R?(j=T,T=null):j=T.sibling;var W=d(m,T,b[R],g);if(W===null){T===null&&(T=j);break}e&&T&&W.alternate===null&&t(m,T),c=i(W,c,R),z===null?S=W:z.sibling=W,z=W,T=j}if(R===b.length)return a(m,T),Ne&&Fa(m,R),S;if(T===null){for(;R<b.length;R++)T=v(m,b[R],g),T!==null&&(c=i(T,c,R),z===null?S=T:z.sibling=T,z=T);return Ne&&Fa(m,R),S}for(T=r(T);R<b.length;R++)j=h(T,m,R,b[R],g),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?R:j.key),c=i(j,c,R),z===null?S=j:z.sibling=j,z=j);return e&&T.forEach(function(ve){return t(m,ve)}),Ne&&Fa(m,R),S}function E(m,c,b,g){if(b==null)throw Error(D(151));for(var S=null,z=null,T=c,R=c=0,j=null,W=b.next();T!==null&&!W.done;R++,W=b.next()){T.index>R?(j=T,T=null):j=T.sibling;var ve=d(m,T,W.value,g);if(ve===null){T===null&&(T=j);break}e&&T&&ve.alternate===null&&t(m,T),c=i(ve,c,R),z===null?S=ve:z.sibling=ve,z=ve,T=j}if(W.done)return a(m,T),Ne&&Fa(m,R),S;if(T===null){for(;!W.done;R++,W=b.next())W=v(m,W.value,g),W!==null&&(c=i(W,c,R),z===null?S=W:z.sibling=W,z=W);return Ne&&Fa(m,R),S}for(T=r(T);!W.done;R++,W=b.next())W=h(T,m,R,W.value,g),W!==null&&(e&&W.alternate!==null&&T.delete(W.key===null?R:W.key),c=i(W,c,R),z===null?S=W:z.sibling=W,z=W);return e&&T.forEach(function(Se){return t(m,Se)}),Ne&&Fa(m,R),S}function U(m,c,b,g){if(typeof b=="object"&&b!==null&&b.type===Hi&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case dl:e:{for(var S=b.key;c!==null;){if(c.key===S){if(S=b.type,S===Hi){if(c.tag===7){a(m,c.sibling),g=n(c,b.props.children),g.return=m,m=g;break e}}else if(c.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===wr&&Wr(S)===c.type){a(m,c.sibling),g=n(c,b.props),Kn(g,b),g.return=m,m=g;break e}a(m,c);break}else t(m,c);c=c.sibling}b.type===Hi?(g=ai(b.props.children,m.mode,g,b.key),g.return=m,m=g):(g=Ul(b.type,b.key,b.props,null,m.mode,g),Kn(g,b),g.return=m,m=g)}return o(m);case Wn:e:{for(S=b.key;c!==null;){if(c.key===S)if(c.tag===4&&c.stateNode.containerInfo===b.containerInfo&&c.stateNode.implementation===b.implementation){a(m,c.sibling),g=n(c,b.children||[]),g.return=m,m=g;break e}else{a(m,c);break}else t(m,c);c=c.sibling}g=Qc(b,m.mode,g),g.return=m,m=g}return o(m);case wr:return b=Wr(b),U(m,c,b,g)}if(eo(b))return w(m,c,b,g);if(Vn(b)){if(S=Vn(b),typeof S!="function")throw Error(D(150));return b=S.call(b),E(m,c,b,g)}if(typeof b.then=="function")return U(m,c,_l(b),g);if(b.$$typeof===Wa)return U(m,c,yl(m,b),g);xl(m,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,c!==null&&c.tag===6?(a(m,c.sibling),g=n(c,b),g.return=m,m=g):(a(m,c),g=Gc(b,m.mode,g),g.return=m,m=g),o(m)):a(m,c)}return function(m,c,b,g){try{No=0;var S=U(m,c,b,g);return tn=null,S}catch(T){if(T===wn||T===Cs)throw T;var z=ea(29,T,null,m.mode);return z.lanes=g,z.return=m,z}}}var si=Yg(!0),Xg=Yg(!1),yr=!1;function Np(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zu(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 Ar(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Rr(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Te&2)!==0){var n=r.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),r.pending=t,t=Fl(e),Dg(e,null,a),t}return Ss(e,r,t,a),Fl(e)}function so(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,sg(e,a)}}function Xc(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var n=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?n=i=o:i=i.next=o,a=a.next}while(a!==null);i===null?n=i=t:i=i.next=t}else n=i=t;a={baseState:r.baseState,firstBaseUpdate:n,lastBaseUpdate:i,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 Au=!1;function co(){if(Au){var e=en;if(e!==null)throw e}}function uo(e,t,a,r){Au=!1;var n=e.updateQueue;yr=!1;var i=n.firstBaseUpdate,o=n.lastBaseUpdate,l=n.shared.pending;if(l!==null){n.shared.pending=null;var u=l,p=u.next;u.next=null,o===null?i=p:o.next=p,o=u;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=p:l.next=p,f.lastBaseUpdate=u))}if(i!==null){var v=n.baseState;o=0,f=p=u=null,l=i;do{var d=l.lane&-536870913,h=d!==l.lane;if(h?(ke&d)===d:(r&d)===d){d!==0&&d===sn&&(Au=!0),f!==null&&(f=f.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var w=e,E=l;d=t;var U=a;switch(E.tag){case 1:if(w=E.payload,typeof w=="function"){v=w.call(U,v,d);break e}v=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=E.payload,d=typeof w=="function"?w.call(U,v,d):w,d==null)break e;v=Je({},v,d);break e;case 2:yr=!0}}d=l.callback,d!==null&&(e.flags|=64,h&&(e.flags|=8192),h=n.callbacks,h===null?n.callbacks=[d]:h.push(d))}else h={lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(p=f=h,u=v):f=f.next=h,o|=d;if(l=l.next,l===null){if(l=n.shared.pending,l===null)break;h=l,l=h.next,h.next=null,n.lastBaseUpdate=h,n.shared.pending=null}}while(!0);f===null&&(u=v),n.baseState=u,n.firstBaseUpdate=p,n.lastBaseUpdate=f,i===null&&(n.shared.lanes=0),Qr|=o,e.lanes=o,e.memoizedState=v}}function $g(e,t){if(typeof e!="function")throw Error(D(191,e));e.call(t)}function Vg(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)$g(a[e],t)}var cn=Ha(null),ts=Ha(0);function ef(e,t){e=cr,Xe(ts,e),Xe(cn,t),cr=e|t.baseLanes}function Ru(){Xe(ts,cr),Xe(cn,cn.current)}function Sp(){cr=ts.current,_t(cn),_t(ts)}var la=Ha(null),wa=null;function xr(e){var t=e.alternate;Xe(ot,ot.current&1),Xe(la,e),wa===null&&(t===null||cn.current!==null||t.memoizedState!==null)&&(wa=e)}function Uu(e){Xe(ot,ot.current),Xe(la,e),wa===null&&(wa=e)}function Zg(e){e.tag===22?(Xe(ot,ot.current),Xe(la,e),wa===null&&(wa=e)):kr(e)}function kr(){Xe(ot,ot.current),Xe(la,la.current)}function Wt(e){_t(la),wa===e&&(wa=null),_t(ot)}var ot=Ha(0);function as(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Wu(a)||ep(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 or=0,he=null,je=null,st=null,rs=!1,an=!1,ci=!1,is=0,So=0,rn=null,hy=0;function at(){throw Error(D(321))}function Cp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!oa(e[a],t[a]))return!1;return!0}function qp(e,t,a,r,n,i){return or=i,he=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,me.H=e===null||e.memoizedState===null?Nh:Lp,ci=!1,i=a(r,n),ci=!1,an&&(i=Jg(t,a,r,n)),Kg(e),i}function Kg(e){me.H=Co;var t=je!==null&&je.next!==null;if(or=0,st=je=he=null,rs=!1,So=0,rn=null,t)throw Error(D(300));e===null||pt||(e=e.dependencies,e!==null&&Wl(e)&&(pt=!0))}function Jg(e,t,a,r){he=e;var n=0;do{if(an&&(rn=null),So=0,an=!1,25<=n)throw Error(D(301));if(n+=1,st=je=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}me.H=Sh,i=t(a,r)}while(an);return i}function by(){var e=me.H,t=e.useState()[0];return t=typeof t.then=="function"?Ho(t):t,e=e.useState()[0],(je!==null?je.memoizedState:null)!==e&&(he.flags|=1024),t}function Ep(){var e=is!==0;return is=0,e}function Mp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Tp(e){if(rs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}rs=!1}or=0,st=je=he=null,an=!1,So=is=0,rn=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?he.memoizedState=st=e:st=st.next=e,st}function lt(){if(je===null){var e=he.alternate;e=e!==null?e.memoizedState:null}else e=je.next;var t=st===null?he.memoizedState:st.next;if(t!==null)st=t,je=e;else{if(e===null)throw he.alternate===null?Error(D(467)):Error(D(310));je=e,e={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},st===null?he.memoizedState=st=e:st=st.next=e}return st}function qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ho(e){var t=So;return So+=1,rn===null&&(rn=[]),e=Qg(rn,e,t),t=he,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,me.H=t===null||t.memoizedState===null?Nh:Lp),e}function Es(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ho(e);if(e.$$typeof===Wa)return Ct(e)}throw Error(D(438,String(e)))}function zp(e){var t=null,a=he.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=he.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=qs(),he.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]=a0;return t.index++,a}function lr(e,t){return typeof t=="function"?t(e):t}function Bl(e){var t=lt();return Ap(t,je,e)}function Ap(e,t,a){var r=e.queue;if(r===null)throw Error(D(311));r.lastRenderedReducer=a;var n=e.baseQueue,i=r.pending;if(i!==null){if(n!==null){var o=n.next;n.next=i.next,i.next=o}t.baseQueue=n=i,r.pending=null}if(i=e.baseState,n===null)e.memoizedState=i;else{t=n.next;var l=o=null,u=null,p=t,f=!1;do{var v=p.lane&-536870913;if(v!==p.lane?(ke&v)===v:(or&v)===v){var d=p.revertLane;if(d===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),v===sn&&(f=!0);else if((or&d)===d){p=p.next,d===sn&&(f=!0);continue}else v={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},u===null?(l=u=v,o=i):u=u.next=v,he.lanes|=d,Qr|=d;v=p.action,ci&&a(i,v),i=p.hasEagerState?p.eagerState:a(i,v)}else d={lane:v,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},u===null?(l=u=d,o=i):u=u.next=d,he.lanes|=v,Qr|=v;p=p.next}while(p!==null&&p!==t);if(u===null?o=i:u.next=l,!oa(i,e.memoizedState)&&(pt=!0,f&&(a=en,a!==null)))throw a;e.memoizedState=i,e.baseState=o,e.baseQueue=u,r.lastRenderedState=i}return n===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function $c(e){var t=lt(),a=t.queue;if(a===null)throw Error(D(311));a.lastRenderedReducer=e;var r=a.dispatch,n=a.pending,i=t.memoizedState;if(n!==null){a.pending=null;var o=n=n.next;do i=e(i,o.action),o=o.next;while(o!==n);oa(i,t.memoizedState)||(pt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),a.lastRenderedState=i}return[i,r]}function Pg(e,t,a){var r=he,n=lt(),i=Ne;if(i){if(a===void 0)throw Error(D(407));a=a()}else a=t();var o=!oa((je||n).memoizedState,a);if(o&&(n.memoizedState=a,pt=!0),n=n.queue,Rp(Wg.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||st!==null&&st.memoizedState.tag&1){if(r.flags|=2048,un(9,{destroy:void 0},Ig.bind(null,r,n,a,t),null),Ge===null)throw Error(D(349));i||(or&127)!==0||Fg(r,t,a)}return a}function Fg(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=he.updateQueue,t===null?(t=qs(),he.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ig(e,t,a,r){t.value=a,t.getSnapshot=r,eh(t)&&th(e)}function Wg(e,t,a){return a(function(){eh(t)&&th(e)})}function eh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!oa(e,a)}catch{return!0}}function th(e){var t=fi(e,2);t!==null&&Xt(t,e,2)}function Du(e){var t=Dt();if(typeof e=="function"){var a=e;if(e=a(),ci){Sr(!0);try{a()}finally{Sr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:e},t}function ah(e,t,a,r){return e.baseState=a,Ap(e,je,typeof r=="function"?r:lr)}function vy(e,t,a,r,n){if(Ts(e))throw Error(D(485));if(e=t.action,e!==null){var i={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};me.T!==null?a(!0):i.isTransition=!1,r(i),a=t.pending,a===null?(i.next=t.pending=i,rh(t,i)):(i.next=a.next,t.pending=a.next=i)}}function rh(e,t){var a=t.action,r=t.payload,n=e.state;if(t.isTransition){var i=me.T,o={};me.T=o;try{var l=a(n,r),u=me.S;u!==null&&u(o,l),tf(e,t,l)}catch(p){Bu(e,t,p)}finally{i!==null&&o.types!==null&&(i.types=o.types),me.T=i}}else try{i=a(n,r),tf(e,t,i)}catch(p){Bu(e,t,p)}}function tf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){af(e,t,r)},function(r){return Bu(e,t,r)}):af(e,t,a)}function af(e,t,a){t.status="fulfilled",t.value=a,ih(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,rh(e,a)))}function Bu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,ih(t),t=t.next;while(t!==r)}e.action=null}function ih(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function nh(e,t){return t}function rf(e,t){if(Ne){var a=Ge.formState;if(a!==null){e:{var r=he;if(Ne){if(Ke){t:{for(var n=Ke,i=va;n.nodeType!==8;){if(!i){n=null;break t}if(n=ya(n.nextSibling),n===null){n=null;break t}}i=n.data,n=i==="F!"||i==="F"?n:null}if(n){Ke=ya(n.nextSibling),r=n.data==="F!";break e}}jr(r)}r=!1}r&&(t=a[0])}}return a=Dt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nh,lastRenderedState:t},a.queue=r,a=_h.bind(null,he,r),r.dispatch=a,r=Du(!1),i=Op.bind(null,he,!1,r.queue),r=Dt(),n={state:t,dispatch:null,action:e,pending:null},r.queue=n,a=vy.bind(null,he,n,i,a),n.dispatch=a,r.memoizedState=e,[t,a,!1]}function nf(e){var t=lt();return oh(t,je,e)}function oh(e,t,a){if(t=Ap(e,t,nh)[0],e=Bl(lr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Ho(t)}catch(o){throw o===wn?Cs:o}else r=t;t=lt();var n=t.queue,i=n.dispatch;return a!==t.memoizedState&&(he.flags|=2048,un(9,{destroy:void 0},wy.bind(null,n,a),null)),[r,i,e]}function wy(e,t){e.action=t}function of(e){var t=lt(),a=je;if(a!==null)return oh(t,a,e);lt(),t=t.memoizedState,a=lt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function un(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=he.updateQueue,t===null&&(t=qs(),he.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 lh(){return lt().memoizedState}function Ol(e,t,a,r){var n=Dt();he.flags|=e,n.memoizedState=un(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ms(e,t,a,r){var n=lt();r=r===void 0?null:r;var i=n.memoizedState.inst;je!==null&&r!==null&&Cp(r,je.memoizedState.deps)?n.memoizedState=un(t,i,a,r):(he.flags|=e,n.memoizedState=un(1|t,i,a,r))}function lf(e,t){Ol(8390656,8,e,t)}function Rp(e,t){Ms(2048,8,e,t)}function yy(e){he.flags|=4;var t=he.updateQueue;if(t===null)t=qs(),he.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function sh(e){var t=lt().memoizedState;return yy({ref:t,nextImpl:e}),function(){if((Te&2)!==0)throw Error(D(440));return t.impl.apply(void 0,arguments)}}function ch(e,t){return Ms(4,2,e,t)}function uh(e,t){return Ms(4,4,e,t)}function ph(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 dh(e,t,a){a=a!=null?a.concat([e]):null,Ms(4,4,ph.bind(null,t,e),a)}function Up(){}function mh(e,t){var a=lt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Cp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function fh(e,t){var a=lt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Cp(t,r[1]))return r[0];if(r=e(),ci){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r}function Dp(e,t,a){return a===void 0||(or&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=ab(),he.lanes|=e,Qr|=e,a)}function gh(e,t,a,r){return oa(a,t)?a:cn.current!==null?(e=Dp(e,a,r),oa(e,t)||(pt=!0),e):(or&42)===0||(or&1073741824)!==0&&(ke&261930)===0?(pt=!0,e.memoizedState=a):(e=ab(),he.lanes|=e,Qr|=e,t)}function hh(e,t,a,r,n){var i=ze.p;ze.p=i!==0&&8>i?i:8;var o=me.T,l={};me.T=l,Op(e,!1,t,a);try{var u=n(),p=me.S;if(p!==null&&p(l,u),u!==null&&typeof u=="object"&&typeof u.then=="function"){var f=gy(u,r);po(e,t,f,na(e))}else po(e,t,r,na(e))}catch(v){po(e,t,{then:function(){},status:"rejected",reason:v},na())}finally{ze.p=i,o!==null&&l.types!==null&&(o.types=l.types),me.T=o}}function _y(){}function Ou(e,t,a,r){if(e.tag!==5)throw Error(D(476));var n=bh(e).queue;hh(e,n,t,ti,a===null?_y:function(){return vh(e),a(r)})}function bh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ti,baseState:ti,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:ti},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vh(e){var t=bh(e);t.next===null&&(t=e.alternate.memoizedState),po(e,t.next.queue,{},na())}function Bp(){return Ct(Mo)}function wh(){return lt().memoizedState}function yh(){return lt().memoizedState}function xy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=na();e=Ar(a);var r=Rr(t,e,a);r!==null&&(Xt(r,t,a),so(r,t,a)),t={cache:_p()},e.payload=t;return}t=t.return}}function ky(e,t,a){var r=na();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ts(e)?xh(t,a):(a=bp(e,t,a,r),a!==null&&(Xt(a,e,r),kh(a,t,r)))}function _h(e,t,a){var r=na();po(e,t,a,r)}function po(e,t,a,r){var n={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ts(e))xh(t,n);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,a);if(n.hasEagerState=!0,n.eagerState=l,oa(l,o))return Ss(e,t,n,0),Ge===null&&Ns(),!1}catch{}if(a=bp(e,t,n,r),a!==null)return Xt(a,e,r),kh(a,t,r),!0}return!1}function Op(e,t,a,r){if(r={lane:2,revertLane:Vp(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ts(e)){if(t)throw Error(D(479))}else t=bp(e,a,r,2),t!==null&&Xt(t,e,2)}function Ts(e){var t=e.alternate;return e===he||t!==null&&t===he}function xh(e,t){an=rs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function kh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,sg(e,a)}}var Co={readContext:Ct,use:Es,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};Co.useEffectEvent=at;var Nh={readContext:Ct,use:Es,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:lf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ol(4194308,4,ph.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ol(4194308,4,e,t)},useInsertionEffect:function(e,t){Ol(4,2,e,t)},useMemo:function(e,t){var a=Dt();t=t===void 0?null:t;var r=e();if(ci){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Dt();if(a!==void 0){var n=a(t);if(ci){Sr(!0);try{a(t)}finally{Sr(!1)}}}else n=t;return r.memoizedState=r.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=ky.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Du(e);var t=e.queue,a=_h.bind(null,he,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Up,useDeferredValue:function(e,t){var a=Dt();return Dp(a,e,t)},useTransition:function(){var e=Du(!1);return e=hh.bind(null,he,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=he,n=Dt();if(Ne){if(a===void 0)throw Error(D(407));a=a()}else{if(a=t(),Ge===null)throw Error(D(349));(ke&127)!==0||Fg(r,t,a)}n.memoizedState=a;var i={value:a,getSnapshot:t};return n.queue=i,lf(Wg.bind(null,r,i,e),[e]),r.flags|=2048,un(9,{destroy:void 0},Ig.bind(null,r,i,a,t),null),a},useId:function(){var e=Dt(),t=Ge.identifierPrefix;if(Ne){var a=Ba,r=Da;a=(r&~(1<<32-ia(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=is++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=hy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Bp,useFormState:rf,useActionState:rf,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Op.bind(null,he,!0,a),a.dispatch=t,[e,t]},useMemoCache:zp,useCacheRefresh:function(){return Dt().memoizedState=xy.bind(null,he)},useEffectEvent:function(e){var t=Dt(),a={impl:e};return t.memoizedState=a,function(){if((Te&2)!==0)throw Error(D(440));return a.impl.apply(void 0,arguments)}}},Lp={readContext:Ct,use:Es,useCallback:mh,useContext:Ct,useEffect:Rp,useImperativeHandle:dh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:fh,useReducer:Bl,useRef:lh,useState:function(){return Bl(lr)},useDebugValue:Up,useDeferredValue:function(e,t){var a=lt();return gh(a,je.memoizedState,e,t)},useTransition:function(){var e=Bl(lr)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Ho(e),t]},useSyncExternalStore:Pg,useId:wh,useHostTransitionStatus:Bp,useFormState:nf,useActionState:nf,useOptimistic:function(e,t){var a=lt();return ah(a,je,e,t)},useMemoCache:zp,useCacheRefresh:yh};Lp.useEffectEvent=sh;var Sh={readContext:Ct,use:Es,useCallback:mh,useContext:Ct,useEffect:Rp,useImperativeHandle:dh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:fh,useReducer:$c,useRef:lh,useState:function(){return $c(lr)},useDebugValue:Up,useDeferredValue:function(e,t){var a=lt();return je===null?Dp(a,e,t):gh(a,je.memoizedState,e,t)},useTransition:function(){var e=$c(lr)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Ho(e),t]},useSyncExternalStore:Pg,useId:wh,useHostTransitionStatus:Bp,useFormState:of,useActionState:of,useOptimistic:function(e,t){var a=lt();return je!==null?ah(a,je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:zp,useCacheRefresh:yh};Sh.useEffectEvent=sh;function Vc(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:Je({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Lu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=na(),n=Ar(r);n.payload=t,a!=null&&(n.callback=a),t=Rr(e,n,r),t!==null&&(Xt(t,e,r),so(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=na(),n=Ar(r);n.tag=1,n.payload=t,a!=null&&(n.callback=a),t=Rr(e,n,r),t!==null&&(Xt(t,e,r),so(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=na(),r=Ar(a);r.tag=2,t!=null&&(r.callback=t),t=Rr(e,r,a),t!==null&&(Xt(t,e,a),so(t,e,a))}};function sf(e,t,a,r,n,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!_o(a,r)||!_o(n,i):!0}function cf(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&&Lu.enqueueReplaceState(t,t.state,null)}function ui(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=Je({},a));for(var n in e)a[n]===void 0&&(a[n]=e[n])}return a}function Ch(e){Pl(e)}function qh(e){console.error(e)}function Eh(e){Pl(e)}function ns(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function uf(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function Hu(e,t,a){return a=Ar(a),a.tag=3,a.payload={element:null},a.callback=function(){ns(e,t)},a}function Mh(e){return e=Ar(e),e.tag=3,e}function Th(e,t,a,r){var n=a.type.getDerivedStateFromError;if(typeof n=="function"){var i=r.value;e.payload=function(){return n(i)},e.callback=function(){uf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){uf(t,a,r),typeof n!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function Ny(e,t,a,r,n){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&vn(t,a,n,!0),a=la.current,a!==null){switch(a.tag){case 31:case 13:return wa===null?us():a.alternate===null&&rt===0&&(rt=3),a.flags&=-257,a.flags|=65536,a.lanes=n,r===es?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),ru(e,r,n)),!1;case 22:return a.flags|=65536,r===es?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)),ru(e,r,n)),!1}throw Error(D(435,a.tag))}return ru(e,r,n),us(),!1}if(Ne)return t=la.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,r!==Cu&&(e=Error(D(422),{cause:r}),ko(ba(e,a)))):(r!==Cu&&(t=Error(D(423),{cause:r}),ko(ba(t,a))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,r=ba(r,a),n=Hu(e.stateNode,r,n),Xc(e,n),rt!==4&&(rt=2)),!1;var i=Error(D(520),{cause:r});if(i=ba(i,a),go===null?go=[i]:go.push(i),rt!==4&&(rt=2),t===null)return!0;r=ba(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=n&-n,a.lanes|=e,e=Hu(a.stateNode,r,e),Xc(a,e),!1;case 1:if(t=a.type,i=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Ur===null||!Ur.has(i))))return a.flags|=65536,n&=-n,a.lanes|=n,n=Mh(n),Th(n,e,a,r),Xc(a,n),!1}a=a.return}while(a!==null);return!1}var Hp=Error(D(461)),pt=!1;function kt(e,t,a,r){t.child=e===null?Xg(t,null,a,r):si(t,e.child,a,r)}function pf(e,t,a,r,n){a=a.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return li(t),r=qp(e,t,a,o,i,n),l=Ep(),e!==null&&!pt?(Mp(e,t,n),sr(e,t,n)):(Ne&&l&&wp(t),t.flags|=1,kt(e,t,r,n),t.child)}function df(e,t,a,r,n){if(e===null){var i=a.type;return typeof i=="function"&&!vp(i)&&i.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=i,zh(e,t,i,r,n)):(e=Ul(a.type,null,r,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!jp(e,n)){var o=i.memoizedProps;if(a=a.compare,a=a!==null?a:_o,a(o,r)&&e.ref===t.ref)return sr(e,t,n)}return t.flags|=1,e=ar(i,r),e.ref=t.ref,e.return=t,t.child=e}function zh(e,t,a,r,n){if(e!==null){var i=e.memoizedProps;if(_o(i,r)&&e.ref===t.ref)if(pt=!1,t.pendingProps=r=i,jp(e,n))(e.flags&131072)!==0&&(pt=!0);else return t.lanes=e.lanes,sr(e,t,n)}return ju(e,t,a,r,n)}function Ah(e,t,a,r){var n=r.children,i=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(i=i!==null?i.baseLanes|a:a,e!==null){for(r=t.child=e.child,n=0;r!==null;)n=n|r.lanes|r.childLanes,r=r.sibling;r=n&~i}else r=0,t.child=null;return mf(e,t,i,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Dl(t,i!==null?i.cachePool:null),i!==null?ef(t,i):Ru(),Zg(t);else return r=t.lanes=536870912,mf(e,t,i!==null?i.baseLanes|a:a,a,r)}else i!==null?(Dl(t,i.cachePool),ef(t,i),kr(t),t.memoizedState=null):(e!==null&&Dl(t,null),Ru(),kr(t));return kt(e,t,n,a),t.child}function ao(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function mf(e,t,a,r,n){var i=xp();return i=i===null?null:{parent:ut._currentValue,pool:i},t.memoizedState={baseLanes:a,cachePool:i},e!==null&&Dl(t,null),Ru(),Zg(t),e!==null&&vn(e,t,r,!0),t.childLanes=n,null}function Ll(e,t){return t=os({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ff(e,t,a){return si(t,e.child,null,a),e=Ll(t,t.pendingProps),e.flags|=2,Wt(t),t.memoizedState=null,e}function Sy(e,t,a){var r=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ne){if(r.mode==="hidden")return e=Ll(t,r),t.lanes=536870912,ao(null,e);if(Uu(t),(e=Ke)?(e=Nb(e,va),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hr!==null?{id:Da,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Og(e),a.return=t,t.child=a,St=t,Ke=null)):e=null,e===null)throw jr(t);return t.lanes=536870912,null}return Ll(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(Uu(t),n)if(t.flags&256)t.flags&=-257,t=ff(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(D(558));else if(pt||vn(e,t,a,!1),n=(a&e.childLanes)!==0,pt||n){if(r=Ge,r!==null&&(o=cg(r,a),o!==0&&o!==i.retryLane))throw i.retryLane=o,fi(e,o),Xt(r,e,o),Hp;us(),t=ff(e,t,a)}else e=i.treeContext,Ke=ya(o.nextSibling),St=t,Ne=!0,zr=null,va=!1,e!==null&&Hg(t,e),t=Ll(t,r),t.flags|=4096;return t}return e=ar(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Hl(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(D(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function ju(e,t,a,r,n){return li(t),a=qp(e,t,a,r,void 0,n),r=Ep(),e!==null&&!pt?(Mp(e,t,n),sr(e,t,n)):(Ne&&r&&wp(t),t.flags|=1,kt(e,t,a,n),t.child)}function gf(e,t,a,r,n,i){return li(t),t.updateQueue=null,a=Jg(t,r,a,n),Kg(e),r=Ep(),e!==null&&!pt?(Mp(e,t,i),sr(e,t,i)):(Ne&&r&&wp(t),t.flags|=1,kt(e,t,a,i),t.child)}function hf(e,t,a,r,n){if(li(t),t.stateNode===null){var i=Zi,o=a.contextType;typeof o=="object"&&o!==null&&(i=Ct(o)),i=new a(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Lu,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},Np(t),o=a.contextType,i.context=typeof o=="object"&&o!==null?Ct(o):Zi,i.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(Vc(t,a,o,r),i.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&Lu.enqueueReplaceState(i,i.state,null),uo(t,r,i,n),co(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var l=t.memoizedProps,u=ui(a,l);i.props=u;var p=i.context,f=a.contextType;o=Zi,typeof f=="object"&&f!==null&&(o=Ct(f));var v=a.getDerivedStateFromProps;f=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||p!==o)&&cf(t,i,r,o),yr=!1;var d=t.memoizedState;i.state=d,uo(t,r,i,n),co(),p=t.memoizedState,l||d!==p||yr?(typeof v=="function"&&(Vc(t,a,v,r),p=t.memoizedState),(u=yr||sf(t,a,u,r,d,p,o))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=o,r=u):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,zu(e,t),o=t.memoizedProps,f=ui(a,o),i.props=f,v=t.pendingProps,d=i.context,p=a.contextType,u=Zi,typeof p=="object"&&p!==null&&(u=Ct(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==v||d!==u)&&cf(t,i,r,u),yr=!1,d=t.memoizedState,i.state=d,uo(t,r,i,n),co();var h=t.memoizedState;o!==v||d!==h||yr||e!==null&&e.dependencies!==null&&Wl(e.dependencies)?(typeof l=="function"&&(Vc(t,a,l,r),h=t.memoizedState),(f=yr||sf(t,a,f,r,d,h,u)||e!==null&&e.dependencies!==null&&Wl(e.dependencies))?(p||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,h,u),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,h,u)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=u,r=f):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Hl(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=si(t,e.child,null,n),t.child=si(t,null,a,n)):kt(e,t,a,n),t.memoizedState=i.state,e=t.child):e=sr(e,t,n),e}function bf(e,t,a,r){return oi(),t.flags|=256,kt(e,t,a,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kc(e){return{baseLanes:e,cachePool:Gg()}}function Jc(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ta),e}function Rh(e,t,a){var r=t.pendingProps,n=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),o&&(n=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ne){if(n?xr(t):kr(t),(e=Ke)?(e=Nb(e,va),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hr!==null?{id:Da,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Og(e),a.return=t,t.child=a,St=t,Ke=null)):e=null,e===null)throw jr(t);return ep(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,n?(kr(t),n=t.mode,l=os({mode:"hidden",children:l},n),r=ai(r,n,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=Kc(a),r.childLanes=Jc(e,o,a),t.memoizedState=Zc,ao(null,r)):(xr(t),Gu(t,l))}var u=e.memoizedState;if(u!==null&&(l=u.dehydrated,l!==null)){if(i)t.flags&256?(xr(t),t.flags&=-257,t=Pc(e,t,a)):t.memoizedState!==null?(kr(t),t.child=e.child,t.flags|=128,t=null):(kr(t),l=r.fallback,n=t.mode,r=os({mode:"visible",children:r.children},n),l=ai(l,n,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,si(t,e.child,null,a),r=t.child,r.memoizedState=Kc(a),r.childLanes=Jc(e,o,a),t.memoizedState=Zc,t=ao(null,r));else if(xr(t),ep(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(D(419)),r.stack="",r.digest=o,ko({value:r,source:null,stack:null}),t=Pc(e,t,a)}else if(pt||vn(e,t,a,!1),o=(a&e.childLanes)!==0,pt||o){if(o=Ge,o!==null&&(r=cg(o,a),r!==0&&r!==u.retryLane))throw u.retryLane=r,fi(e,r),Xt(o,e,r),Hp;Wu(l)||us(),t=Pc(e,t,a)}else Wu(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,Ke=ya(l.nextSibling),St=t,Ne=!0,zr=null,va=!1,e!==null&&Hg(t,e),t=Gu(t,r.children),t.flags|=4096);return t}return n?(kr(t),l=r.fallback,n=t.mode,u=e.child,p=u.sibling,r=ar(u,{mode:"hidden",children:r.children}),r.subtreeFlags=u.subtreeFlags&65011712,p!==null?l=ar(p,l):(l=ai(l,n,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,ao(null,r),r=t.child,l=e.child.memoizedState,l===null?l=Kc(a):(n=l.cachePool,n!==null?(u=ut._currentValue,n=n.parent!==u?{parent:u,pool:u}:n):n=Gg(),l={baseLanes:l.baseLanes|a,cachePool:n}),r.memoizedState=l,r.childLanes=Jc(e,o,a),t.memoizedState=Zc,ao(e.child,r)):(xr(t),a=e.child,e=a.sibling,a=ar(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 Gu(e,t){return t=os({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function os(e,t){return e=ea(22,e,null,t),e.lanes=0,e}function Pc(e,t,a){return si(t,e.child,null,a),e=Gu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vf(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Eu(e.return,t,a)}function Fc(e,t,a,r,n,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:n,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=n,o.treeForkCount=i)}function Uh(e,t,a){var r=t.pendingProps,n=r.revealOrder,i=r.tail;r=r.children;var o=ot.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Xe(ot,o),kt(e,t,r,a),r=Ne?xo:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vf(e,a,t);else if(e.tag===19)vf(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(n){case"forwards":for(a=t.child,n=null;a!==null;)e=a.alternate,e!==null&&as(e)===null&&(n=a),a=a.sibling;a=n,a===null?(n=t.child,t.child=null):(n=a.sibling,a.sibling=null),Fc(t,!1,n,a,i,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&as(e)===null){t.child=n;break}e=n.sibling,n.sibling=a,a=n,n=e}Fc(t,!0,a,null,i,r);break;case"together":Fc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function sr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Qr|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(vn(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(D(153));if(t.child!==null){for(e=t.child,a=ar(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=ar(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function jp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Wl(e)))}function Cy(e,t,a){switch(t.tag){case 3:Vl(t,t.stateNode.containerInfo),_r(t,ut,e.memoizedState.cache),oi();break;case 27:case 5:gu(t);break;case 4:Vl(t,t.stateNode.containerInfo);break;case 10:_r(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Uu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(xr(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Rh(e,t,a):(xr(t),e=sr(e,t,a),e!==null?e.sibling:null);xr(t);break;case 19:var n=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(vn(e,t,a,!1),r=(a&t.childLanes)!==0),n){if(r)return Uh(e,t,a);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),Xe(ot,ot.current),r)break;return null;case 22:return t.lanes=0,Ah(e,t,a,t.pendingProps);case 24:_r(t,ut,e.memoizedState.cache)}return sr(e,t,a)}function Dh(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)pt=!0;else{if(!jp(e,a)&&(t.flags&128)===0)return pt=!1,Cy(e,t,a);pt=(e.flags&131072)!==0}else pt=!1,Ne&&(t.flags&1048576)!==0&&Lg(t,xo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Wr(t.elementType),t.type=e,typeof e=="function")vp(e)?(r=ui(e,r),t.tag=1,t=hf(null,t,e,r,a)):(t.tag=0,t=ju(null,t,e,r,a));else{if(e!=null){var n=e.$$typeof;if(n===ip){t.tag=11,t=pf(null,t,e,r,a);break e}else if(n===np){t.tag=14,t=df(null,t,e,r,a);break e}}throw t=mu(e)||e,Error(D(306,t,""))}}return t;case 0:return ju(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,n=ui(r,t.pendingProps),hf(e,t,r,n,a);case 3:e:{if(Vl(t,t.stateNode.containerInfo),e===null)throw Error(D(387));r=t.pendingProps;var i=t.memoizedState;n=i.element,zu(e,t),uo(t,r,null,a);var o=t.memoizedState;if(r=o.cache,_r(t,ut,r),r!==i.cache&&Mu(t,[ut],a,!0),co(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=bf(e,t,r,a);break e}else if(r!==n){n=ba(Error(D(424)),t),ko(n),t=bf(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,Ke=ya(e.firstChild),St=t,Ne=!0,zr=null,va=!0,a=Xg(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(oi(),r===n){t=sr(e,t,a);break e}kt(e,t,r,a)}t=t.child}return t;case 26:return Hl(e,t),e===null?(a=jf(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ne||(a=t.type,e=t.pendingProps,r=fs(Tr.current).createElement(a),r[Nt]=t,r[$t]=e,qt(r,a,e),yt(r),t.stateNode=r):t.memoizedState=jf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return gu(t),e===null&&Ne&&(r=t.stateNode=Sb(t.type,t.pendingProps,Tr.current),St=t,va=!0,n=Ke,Xr(t.type)?(tp=n,Ke=ya(r.firstChild)):Ke=n),kt(e,t,t.pendingProps.children,a),Hl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ne&&((n=r=Ke)&&(r=e1(r,t.type,t.pendingProps,va),r!==null?(t.stateNode=r,St=t,Ke=ya(r.firstChild),va=!1,n=!0):n=!1),n||jr(t)),gu(t),n=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,Fu(n,i)?r=null:o!==null&&Fu(n,o)&&(t.flags|=32),t.memoizedState!==null&&(n=qp(e,t,by,null,null,a),Mo._currentValue=n),Hl(e,t),kt(e,t,r,a),t.child;case 6:return e===null&&Ne&&((e=a=Ke)&&(a=t1(a,t.pendingProps,va),a!==null?(t.stateNode=a,St=t,Ke=null,e=!0):e=!1),e||jr(t)),null;case 13:return Rh(e,t,a);case 4:return Vl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=si(t,null,r,a):kt(e,t,r,a),t.child;case 11:return pf(e,t,t.type,t.pendingProps,a);case 7:return kt(e,t,t.pendingProps,a),t.child;case 8:return kt(e,t,t.pendingProps.children,a),t.child;case 12:return kt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,_r(t,t.type,r.value),kt(e,t,r.children,a),t.child;case 9:return n=t.type._context,r=t.pendingProps.children,li(t),n=Ct(n),r=r(n),t.flags|=1,kt(e,t,r,a),t.child;case 14:return df(e,t,t.type,t.pendingProps,a);case 15:return zh(e,t,t.type,t.pendingProps,a);case 19:return Uh(e,t,a);case 31:return Sy(e,t,a);case 22:return Ah(e,t,a,t.pendingProps);case 24:return li(t),r=Ct(ut),e===null?(n=xp(),n===null&&(n=Ge,i=_p(),n.pooledCache=i,i.refCount++,i!==null&&(n.pooledCacheLanes|=a),n=i),t.memoizedState={parent:r,cache:n},Np(t),_r(t,ut,n)):((e.lanes&a)!==0&&(zu(e,t),uo(t,null,null,a),co()),n=e.memoizedState,i=t.memoizedState,n.parent!==r?(n={parent:r,cache:r},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),_r(t,ut,r)):(r=i.cache,_r(t,ut,r),r!==n.cache&&Mu(t,[ut],a,!0))),kt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(D(156,t.tag))}function Za(e){e.flags|=4}function Ic(e,t,a,r,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(nb())e.flags|=8192;else throw ii=es,kp}else e.flags&=-16777217}function wf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eb(t))if(nb())e.flags|=8192;else throw ii=es,kp}function kl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?og():536870912,e.lanes|=t,pn|=t)}function Jn(e,t){if(!Ne)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 Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var n=e.child;n!==null;)a|=n.lanes|n.childLanes,r|=n.subtreeFlags&65011712,r|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)a|=n.lanes|n.childLanes,r|=n.subtreeFlags,r|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function qy(e,t,a){var r=t.pendingProps;switch(yp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),rr(ut),nn(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Di(t)?Za(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Yc())),Ze(t),null;case 26:var n=t.type,i=t.memoizedState;return e===null?(Za(t),i!==null?(Ze(t),wf(t,i)):(Ze(t),Ic(t,n,null,r,a))):i?i!==e.memoizedState?(Za(t),Ze(t),wf(t,i)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Za(t),Ze(t),Ic(t,n,e,r,a)),null;case 27:if(Zl(t),a=Tr.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(!r){if(t.stateNode===null)throw Error(D(166));return Ze(t),null}e=La.current,Di(t)?Zm(t,e):(e=Sb(n,r,a),t.stateNode=e,Za(t))}return Ze(t),null;case 5:if(Zl(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(!r){if(t.stateNode===null)throw Error(D(166));return Ze(t),null}if(i=La.current,Di(t))Zm(t,i);else{var o=fs(Tr.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(n,{is:r.is}):o.createElement(n)}}i[Nt]=t,i[$t]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.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=i;e:switch(qt(i,n,r),n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Za(t)}}return Ze(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(D(166));if(e=Tr.current,Di(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,n=St,n!==null)switch(n.tag){case 27:case 5:r=n.memoizedProps}e[Nt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||_b(e.nodeValue,a)),e||jr(t,!0)}else e=fs(e).createTextNode(r),e[Nt]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Di(t),a!==null){if(e===null){if(!r)throw Error(D(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(557));e[Nt]=t}else oi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Yc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Wt(t),t):(Wt(t),null);if((t.flags&128)!==0)throw Error(D(558))}return Ze(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=Di(t),r!==null&&r.dehydrated!==null){if(e===null){if(!n)throw Error(D(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(D(317));n[Nt]=t}else oi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),n=!1}else n=Yc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(Wt(t),t):(Wt(t),null)}return Wt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,n=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(n=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==n&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),kl(t,t.updateQueue),Ze(t),null);case 4:return nn(),e===null&&Zp(t.stateNode.containerInfo),Ze(t),null;case 10:return rr(t.type),Ze(t),null;case 19:if(_t(ot),r=t.memoizedState,r===null)return Ze(t),null;if(n=(t.flags&128)!==0,i=r.rendering,i===null)if(n)Jn(r,!1);else{if(rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=as(e),i!==null){for(t.flags|=128,Jn(r,!1),e=i.updateQueue,t.updateQueue=e,kl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Bg(a,e),a=a.sibling;return Xe(ot,ot.current&1|2),Ne&&Fa(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&aa()>ss&&(t.flags|=128,n=!0,Jn(r,!1),t.lanes=4194304)}else{if(!n)if(e=as(i),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,kl(t,e),Jn(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!Ne)return Ze(t),null}else 2*aa()-r.renderingStartTime>ss&&a!==536870912&&(t.flags|=128,n=!0,Jn(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=aa(),e.sibling=null,a=ot.current,Xe(ot,n?a&1|2:a&1),Ne&&Fa(t,r.treeForkCount),e):(Ze(t),null);case 22:case 23:return Wt(t),Sp(),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&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&kl(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&&_t(ri),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),rr(ut),Ze(t),null;case 25:return null;case 30:return null}throw Error(D(156,t.tag))}function Ey(e,t){switch(yp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rr(ut),nn(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Zl(t),null;case 31:if(t.memoizedState!==null){if(Wt(t),t.alternate===null)throw Error(D(340));oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Wt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(D(340));oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _t(ot),null;case 4:return nn(),null;case 10:return rr(t.type),null;case 22:case 23:return Wt(t),Sp(),e!==null&&_t(ri),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return rr(ut),null;case 25:return null;default:return null}}function Bh(e,t){switch(yp(t),t.tag){case 3:rr(ut),nn();break;case 26:case 27:case 5:Zl(t);break;case 4:nn();break;case 31:t.memoizedState!==null&&Wt(t);break;case 13:Wt(t);break;case 19:_t(ot);break;case 10:rr(t.type);break;case 22:case 23:Wt(t),Sp(),e!==null&&_t(ri);break;case 24:rr(ut)}}function jo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var n=r.next;a=n;do{if((a.tag&e)===e){r=void 0;var i=a.create,o=a.inst;r=i(),o.destroy=r}a=a.next}while(a!==n)}}catch(l){Be(t,t.return,l)}}function Gr(e,t,a){try{var r=t.updateQueue,n=r!==null?r.lastEffect:null;if(n!==null){var i=n.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,n=t;var u=a,p=l;try{p()}catch(f){Be(n,u,f)}}}r=r.next}while(r!==i)}}catch(f){Be(t,t.return,f)}}function Oh(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Vg(t,a)}catch(r){Be(e,e.return,r)}}}function Lh(e,t,a){a.props=ui(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Be(e,t,r)}}function mo(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(n){Be(e,t,n)}}function Oa(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(n){Be(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(n){Be(e,t,n)}else a.current=null}function Hh(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(n){Be(e,e.return,n)}}function Wc(e,t,a){try{var r=e.stateNode;Ky(r,e.type,a,t),r[$t]=t}catch(n){Be(e,e.return,n)}}function jh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Xr(e.type)||e.tag===4}function eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jh(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&&Xr(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 Qu(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=er));else if(r!==4&&(r===27&&Xr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Qu(e,t,a),e=e.sibling;e!==null;)Qu(e,t,a),e=e.sibling}function ls(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&&Xr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ls(e,t,a),e=e.sibling;e!==null;)ls(e,t,a),e=e.sibling}function Gh(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);qt(t,r,a),t[Nt]=e,t[$t]=a}catch(i){Be(e,e.return,i)}}var Ia=!1,ct=!1,tu=!1,yf=typeof WeakSet=="function"?WeakSet:Set,wt=null;function My(e,t){if(e=e.containerInfo,Ju=vs,e=Eg(e),gp(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 n=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var o=0,l=-1,u=-1,p=0,f=0,v=e,d=null;t:for(;;){for(var h;v!==a||n!==0&&v.nodeType!==3||(l=o+n),v!==i||r!==0&&v.nodeType!==3||(u=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(h=v.firstChild)!==null;)d=v,v=h;for(;;){if(v===e)break t;if(d===a&&++p===n&&(l=o),d===i&&++f===r&&(u=o),(h=v.nextSibling)!==null)break;v=d,d=v.parentNode}v=h}a=l===-1||u===-1?null:{start:l,end:u}}else a=null}a=a||{start:0,end:0}}else a=null;for(Pu={focusedElem:e,selectionRange:a},vs=!1,wt=t;wt!==null;)if(t=wt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,wt=e;else for(;wt!==null;){switch(t=wt,i=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++)n=e[a],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,a=t,n=i.memoizedProps,i=i.memoizedState,r=a.stateNode;try{var w=ui(a.type,n);e=r.getSnapshotBeforeUpdate(w,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(E){Be(a,a.return,E)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Iu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Iu(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(D(163))}if(e=t.sibling,e!==null){e.return=t.return,wt=e;break}wt=t.return}}function Qh(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ja(e,a),r&4&&jo(5,a);break;case 1:if(Ja(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(o){Be(a,a.return,o)}else{var n=ui(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Be(a,a.return,o)}}r&64&&Oh(a),r&512&&mo(a,a.return);break;case 3:if(Ja(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{Vg(e,t)}catch(o){Be(a,a.return,o)}}break;case 27:t===null&&r&4&&Gh(a);case 26:case 5:Ja(e,a),t===null&&r&4&&Hh(a),r&512&&mo(a,a.return);break;case 12:Ja(e,a);break;case 31:Ja(e,a),r&4&&$h(e,a);break;case 13:Ja(e,a),r&4&&Vh(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Ly.bind(null,a),a1(e,a))));break;case 22:if(r=a.memoizedState!==null||Ia,!r){t=t!==null&&t.memoizedState!==null||ct,n=Ia;var i=ct;Ia=r,(ct=t)&&!i?Pa(e,a,(a.subtreeFlags&8772)!==0):Ja(e,a),Ia=n,ct=i}break;case 30:break;default:Ja(e,a)}}function Yh(e){var t=e.alternate;t!==null&&(e.alternate=null,Yh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&cp(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 We=null,Qt=!1;function Ka(e,t,a){for(a=a.child;a!==null;)Xh(e,t,a),a=a.sibling}function Xh(e,t,a){if(ra&&typeof ra.onCommitFiberUnmount=="function")try{ra.onCommitFiberUnmount(Ro,a)}catch{}switch(a.tag){case 26:ct||Oa(a,t),Ka(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ct||Oa(a,t);var r=We,n=Qt;Xr(a.type)&&(We=a.stateNode,Qt=!1),Ka(e,t,a),bo(a.stateNode),We=r,Qt=n;break;case 5:ct||Oa(a,t);case 6:if(r=We,n=Qt,We=null,Ka(e,t,a),We=r,Qt=n,We!==null)if(Qt)try{(We.nodeType===9?We.body:We.nodeName==="HTML"?We.ownerDocument.body:We).removeChild(a.stateNode)}catch(i){Be(a,t,i)}else try{We.removeChild(a.stateNode)}catch(i){Be(a,t,i)}break;case 18:We!==null&&(Qt?(e=We,Df(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),gn(e)):Df(We,a.stateNode));break;case 4:r=We,n=Qt,We=a.stateNode.containerInfo,Qt=!0,Ka(e,t,a),We=r,Qt=n;break;case 0:case 11:case 14:case 15:Gr(2,a,t),ct||Gr(4,a,t),Ka(e,t,a);break;case 1:ct||(Oa(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Lh(a,t,r)),Ka(e,t,a);break;case 21:Ka(e,t,a);break;case 22:ct=(r=ct)||a.memoizedState!==null,Ka(e,t,a),ct=r;break;default:Ka(e,t,a)}}function $h(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{gn(e)}catch(a){Be(t,t.return,a)}}}function Vh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{gn(e)}catch(a){Be(t,t.return,a)}}function Ty(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new yf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new yf),t;default:throw Error(D(435,e.tag))}}function Nl(e,t){var a=Ty(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var n=Hy.bind(null,e,r);r.then(n,n)}})}function jt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var n=a[r],i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Xr(l.type)){We=l.stateNode,Qt=!1;break e}break;case 5:We=l.stateNode,Qt=!1;break e;case 3:case 4:We=l.stateNode.containerInfo,Qt=!0;break e}l=l.return}if(We===null)throw Error(D(160));Xh(i,o,n),We=null,Qt=!1,i=n.alternate,i!==null&&(i.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Zh(t,e),t=t.sibling}var Ma=null;function Zh(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jt(t,e),Gt(e),r&4&&(Gr(3,e,e.return),jo(3,e),Gr(5,e,e.return));break;case 1:jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),r&64&&Ia&&(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 n=Ma;if(jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),r&4){var i=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,n=n.ownerDocument||n;t:switch(r){case"title":i=n.getElementsByTagName("title")[0],(!i||i[Bo]||i[Nt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=n.createElement(r),n.head.insertBefore(i,n.querySelector("head > title"))),qt(i,r,a),i[Nt]=e,yt(i),r=i;break e;case"link":var o=Qf("link","href",n).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(i=o[l],i.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&i.getAttribute("rel")===(a.rel==null?null:a.rel)&&i.getAttribute("title")===(a.title==null?null:a.title)&&i.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}i=n.createElement(r),qt(i,r,a),n.head.appendChild(i);break;case"meta":if(o=Qf("meta","content",n).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(i=o[l],i.getAttribute("content")===(a.content==null?null:""+a.content)&&i.getAttribute("name")===(a.name==null?null:a.name)&&i.getAttribute("property")===(a.property==null?null:a.property)&&i.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&i.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}i=n.createElement(r),qt(i,r,a),n.head.appendChild(i);break;default:throw Error(D(468,r))}i[Nt]=e,yt(i),r=i}e.stateNode=r}else Yf(n,e.type,e.stateNode);else e.stateNode=Gf(n,r,e.memoizedProps);else i!==r?(i===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):i.count--,r===null?Yf(n,e.type,e.stateNode):Gf(n,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,a.memoizedProps)}break;case 27:jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),a!==null&&r&4&&Wc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),e.flags&32){n=e.stateNode;try{ln(n,"")}catch(w){Be(e,e.return,w)}}r&4&&e.stateNode!=null&&(n=e.memoizedProps,Wc(e,n,a!==null?a.memoizedProps:n)),r&1024&&(tu=!0);break;case 6:if(jt(t,e),Gt(e),r&4){if(e.stateNode===null)throw Error(D(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(w){Be(e,e.return,w)}}break;case 3:if(Ql=null,n=Ma,Ma=gs(t.containerInfo),jt(t,e),Ma=n,Gt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{gn(t.containerInfo)}catch(w){Be(e,e.return,w)}tu&&(tu=!1,Kh(e));break;case 4:r=Ma,Ma=gs(e.stateNode.containerInfo),jt(t,e),Gt(e),Ma=r;break;case 12:jt(t,e),Gt(e);break;case 31:jt(t,e),Gt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 13:jt(t,e),Gt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(zs=aa()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 22:n=e.memoizedState!==null;var u=a!==null&&a.memoizedState!==null,p=Ia,f=ct;if(Ia=p||n,ct=f||u,jt(t,e),ct=f,Ia=p,Gt(e),r&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(a===null||u||Ia||ct||ei(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){u=a=t;try{if(i=u.stateNode,n)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=u.stateNode;var v=u.memoizedProps.style,d=v!=null&&v.hasOwnProperty("display")?v.display:null;l.style.display=d==null||typeof d=="boolean"?"":(""+d).trim()}}catch(w){Be(u,u.return,w)}}}else if(t.tag===6){if(a===null){u=t;try{u.stateNode.nodeValue=n?"":u.memoizedProps}catch(w){Be(u,u.return,w)}}}else if(t.tag===18){if(a===null){u=t;try{var h=u.stateNode;n?Bf(h,!0):Bf(u.stateNode,!1)}catch(w){Be(u,u.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,Nl(e,a))));break;case 19:jt(t,e),Gt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 30:break;case 21:break;default:jt(t,e),Gt(e)}}function Gt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(jh(r)){a=r;break}r=r.return}if(a==null)throw Error(D(160));switch(a.tag){case 27:var n=a.stateNode,i=eu(e);ls(e,i,n);break;case 5:var o=a.stateNode;a.flags&32&&(ln(o,""),a.flags&=-33);var l=eu(e);ls(e,l,o);break;case 3:case 4:var u=a.stateNode.containerInfo,p=eu(e);Qu(e,p,u);break;default:throw Error(D(161))}}catch(f){Be(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Kh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Kh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qh(e,t.alternate,t),t=t.sibling}function ei(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gr(4,t,t.return),ei(t);break;case 1:Oa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Lh(t,t.return,a),ei(t);break;case 27:bo(t.stateNode);case 26:case 5:Oa(t,t.return),ei(t);break;case 22:t.memoizedState===null&&ei(t);break;case 30:ei(t);break;default:ei(t)}e=e.sibling}}function Pa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,n=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:Pa(n,i,a),jo(4,i);break;case 1:if(Pa(n,i,a),r=i,n=r.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(p){Be(r,r.return,p)}if(r=i,n=r.updateQueue,n!==null){var l=r.stateNode;try{var u=n.shared.hiddenCallbacks;if(u!==null)for(n.shared.hiddenCallbacks=null,n=0;n<u.length;n++)$g(u[n],l)}catch(p){Be(r,r.return,p)}}a&&o&64&&Oh(i),mo(i,i.return);break;case 27:Gh(i);case 26:case 5:Pa(n,i,a),a&&r===null&&o&4&&Hh(i),mo(i,i.return);break;case 12:Pa(n,i,a);break;case 31:Pa(n,i,a),a&&o&4&&$h(n,i);break;case 13:Pa(n,i,a),a&&o&4&&Vh(n,i);break;case 22:i.memoizedState===null&&Pa(n,i,a),mo(i,i.return);break;case 30:break;default:Pa(n,i,a)}t=t.sibling}}function Gp(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&&Lo(a))}function Qp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Lo(e))}function Ea(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jh(e,t,a,r),t=t.sibling}function Jh(e,t,a,r){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Ea(e,t,a,r),n&2048&&jo(9,t);break;case 1:Ea(e,t,a,r);break;case 3:Ea(e,t,a,r),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Lo(e)));break;case 12:if(n&2048){Ea(e,t,a,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(u){Be(t,t.return,u)}}else Ea(e,t,a,r);break;case 31:Ea(e,t,a,r);break;case 13:Ea(e,t,a,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Ea(e,t,a,r):fo(e,t):i._visibility&2?Ea(e,t,a,r):(i._visibility|=2,Oi(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),n&2048&&Gp(o,t);break;case 24:Ea(e,t,a,r),n&2048&&Qp(t.alternate,t);break;default:Ea(e,t,a,r)}}function Oi(e,t,a,r,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,l=a,u=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Oi(i,o,l,u,n),jo(8,o);break;case 23:break;case 22:var f=o.stateNode;o.memoizedState!==null?f._visibility&2?Oi(i,o,l,u,n):fo(i,o):(f._visibility|=2,Oi(i,o,l,u,n)),n&&p&2048&&Gp(o.alternate,o);break;case 24:Oi(i,o,l,u,n),n&&p&2048&&Qp(o.alternate,o);break;default:Oi(i,o,l,u,n)}t=t.sibling}}function fo(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,n=r.flags;switch(r.tag){case 22:fo(a,r),n&2048&&Gp(r.alternate,r);break;case 24:fo(a,r),n&2048&&Qp(r.alternate,r);break;default:fo(a,r)}t=t.sibling}}var ro=8192;function Bi(e,t,a){if(e.subtreeFlags&ro)for(e=e.child;e!==null;)Ph(e,t,a),e=e.sibling}function Ph(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&ro&&e.memoizedState!==null&&f1(a,Ma,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var r=Ma;Ma=gs(e.stateNode.containerInfo),Bi(e,t,a),Ma=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ro,ro=16777216,Bi(e,t,a),ro=r):Bi(e,t,a));break;default:Bi(e,t,a)}}function Fh(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 Pn(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];wt=r,Wh(r,e)}Fh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ih(e),e=e.sibling}function Ih(e){switch(e.tag){case 0:case 11:case 15:Pn(e),e.flags&2048&&Gr(9,e,e.return);break;case 3:Pn(e);break;case 12:Pn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):Pn(e);break;default:Pn(e)}}function jl(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];wt=r,Wh(r,e)}Fh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gr(8,t,t.return),jl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Wh(e,t){for(;wt!==null;){var a=wt;switch(a.tag){case 0:case 11:case 15:Gr(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:Lo(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,wt=r;else e:for(a=e;wt!==null;){r=wt;var n=r.sibling,i=r.return;if(Yh(r),r===a){wt=null;break e}if(n!==null){n.return=i,wt=n;break e}wt=i}}}var zy={getCacheForType:function(e){var t=Ct(ut),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Ct(ut).controller.signal}},Ay=typeof WeakMap=="function"?WeakMap:Map,Te=0,Ge=null,xe=null,ke=0,De=0,It=null,qr=!1,yn=!1,Yp=!1,cr=0,rt=0,Qr=0,ni=0,Xp=0,ta=0,pn=0,go=null,Yt=null,Yu=!1,zs=0,eb=0,ss=1/0,cs=null,Ur=null,gt=0,Dr=null,dn=null,ir=0,Xu=0,$u=null,tb=null,ho=0,Vu=null;function na(){return(Te&2)!==0&&ke!==0?ke&-ke:me.T!==null?Vp():ug()}function ab(){if(ta===0)if((ke&536870912)===0||Ne){var e=fl;fl<<=1,(fl&3932160)===0&&(fl=262144),ta=e}else ta=536870912;return e=la.current,e!==null&&(e.flags|=32),ta}function Xt(e,t,a){(e===Ge&&(De===2||De===9)||e.cancelPendingCommit!==null)&&(mn(e,0),Er(e,ke,ta,!1)),Do(e,a),((Te&2)===0||e!==Ge)&&(e===Ge&&((Te&2)===0&&(ni|=a),rt===4&&Er(e,ke,ta,!1)),ja(e))}function rb(e,t,a){if((Te&6)!==0)throw Error(D(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Uo(e,t),n=r?Dy(e,t):au(e,t,!0),i=r;do{if(n===0){yn&&!r&&Er(e,t,0,!1);break}else{if(a=e.current.alternate,i&&!Ry(a)){n=au(e,t,!1),i=!1;continue}if(n===2){if(i=t,e.errorRecoveryDisabledLanes&i)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;n=go;var u=l.current.memoizedState.isDehydrated;if(u&&(mn(l,o).flags|=256),o=au(l,o,!1),o!==2){if(Yp&&!u){l.errorRecoveryDisabledLanes|=i,ni|=i,n=4;break e}i=Yt,Yt=n,i!==null&&(Yt===null?Yt=i:Yt.push.apply(Yt,i))}n=o}if(i=!1,n!==2)continue}}if(n===1){mn(e,0),Er(e,t,0,!0);break}e:{switch(r=e,i=n,i){case 0:case 1:throw Error(D(345));case 4:if((t&4194048)!==t)break;case 6:Er(r,t,ta,!qr);break e;case 2:Yt=null;break;case 3:case 5:break;default:throw Error(D(329))}if((t&62914560)===t&&(n=zs+300-aa(),10<n)){if(Er(r,t,ta,!qr),ys(r,0,!0)!==0)break e;ir=t,r.timeoutHandle=kb(_f.bind(null,r,a,Yt,cs,Yu,t,ta,ni,pn,qr,i,"Throttled",-0,0),n);break e}_f(r,a,Yt,cs,Yu,t,ta,ni,pn,qr,i,null,-0,0)}}break}while(!0);ja(e)}function _f(e,t,a,r,n,i,o,l,u,p,f,v,d,h){if(e.timeoutHandle=-1,v=t.subtreeFlags,v&8192||(v&16785408)===16785408){v={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:er},Ph(t,i,v);var w=(i&62914560)===i?zs-aa():(i&4194048)===i?eb-aa():0;if(w=g1(v,w),w!==null){ir=i,e.cancelPendingCommit=w(kf.bind(null,e,t,i,a,r,n,o,l,u,f,v,null,d,h)),Er(e,i,o,!p);return}}kf(e,t,i,a,r,n,o,l,u)}function Ry(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 n=a[r],i=n.getSnapshot;n=n.value;try{if(!oa(i(),n))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 Er(e,t,a,r){t&=~Xp,t&=~ni,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var n=t;0<n;){var i=31-ia(n),o=1<<i;r[i]=-1,n&=~o}a!==0&&lg(e,a,t)}function As(){return(Te&6)===0?(Go(0,!1),!1):!0}function $p(){if(xe!==null){if(De===0)var e=xe.return;else e=xe,tr=gi=null,Tp(e),tn=null,No=0,e=xe;for(;e!==null;)Bh(e.alternate,e),e=e.return;xe=null}}function mn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Fy(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ir=0,$p(),Ge=e,xe=a=ar(e.current,null),ke=t,De=0,It=null,qr=!1,yn=Uo(e,t),Yp=!1,pn=ta=Xp=ni=Qr=rt=0,Yt=go=null,Yu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var n=31-ia(r),i=1<<n;t|=e[n],r&=~i}return cr=t,Ns(),a}function ib(e,t){he=null,me.H=Co,t===wn||t===Cs?(t=Im(),De=3):t===kp?(t=Im(),De=4):De=t===Hp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,xe===null&&(rt=1,ns(e,ba(t,e.current)))}function nb(){var e=la.current;return e===null?!0:(ke&4194048)===ke?wa===null:(ke&62914560)===ke||(ke&536870912)!==0?e===wa:!1}function ob(){var e=me.H;return me.H=Co,e===null?Co:e}function lb(){var e=me.A;return me.A=zy,e}function us(){rt=4,qr||(ke&4194048)!==ke&&la.current!==null||(yn=!0),(Qr&134217727)===0&&(ni&134217727)===0||Ge===null||Er(Ge,ke,ta,!1)}function au(e,t,a){var r=Te;Te|=2;var n=ob(),i=lb();(Ge!==e||ke!==t)&&(cs=null,mn(e,t)),t=!1;var o=rt;e:do try{if(De!==0&&xe!==null){var l=xe,u=It;switch(De){case 8:$p(),o=6;break e;case 3:case 2:case 9:case 6:la.current===null&&(t=!0);var p=De;if(De=0,It=null,Pi(e,l,u,p),a&&yn){o=0;break e}break;default:p=De,De=0,It=null,Pi(e,l,u,p)}}Uy(),o=rt;break}catch(f){ib(e,f)}while(!0);return t&&e.shellSuspendCounter++,tr=gi=null,Te=r,me.H=n,me.A=i,xe===null&&(Ge=null,ke=0,Ns()),o}function Uy(){for(;xe!==null;)sb(xe)}function Dy(e,t){var a=Te;Te|=2;var r=ob(),n=lb();Ge!==e||ke!==t?(cs=null,ss=aa()+500,mn(e,t)):yn=Uo(e,t);e:do try{if(De!==0&&xe!==null){t=xe;var i=It;t:switch(De){case 1:De=0,It=null,Pi(e,t,i,1);break;case 2:case 9:if(Fm(i)){De=0,It=null,xf(t);break}t=function(){De!==2&&De!==9||Ge!==e||(De=7),ja(e)},i.then(t,t);break e;case 3:De=7;break e;case 4:De=5;break e;case 7:Fm(i)?(De=0,It=null,xf(t)):(De=0,It=null,Pi(e,t,i,7));break;case 5:var o=null;switch(xe.tag){case 26:o=xe.memoizedState;case 5:case 27:var l=xe;if(o?Eb(o):l.stateNode.complete){De=0,It=null;var u=l.sibling;if(u!==null)xe=u;else{var p=l.return;p!==null?(xe=p,Rs(p)):xe=null}break t}}De=0,It=null,Pi(e,t,i,5);break;case 6:De=0,It=null,Pi(e,t,i,6);break;case 8:$p(),rt=6;break e;default:throw Error(D(462))}}By();break}catch(f){ib(e,f)}while(!0);return tr=gi=null,me.H=r,me.A=n,Te=a,xe!==null?0:(Ge=null,ke=0,Ns(),rt)}function By(){for(;xe!==null&&!n0();)sb(xe)}function sb(e){var t=Dh(e.alternate,e,cr);e.memoizedProps=e.pendingProps,t===null?Rs(e):xe=t}function xf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=gf(a,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=gf(a,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Tp(t);default:Bh(a,t),t=xe=Bg(t,cr),t=Dh(a,t,cr)}e.memoizedProps=e.pendingProps,t===null?Rs(e):xe=t}function Pi(e,t,a,r){tr=gi=null,Tp(t),tn=null,No=0;var n=t.return;try{if(Ny(e,n,t,a,ke)){rt=1,ns(e,ba(a,e.current)),xe=null;return}}catch(i){if(n!==null)throw xe=n,i;rt=1,ns(e,ba(a,e.current)),xe=null;return}t.flags&32768?(Ne||r===1?e=!0:yn||(ke&536870912)!==0?e=!1:(qr=e=!0,(r===2||r===9||r===3||r===6)&&(r=la.current,r!==null&&r.tag===13&&(r.flags|=16384))),cb(t,e)):Rs(t)}function Rs(e){var t=e;do{if((t.flags&32768)!==0){cb(t,qr);return}e=t.return;var a=qy(t.alternate,t,cr);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);rt===0&&(rt=5)}function cb(e,t){do{var a=Ey(e.alternate,e);if(a!==null){a.flags&=32767,xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=a}while(e!==null);rt=6,xe=null}function kf(e,t,a,r,n,i,o,l,u){e.cancelPendingCommit=null;do Us();while(gt!==0);if((Te&6)!==0)throw Error(D(327));if(t!==null){if(t===e.current)throw Error(D(177));if(i=t.lanes|t.childLanes,i|=hp,g0(e,a,i,o,l,u),e===Ge&&(xe=Ge=null,ke=0),dn=t,Dr=e,ir=a,Xu=i,$u=n,tb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jy(Kl,function(){return fb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=me.T,me.T=null,n=ze.p,ze.p=2,o=Te,Te|=4;try{My(e,t,a)}finally{Te=o,ze.p=n,me.T=r}}gt=1,ub(),pb(),db()}}function ub(){if(gt===1){gt=0;var e=Dr,t=dn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null;var r=ze.p;ze.p=2;var n=Te;Te|=4;try{Zh(t,e);var i=Pu,o=Eg(e.containerInfo),l=i.focusedElem,u=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&qg(l.ownerDocument.documentElement,l)){if(u!==null&&gp(l)){var p=u.start,f=u.end;if(f===void 0&&(f=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(f,l.value.length);else{var v=l.ownerDocument||document,d=v&&v.defaultView||window;if(d.getSelection){var h=d.getSelection(),w=l.textContent.length,E=Math.min(u.start,w),U=u.end===void 0?E:Math.min(u.end,w);!h.extend&&E>U&&(o=U,U=E,E=o);var m=Xm(l,E),c=Xm(l,U);if(m&&c&&(h.rangeCount!==1||h.anchorNode!==m.node||h.anchorOffset!==m.offset||h.focusNode!==c.node||h.focusOffset!==c.offset)){var b=v.createRange();b.setStart(m.node,m.offset),h.removeAllRanges(),E>U?(h.addRange(b),h.extend(c.node,c.offset)):(b.setEnd(c.node,c.offset),h.addRange(b))}}}}for(v=[],h=l;h=h.parentNode;)h.nodeType===1&&v.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<v.length;l++){var g=v[l];g.element.scrollLeft=g.left,g.element.scrollTop=g.top}}vs=!!Ju,Pu=Ju=null}finally{Te=n,ze.p=r,me.T=a}}e.current=t,gt=2}}function pb(){if(gt===2){gt=0;var e=Dr,t=dn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=me.T,me.T=null;var r=ze.p;ze.p=2;var n=Te;Te|=4;try{Qh(e,t.alternate,t)}finally{Te=n,ze.p=r,me.T=a}}gt=3}}function db(){if(gt===4||gt===3){gt=0,o0();var e=Dr,t=dn,a=ir,r=tb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?gt=5:(gt=0,dn=Dr=null,mb(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(Ur=null),sp(a),t=t.stateNode,ra&&typeof ra.onCommitFiberRoot=="function")try{ra.onCommitFiberRoot(Ro,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=me.T,n=ze.p,ze.p=2,me.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];i(l.value,{componentStack:l.stack})}}finally{me.T=t,ze.p=n}}(ir&3)!==0&&Us(),ja(e),n=e.pendingLanes,(a&261930)!==0&&(n&42)!==0?e===Vu?ho++:(ho=0,Vu=e):ho=0,Go(0,!1)}}function mb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Lo(t)))}function Us(){return ub(),pb(),db(),fb()}function fb(){if(gt!==5)return!1;var e=Dr,t=Xu;Xu=0;var a=sp(ir),r=me.T,n=ze.p;try{ze.p=32>a?32:a,me.T=null,a=$u,$u=null;var i=Dr,o=ir;if(gt=0,dn=Dr=null,ir=0,(Te&6)!==0)throw Error(D(331));var l=Te;if(Te|=4,Ih(i.current),Jh(i,i.current,o,a),Te=l,Go(0,!1),ra&&typeof ra.onPostCommitFiberRoot=="function")try{ra.onPostCommitFiberRoot(Ro,i)}catch{}return!0}finally{ze.p=n,me.T=r,mb(e,t)}}function Nf(e,t,a){t=ba(a,t),t=Hu(e.stateNode,t,2),e=Rr(e,t,2),e!==null&&(Do(e,2),ja(e))}function Be(e,t,a){if(e.tag===3)Nf(e,e,a);else for(;t!==null;){if(t.tag===3){Nf(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ur===null||!Ur.has(r))){e=ba(a,e),a=Mh(2),r=Rr(t,a,2),r!==null&&(Th(a,r,t,e),Do(r,2),ja(r));break}}t=t.return}}function ru(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Ay;var n=new Set;r.set(t,n)}else n=r.get(t),n===void 0&&(n=new Set,r.set(t,n));n.has(a)||(Yp=!0,n.add(a),e=Oy.bind(null,e,t,a),t.then(e,e))}function Oy(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(ke&a)===a&&(rt===4||rt===3&&(ke&62914560)===ke&&300>aa()-zs?(Te&2)===0&&mn(e,0):Xp|=a,pn===ke&&(pn=0)),ja(e)}function gb(e,t){t===0&&(t=og()),e=fi(e,t),e!==null&&(Do(e,t),ja(e))}function Ly(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),gb(e,a)}function Hy(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,n=e.memoizedState;n!==null&&(a=n.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(D(314))}r!==null&&r.delete(t),gb(e,a)}function jy(e,t){return op(e,t)}var ps=null,Li=null,Zu=!1,ds=!1,iu=!1,Mr=0;function ja(e){e!==Li&&e.next===null&&(Li===null?ps=Li=e:Li=Li.next=e),ds=!0,Zu||(Zu=!0,Qy())}function Go(e,t){if(!iu&&ds){iu=!0;do for(var a=!1,r=ps;r!==null;){if(!t)if(e!==0){var n=r.pendingLanes;if(n===0)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-ia(42|e)+1)-1,i&=n&~(o&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,Sf(r,i))}else i=ke,i=ys(r,r===Ge?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(i&3)===0||Uo(r,i)||(a=!0,Sf(r,i));r=r.next}while(a);iu=!1}}function Gy(){hb()}function hb(){ds=Zu=!1;var e=0;Mr!==0&&Py()&&(e=Mr);for(var t=aa(),a=null,r=ps;r!==null;){var n=r.next,i=bb(r,t);i===0?(r.next=null,a===null?ps=n:a.next=n,n===null&&(Li=a)):(a=r,(e!==0||(i&3)!==0)&&(ds=!0)),r=n}gt!==0&&gt!==5||Go(e,!1),Mr!==0&&(Mr=0)}function bb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,n=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-ia(i),l=1<<o,u=n[o];u===-1?((l&a)===0||(l&r)!==0)&&(n[o]=f0(l,t)):u<=t&&(e.expiredLanes|=l),i&=~l}if(t=Ge,a=ke,a=ys(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(De===2||De===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Rc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Uo(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Rc(r),sp(a)){case 2:case 8:a=ig;break;case 32:a=Kl;break;case 268435456:a=ng;break;default:a=Kl}return r=vb.bind(null,e),a=op(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Rc(r),e.callbackPriority=2,e.callbackNode=null,2}function vb(e,t){if(gt!==0&&gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Us()&&e.callbackNode!==a)return null;var r=ke;return r=ys(e,e===Ge?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(rb(e,r,t),bb(e,aa()),e.callbackNode!=null&&e.callbackNode===a?vb.bind(null,e):null)}function Sf(e,t){if(Us())return null;rb(e,t,!0)}function Qy(){Iy(function(){(Te&6)!==0?op(rg,Gy):hb()})}function Vp(){if(Mr===0){var e=sn;e===0&&(e=ml,ml<<=1,(ml&261888)===0&&(ml=256)),Mr=e}return Mr}function Cf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zl(""+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 Yy(e,t,a,r,n){if(t==="submit"&&a&&a.stateNode===n){var i=Cf((n[$t]||null).action),o=r.submitter;o&&(t=(t=o[$t]||null)?Cf(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var l=new _s("action","action",null,r,n);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Mr!==0){var u=o?qf(n,o):new FormData(n);Ou(a,{pending:!0,data:u,method:n.method,action:i},null,u)}}else typeof i=="function"&&(l.preventDefault(),u=o?qf(n,o):new FormData(n),Ou(a,{pending:!0,data:u,method:n.method,action:i},i,u))},currentTarget:n}]})}}for(Sl=0;Sl<Su.length;Sl++)Cl=Su[Sl],Ef=Cl.toLowerCase(),Mf=Cl[0].toUpperCase()+Cl.slice(1),Ta(Ef,"on"+Mf);var Cl,Ef,Mf,Sl;Ta(Tg,"onAnimationEnd");Ta(zg,"onAnimationIteration");Ta(Ag,"onAnimationStart");Ta("dblclick","onDoubleClick");Ta("focusin","onFocus");Ta("focusout","onBlur");Ta(ly,"onTransitionRun");Ta(sy,"onTransitionStart");Ta(cy,"onTransitionCancel");Ta(Rg,"onTransitionEnd");on("onMouseEnter",["mouseout","mouseover"]);on("onMouseLeave",["mouseout","mouseover"]);on("onPointerEnter",["pointerout","pointerover"]);on("onPointerLeave",["pointerout","pointerover"]);pi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pi("onBeforeInput",["compositionend","keypress","textInput","paste"]);pi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qo="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(" "),Xy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qo));function wb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],n=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],u=l.instance,p=l.currentTarget;if(l=l.listener,u!==i&&n.isPropagationStopped())break e;i=l,n.currentTarget=p;try{i(n)}catch(f){Pl(f)}n.currentTarget=null,i=u}else for(o=0;o<r.length;o++){if(l=r[o],u=l.instance,p=l.currentTarget,l=l.listener,u!==i&&n.isPropagationStopped())break e;i=l,n.currentTarget=p;try{i(n)}catch(f){Pl(f)}n.currentTarget=null,i=u}}}}function _e(e,t){var a=t[bu];a===void 0&&(a=t[bu]=new Set);var r=e+"__bubble";a.has(r)||(yb(t,e,2,!1),a.add(r))}function nu(e,t,a){var r=0;t&&(r|=4),yb(a,e,r,t)}var ql="_reactListening"+Math.random().toString(36).slice(2);function Zp(e){if(!e[ql]){e[ql]=!0,pg.forEach(function(a){a!=="selectionchange"&&(Xy.has(a)||nu(a,!1,e),nu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ql]||(t[ql]=!0,nu("selectionchange",!1,t))}}function yb(e,t,a,r){switch(Rb(t)){case 2:var n=v1;break;case 8:n=w1;break;default:n=Fp}a=n.bind(null,t,a,e),n=void 0,!xu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),r?n!==void 0?e.addEventListener(t,a,{capture:!0,passive:n}):e.addEventListener(t,a,!0):n!==void 0?e.addEventListener(t,a,{passive:n}):e.addEventListener(t,a,!1)}function ou(e,t,a,r,n){var i=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===n)break;if(o===4)for(o=r.return;o!==null;){var u=o.tag;if((u===3||u===4)&&o.stateNode.containerInfo===n)return;o=o.return}for(;l!==null;){if(o=Gi(l),o===null)return;if(u=o.tag,u===5||u===6||u===26||u===27){r=i=o;continue e}l=l.parentNode}}r=r.return}wg(function(){var p=i,f=pp(a),v=[];e:{var d=Ug.get(e);if(d!==void 0){var h=_s,w=e;switch(e){case"keypress":if(Rl(a)===0)break e;case"keydown":case"keyup":h=H0;break;case"focusin":w="focus",h=Lc;break;case"focusout":w="blur",h=Lc;break;case"beforeblur":case"afterblur":h=Lc;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=Dm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=q0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Q0;break;case Tg:case zg:case Ag:h=T0;break;case Rg:h=X0;break;case"scroll":case"scrollend":h=S0;break;case"wheel":h=V0;break;case"copy":case"cut":case"paste":h=A0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Om;break;case"toggle":case"beforetoggle":h=K0}var E=(t&4)!==0,U=!E&&(e==="scroll"||e==="scrollend"),m=E?d!==null?d+"Capture":null:d;E=[];for(var c=p,b;c!==null;){var g=c;if(b=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||b===null||m===null||(g=wo(c,m),g!=null&&E.push(Eo(c,g,b))),U)break;c=c.return}0<E.length&&(d=new h(d,w,null,a,f),v.push({event:d,listeners:E}))}}if((t&7)===0){e:{if(d=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",d&&a!==_u&&(w=a.relatedTarget||a.fromElement)&&(Gi(w)||w[hn]))break e;if((h||d)&&(d=f.window===f?f:(d=f.ownerDocument)?d.defaultView||d.parentWindow:window,h?(w=a.relatedTarget||a.toElement,h=p,w=w?Gi(w):null,w!==null&&(U=Ao(w),E=w.tag,w!==U||E!==5&&E!==27&&E!==6)&&(w=null)):(h=null,w=p),h!==w)){if(E=Dm,g="onMouseLeave",m="onMouseEnter",c="mouse",(e==="pointerout"||e==="pointerover")&&(E=Om,g="onPointerLeave",m="onPointerEnter",c="pointer"),U=h==null?d:to(h),b=w==null?d:to(w),d=new E(g,c+"leave",h,a,f),d.target=U,d.relatedTarget=b,g=null,Gi(f)===p&&(E=new E(m,c+"enter",w,a,f),E.target=b,E.relatedTarget=U,g=E),U=g,h&&w)t:{for(E=$y,m=h,c=w,b=0,g=m;g;g=E(g))b++;g=0;for(var S=c;S;S=E(S))g++;for(;0<b-g;)m=E(m),b--;for(;0<g-b;)c=E(c),g--;for(;b--;){if(m===c||c!==null&&m===c.alternate){E=m;break t}m=E(m),c=E(c)}E=null}else E=null;h!==null&&Tf(v,d,h,E,!1),w!==null&&U!==null&&Tf(v,U,w,E,!0)}}e:{if(d=p?to(p):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var z=Gm;else if(jm(d))if(Sg)z=iy;else{z=ay;var T=ty}else h=d.nodeName,!h||h.toLowerCase()!=="input"||d.type!=="checkbox"&&d.type!=="radio"?p&&up(p.elementType)&&(z=Gm):z=ry;if(z&&(z=z(e,p))){Ng(v,z,a,f);break e}T&&T(e,d,p),e==="focusout"&&p&&d.type==="number"&&p.memoizedProps.value!=null&&yu(d,"number",d.value)}switch(T=p?to(p):window,e){case"focusin":(jm(T)||T.contentEditable==="true")&&(Xi=T,ku=p,oo=null);break;case"focusout":oo=ku=Xi=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,$m(v,a,f);break;case"selectionchange":if(oy)break;case"keydown":case"keyup":$m(v,a,f)}var R;if(fp)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else Yi?xg(e,a)&&(j="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(j="onCompositionStart");j&&(_g&&a.locale!=="ko"&&(Yi||j!=="onCompositionStart"?j==="onCompositionEnd"&&Yi&&(R=yg()):(Cr=f,dp="value"in Cr?Cr.value:Cr.textContent,Yi=!0)),T=ms(p,j),0<T.length&&(j=new Bm(j,e,null,a,f),v.push({event:j,listeners:T}),R?j.data=R:(R=kg(a),R!==null&&(j.data=R)))),(R=P0?F0(e,a):I0(e,a))&&(j=ms(p,"onBeforeInput"),0<j.length&&(T=new Bm("onBeforeInput","beforeinput",null,a,f),v.push({event:T,listeners:j}),T.data=R)),Yy(v,e,p,a,f)}wb(v,t)})}function Eo(e,t,a){return{instance:e,listener:t,currentTarget:a}}function ms(e,t){for(var a=t+"Capture",r=[];e!==null;){var n=e,i=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||i===null||(n=wo(e,a),n!=null&&r.unshift(Eo(e,n,i)),n=wo(e,t),n!=null&&r.push(Eo(e,n,i))),e.tag===3)return r;e=e.return}return[]}function $y(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tf(e,t,a,r,n){for(var i=t._reactName,o=[];a!==null&&a!==r;){var l=a,u=l.alternate,p=l.stateNode;if(l=l.tag,u!==null&&u===r)break;l!==5&&l!==26&&l!==27||p===null||(u=p,n?(p=wo(a,i),p!=null&&o.unshift(Eo(a,p,u))):n||(p=wo(a,i),p!=null&&o.push(Eo(a,p,u)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var Vy=/\r\n?/g,Zy=/\u0000|\uFFFD/g;function zf(e){return(typeof e=="string"?e:""+e).replace(Vy,`
9
- `).replace(Zy,"")}function _b(e,t){return t=zf(t),zf(e)===t}function He(e,t,a,r,n,i){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ln(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ln(e,""+r);break;case"className":hl(e,"class",r);break;case"tabIndex":hl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":hl(e,a,r);break;case"style":vg(e,r,i);break;case"data":if(t!=="object"){hl(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=zl(""+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 i=="function"&&(a==="formAction"?(t!=="input"&&He(e,t,"name",n.name,n,null),He(e,t,"formEncType",n.formEncType,n,null),He(e,t,"formMethod",n.formMethod,n,null),He(e,t,"formTarget",n.formTarget,n,null)):(He(e,t,"encType",n.encType,n,null),He(e,t,"method",n.method,n,null),He(e,t,"target",n.target,n,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=zl(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=er);break;case"onScroll":r!=null&&_e("scroll",e);break;case"onScrollEnd":r!=null&&_e("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(D(61));if(a=r.__html,a!=null){if(n.children!=null)throw Error(D(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=zl(""+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":_e("beforetoggle",e),_e("toggle",e),Tl(e,"popover",r);break;case"xlinkActuate":Va(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Va(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Va(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Va(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Va(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Va(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Va(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Va(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Va(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Tl(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=k0.get(a)||a,Tl(e,a,r))}}function Ku(e,t,a,r,n,i){switch(a){case"style":vg(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(D(61));if(a=r.__html,a!=null){if(n.children!=null)throw Error(D(60));e.innerHTML=a}}break;case"children":typeof r=="string"?ln(e,r):(typeof r=="number"||typeof r=="bigint")&&ln(e,""+r);break;case"onScroll":r!=null&&_e("scroll",e);break;case"onScrollEnd":r!=null&&_e("scrollend",e);break;case"onClick":r!=null&&(e.onclick=er);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(n=a.endsWith("Capture"),t=a.slice(2,n?a.length-7:void 0),i=e[$t]||null,i=i!=null?i[a]:null,typeof i=="function"&&e.removeEventListener(t,i,n),typeof r=="function")){typeof i!="function"&&i!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,n);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Tl(e,a,r)}}}function qt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",e),_e("load",e);var r=!1,n=!1,i;for(i in a)if(a.hasOwnProperty(i)){var o=a[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(D(137,t));default:He(e,t,i,o,a,null)}}n&&He(e,t,"srcSet",a.srcSet,a,null),r&&He(e,t,"src",a.src,a,null);return;case"input":_e("invalid",e);var l=i=o=n=null,u=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var f=a[r];if(f!=null)switch(r){case"name":n=f;break;case"type":o=f;break;case"checked":u=f;break;case"defaultChecked":p=f;break;case"value":i=f;break;case"defaultValue":l=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(D(137,t));break;default:He(e,t,r,f,a,null)}}gg(e,i,l,u,p,o,n,!1);return;case"select":_e("invalid",e),r=o=i=null;for(n in a)if(a.hasOwnProperty(n)&&(l=a[n],l!=null))switch(n){case"value":i=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:He(e,t,n,l,a,null)}t=i,a=o,e.multiple=!!r,t!=null?Ii(e,!!r,t,!1):a!=null&&Ii(e,!!r,a,!0);return;case"textarea":_e("invalid",e),i=n=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":n=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(D(91));break;default:He(e,t,o,l,a,null)}bg(e,r,n,i);return;case"option":for(u in a)a.hasOwnProperty(u)&&(r=a[u],r!=null)&&(u==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":He(e,t,u,r,a,null));return;case"dialog":_e("beforetoggle",e),_e("toggle",e),_e("cancel",e),_e("close",e);break;case"iframe":case"object":_e("load",e);break;case"video":case"audio":for(r=0;r<qo.length;r++)_e(qo[r],e);break;case"image":_e("error",e),_e("load",e);break;case"details":_e("toggle",e);break;case"embed":case"source":case"link":_e("error",e),_e("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(D(137,t));default:He(e,t,p,r,a,null)}return;default:if(up(t)){for(f in a)a.hasOwnProperty(f)&&(r=a[f],r!==void 0&&Ku(e,t,f,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&He(e,t,l,r,a,null))}function Ky(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 n=null,i=null,o=null,l=null,u=null,p=null,f=null;for(h in a){var v=a[h];if(a.hasOwnProperty(h)&&v!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":u=v;default:r.hasOwnProperty(h)||He(e,t,h,null,r,v)}}for(var d in r){var h=r[d];if(v=a[d],r.hasOwnProperty(d)&&(h!=null||v!=null))switch(d){case"type":i=h;break;case"name":n=h;break;case"checked":p=h;break;case"defaultChecked":f=h;break;case"value":o=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(D(137,t));break;default:h!==v&&He(e,t,d,h,r,v)}}wu(e,o,l,u,p,f,i,n);return;case"select":h=o=l=d=null;for(i in a)if(u=a[i],a.hasOwnProperty(i)&&u!=null)switch(i){case"value":break;case"multiple":h=u;default:r.hasOwnProperty(i)||He(e,t,i,null,r,u)}for(n in r)if(i=r[n],u=a[n],r.hasOwnProperty(n)&&(i!=null||u!=null))switch(n){case"value":d=i;break;case"defaultValue":l=i;break;case"multiple":o=i;default:i!==u&&He(e,t,n,i,r,u)}t=l,a=o,r=h,d!=null?Ii(e,!!a,d,!1):!!r!=!!a&&(t!=null?Ii(e,!!a,t,!0):Ii(e,!!a,a?[]:"",!1));return;case"textarea":h=d=null;for(l in a)if(n=a[l],a.hasOwnProperty(l)&&n!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:He(e,t,l,null,r,n)}for(o in r)if(n=r[o],i=a[o],r.hasOwnProperty(o)&&(n!=null||i!=null))switch(o){case"value":d=n;break;case"defaultValue":h=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(D(91));break;default:n!==i&&He(e,t,o,n,r,i)}hg(e,d,h);return;case"option":for(var w in a)d=a[w],a.hasOwnProperty(w)&&d!=null&&!r.hasOwnProperty(w)&&(w==="selected"?e.selected=!1:He(e,t,w,null,r,d));for(u in r)d=r[u],h=a[u],r.hasOwnProperty(u)&&d!==h&&(d!=null||h!=null)&&(u==="selected"?e.selected=d&&typeof d!="function"&&typeof d!="symbol":He(e,t,u,d,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 E in a)d=a[E],a.hasOwnProperty(E)&&d!=null&&!r.hasOwnProperty(E)&&He(e,t,E,null,r,d);for(p in r)if(d=r[p],h=a[p],r.hasOwnProperty(p)&&d!==h&&(d!=null||h!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(D(137,t));break;default:He(e,t,p,d,r,h)}return;default:if(up(t)){for(var U in a)d=a[U],a.hasOwnProperty(U)&&d!==void 0&&!r.hasOwnProperty(U)&&Ku(e,t,U,void 0,r,d);for(f in r)d=r[f],h=a[f],!r.hasOwnProperty(f)||d===h||d===void 0&&h===void 0||Ku(e,t,f,d,r,h);return}}for(var m in a)d=a[m],a.hasOwnProperty(m)&&d!=null&&!r.hasOwnProperty(m)&&He(e,t,m,null,r,d);for(v in r)d=r[v],h=a[v],!r.hasOwnProperty(v)||d===h||d==null&&h==null||He(e,t,v,d,r,h)}function Af(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jy(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var n=a[r],i=n.transferSize,o=n.initiatorType,l=n.duration;if(i&&l&&Af(o)){for(o=0,l=n.responseEnd,r+=1;r<a.length;r++){var u=a[r],p=u.startTime;if(p>l)break;var f=u.transferSize,v=u.initiatorType;f&&Af(v)&&(u=u.responseEnd,o+=f*(u<l?1:(l-p)/(u-p)))}if(--r,t+=8*(i+o)/(n.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 Ju=null,Pu=null;function fs(e){return e.nodeType===9?e:e.ownerDocument}function Rf(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 xb(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 Fu(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 lu=null;function Py(){var e=window.event;return e&&e.type==="popstate"?e===lu?!1:(lu=e,!0):(lu=null,!1)}var kb=typeof setTimeout=="function"?setTimeout:void 0,Fy=typeof clearTimeout=="function"?clearTimeout:void 0,Uf=typeof Promise=="function"?Promise:void 0,Iy=typeof queueMicrotask=="function"?queueMicrotask:typeof Uf<"u"?function(e){return Uf.resolve(null).then(e).catch(Wy)}:kb;function Wy(e){setTimeout(function(){throw e})}function Xr(e){return e==="head"}function Df(e,t){var a=t,r=0;do{var n=a.nextSibling;if(e.removeChild(a),n&&n.nodeType===8)if(a=n.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(n),gn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")bo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,bo(a);for(var i=a.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[Bo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=o}}else a==="body"&&bo(e.ownerDocument.body);a=n}while(a);gn(t)}function Bf(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 Iu(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":Iu(a),cp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function e1(e,t,a,r){for(;e.nodeType===1;){var n=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Bo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=ya(e.nextSibling),e===null)break}return null}function t1(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ya(e.nextSibling),e===null))return null;return e}function Nb(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ya(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$?"||e.data==="$~"}function ep(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function a1(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 ya(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 tp=null;function Of(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return ya(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Lf(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 Sb(e,t,a){switch(t=fs(a),e){case"html":if(e=t.documentElement,!e)throw Error(D(452));return e;case"head":if(e=t.head,!e)throw Error(D(453));return e;case"body":if(e=t.body,!e)throw Error(D(454));return e;default:throw Error(D(451))}}function bo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);cp(e)}var _a=new Map,Hf=new Set;function gs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ur=ze.d;ze.d={f:r1,r:i1,D:n1,C:o1,L:l1,m:s1,X:u1,S:c1,M:p1};function r1(){var e=ur.f(),t=As();return e||t}function i1(e){var t=bn(e);t!==null&&t.tag===5&&t.type==="form"?vh(t):ur.r(e)}var _n=typeof document>"u"?null:document;function Cb(e,t,a){var r=_n;if(r&&typeof t=="string"&&t){var n=ha(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof a=="string"&&(n+='[crossorigin="'+a+'"]'),Hf.has(n)||(Hf.add(n),e={rel:e,crossOrigin:a,href:t},r.querySelector(n)===null&&(t=r.createElement("link"),qt(t,"link",e),yt(t),r.head.appendChild(t)))}}function n1(e){ur.D(e),Cb("dns-prefetch",e,null)}function o1(e,t){ur.C(e,t),Cb("preconnect",e,t)}function l1(e,t,a){ur.L(e,t,a);var r=_n;if(r&&e&&t){var n='link[rel="preload"][as="'+ha(t)+'"]';t==="image"&&a&&a.imageSrcSet?(n+='[imagesrcset="'+ha(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(n+='[imagesizes="'+ha(a.imageSizes)+'"]')):n+='[href="'+ha(e)+'"]';var i=n;switch(t){case"style":i=fn(e);break;case"script":i=xn(e)}_a.has(i)||(e=Je({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),_a.set(i,e),r.querySelector(n)!==null||t==="style"&&r.querySelector(Qo(i))||t==="script"&&r.querySelector(Yo(i))||(t=r.createElement("link"),qt(t,"link",e),yt(t),r.head.appendChild(t)))}}function s1(e,t){ur.m(e,t);var a=_n;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+ha(r)+'"][href="'+ha(e)+'"]',i=n;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=xn(e)}if(!_a.has(i)&&(e=Je({rel:"modulepreload",href:e},t),_a.set(i,e),a.querySelector(n)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yo(i)))return}r=a.createElement("link"),qt(r,"link",e),yt(r),a.head.appendChild(r)}}}function c1(e,t,a){ur.S(e,t,a);var r=_n;if(r&&e){var n=Fi(r).hoistableStyles,i=fn(e);t=t||"default";var o=n.get(i);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Qo(i)))l.loading=5;else{e=Je({rel:"stylesheet",href:e,"data-precedence":t},a),(a=_a.get(i))&&Kp(e,a);var u=o=r.createElement("link");yt(u),qt(u,"link",e),u._p=new Promise(function(p,f){u.onload=p,u.onerror=f}),u.addEventListener("load",function(){l.loading|=1}),u.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Gl(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},n.set(i,o)}}}function u1(e,t){ur.X(e,t);var a=_n;if(a&&e){var r=Fi(a).hoistableScripts,n=xn(e),i=r.get(n);i||(i=a.querySelector(Yo(n)),i||(e=Je({src:e,async:!0},t),(t=_a.get(n))&&Jp(e,t),i=a.createElement("script"),yt(i),qt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(n,i))}}function p1(e,t){ur.M(e,t);var a=_n;if(a&&e){var r=Fi(a).hoistableScripts,n=xn(e),i=r.get(n);i||(i=a.querySelector(Yo(n)),i||(e=Je({src:e,async:!0,type:"module"},t),(t=_a.get(n))&&Jp(e,t),i=a.createElement("script"),yt(i),qt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(n,i))}}function jf(e,t,a,r){var n=(n=Tr.current)?gs(n):null;if(!n)throw Error(D(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=fn(a.href),a=Fi(n).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=fn(a.href);var i=Fi(n).hoistableStyles,o=i.get(e);if(o||(n=n.ownerDocument||n,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=n.querySelector(Qo(e)))&&!i._p&&(o.instance=i,o.state.loading=5),_a.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},_a.set(e,a),i||d1(n,e,a,o.state))),t&&r===null)throw Error(D(528,""));return o}if(t&&r!==null)throw Error(D(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=xn(a),a=Fi(n).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(D(444,e))}}function fn(e){return'href="'+ha(e)+'"'}function Qo(e){return'link[rel="stylesheet"]['+e+"]"}function qb(e){return Je({},e,{"data-precedence":e.precedence,precedence:null})}function d1(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}),qt(t,"link",a),yt(t),e.head.appendChild(t))}function xn(e){return'[src="'+ha(e)+'"]'}function Yo(e){return"script[async]"+e}function Gf(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ha(a.href)+'"]');if(r)return t.instance=r,yt(r),r;var n=Je({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),yt(r),qt(r,"style",n),Gl(r,a.precedence,e),t.instance=r;case"stylesheet":n=fn(a.href);var i=e.querySelector(Qo(n));if(i)return t.state.loading|=4,t.instance=i,yt(i),i;r=qb(a),(n=_a.get(n))&&Kp(r,n),i=(e.ownerDocument||e).createElement("link"),yt(i);var o=i;return o._p=new Promise(function(l,u){o.onload=l,o.onerror=u}),qt(i,"link",r),t.state.loading|=4,Gl(i,a.precedence,e),t.instance=i;case"script":return i=xn(a.src),(n=e.querySelector(Yo(i)))?(t.instance=n,yt(n),n):(r=a,(n=_a.get(i))&&(r=Je({},a),Jp(r,n)),e=e.ownerDocument||e,n=e.createElement("script"),yt(n),qt(n,"link",r),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(D(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Gl(r,a.precedence,e));return t.instance}function Gl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=r.length?r[r.length-1]:null,i=n,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)i=l;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Kp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Jp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ql=null;function Qf(e,t,a){if(Ql===null){var r=new Map,n=Ql=new Map;n.set(a,r)}else n=Ql,r=n.get(a),r||(r=new Map,n.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),n=0;n<a.length;n++){var i=a[n];if(!(i[Bo]||i[Nt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(i):r.set(o,[i])}}return r}function Yf(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function m1(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 Eb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function f1(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 n=fn(r.href),i=t.querySelector(Qo(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=hs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,yt(i);return}i=t.ownerDocument||t,r=qb(r),(n=_a.get(n))&&Kp(r,n),i=i.createElement("link"),yt(i);var o=i;o._p=new Promise(function(l,u){o.onload=l,o.onerror=u}),qt(i,"link",r),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=hs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var su=0;function g1(e,t){return e.stylesheets&&e.count===0&&Yl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Yl(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&su===0&&(su=62500*Jy());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yl(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>su?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(n)}}:null}function hs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bs=null;function Yl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bs=new Map,t.forEach(h1,e),bs=null,hs.call(e))}function h1(e,t){if(!(t.state.loading&4)){var a=bs.get(e);if(a)var r=a.get(null);else{a=new Map,bs.set(e,a);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var o=n[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}n=t.instance,o=n.getAttribute("data-precedence"),i=a.get(o)||r,i===r&&a.set(null,n),a.set(o,n),this.count++,r=hs.bind(this),n.addEventListener("load",r),n.addEventListener("error",r),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var Mo={$$typeof:Wa,Provider:null,Consumer:null,_currentValue:ti,_currentValue2:ti,_threadCount:0};function b1(e,t,a,r,n,i,o,l,u){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=Uc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uc(0),this.hiddenUpdates=Uc(null),this.identifierPrefix=r,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function Mb(e,t,a,r,n,i,o,l,u,p,f,v){return e=new b1(e,t,a,o,u,p,f,v,l),t=1,i===!0&&(t|=24),i=ea(3,null,null,t),e.current=i,i.stateNode=e,t=_p(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:a,cache:t},Np(i),e}function Tb(e){return e?(e=Zi,e):Zi}function zb(e,t,a,r,n,i){n=Tb(n),r.context===null?r.context=n:r.pendingContext=n,r=Ar(t),r.payload={element:a},i=i===void 0?null:i,i!==null&&(r.callback=i),a=Rr(e,r,t),a!==null&&(Xt(a,e,t),so(a,e,t))}function Xf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Pp(e,t){Xf(e,t),(e=e.alternate)&&Xf(e,t)}function Ab(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Xt(t,e,67108864),Pp(e,67108864)}}function $f(e){if(e.tag===13||e.tag===31){var t=na();t=lp(t);var a=fi(e,t);a!==null&&Xt(a,e,t),Pp(e,t)}}var vs=!0;function v1(e,t,a,r){var n=me.T;me.T=null;var i=ze.p;try{ze.p=2,Fp(e,t,a,r)}finally{ze.p=i,me.T=n}}function w1(e,t,a,r){var n=me.T;me.T=null;var i=ze.p;try{ze.p=8,Fp(e,t,a,r)}finally{ze.p=i,me.T=n}}function Fp(e,t,a,r){if(vs){var n=ap(r);if(n===null)ou(e,t,r,ws,a),Vf(e,r);else if(_1(n,e,t,a,r))r.stopPropagation();else if(Vf(e,r),t&4&&-1<y1.indexOf(e)){for(;n!==null;){var i=bn(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Ir(i.pendingLanes);if(o!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var u=1<<31-ia(o);l.entanglements[1]|=u,o&=~u}ja(i),(Te&6)===0&&(ss=aa()+500,Go(0,!1))}}break;case 31:case 13:l=fi(i,2),l!==null&&Xt(l,i,2),As(),Pp(i,2)}if(i=ap(r),i===null&&ou(e,t,r,ws,a),i===n)break;n=i}n!==null&&r.stopPropagation()}else ou(e,t,r,null,a)}}function ap(e){return e=pp(e),Ip(e)}var ws=null;function Ip(e){if(ws=null,e=Gi(e),e!==null){var t=Ao(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=If(t),e!==null)return e;e=null}else if(a===31){if(e=Wf(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 ws=e,null}function Rb(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(l0()){case rg:return 2;case ig:return 8;case Kl:case s0:return 32;case ng:return 268435456;default:return 32}default:return 32}}var rp=!1,Br=null,Or=null,Lr=null,To=new Map,zo=new Map,Nr=[],y1="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 Vf(e,t){switch(e){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Lr=null;break;case"pointerover":case"pointerout":To.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(t.pointerId)}}function Fn(e,t,a,r,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:i,targetContainers:[n]},t!==null&&(t=bn(t),t!==null&&Ab(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function _1(e,t,a,r,n){switch(t){case"focusin":return Br=Fn(Br,e,t,a,r,n),!0;case"dragenter":return Or=Fn(Or,e,t,a,r,n),!0;case"mouseover":return Lr=Fn(Lr,e,t,a,r,n),!0;case"pointerover":var i=n.pointerId;return To.set(i,Fn(To.get(i)||null,e,t,a,r,n)),!0;case"gotpointercapture":return i=n.pointerId,zo.set(i,Fn(zo.get(i)||null,e,t,a,r,n)),!0}return!1}function Ub(e){var t=Gi(e.target);if(t!==null){var a=Ao(t);if(a!==null){if(t=a.tag,t===13){if(t=If(a),t!==null){e.blockedOn=t,Em(e.priority,function(){$f(a)});return}}else if(t===31){if(t=Wf(a),t!==null){e.blockedOn=t,Em(e.priority,function(){$f(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 Xl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ap(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);_u=r,a.target.dispatchEvent(r),_u=null}else return t=bn(a),t!==null&&Ab(t),e.blockedOn=a,!1;t.shift()}return!0}function Zf(e,t,a){Xl(e)&&a.delete(t)}function x1(){rp=!1,Br!==null&&Xl(Br)&&(Br=null),Or!==null&&Xl(Or)&&(Or=null),Lr!==null&&Xl(Lr)&&(Lr=null),To.forEach(Zf),zo.forEach(Zf)}function El(e,t){e.blockedOn===t&&(e.blockedOn=null,rp||(rp=!0,ht.unstable_scheduleCallback(ht.unstable_NormalPriority,x1)))}var Ml=null;function Kf(e){Ml!==e&&(Ml=e,ht.unstable_scheduleCallback(ht.unstable_NormalPriority,function(){Ml===e&&(Ml=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],n=e[t+2];if(typeof r!="function"){if(Ip(r||a)===null)continue;break}var i=bn(a);i!==null&&(e.splice(t,3),t-=3,Ou(i,{pending:!0,data:n,method:a.method,action:r},r,n))}}))}function gn(e){function t(u){return El(u,e)}Br!==null&&El(Br,e),Or!==null&&El(Or,e),Lr!==null&&El(Lr,e),To.forEach(t),zo.forEach(t);for(var a=0;a<Nr.length;a++){var r=Nr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Nr.length&&(a=Nr[0],a.blockedOn===null);)Ub(a),a.blockedOn===null&&Nr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var n=a[r],i=a[r+1],o=n[$t]||null;if(typeof i=="function")o||Kf(a);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(n=i,o=i[$t]||null)l=o.formAction;else if(Ip(n)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),Kf(a)}}}function Db(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return n=o})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,n=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),n!==null&&(n(),n=null)}}}function Wp(e){this._internalRoot=e}Ds.prototype.render=Wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(D(409));var a=t.current,r=na();zb(a,r,e,t,null,null)};Ds.prototype.unmount=Wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zb(e.current,2,null,e,null,null),As(),t[hn]=null}};function Ds(e){this._internalRoot=e}Ds.prototype.unstable_scheduleHydration=function(e){if(e){var t=ug();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Nr.length&&t!==0&&t<Nr[a].priority;a++);Nr.splice(a,0,e),a===0&&Ub(e)}};var Jf=Pf.version;if(Jf!=="19.2.3")throw Error(D(527,Jf,"19.2.3"));ze.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(D(188)):(e=Object.keys(e).join(","),Error(D(268,e)));return e=e0(t),e=e!==null?eg(e):null,e=e===null?null:e.stateNode,e};var k1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(In=__REACT_DEVTOOLS_GLOBAL_HOOK__,!In.isDisabled&&In.supportsFiber))try{Ro=In.inject(k1),ra=In}catch{}var In;Bs.createRoot=function(e,t){if(!Ff(e))throw Error(D(299));var a=!1,r="",n=Ch,i=qh,o=Eh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Mb(e,1,!1,null,null,a,r,null,n,i,o,Db),e[hn]=t.current,Zp(e),new Wp(t)};Bs.hydrateRoot=function(e,t,a){if(!Ff(e))throw Error(D(299));var r=!1,n="",i=Ch,o=qh,l=Eh,u=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(n=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(u=a.formState)),t=Mb(e,1,!0,t,a??null,r,n,u,i,o,l,Db),t.context=Tb(null),a=t.current,r=na(),r=lp(r),n=Ar(r),n.callback=null,Rr(a,n,r),a=r,t.current.lanes=a,Do(t,a),ja(t),e[hn]=t.current,Zp(e),new Ds(t)};Bs.version="19.2.3"});var Hb=Ra((I_,Lb)=>{"use strict";function Ob(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ob)}catch(e){console.error(e)}}Ob(),Lb.exports=Bb()});var Tv=Ra(Hs=>{"use strict";var M1=Symbol.for("react.transitional.element"),T1=Symbol.for("react.fragment");function Mv(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 n in t)n!=="key"&&(a[n]=t[n])}else a=t;return t=a.ref,{$$typeof:M1,type:e,key:r,ref:t!==void 0?t:null,props:a}}Hs.Fragment=T1;Hs.jsx=Mv;Hs.jsxs=Mv});var re=Ra((kk,zv)=>{"use strict";zv.exports=Tv()});var xw=Y(Hb());var jb=`/* Every rule is scoped to .app-wrapper, the root of each widget, so nothing here styles
8
+ `+r.stack}}var hu=Object.prototype.hasOwnProperty,op=bt.unstable_scheduleCallback,Rc=bt.unstable_cancelCallback,o0=bt.unstable_shouldYield,l0=bt.unstable_requestPaint,aa=bt.unstable_now,s0=bt.unstable_getCurrentPriorityLevel,rg=bt.unstable_ImmediatePriority,ig=bt.unstable_UserBlockingPriority,Jl=bt.unstable_NormalPriority,c0=bt.unstable_LowPriority,ng=bt.unstable_IdlePriority,u0=bt.log,p0=bt.unstable_setDisableYieldValue,Uo=null,ra=null;function Sr(e){if(typeof u0=="function"&&p0(e),ra&&typeof ra.setStrictMode=="function")try{ra.setStrictMode(Uo,e)}catch{}}var ia=Math.clz32?Math.clz32:f0,d0=Math.log,m0=Math.LN2;function f0(e){return e>>>=0,e===0?32:31-(d0(e)/m0|0)|0}var fl=256,gl=262144,hl=4194304;function Wr(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 _s(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~i,r!==0?n=Wr(r):(o&=l,o!==0?n=Wr(o):a||(a=l&~e,a!==0&&(n=Wr(a))))):(l=r&~i,l!==0?n=Wr(l):o!==0?n=Wr(o):a||(a=r&~e,a!==0&&(n=Wr(a)))),n===0?0:t!==0&&t!==n&&(t&i)===0&&(i=n&-n,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:n}function Do(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function g0(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 og(){var e=hl;return hl<<=1,(hl&62914560)===0&&(hl=4194304),e}function Uc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Bo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function h0(e,t,a,r,n,i){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,u=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var f=31-ia(a),b=1<<f;l[f]=0,u[f]=-1;var m=p[f];if(m!==null)for(p[f]=null,f=0;f<m.length;f++){var h=m[f];h!==null&&(h.lane&=-536870913)}a&=~b}r!==0&&lg(e,r,0),i!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function lg(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ia(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function sg(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-ia(a),n=1<<r;n&t|e[r]&t&&(e[r]|=t),a&=~n}}function cg(e,t){var a=t&-t;return a=(a&42)!==0?1:lp(a),(a&(e.suspendedLanes|t))!==0?0:a}function lp(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 sp(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ug(){var e=Re.p;return e!==0?e:(e=window.event,e===void 0?32:Rb(e.type))}function Em(e,t){var a=Re.p;try{return Re.p=e,t()}finally{Re.p=a}}var Yr=Math.random().toString(36).slice(2),Nt="__reactFiber$"+Yr,$t="__reactProps$"+Yr,bn="__reactContainer$"+Yr,bu="__reactEvents$"+Yr,b0="__reactListeners$"+Yr,v0="__reactHandles$"+Yr,Mm="__reactResources$"+Yr,Oo="__reactMarker$"+Yr;function cp(e){delete e[Nt],delete e[$t],delete e[bu],delete e[b0],delete e[v0]}function Qi(e){var t=e[Nt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[Nt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Lf(e);e!==null;){if(a=e[Nt])return a;e=Lf(e)}return t}e=a,a=e.parentNode}return null}function vn(e){if(e=e[Nt]||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 ao(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(D(33))}function Ii(e){var t=e[Mm];return t||(t=e[Mm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[Oo]=!0}var pg=new Set,dg={};function di(e,t){ln(e,t),ln(e+"Capture",t)}function ln(e,t){for(dg[e]=t,e=0;e<t.length;e++)pg.add(t[e])}var w0=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]*$"),Tm={},zm={};function y0(e){return hu.call(zm,e)?!0:hu.call(Tm,e)?!1:w0.test(e)?zm[e]=!0:(Tm[e]=!0,!1)}function zl(e,t,a){if(y0(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 bl(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 Va(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 ma(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _0(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 n=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){a=""+o,i.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 vu(e){if(!e._valueTracker){var t=mg(e)?"checked":"value";e._valueTracker=_0(e,t,""+e[t])}}function fg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=mg(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Pl(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 x0=/[\n"\\]/g;function ha(e){return e.replace(x0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wu(e,t,a,r,n,i,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=""+ma(t)):e.value!==""+ma(t)&&(e.value=""+ma(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?yu(e,o,ma(t)):a!=null?yu(e,o,ma(a)):r!=null&&e.removeAttribute("value"),n==null&&i!=null&&(e.defaultChecked=!!i),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+ma(l):e.removeAttribute("name")}function gg(e,t,a,r,n,i,o,l){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){vu(e);return}a=a!=null?""+ma(a):"",t=t!=null?""+ma(t):a,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??n,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),vu(e)}function yu(e,t,a){t==="number"&&Pl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Wi(e,t,a,r){if(e=e.options,t){t={};for(var n=0;n<a.length;n++)t["$"+a[n]]=!0;for(a=0;a<e.length;a++)n=t.hasOwnProperty("$"+e[a].value),e[a].selected!==n&&(e[a].selected=n),n&&r&&(e[a].defaultSelected=!0)}else{for(a=""+ma(a),t=null,n=0;n<e.length;n++){if(e[n].value===a){e[n].selected=!0,r&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function hg(e,t,a){if(t!=null&&(t=""+ma(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+ma(a):""}function bg(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(D(92));if(to(r)){if(1<r.length)throw Error(D(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=ma(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),vu(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 k0=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 Am(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||k0.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function vg(e,t,a){if(t!=null&&typeof t!="object")throw Error(D(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 n in t)r=t[n],t.hasOwnProperty(n)&&a[n]!==r&&Am(e,n,r)}else for(var i in t)t.hasOwnProperty(i)&&Am(e,i,t[i])}function up(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 N0=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"]]),S0=/^[\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 Al(e){return S0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function er(){}var _u=null;function pp(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 Rm(e){var t=vn(e);if(t&&(e=t.stateNode)){var a=e[$t]||null;e:switch(e=t.stateNode,t.type){case"input":if(wu(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="'+ha(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var n=r[$t]||null;if(!n)throw Error(D(90));wu(r,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&fg(r)}break e;case"textarea":hg(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Wi(e,!!a.multiple,t,!1)}}}var Dc=!1;function wg(e,t,a){if(Dc)return e(t,a);Dc=!0;try{var r=e(t);return r}finally{if(Dc=!1,(Yi!==null||en!==null)&&(Rs(),Yi&&(t=Yi,e=en,en=Yi=null,Rm(t),e)))for(t=0;t<e.length;t++)Rm(e[t])}}function yo(e,t){var a=e.stateNode;if(a===null)return null;var r=a[$t]||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(D(231,t,typeof a));return a}var nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xu=!1;if(nr)try{Di={},Object.defineProperty(Di,"passive",{get:function(){xu=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{xu=!1}var Di,Cr=null,dp=null,Rl=null;function yg(){if(Rl)return Rl;var e,t=dp,a=t.length,r,n="value"in Cr?Cr.value:Cr.textContent,i=n.length;for(e=0;e<a&&t[e]===n[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===n[i-r];r++);return Rl=n.slice(e,1<r?1-r:void 0)}function Ul(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 vl(){return!0}function Um(){return!1}function Vt(e){function t(a,r,n,i,o){this._reactName=a,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?vl:Um,this.isPropagationStopped=Um,this}return Je(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=vl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=vl)},persist:function(){},isPersistent:vl}),t}var mi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xs=Vt(mi),Lo=Je({},mi,{view:0,detail:0}),C0=Vt(Lo),Bc,Oc,Kn,ks=Je({},Lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mp,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!==Kn&&(Kn&&e.type==="mousemove"?(Bc=e.screenX-Kn.screenX,Oc=e.screenY-Kn.screenY):Oc=Bc=0,Kn=e),Bc)},movementY:function(e){return"movementY"in e?e.movementY:Oc}}),Dm=Vt(ks),q0=Je({},ks,{dataTransfer:0}),E0=Vt(q0),M0=Je({},Lo,{relatedTarget:0}),Lc=Vt(M0),T0=Je({},mi,{animationName:0,elapsedTime:0,pseudoElement:0}),z0=Vt(T0),A0=Je({},mi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),R0=Vt(A0),U0=Je({},mi,{data:0}),Bm=Vt(U0),D0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},B0={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"},O0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function L0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=O0[e])?!!t[e]:!1}function mp(){return L0}var H0=Je({},Lo,{key:function(e){if(e.key){var t=D0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ul(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?B0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mp,charCode:function(e){return e.type==="keypress"?Ul(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ul(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),j0=Vt(H0),G0=Je({},ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Om=Vt(G0),Q0=Je({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mp}),Y0=Vt(Q0),X0=Je({},mi,{propertyName:0,elapsedTime:0,pseudoElement:0}),$0=Vt(X0),V0=Je({},ks,{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}),Z0=Vt(V0),K0=Je({},mi,{newState:0,oldState:0}),J0=Vt(K0),P0=[9,13,27,32],fp=nr&&"CompositionEvent"in window,no=null;nr&&"documentMode"in document&&(no=document.documentMode);var F0=nr&&"TextEvent"in window&&!no,_g=nr&&(!fp||no&&8<no&&11>=no),Lm=" ",Hm=!1;function xg(e,t){switch(e){case"keyup":return P0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xi=!1;function I0(e,t){switch(e){case"compositionend":return kg(t);case"keypress":return t.which!==32?null:(Hm=!0,Lm);case"textInput":return e=t.data,e===Lm&&Hm?null:e;default:return null}}function W0(e,t){if(Xi)return e==="compositionend"||!fp&&xg(e,t)?(e=yg(),Rl=dp=Cr=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 _g&&t.locale!=="ko"?null:t.data;default:return null}}var ey={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 jm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ey[e.type]:t==="textarea"}function Ng(e,t,a,r){Yi?en?en.push(r):en=[r]:Yi=r,t=fs(t,"onChange"),0<t.length&&(a=new xs("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var oo=null,_o=null;function ty(e){wb(e,0)}function Ns(e){var t=ao(e);if(fg(t))return e}function Gm(e,t){if(e==="change")return t}var Sg=!1;nr&&(nr?(yl="oninput"in document,yl||(Hc=document.createElement("div"),Hc.setAttribute("oninput","return;"),yl=typeof Hc.oninput=="function"),wl=yl):wl=!1,Sg=wl&&(!document.documentMode||9<document.documentMode));var wl,yl,Hc;function Qm(){oo&&(oo.detachEvent("onpropertychange",Cg),_o=oo=null)}function Cg(e){if(e.propertyName==="value"&&Ns(_o)){var t=[];Ng(t,_o,e,pp(e)),wg(ty,t)}}function ay(e,t,a){e==="focusin"?(Qm(),oo=t,_o=a,oo.attachEvent("onpropertychange",Cg)):e==="focusout"&&Qm()}function ry(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ns(_o)}function iy(e,t){if(e==="click")return Ns(t)}function ny(e,t){if(e==="input"||e==="change")return Ns(t)}function oy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oa=typeof Object.is=="function"?Object.is:oy;function xo(e,t){if(oa(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 n=a[r];if(!hu.call(t,n)||!oa(e[n],t[n]))return!1}return!0}function Ym(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xm(e,t){var a=Ym(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=Ym(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 Eg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pl(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=Pl(e.document)}return t}function gp(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 ly=nr&&"documentMode"in document&&11>=document.documentMode,$i=null,ku=null,lo=null,Nu=!1;function $m(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nu||$i==null||$i!==Pl(r)||(r=$i,"selectionStart"in r&&gp(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}),lo&&xo(lo,r)||(lo=r,r=fs(ku,"onSelect"),0<r.length&&(t=new xs("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=$i)))}function Fr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Vi={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")},jc={},Mg={};nr&&(Mg=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function fi(e){if(jc[e])return jc[e];if(!Vi[e])return e;var t=Vi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Mg)return jc[e]=t[a];return e}var Tg=fi("animationend"),zg=fi("animationiteration"),Ag=fi("animationstart"),sy=fi("transitionrun"),cy=fi("transitionstart"),uy=fi("transitioncancel"),Rg=fi("transitionend"),Ug=new Map,Su="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(" ");Su.push("scrollEnd");function Ta(e,t){Ug.set(e,t),di(t,[e])}var Fl=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)},da=[],Zi=0,hp=0;function Ss(){for(var e=Zi,t=hp=Zi=0;t<e;){var a=da[t];da[t++]=null;var r=da[t];da[t++]=null;var n=da[t];da[t++]=null;var i=da[t];if(da[t++]=null,r!==null&&n!==null){var o=r.pending;o===null?n.next=n:(n.next=o.next,o.next=n),r.pending=n}i!==0&&Dg(a,n,i)}}function Cs(e,t,a,r){da[Zi++]=e,da[Zi++]=t,da[Zi++]=a,da[Zi++]=r,hp|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function bp(e,t,a,r){return Cs(e,t,a,r),Il(e)}function gi(e,t){return Cs(e,null,null,t),Il(e)}function Dg(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var n=!1,i=e.return;i!==null;)i.childLanes|=a,r=i.alternate,r!==null&&(r.childLanes|=a),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(n=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,n&&t!==null&&(n=31-ia(a),e=i.hiddenUpdates,r=e[n],r===null?e[n]=[t]:r.push(t),t.lane=a|536870912),i):null}function Il(e){if(50<bo)throw bo=0,Vu=null,Error(D(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ki={};function py(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 ea(e,t,a,r){return new py(e,t,a,r)}function vp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ar(e,t){var a=e.alternate;return a===null?(a=ea(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 Bg(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 Dl(e,t,a,r,n,i){var o=0;if(r=e,typeof e=="function")vp(e)&&(o=1);else if(typeof e=="string")o=f1(e,a,La.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case du:return e=ea(31,a,t,n),e.elementType=du,e.lanes=i,e;case ji:return ri(a.children,n,i,t);case tg:o=8,n|=24;break;case cu:return e=ea(12,a,t,n|2),e.elementType=cu,e.lanes=i,e;case uu:return e=ea(13,a,t,n),e.elementType=uu,e.lanes=i,e;case pu:return e=ea(19,a,t,n),e.elementType=pu,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wa:o=10;break e;case ag:o=9;break e;case ip:o=11;break e;case np:o=14;break e;case wr:o=16,r=null;break e}o=29,a=Error(D(130,e===null?"null":typeof e,"")),r=null}return t=ea(o,a,t,n),t.elementType=e,t.type=r,t.lanes=i,t}function ri(e,t,a,r){return e=ea(7,e,r,t),e.lanes=a,e}function Gc(e,t,a){return e=ea(6,e,null,t),e.lanes=a,e}function Og(e){var t=ea(18,null,null,0);return t.stateNode=e,t}function Qc(e,t,a){return t=ea(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vm=new WeakMap;function ba(e,t){if(typeof e=="object"&&e!==null){var a=Vm.get(e);return a!==void 0?a:(t={value:e,source:t,stack:qm(t)},Vm.set(e,t),t)}return{value:e,source:t,stack:qm(t)}}var Ji=[],Pi=0,Wl=null,ko=0,fa=[],ga=0,Hr=null,Da=1,Ba="";function Fa(e,t){Ji[Pi++]=ko,Ji[Pi++]=Wl,Wl=e,ko=t}function Lg(e,t,a){fa[ga++]=Da,fa[ga++]=Ba,fa[ga++]=Hr,Hr=e;var r=Da;e=Ba;var n=32-ia(r)-1;r&=~(1<<n),a+=1;var i=32-ia(t)+n;if(30<i){var o=n-n%5;i=(r&(1<<o)-1).toString(32),r>>=o,n-=o,Da=1<<32-ia(t)+n|a<<n|r,Ba=i+e}else Da=1<<i|a<<n|r,Ba=e}function wp(e){e.return!==null&&(Fa(e,1),Lg(e,1,0))}function yp(e){for(;e===Wl;)Wl=Ji[--Pi],Ji[Pi]=null,ko=Ji[--Pi],Ji[Pi]=null;for(;e===Hr;)Hr=fa[--ga],fa[ga]=null,Ba=fa[--ga],fa[ga]=null,Da=fa[--ga],fa[ga]=null}function Hg(e,t){fa[ga++]=Da,fa[ga++]=Ba,fa[ga++]=Hr,Da=t.id,Ba=t.overflow,Hr=e}var St=null,Ke=null,Se=!1,zr=null,va=!1,Cu=Error(D(519));function jr(e){var t=Error(D(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw No(ba(t,e)),Cu}function Zm(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Nt]=e,t[$t]=r,a){case"dialog":xe("cancel",t),xe("close",t);break;case"iframe":case"object":case"embed":xe("load",t);break;case"video":case"audio":for(a=0;a<Eo.length;a++)xe(Eo[a],t);break;case"source":xe("error",t);break;case"img":case"image":case"link":xe("error",t),xe("load",t);break;case"details":xe("toggle",t);break;case"input":xe("invalid",t),gg(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":xe("invalid",t);break;case"textarea":xe("invalid",t),bg(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||_b(t.textContent,a)?(r.popover!=null&&(xe("beforetoggle",t),xe("toggle",t)),r.onScroll!=null&&xe("scroll",t),r.onScrollEnd!=null&&xe("scrollend",t),r.onClick!=null&&(t.onclick=er),t=!0):t=!1,t||jr(e,!0)}function Km(e){for(St=e.return;St;)switch(St.tag){case 5:case 31:case 13:va=!1;return;case 27:case 3:va=!0;return;default:St=St.return}}function Bi(e){if(e!==St)return!1;if(!Se)return Km(e),Se=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Fu(e.type,e.memoizedProps)),a=!a),a&&Ke&&jr(e),Km(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(317));Ke=Of(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(317));Ke=Of(e)}else t===27?(t=Ke,Xr(e.type)?(e=tp,tp=null,Ke=e):Ke=t):Ke=St?ya(e.stateNode.nextSibling):null;return!0}function li(){Ke=St=null,Se=!1}function Yc(){var e=zr;return e!==null&&(Yt===null?Yt=e:Yt.push.apply(Yt,e),zr=null),e}function No(e){zr===null?zr=[e]:zr.push(e)}var qu=Ha(null),hi=null,tr=null;function _r(e,t,a){Xe(qu,t._currentValue),t._currentValue=a}function rr(e){e._currentValue=qu.current,_t(qu)}function Eu(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 Mu(e,t,a,r){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var i=n.dependencies;if(i!==null){var o=n.child;i=i.firstContext;e:for(;i!==null;){var l=i;i=n;for(var u=0;u<t.length;u++)if(l.context===t[u]){i.lanes|=a,l=i.alternate,l!==null&&(l.lanes|=a),Eu(i.return,a,e),r||(o=null);break e}i=l.next}}else if(n.tag===18){if(o=n.return,o===null)throw Error(D(341));o.lanes|=a,i=o.alternate,i!==null&&(i.lanes|=a),Eu(o,a,e),o=null}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===e){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}}function wn(e,t,a,r){e=null;for(var n=t,i=!1;n!==null;){if(!i){if((n.flags&524288)!==0)i=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var o=n.alternate;if(o===null)throw Error(D(387));if(o=o.memoizedProps,o!==null){var l=n.type;oa(n.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(n===Vl.current){if(o=n.alternate,o===null)throw Error(D(387));o.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(To):e=[To])}n=n.return}e!==null&&Mu(t,e,a,r),t.flags|=262144}function es(e){for(e=e.firstContext;e!==null;){if(!oa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function si(e){hi=e,tr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return jg(hi,e)}function _l(e,t){return hi===null&&si(e),jg(e,t)}function jg(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},tr===null){if(e===null)throw Error(D(308));tr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else tr=tr.next=t;return a}var dy=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()})}},my=bt.unstable_scheduleCallback,fy=bt.unstable_NormalPriority,ut={$$typeof:Wa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _p(){return{controller:new dy,data:new Map,refCount:0}}function Ho(e){e.refCount--,e.refCount===0&&my(fy,function(){e.controller.abort()})}var so=null,Tu=0,cn=0,tn=null;function gy(e,t){if(so===null){var a=so=[];Tu=0,cn=Vp(),tn={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Tu++,t.then(Jm,Jm),t}function Jm(){if(--Tu===0&&so!==null){tn!==null&&(tn.status="fulfilled");var e=so;so=null,cn=0,tn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function hy(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(n){a.push(n)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var n=0;n<a.length;n++)(0,a[n])(t)},function(n){for(r.status="rejected",r.reason=n,n=0;n<a.length;n++)(0,a[n])(void 0)}),r}var Pm=me.S;me.S=function(e,t){eb=aa(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&gy(e,t),Pm!==null&&Pm(e,t)};var ii=Ha(null);function xp(){var e=ii.current;return e!==null?e:Ge.pooledCache}function Bl(e,t){t===null?Xe(ii,ii.current):Xe(ii,t.pool)}function Gg(){var e=xp();return e===null?null:{parent:ut._currentValue,pool:e}}var yn=Error(D(460)),kp=Error(D(474)),qs=Error(D(542)),ts={then:function(){}};function Fm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qg(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(er,er),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Wm(e),e;default:if(typeof t.status=="string")t.then(er,er);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(D(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=r}},function(r){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Wm(e),e}throw ni=t,yn}}function ei(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ni=a,yn):a}}var ni=null;function Im(){if(ni===null)throw Error(D(459));var e=ni;return ni=null,e}function Wm(e){if(e===yn||e===qs)throw Error(D(483))}var an=null,So=0;function xl(e){var t=So;return So+=1,an===null&&(an=[]),Qg(an,e,t)}function Jn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function kl(e,t){throw t.$$typeof===a0?Error(D(525)):(e=Object.prototype.toString.call(t),Error(D(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yg(e){function t(d,c){if(e){var g=d.deletions;g===null?(d.deletions=[c],d.flags|=16):g.push(c)}}function a(d,c){if(!e)return null;for(;c!==null;)t(d,c),c=c.sibling;return null}function r(d){for(var c=new Map;d!==null;)d.key!==null?c.set(d.key,d):c.set(d.index,d),d=d.sibling;return c}function n(d,c){return d=ar(d,c),d.index=0,d.sibling=null,d}function i(d,c,g){return d.index=g,e?(g=d.alternate,g!==null?(g=g.index,g<c?(d.flags|=67108866,c):g):(d.flags|=67108866,c)):(d.flags|=1048576,c)}function o(d){return e&&d.alternate===null&&(d.flags|=67108866),d}function l(d,c,g,v){return c===null||c.tag!==6?(c=Gc(g,d.mode,v),c.return=d,c):(c=n(c,g),c.return=d,c)}function u(d,c,g,v){var S=g.type;return S===ji?f(d,c,g.props.children,v,g.key):c!==null&&(c.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===wr&&ei(S)===c.type)?(c=n(c,g.props),Jn(c,g),c.return=d,c):(c=Dl(g.type,g.key,g.props,null,d.mode,v),Jn(c,g),c.return=d,c)}function p(d,c,g,v){return c===null||c.tag!==4||c.stateNode.containerInfo!==g.containerInfo||c.stateNode.implementation!==g.implementation?(c=Qc(g,d.mode,v),c.return=d,c):(c=n(c,g.children||[]),c.return=d,c)}function f(d,c,g,v,S){return c===null||c.tag!==7?(c=ri(g,d.mode,v,S),c.return=d,c):(c=n(c,g),c.return=d,c)}function b(d,c,g){if(typeof c=="string"&&c!==""||typeof c=="number"||typeof c=="bigint")return c=Gc(""+c,d.mode,g),c.return=d,c;if(typeof c=="object"&&c!==null){switch(c.$$typeof){case ml:return g=Dl(c.type,c.key,c.props,null,d.mode,g),Jn(g,c),g.return=d,g;case eo:return c=Qc(c,d.mode,g),c.return=d,c;case wr:return c=ei(c),b(d,c,g)}if(to(c)||Zn(c))return c=ri(c,d.mode,g,null),c.return=d,c;if(typeof c.then=="function")return b(d,xl(c),g);if(c.$$typeof===Wa)return b(d,_l(d,c),g);kl(d,c)}return null}function m(d,c,g,v){var S=c!==null?c.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return S!==null?null:l(d,c,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case ml:return g.key===S?u(d,c,g,v):null;case eo:return g.key===S?p(d,c,g,v):null;case wr:return g=ei(g),m(d,c,g,v)}if(to(g)||Zn(g))return S!==null?null:f(d,c,g,v,null);if(typeof g.then=="function")return m(d,c,xl(g),v);if(g.$$typeof===Wa)return m(d,c,_l(d,g),v);kl(d,g)}return null}function h(d,c,g,v,S){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return d=d.get(g)||null,l(c,d,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ml:return d=d.get(v.key===null?g:v.key)||null,u(c,d,v,S);case eo:return d=d.get(v.key===null?g:v.key)||null,p(c,d,v,S);case wr:return v=ei(v),h(d,c,g,v,S)}if(to(v)||Zn(v))return d=d.get(g)||null,f(c,d,v,S,null);if(typeof v.then=="function")return h(d,c,g,xl(v),S);if(v.$$typeof===Wa)return h(d,c,g,_l(c,v),S);kl(c,v)}return null}function w(d,c,g,v){for(var S=null,M=null,T=c,U=c=0,j=null;T!==null&&U<g.length;U++){T.index>U?(j=T,T=null):j=T.sibling;var F=m(d,T,g[U],v);if(F===null){T===null&&(T=j);break}e&&T&&F.alternate===null&&t(d,T),c=i(F,c,U),M===null?S=F:M.sibling=F,M=F,T=j}if(U===g.length)return a(d,T),Se&&Fa(d,U),S;if(T===null){for(;U<g.length;U++)T=b(d,g[U],v),T!==null&&(c=i(T,c,U),M===null?S=T:M.sibling=T,M=T);return Se&&Fa(d,U),S}for(T=r(T);U<g.length;U++)j=h(T,d,U,g[U],v),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?U:j.key),c=i(j,c,U),M===null?S=j:M.sibling=j,M=j);return e&&T.forEach(function(we){return t(d,we)}),Se&&Fa(d,U),S}function E(d,c,g,v){if(g==null)throw Error(D(151));for(var S=null,M=null,T=c,U=c=0,j=null,F=g.next();T!==null&&!F.done;U++,F=g.next()){T.index>U?(j=T,T=null):j=T.sibling;var we=m(d,T,F.value,v);if(we===null){T===null&&(T=j);break}e&&T&&we.alternate===null&&t(d,T),c=i(we,c,U),M===null?S=we:M.sibling=we,M=we,T=j}if(F.done)return a(d,T),Se&&Fa(d,U),S;if(T===null){for(;!F.done;U++,F=g.next())F=b(d,F.value,v),F!==null&&(c=i(F,c,U),M===null?S=F:M.sibling=F,M=F);return Se&&Fa(d,U),S}for(T=r(T);!F.done;U++,F=g.next())F=h(T,d,U,F.value,v),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?U:F.key),c=i(F,c,U),M===null?S=F:M.sibling=F,M=F);return e&&T.forEach(function(Ee){return t(d,Ee)}),Se&&Fa(d,U),S}function R(d,c,g,v){if(typeof g=="object"&&g!==null&&g.type===ji&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ml:e:{for(var S=g.key;c!==null;){if(c.key===S){if(S=g.type,S===ji){if(c.tag===7){a(d,c.sibling),v=n(c,g.props.children),v.return=d,d=v;break e}}else if(c.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===wr&&ei(S)===c.type){a(d,c.sibling),v=n(c,g.props),Jn(v,g),v.return=d,d=v;break e}a(d,c);break}else t(d,c);c=c.sibling}g.type===ji?(v=ri(g.props.children,d.mode,v,g.key),v.return=d,d=v):(v=Dl(g.type,g.key,g.props,null,d.mode,v),Jn(v,g),v.return=d,d=v)}return o(d);case eo:e:{for(S=g.key;c!==null;){if(c.key===S)if(c.tag===4&&c.stateNode.containerInfo===g.containerInfo&&c.stateNode.implementation===g.implementation){a(d,c.sibling),v=n(c,g.children||[]),v.return=d,d=v;break e}else{a(d,c);break}else t(d,c);c=c.sibling}v=Qc(g,d.mode,v),v.return=d,d=v}return o(d);case wr:return g=ei(g),R(d,c,g,v)}if(to(g))return w(d,c,g,v);if(Zn(g)){if(S=Zn(g),typeof S!="function")throw Error(D(150));return g=S.call(g),E(d,c,g,v)}if(typeof g.then=="function")return R(d,c,xl(g),v);if(g.$$typeof===Wa)return R(d,c,_l(d,g),v);kl(d,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,c!==null&&c.tag===6?(a(d,c.sibling),v=n(c,g),v.return=d,d=v):(a(d,c),v=Gc(g,d.mode,v),v.return=d,d=v),o(d)):a(d,c)}return function(d,c,g,v){try{So=0;var S=R(d,c,g,v);return an=null,S}catch(T){if(T===yn||T===qs)throw T;var M=ea(29,T,null,d.mode);return M.lanes=v,M.return=d,M}}}var ci=Yg(!0),Xg=Yg(!1),yr=!1;function Np(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zu(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 Ar(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Rr(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ae&2)!==0){var n=r.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),r.pending=t,t=Il(e),Dg(e,null,a),t}return Cs(e,r,t,a),Il(e)}function co(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,sg(e,a)}}function Xc(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var n=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?n=i=o:i=i.next=o,a=a.next}while(a!==null);i===null?n=i=t:i=i.next=t}else n=i=t;a={baseState:r.baseState,firstBaseUpdate:n,lastBaseUpdate:i,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 Au=!1;function uo(){if(Au){var e=tn;if(e!==null)throw e}}function po(e,t,a,r){Au=!1;var n=e.updateQueue;yr=!1;var i=n.firstBaseUpdate,o=n.lastBaseUpdate,l=n.shared.pending;if(l!==null){n.shared.pending=null;var u=l,p=u.next;u.next=null,o===null?i=p:o.next=p,o=u;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=p:l.next=p,f.lastBaseUpdate=u))}if(i!==null){var b=n.baseState;o=0,f=p=u=null,l=i;do{var m=l.lane&-536870913,h=m!==l.lane;if(h?(Ne&m)===m:(r&m)===m){m!==0&&m===cn&&(Au=!0),f!==null&&(f=f.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var w=e,E=l;m=t;var R=a;switch(E.tag){case 1:if(w=E.payload,typeof w=="function"){b=w.call(R,b,m);break e}b=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=E.payload,m=typeof w=="function"?w.call(R,b,m):w,m==null)break e;b=Je({},b,m);break e;case 2:yr=!0}}m=l.callback,m!==null&&(e.flags|=64,h&&(e.flags|=8192),h=n.callbacks,h===null?n.callbacks=[m]:h.push(m))}else h={lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(p=f=h,u=b):f=f.next=h,o|=m;if(l=l.next,l===null){if(l=n.shared.pending,l===null)break;h=l,l=h.next,h.next=null,n.lastBaseUpdate=h,n.shared.pending=null}}while(!0);f===null&&(u=b),n.baseState=u,n.firstBaseUpdate=p,n.lastBaseUpdate=f,i===null&&(n.shared.lanes=0),Qr|=o,e.lanes=o,e.memoizedState=b}}function $g(e,t){if(typeof e!="function")throw Error(D(191,e));e.call(t)}function Vg(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)$g(a[e],t)}var un=Ha(null),as=Ha(0);function ef(e,t){e=cr,Xe(as,e),Xe(un,t),cr=e|t.baseLanes}function Ru(){Xe(as,cr),Xe(un,un.current)}function Sp(){cr=as.current,_t(un),_t(as)}var la=Ha(null),wa=null;function xr(e){var t=e.alternate;Xe(ot,ot.current&1),Xe(la,e),wa===null&&(t===null||un.current!==null||t.memoizedState!==null)&&(wa=e)}function Uu(e){Xe(ot,ot.current),Xe(la,e),wa===null&&(wa=e)}function Zg(e){e.tag===22?(Xe(ot,ot.current),Xe(la,e),wa===null&&(wa=e)):kr(e)}function kr(){Xe(ot,ot.current),Xe(la,la.current)}function Wt(e){_t(la),wa===e&&(wa=null),_t(ot)}var ot=Ha(0);function rs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Wu(a)||ep(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 or=0,he=null,je=null,st=null,is=!1,rn=!1,ui=!1,ns=0,Co=0,nn=null,by=0;function rt(){throw Error(D(321))}function Cp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!oa(e[a],t[a]))return!1;return!0}function qp(e,t,a,r,n,i){return or=i,he=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,me.H=e===null||e.memoizedState===null?Nh:Lp,ui=!1,i=a(r,n),ui=!1,rn&&(i=Jg(t,a,r,n)),Kg(e),i}function Kg(e){me.H=qo;var t=je!==null&&je.next!==null;if(or=0,st=je=he=null,is=!1,Co=0,nn=null,t)throw Error(D(300));e===null||pt||(e=e.dependencies,e!==null&&es(e)&&(pt=!0))}function Jg(e,t,a,r){he=e;var n=0;do{if(rn&&(nn=null),Co=0,rn=!1,25<=n)throw Error(D(301));if(n+=1,st=je=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}me.H=Sh,i=t(a,r)}while(rn);return i}function vy(){var e=me.H,t=e.useState()[0];return t=typeof t.then=="function"?jo(t):t,e=e.useState()[0],(je!==null?je.memoizedState:null)!==e&&(he.flags|=1024),t}function Ep(){var e=ns!==0;return ns=0,e}function Mp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Tp(e){if(is){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}is=!1}or=0,st=je=he=null,rn=!1,Co=ns=0,nn=null}function Bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?he.memoizedState=st=e:st=st.next=e,st}function lt(){if(je===null){var e=he.alternate;e=e!==null?e.memoizedState:null}else e=je.next;var t=st===null?he.memoizedState:st.next;if(t!==null)st=t,je=e;else{if(e===null)throw he.alternate===null?Error(D(467)):Error(D(310));je=e,e={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},st===null?he.memoizedState=st=e:st=st.next=e}return st}function Es(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jo(e){var t=Co;return Co+=1,nn===null&&(nn=[]),e=Qg(nn,e,t),t=he,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,me.H=t===null||t.memoizedState===null?Nh:Lp),e}function Ms(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return jo(e);if(e.$$typeof===Wa)return Ct(e)}throw Error(D(438,String(e)))}function zp(e){var t=null,a=he.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=he.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Es(),he.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]=r0;return t.index++,a}function lr(e,t){return typeof t=="function"?t(e):t}function Ol(e){var t=lt();return Ap(t,je,e)}function Ap(e,t,a){var r=e.queue;if(r===null)throw Error(D(311));r.lastRenderedReducer=a;var n=e.baseQueue,i=r.pending;if(i!==null){if(n!==null){var o=n.next;n.next=i.next,i.next=o}t.baseQueue=n=i,r.pending=null}if(i=e.baseState,n===null)e.memoizedState=i;else{t=n.next;var l=o=null,u=null,p=t,f=!1;do{var b=p.lane&-536870913;if(b!==p.lane?(Ne&b)===b:(or&b)===b){var m=p.revertLane;if(m===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),b===cn&&(f=!0);else if((or&m)===m){p=p.next,m===cn&&(f=!0);continue}else b={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},u===null?(l=u=b,o=i):u=u.next=b,he.lanes|=m,Qr|=m;b=p.action,ui&&a(i,b),i=p.hasEagerState?p.eagerState:a(i,b)}else m={lane:b,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},u===null?(l=u=m,o=i):u=u.next=m,he.lanes|=b,Qr|=b;p=p.next}while(p!==null&&p!==t);if(u===null?o=i:u.next=l,!oa(i,e.memoizedState)&&(pt=!0,f&&(a=tn,a!==null)))throw a;e.memoizedState=i,e.baseState=o,e.baseQueue=u,r.lastRenderedState=i}return n===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function $c(e){var t=lt(),a=t.queue;if(a===null)throw Error(D(311));a.lastRenderedReducer=e;var r=a.dispatch,n=a.pending,i=t.memoizedState;if(n!==null){a.pending=null;var o=n=n.next;do i=e(i,o.action),o=o.next;while(o!==n);oa(i,t.memoizedState)||(pt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),a.lastRenderedState=i}return[i,r]}function Pg(e,t,a){var r=he,n=lt(),i=Se;if(i){if(a===void 0)throw Error(D(407));a=a()}else a=t();var o=!oa((je||n).memoizedState,a);if(o&&(n.memoizedState=a,pt=!0),n=n.queue,Rp(Wg.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||st!==null&&st.memoizedState.tag&1){if(r.flags|=2048,pn(9,{destroy:void 0},Ig.bind(null,r,n,a,t),null),Ge===null)throw Error(D(349));i||(or&127)!==0||Fg(r,t,a)}return a}function Fg(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=he.updateQueue,t===null?(t=Es(),he.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ig(e,t,a,r){t.value=a,t.getSnapshot=r,eh(t)&&th(e)}function Wg(e,t,a){return a(function(){eh(t)&&th(e)})}function eh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!oa(e,a)}catch{return!0}}function th(e){var t=gi(e,2);t!==null&&Xt(t,e,2)}function Du(e){var t=Bt();if(typeof e=="function"){var a=e;if(e=a(),ui){Sr(!0);try{a()}finally{Sr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:e},t}function ah(e,t,a,r){return e.baseState=a,Ap(e,je,typeof r=="function"?r:lr)}function wy(e,t,a,r,n){if(zs(e))throw Error(D(485));if(e=t.action,e!==null){var i={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};me.T!==null?a(!0):i.isTransition=!1,r(i),a=t.pending,a===null?(i.next=t.pending=i,rh(t,i)):(i.next=a.next,t.pending=a.next=i)}}function rh(e,t){var a=t.action,r=t.payload,n=e.state;if(t.isTransition){var i=me.T,o={};me.T=o;try{var l=a(n,r),u=me.S;u!==null&&u(o,l),tf(e,t,l)}catch(p){Bu(e,t,p)}finally{i!==null&&o.types!==null&&(i.types=o.types),me.T=i}}else try{i=a(n,r),tf(e,t,i)}catch(p){Bu(e,t,p)}}function tf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){af(e,t,r)},function(r){return Bu(e,t,r)}):af(e,t,a)}function af(e,t,a){t.status="fulfilled",t.value=a,ih(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,rh(e,a)))}function Bu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,ih(t),t=t.next;while(t!==r)}e.action=null}function ih(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function nh(e,t){return t}function rf(e,t){if(Se){var a=Ge.formState;if(a!==null){e:{var r=he;if(Se){if(Ke){t:{for(var n=Ke,i=va;n.nodeType!==8;){if(!i){n=null;break t}if(n=ya(n.nextSibling),n===null){n=null;break t}}i=n.data,n=i==="F!"||i==="F"?n:null}if(n){Ke=ya(n.nextSibling),r=n.data==="F!";break e}}jr(r)}r=!1}r&&(t=a[0])}}return a=Bt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nh,lastRenderedState:t},a.queue=r,a=_h.bind(null,he,r),r.dispatch=a,r=Du(!1),i=Op.bind(null,he,!1,r.queue),r=Bt(),n={state:t,dispatch:null,action:e,pending:null},r.queue=n,a=wy.bind(null,he,n,i,a),n.dispatch=a,r.memoizedState=e,[t,a,!1]}function nf(e){var t=lt();return oh(t,je,e)}function oh(e,t,a){if(t=Ap(e,t,nh)[0],e=Ol(lr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=jo(t)}catch(o){throw o===yn?qs:o}else r=t;t=lt();var n=t.queue,i=n.dispatch;return a!==t.memoizedState&&(he.flags|=2048,pn(9,{destroy:void 0},yy.bind(null,n,a),null)),[r,i,e]}function yy(e,t){e.action=t}function of(e){var t=lt(),a=je;if(a!==null)return oh(t,a,e);lt(),t=t.memoizedState,a=lt();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=he.updateQueue,t===null&&(t=Es(),he.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 lh(){return lt().memoizedState}function Ll(e,t,a,r){var n=Bt();he.flags|=e,n.memoizedState=pn(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ts(e,t,a,r){var n=lt();r=r===void 0?null:r;var i=n.memoizedState.inst;je!==null&&r!==null&&Cp(r,je.memoizedState.deps)?n.memoizedState=pn(t,i,a,r):(he.flags|=e,n.memoizedState=pn(1|t,i,a,r))}function lf(e,t){Ll(8390656,8,e,t)}function Rp(e,t){Ts(2048,8,e,t)}function _y(e){he.flags|=4;var t=he.updateQueue;if(t===null)t=Es(),he.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function sh(e){var t=lt().memoizedState;return _y({ref:t,nextImpl:e}),function(){if((Ae&2)!==0)throw Error(D(440));return t.impl.apply(void 0,arguments)}}function ch(e,t){return Ts(4,2,e,t)}function uh(e,t){return Ts(4,4,e,t)}function ph(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 dh(e,t,a){a=a!=null?a.concat([e]):null,Ts(4,4,ph.bind(null,t,e),a)}function Up(){}function mh(e,t){var a=lt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Cp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function fh(e,t){var a=lt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Cp(t,r[1]))return r[0];if(r=e(),ui){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r}function Dp(e,t,a){return a===void 0||(or&1073741824)!==0&&(Ne&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=ab(),he.lanes|=e,Qr|=e,a)}function gh(e,t,a,r){return oa(a,t)?a:un.current!==null?(e=Dp(e,a,r),oa(e,t)||(pt=!0),e):(or&42)===0||(or&1073741824)!==0&&(Ne&261930)===0?(pt=!0,e.memoizedState=a):(e=ab(),he.lanes|=e,Qr|=e,t)}function hh(e,t,a,r,n){var i=Re.p;Re.p=i!==0&&8>i?i:8;var o=me.T,l={};me.T=l,Op(e,!1,t,a);try{var u=n(),p=me.S;if(p!==null&&p(l,u),u!==null&&typeof u=="object"&&typeof u.then=="function"){var f=hy(u,r);mo(e,t,f,na(e))}else mo(e,t,r,na(e))}catch(b){mo(e,t,{then:function(){},status:"rejected",reason:b},na())}finally{Re.p=i,o!==null&&l.types!==null&&(o.types=l.types),me.T=o}}function xy(){}function Ou(e,t,a,r){if(e.tag!==5)throw Error(D(476));var n=bh(e).queue;hh(e,n,t,ai,a===null?xy:function(){return vh(e),a(r)})}function bh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ai,baseState:ai,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:ai},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vh(e){var t=bh(e);t.next===null&&(t=e.alternate.memoizedState),mo(e,t.next.queue,{},na())}function Bp(){return Ct(To)}function wh(){return lt().memoizedState}function yh(){return lt().memoizedState}function ky(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=na();e=Ar(a);var r=Rr(t,e,a);r!==null&&(Xt(r,t,a),co(r,t,a)),t={cache:_p()},e.payload=t;return}t=t.return}}function Ny(e,t,a){var r=na();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},zs(e)?xh(t,a):(a=bp(e,t,a,r),a!==null&&(Xt(a,e,r),kh(a,t,r)))}function _h(e,t,a){var r=na();mo(e,t,a,r)}function mo(e,t,a,r){var n={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(zs(e))xh(t,n);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,a);if(n.hasEagerState=!0,n.eagerState=l,oa(l,o))return Cs(e,t,n,0),Ge===null&&Ss(),!1}catch{}if(a=bp(e,t,n,r),a!==null)return Xt(a,e,r),kh(a,t,r),!0}return!1}function Op(e,t,a,r){if(r={lane:2,revertLane:Vp(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},zs(e)){if(t)throw Error(D(479))}else t=bp(e,a,r,2),t!==null&&Xt(t,e,2)}function zs(e){var t=e.alternate;return e===he||t!==null&&t===he}function xh(e,t){rn=is=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function kh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,sg(e,a)}}var qo={readContext:Ct,use:Ms,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};qo.useEffectEvent=rt;var Nh={readContext:Ct,use:Ms,useCallback:function(e,t){return Bt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:lf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ll(4194308,4,ph.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ll(4194308,4,e,t)},useInsertionEffect:function(e,t){Ll(4,2,e,t)},useMemo:function(e,t){var a=Bt();t=t===void 0?null:t;var r=e();if(ui){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Bt();if(a!==void 0){var n=a(t);if(ui){Sr(!0);try{a(t)}finally{Sr(!1)}}}else n=t;return r.memoizedState=r.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=Ny.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=Bt();return e={current:e},t.memoizedState=e},useState:function(e){e=Du(e);var t=e.queue,a=_h.bind(null,he,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Up,useDeferredValue:function(e,t){var a=Bt();return Dp(a,e,t)},useTransition:function(){var e=Du(!1);return e=hh.bind(null,he,e.queue,!0,!1),Bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=he,n=Bt();if(Se){if(a===void 0)throw Error(D(407));a=a()}else{if(a=t(),Ge===null)throw Error(D(349));(Ne&127)!==0||Fg(r,t,a)}n.memoizedState=a;var i={value:a,getSnapshot:t};return n.queue=i,lf(Wg.bind(null,r,i,e),[e]),r.flags|=2048,pn(9,{destroy:void 0},Ig.bind(null,r,i,a,t),null),a},useId:function(){var e=Bt(),t=Ge.identifierPrefix;if(Se){var a=Ba,r=Da;a=(r&~(1<<32-ia(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ns++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=by++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Bp,useFormState:rf,useActionState:rf,useOptimistic:function(e){var t=Bt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Op.bind(null,he,!0,a),a.dispatch=t,[e,t]},useMemoCache:zp,useCacheRefresh:function(){return Bt().memoizedState=ky.bind(null,he)},useEffectEvent:function(e){var t=Bt(),a={impl:e};return t.memoizedState=a,function(){if((Ae&2)!==0)throw Error(D(440));return a.impl.apply(void 0,arguments)}}},Lp={readContext:Ct,use:Ms,useCallback:mh,useContext:Ct,useEffect:Rp,useImperativeHandle:dh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:fh,useReducer:Ol,useRef:lh,useState:function(){return Ol(lr)},useDebugValue:Up,useDeferredValue:function(e,t){var a=lt();return gh(a,je.memoizedState,e,t)},useTransition:function(){var e=Ol(lr)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:jo(e),t]},useSyncExternalStore:Pg,useId:wh,useHostTransitionStatus:Bp,useFormState:nf,useActionState:nf,useOptimistic:function(e,t){var a=lt();return ah(a,je,e,t)},useMemoCache:zp,useCacheRefresh:yh};Lp.useEffectEvent=sh;var Sh={readContext:Ct,use:Ms,useCallback:mh,useContext:Ct,useEffect:Rp,useImperativeHandle:dh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:fh,useReducer:$c,useRef:lh,useState:function(){return $c(lr)},useDebugValue:Up,useDeferredValue:function(e,t){var a=lt();return je===null?Dp(a,e,t):gh(a,je.memoizedState,e,t)},useTransition:function(){var e=$c(lr)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:jo(e),t]},useSyncExternalStore:Pg,useId:wh,useHostTransitionStatus:Bp,useFormState:of,useActionState:of,useOptimistic:function(e,t){var a=lt();return je!==null?ah(a,je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:zp,useCacheRefresh:yh};Sh.useEffectEvent=sh;function Vc(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:Je({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Lu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=na(),n=Ar(r);n.payload=t,a!=null&&(n.callback=a),t=Rr(e,n,r),t!==null&&(Xt(t,e,r),co(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=na(),n=Ar(r);n.tag=1,n.payload=t,a!=null&&(n.callback=a),t=Rr(e,n,r),t!==null&&(Xt(t,e,r),co(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=na(),r=Ar(a);r.tag=2,t!=null&&(r.callback=t),t=Rr(e,r,a),t!==null&&(Xt(t,e,a),co(t,e,a))}};function sf(e,t,a,r,n,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!xo(a,r)||!xo(n,i):!0}function cf(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&&Lu.enqueueReplaceState(t,t.state,null)}function pi(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=Je({},a));for(var n in e)a[n]===void 0&&(a[n]=e[n])}return a}function Ch(e){Fl(e)}function qh(e){console.error(e)}function Eh(e){Fl(e)}function os(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function uf(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function Hu(e,t,a){return a=Ar(a),a.tag=3,a.payload={element:null},a.callback=function(){os(e,t)},a}function Mh(e){return e=Ar(e),e.tag=3,e}function Th(e,t,a,r){var n=a.type.getDerivedStateFromError;if(typeof n=="function"){var i=r.value;e.payload=function(){return n(i)},e.callback=function(){uf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){uf(t,a,r),typeof n!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function Sy(e,t,a,r,n){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&wn(t,a,n,!0),a=la.current,a!==null){switch(a.tag){case 31:case 13:return wa===null?ps():a.alternate===null&&it===0&&(it=3),a.flags&=-257,a.flags|=65536,a.lanes=n,r===ts?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),ru(e,r,n)),!1;case 22:return a.flags|=65536,r===ts?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)),ru(e,r,n)),!1}throw Error(D(435,a.tag))}return ru(e,r,n),ps(),!1}if(Se)return t=la.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,r!==Cu&&(e=Error(D(422),{cause:r}),No(ba(e,a)))):(r!==Cu&&(t=Error(D(423),{cause:r}),No(ba(t,a))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,r=ba(r,a),n=Hu(e.stateNode,r,n),Xc(e,n),it!==4&&(it=2)),!1;var i=Error(D(520),{cause:r});if(i=ba(i,a),ho===null?ho=[i]:ho.push(i),it!==4&&(it=2),t===null)return!0;r=ba(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=n&-n,a.lanes|=e,e=Hu(a.stateNode,r,e),Xc(a,e),!1;case 1:if(t=a.type,i=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Ur===null||!Ur.has(i))))return a.flags|=65536,n&=-n,a.lanes|=n,n=Mh(n),Th(n,e,a,r),Xc(a,n),!1}a=a.return}while(a!==null);return!1}var Hp=Error(D(461)),pt=!1;function kt(e,t,a,r){t.child=e===null?Xg(t,null,a,r):ci(t,e.child,a,r)}function pf(e,t,a,r,n){a=a.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return si(t),r=qp(e,t,a,o,i,n),l=Ep(),e!==null&&!pt?(Mp(e,t,n),sr(e,t,n)):(Se&&l&&wp(t),t.flags|=1,kt(e,t,r,n),t.child)}function df(e,t,a,r,n){if(e===null){var i=a.type;return typeof i=="function"&&!vp(i)&&i.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=i,zh(e,t,i,r,n)):(e=Dl(a.type,null,r,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!jp(e,n)){var o=i.memoizedProps;if(a=a.compare,a=a!==null?a:xo,a(o,r)&&e.ref===t.ref)return sr(e,t,n)}return t.flags|=1,e=ar(i,r),e.ref=t.ref,e.return=t,t.child=e}function zh(e,t,a,r,n){if(e!==null){var i=e.memoizedProps;if(xo(i,r)&&e.ref===t.ref)if(pt=!1,t.pendingProps=r=i,jp(e,n))(e.flags&131072)!==0&&(pt=!0);else return t.lanes=e.lanes,sr(e,t,n)}return ju(e,t,a,r,n)}function Ah(e,t,a,r){var n=r.children,i=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(i=i!==null?i.baseLanes|a:a,e!==null){for(r=t.child=e.child,n=0;r!==null;)n=n|r.lanes|r.childLanes,r=r.sibling;r=n&~i}else r=0,t.child=null;return mf(e,t,i,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Bl(t,i!==null?i.cachePool:null),i!==null?ef(t,i):Ru(),Zg(t);else return r=t.lanes=536870912,mf(e,t,i!==null?i.baseLanes|a:a,a,r)}else i!==null?(Bl(t,i.cachePool),ef(t,i),kr(t),t.memoizedState=null):(e!==null&&Bl(t,null),Ru(),kr(t));return kt(e,t,n,a),t.child}function ro(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function mf(e,t,a,r,n){var i=xp();return i=i===null?null:{parent:ut._currentValue,pool:i},t.memoizedState={baseLanes:a,cachePool:i},e!==null&&Bl(t,null),Ru(),Zg(t),e!==null&&wn(e,t,r,!0),t.childLanes=n,null}function Hl(e,t){return t=ls({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ff(e,t,a){return ci(t,e.child,null,a),e=Hl(t,t.pendingProps),e.flags|=2,Wt(t),t.memoizedState=null,e}function Cy(e,t,a){var r=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Se){if(r.mode==="hidden")return e=Hl(t,r),t.lanes=536870912,ro(null,e);if(Uu(t),(e=Ke)?(e=Nb(e,va),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hr!==null?{id:Da,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Og(e),a.return=t,t.child=a,St=t,Ke=null)):e=null,e===null)throw jr(t);return t.lanes=536870912,null}return Hl(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(Uu(t),n)if(t.flags&256)t.flags&=-257,t=ff(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(D(558));else if(pt||wn(e,t,a,!1),n=(a&e.childLanes)!==0,pt||n){if(r=Ge,r!==null&&(o=cg(r,a),o!==0&&o!==i.retryLane))throw i.retryLane=o,gi(e,o),Xt(r,e,o),Hp;ps(),t=ff(e,t,a)}else e=i.treeContext,Ke=ya(o.nextSibling),St=t,Se=!0,zr=null,va=!1,e!==null&&Hg(t,e),t=Hl(t,r),t.flags|=4096;return t}return e=ar(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jl(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(D(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function ju(e,t,a,r,n){return si(t),a=qp(e,t,a,r,void 0,n),r=Ep(),e!==null&&!pt?(Mp(e,t,n),sr(e,t,n)):(Se&&r&&wp(t),t.flags|=1,kt(e,t,a,n),t.child)}function gf(e,t,a,r,n,i){return si(t),t.updateQueue=null,a=Jg(t,r,a,n),Kg(e),r=Ep(),e!==null&&!pt?(Mp(e,t,i),sr(e,t,i)):(Se&&r&&wp(t),t.flags|=1,kt(e,t,a,i),t.child)}function hf(e,t,a,r,n){if(si(t),t.stateNode===null){var i=Ki,o=a.contextType;typeof o=="object"&&o!==null&&(i=Ct(o)),i=new a(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Lu,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},Np(t),o=a.contextType,i.context=typeof o=="object"&&o!==null?Ct(o):Ki,i.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(Vc(t,a,o,r),i.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&Lu.enqueueReplaceState(i,i.state,null),po(t,r,i,n),uo(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var l=t.memoizedProps,u=pi(a,l);i.props=u;var p=i.context,f=a.contextType;o=Ki,typeof f=="object"&&f!==null&&(o=Ct(f));var b=a.getDerivedStateFromProps;f=typeof b=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||p!==o)&&cf(t,i,r,o),yr=!1;var m=t.memoizedState;i.state=m,po(t,r,i,n),uo(),p=t.memoizedState,l||m!==p||yr?(typeof b=="function"&&(Vc(t,a,b,r),p=t.memoizedState),(u=yr||sf(t,a,u,r,m,p,o))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=o,r=u):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,zu(e,t),o=t.memoizedProps,f=pi(a,o),i.props=f,b=t.pendingProps,m=i.context,p=a.contextType,u=Ki,typeof p=="object"&&p!==null&&(u=Ct(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==b||m!==u)&&cf(t,i,r,u),yr=!1,m=t.memoizedState,i.state=m,po(t,r,i,n),uo();var h=t.memoizedState;o!==b||m!==h||yr||e!==null&&e.dependencies!==null&&es(e.dependencies)?(typeof l=="function"&&(Vc(t,a,l,r),h=t.memoizedState),(f=yr||sf(t,a,f,r,m,h,u)||e!==null&&e.dependencies!==null&&es(e.dependencies))?(p||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,h,u),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,h,u)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=u,r=f):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,jl(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=ci(t,e.child,null,n),t.child=ci(t,null,a,n)):kt(e,t,a,n),t.memoizedState=i.state,e=t.child):e=sr(e,t,n),e}function bf(e,t,a,r){return li(),t.flags|=256,kt(e,t,a,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kc(e){return{baseLanes:e,cachePool:Gg()}}function Jc(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ta),e}function Rh(e,t,a){var r=t.pendingProps,n=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),o&&(n=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Se){if(n?xr(t):kr(t),(e=Ke)?(e=Nb(e,va),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Hr!==null?{id:Da,overflow:Ba}:null,retryLane:536870912,hydrationErrors:null},a=Og(e),a.return=t,t.child=a,St=t,Ke=null)):e=null,e===null)throw jr(t);return ep(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,n?(kr(t),n=t.mode,l=ls({mode:"hidden",children:l},n),r=ri(r,n,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=Kc(a),r.childLanes=Jc(e,o,a),t.memoizedState=Zc,ro(null,r)):(xr(t),Gu(t,l))}var u=e.memoizedState;if(u!==null&&(l=u.dehydrated,l!==null)){if(i)t.flags&256?(xr(t),t.flags&=-257,t=Pc(e,t,a)):t.memoizedState!==null?(kr(t),t.child=e.child,t.flags|=128,t=null):(kr(t),l=r.fallback,n=t.mode,r=ls({mode:"visible",children:r.children},n),l=ri(l,n,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,ci(t,e.child,null,a),r=t.child,r.memoizedState=Kc(a),r.childLanes=Jc(e,o,a),t.memoizedState=Zc,t=ro(null,r));else if(xr(t),ep(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(D(419)),r.stack="",r.digest=o,No({value:r,source:null,stack:null}),t=Pc(e,t,a)}else if(pt||wn(e,t,a,!1),o=(a&e.childLanes)!==0,pt||o){if(o=Ge,o!==null&&(r=cg(o,a),r!==0&&r!==u.retryLane))throw u.retryLane=r,gi(e,r),Xt(o,e,r),Hp;Wu(l)||ps(),t=Pc(e,t,a)}else Wu(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,Ke=ya(l.nextSibling),St=t,Se=!0,zr=null,va=!1,e!==null&&Hg(t,e),t=Gu(t,r.children),t.flags|=4096);return t}return n?(kr(t),l=r.fallback,n=t.mode,u=e.child,p=u.sibling,r=ar(u,{mode:"hidden",children:r.children}),r.subtreeFlags=u.subtreeFlags&65011712,p!==null?l=ar(p,l):(l=ri(l,n,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,ro(null,r),r=t.child,l=e.child.memoizedState,l===null?l=Kc(a):(n=l.cachePool,n!==null?(u=ut._currentValue,n=n.parent!==u?{parent:u,pool:u}:n):n=Gg(),l={baseLanes:l.baseLanes|a,cachePool:n}),r.memoizedState=l,r.childLanes=Jc(e,o,a),t.memoizedState=Zc,ro(e.child,r)):(xr(t),a=e.child,e=a.sibling,a=ar(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 Gu(e,t){return t=ls({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ls(e,t){return e=ea(22,e,null,t),e.lanes=0,e}function Pc(e,t,a){return ci(t,e.child,null,a),e=Gu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vf(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Eu(e.return,t,a)}function Fc(e,t,a,r,n,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:n,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=n,o.treeForkCount=i)}function Uh(e,t,a){var r=t.pendingProps,n=r.revealOrder,i=r.tail;r=r.children;var o=ot.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Xe(ot,o),kt(e,t,r,a),r=Se?ko:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vf(e,a,t);else if(e.tag===19)vf(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(n){case"forwards":for(a=t.child,n=null;a!==null;)e=a.alternate,e!==null&&rs(e)===null&&(n=a),a=a.sibling;a=n,a===null?(n=t.child,t.child=null):(n=a.sibling,a.sibling=null),Fc(t,!1,n,a,i,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&rs(e)===null){t.child=n;break}e=n.sibling,n.sibling=a,a=n,n=e}Fc(t,!0,a,null,i,r);break;case"together":Fc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function sr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Qr|=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(D(153));if(t.child!==null){for(e=t.child,a=ar(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=ar(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function jp(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&es(e)))}function qy(e,t,a){switch(t.tag){case 3:Zl(t,t.stateNode.containerInfo),_r(t,ut,e.memoizedState.cache),li();break;case 27:case 5:gu(t);break;case 4:Zl(t,t.stateNode.containerInfo);break;case 10:_r(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Uu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(xr(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Rh(e,t,a):(xr(t),e=sr(e,t,a),e!==null?e.sibling:null);xr(t);break;case 19:var n=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(wn(e,t,a,!1),r=(a&t.childLanes)!==0),n){if(r)return Uh(e,t,a);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),Xe(ot,ot.current),r)break;return null;case 22:return t.lanes=0,Ah(e,t,a,t.pendingProps);case 24:_r(t,ut,e.memoizedState.cache)}return sr(e,t,a)}function Dh(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)pt=!0;else{if(!jp(e,a)&&(t.flags&128)===0)return pt=!1,qy(e,t,a);pt=(e.flags&131072)!==0}else pt=!1,Se&&(t.flags&1048576)!==0&&Lg(t,ko,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ei(t.elementType),t.type=e,typeof e=="function")vp(e)?(r=pi(e,r),t.tag=1,t=hf(null,t,e,r,a)):(t.tag=0,t=ju(null,t,e,r,a));else{if(e!=null){var n=e.$$typeof;if(n===ip){t.tag=11,t=pf(null,t,e,r,a);break e}else if(n===np){t.tag=14,t=df(null,t,e,r,a);break e}}throw t=mu(e)||e,Error(D(306,t,""))}}return t;case 0:return ju(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,n=pi(r,t.pendingProps),hf(e,t,r,n,a);case 3:e:{if(Zl(t,t.stateNode.containerInfo),e===null)throw Error(D(387));r=t.pendingProps;var i=t.memoizedState;n=i.element,zu(e,t),po(t,r,null,a);var o=t.memoizedState;if(r=o.cache,_r(t,ut,r),r!==i.cache&&Mu(t,[ut],a,!0),uo(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=bf(e,t,r,a);break e}else if(r!==n){n=ba(Error(D(424)),t),No(n),t=bf(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,Ke=ya(e.firstChild),St=t,Se=!0,zr=null,va=!0,a=Xg(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(li(),r===n){t=sr(e,t,a);break e}kt(e,t,r,a)}t=t.child}return t;case 26:return jl(e,t),e===null?(a=jf(t.type,null,t.pendingProps,null))?t.memoizedState=a:Se||(a=t.type,e=t.pendingProps,r=gs(Tr.current).createElement(a),r[Nt]=t,r[$t]=e,qt(r,a,e),yt(r),t.stateNode=r):t.memoizedState=jf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return gu(t),e===null&&Se&&(r=t.stateNode=Sb(t.type,t.pendingProps,Tr.current),St=t,va=!0,n=Ke,Xr(t.type)?(tp=n,Ke=ya(r.firstChild)):Ke=n),kt(e,t,t.pendingProps.children,a),jl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Se&&((n=r=Ke)&&(r=t1(r,t.type,t.pendingProps,va),r!==null?(t.stateNode=r,St=t,Ke=ya(r.firstChild),va=!1,n=!0):n=!1),n||jr(t)),gu(t),n=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,Fu(n,i)?r=null:o!==null&&Fu(n,o)&&(t.flags|=32),t.memoizedState!==null&&(n=qp(e,t,vy,null,null,a),To._currentValue=n),jl(e,t),kt(e,t,r,a),t.child;case 6:return e===null&&Se&&((e=a=Ke)&&(a=a1(a,t.pendingProps,va),a!==null?(t.stateNode=a,St=t,Ke=null,e=!0):e=!1),e||jr(t)),null;case 13:return Rh(e,t,a);case 4:return Zl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ci(t,null,r,a):kt(e,t,r,a),t.child;case 11:return pf(e,t,t.type,t.pendingProps,a);case 7:return kt(e,t,t.pendingProps,a),t.child;case 8:return kt(e,t,t.pendingProps.children,a),t.child;case 12:return kt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,_r(t,t.type,r.value),kt(e,t,r.children,a),t.child;case 9:return n=t.type._context,r=t.pendingProps.children,si(t),n=Ct(n),r=r(n),t.flags|=1,kt(e,t,r,a),t.child;case 14:return df(e,t,t.type,t.pendingProps,a);case 15:return zh(e,t,t.type,t.pendingProps,a);case 19:return Uh(e,t,a);case 31:return Cy(e,t,a);case 22:return Ah(e,t,a,t.pendingProps);case 24:return si(t),r=Ct(ut),e===null?(n=xp(),n===null&&(n=Ge,i=_p(),n.pooledCache=i,i.refCount++,i!==null&&(n.pooledCacheLanes|=a),n=i),t.memoizedState={parent:r,cache:n},Np(t),_r(t,ut,n)):((e.lanes&a)!==0&&(zu(e,t),po(t,null,null,a),uo()),n=e.memoizedState,i=t.memoizedState,n.parent!==r?(n={parent:r,cache:r},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),_r(t,ut,r)):(r=i.cache,_r(t,ut,r),r!==n.cache&&Mu(t,[ut],a,!0))),kt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(D(156,t.tag))}function Za(e){e.flags|=4}function Ic(e,t,a,r,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(nb())e.flags|=8192;else throw ni=ts,kp}else e.flags&=-16777217}function wf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Eb(t))if(nb())e.flags|=8192;else throw ni=ts,kp}function Nl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?og():536870912,e.lanes|=t,dn|=t)}function Pn(e,t){if(!Se)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 Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var n=e.child;n!==null;)a|=n.lanes|n.childLanes,r|=n.subtreeFlags&65011712,r|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)a|=n.lanes|n.childLanes,r|=n.subtreeFlags,r|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function Ey(e,t,a){var r=t.pendingProps;switch(yp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),rr(ut),on(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Za(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Yc())),Ze(t),null;case 26:var n=t.type,i=t.memoizedState;return e===null?(Za(t),i!==null?(Ze(t),wf(t,i)):(Ze(t),Ic(t,n,null,r,a))):i?i!==e.memoizedState?(Za(t),Ze(t),wf(t,i)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Za(t),Ze(t),Ic(t,n,e,r,a)),null;case 27:if(Kl(t),a=Tr.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(!r){if(t.stateNode===null)throw Error(D(166));return Ze(t),null}e=La.current,Bi(t)?Zm(t,e):(e=Sb(n,r,a),t.stateNode=e,Za(t))}return Ze(t),null;case 5:if(Kl(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(!r){if(t.stateNode===null)throw Error(D(166));return Ze(t),null}if(i=La.current,Bi(t))Zm(t,i);else{var o=gs(Tr.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(n,{is:r.is}):o.createElement(n)}}i[Nt]=t,i[$t]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.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=i;e:switch(qt(i,n,r),n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Za(t)}}return Ze(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Za(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(D(166));if(e=Tr.current,Bi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,n=St,n!==null)switch(n.tag){case 27:case 5:r=n.memoizedProps}e[Nt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||_b(e.nodeValue,a)),e||jr(t,!0)}else e=gs(e).createTextNode(r),e[Nt]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),a!==null){if(e===null){if(!r)throw Error(D(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(D(557));e[Nt]=t}else li(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Yc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Wt(t),t):(Wt(t),null);if((t.flags&128)!==0)throw Error(D(558))}return Ze(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!n)throw Error(D(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(D(317));n[Nt]=t}else li(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),n=!1}else n=Yc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(Wt(t),t):(Wt(t),null)}return Wt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,n=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(n=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==n&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Nl(t,t.updateQueue),Ze(t),null);case 4:return on(),e===null&&Zp(t.stateNode.containerInfo),Ze(t),null;case 10:return rr(t.type),Ze(t),null;case 19:if(_t(ot),r=t.memoizedState,r===null)return Ze(t),null;if(n=(t.flags&128)!==0,i=r.rendering,i===null)if(n)Pn(r,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=rs(e),i!==null){for(t.flags|=128,Pn(r,!1),e=i.updateQueue,t.updateQueue=e,Nl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Bg(a,e),a=a.sibling;return Xe(ot,ot.current&1|2),Se&&Fa(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&aa()>cs&&(t.flags|=128,n=!0,Pn(r,!1),t.lanes=4194304)}else{if(!n)if(e=rs(i),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,Nl(t,e),Pn(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!Se)return Ze(t),null}else 2*aa()-r.renderingStartTime>cs&&a!==536870912&&(t.flags|=128,n=!0,Pn(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=aa(),e.sibling=null,a=ot.current,Xe(ot,n?a&1|2:a&1),Se&&Fa(t,r.treeForkCount),e):(Ze(t),null);case 22:case 23:return Wt(t),Sp(),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&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&Nl(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&&_t(ii),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),rr(ut),Ze(t),null;case 25:return null;case 30:return null}throw Error(D(156,t.tag))}function My(e,t){switch(yp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rr(ut),on(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Kl(t),null;case 31:if(t.memoizedState!==null){if(Wt(t),t.alternate===null)throw Error(D(340));li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Wt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(D(340));li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _t(ot),null;case 4:return on(),null;case 10:return rr(t.type),null;case 22:case 23:return Wt(t),Sp(),e!==null&&_t(ii),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return rr(ut),null;case 25:return null;default:return null}}function Bh(e,t){switch(yp(t),t.tag){case 3:rr(ut),on();break;case 26:case 27:case 5:Kl(t);break;case 4:on();break;case 31:t.memoizedState!==null&&Wt(t);break;case 13:Wt(t);break;case 19:_t(ot);break;case 10:rr(t.type);break;case 22:case 23:Wt(t),Sp(),e!==null&&_t(ii);break;case 24:rr(ut)}}function Go(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var n=r.next;a=n;do{if((a.tag&e)===e){r=void 0;var i=a.create,o=a.inst;r=i(),o.destroy=r}a=a.next}while(a!==n)}}catch(l){Oe(t,t.return,l)}}function Gr(e,t,a){try{var r=t.updateQueue,n=r!==null?r.lastEffect:null;if(n!==null){var i=n.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,n=t;var u=a,p=l;try{p()}catch(f){Oe(n,u,f)}}}r=r.next}while(r!==i)}}catch(f){Oe(t,t.return,f)}}function Oh(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Vg(t,a)}catch(r){Oe(e,e.return,r)}}}function Lh(e,t,a){a.props=pi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Oe(e,t,r)}}function fo(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(n){Oe(e,t,n)}}function Oa(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(n){Oe(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(n){Oe(e,t,n)}else a.current=null}function Hh(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(n){Oe(e,e.return,n)}}function Wc(e,t,a){try{var r=e.stateNode;Jy(r,e.type,a,t),r[$t]=t}catch(n){Oe(e,e.return,n)}}function jh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Xr(e.type)||e.tag===4}function eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jh(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&&Xr(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 Qu(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=er));else if(r!==4&&(r===27&&Xr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Qu(e,t,a),e=e.sibling;e!==null;)Qu(e,t,a),e=e.sibling}function ss(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&&Xr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ss(e,t,a),e=e.sibling;e!==null;)ss(e,t,a),e=e.sibling}function Gh(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);qt(t,r,a),t[Nt]=e,t[$t]=a}catch(i){Oe(e,e.return,i)}}var Ia=!1,ct=!1,tu=!1,yf=typeof WeakSet=="function"?WeakSet:Set,wt=null;function Ty(e,t){if(e=e.containerInfo,Ju=ws,e=Eg(e),gp(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 n=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var o=0,l=-1,u=-1,p=0,f=0,b=e,m=null;t:for(;;){for(var h;b!==a||n!==0&&b.nodeType!==3||(l=o+n),b!==i||r!==0&&b.nodeType!==3||(u=o+r),b.nodeType===3&&(o+=b.nodeValue.length),(h=b.firstChild)!==null;)m=b,b=h;for(;;){if(b===e)break t;if(m===a&&++p===n&&(l=o),m===i&&++f===r&&(u=o),(h=b.nextSibling)!==null)break;b=m,m=b.parentNode}b=h}a=l===-1||u===-1?null:{start:l,end:u}}else a=null}a=a||{start:0,end:0}}else a=null;for(Pu={focusedElem:e,selectionRange:a},ws=!1,wt=t;wt!==null;)if(t=wt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,wt=e;else for(;wt!==null;){switch(t=wt,i=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++)n=e[a],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,a=t,n=i.memoizedProps,i=i.memoizedState,r=a.stateNode;try{var w=pi(a.type,n);e=r.getSnapshotBeforeUpdate(w,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(E){Oe(a,a.return,E)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Iu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Iu(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(D(163))}if(e=t.sibling,e!==null){e.return=t.return,wt=e;break}wt=t.return}}function Qh(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ja(e,a),r&4&&Go(5,a);break;case 1:if(Ja(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(o){Oe(a,a.return,o)}else{var n=pi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Oe(a,a.return,o)}}r&64&&Oh(a),r&512&&fo(a,a.return);break;case 3:if(Ja(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{Vg(e,t)}catch(o){Oe(a,a.return,o)}}break;case 27:t===null&&r&4&&Gh(a);case 26:case 5:Ja(e,a),t===null&&r&4&&Hh(a),r&512&&fo(a,a.return);break;case 12:Ja(e,a);break;case 31:Ja(e,a),r&4&&$h(e,a);break;case 13:Ja(e,a),r&4&&Vh(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Hy.bind(null,a),r1(e,a))));break;case 22:if(r=a.memoizedState!==null||Ia,!r){t=t!==null&&t.memoizedState!==null||ct,n=Ia;var i=ct;Ia=r,(ct=t)&&!i?Pa(e,a,(a.subtreeFlags&8772)!==0):Ja(e,a),Ia=n,ct=i}break;case 30:break;default:Ja(e,a)}}function Yh(e){var t=e.alternate;t!==null&&(e.alternate=null,Yh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&cp(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 Ie=null,Qt=!1;function Ka(e,t,a){for(a=a.child;a!==null;)Xh(e,t,a),a=a.sibling}function Xh(e,t,a){if(ra&&typeof ra.onCommitFiberUnmount=="function")try{ra.onCommitFiberUnmount(Uo,a)}catch{}switch(a.tag){case 26:ct||Oa(a,t),Ka(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ct||Oa(a,t);var r=Ie,n=Qt;Xr(a.type)&&(Ie=a.stateNode,Qt=!1),Ka(e,t,a),vo(a.stateNode),Ie=r,Qt=n;break;case 5:ct||Oa(a,t);case 6:if(r=Ie,n=Qt,Ie=null,Ka(e,t,a),Ie=r,Qt=n,Ie!==null)if(Qt)try{(Ie.nodeType===9?Ie.body:Ie.nodeName==="HTML"?Ie.ownerDocument.body:Ie).removeChild(a.stateNode)}catch(i){Oe(a,t,i)}else try{Ie.removeChild(a.stateNode)}catch(i){Oe(a,t,i)}break;case 18:Ie!==null&&(Qt?(e=Ie,Df(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),hn(e)):Df(Ie,a.stateNode));break;case 4:r=Ie,n=Qt,Ie=a.stateNode.containerInfo,Qt=!0,Ka(e,t,a),Ie=r,Qt=n;break;case 0:case 11:case 14:case 15:Gr(2,a,t),ct||Gr(4,a,t),Ka(e,t,a);break;case 1:ct||(Oa(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Lh(a,t,r)),Ka(e,t,a);break;case 21:Ka(e,t,a);break;case 22:ct=(r=ct)||a.memoizedState!==null,Ka(e,t,a),ct=r;break;default:Ka(e,t,a)}}function $h(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hn(e)}catch(a){Oe(t,t.return,a)}}}function Vh(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){Oe(t,t.return,a)}}function zy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new yf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new yf),t;default:throw Error(D(435,e.tag))}}function Sl(e,t){var a=zy(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var n=jy.bind(null,e,r);r.then(n,n)}})}function jt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var n=a[r],i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Xr(l.type)){Ie=l.stateNode,Qt=!1;break e}break;case 5:Ie=l.stateNode,Qt=!1;break e;case 3:case 4:Ie=l.stateNode.containerInfo,Qt=!0;break e}l=l.return}if(Ie===null)throw Error(D(160));Xh(i,o,n),Ie=null,Qt=!1,i=n.alternate,i!==null&&(i.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Zh(t,e),t=t.sibling}var Ma=null;function Zh(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jt(t,e),Gt(e),r&4&&(Gr(3,e,e.return),Go(3,e),Gr(5,e,e.return));break;case 1:jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),r&64&&Ia&&(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 n=Ma;if(jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),r&4){var i=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,n=n.ownerDocument||n;t:switch(r){case"title":i=n.getElementsByTagName("title")[0],(!i||i[Oo]||i[Nt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=n.createElement(r),n.head.insertBefore(i,n.querySelector("head > title"))),qt(i,r,a),i[Nt]=e,yt(i),r=i;break e;case"link":var o=Qf("link","href",n).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(i=o[l],i.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&i.getAttribute("rel")===(a.rel==null?null:a.rel)&&i.getAttribute("title")===(a.title==null?null:a.title)&&i.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}i=n.createElement(r),qt(i,r,a),n.head.appendChild(i);break;case"meta":if(o=Qf("meta","content",n).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(i=o[l],i.getAttribute("content")===(a.content==null?null:""+a.content)&&i.getAttribute("name")===(a.name==null?null:a.name)&&i.getAttribute("property")===(a.property==null?null:a.property)&&i.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&i.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}i=n.createElement(r),qt(i,r,a),n.head.appendChild(i);break;default:throw Error(D(468,r))}i[Nt]=e,yt(i),r=i}e.stateNode=r}else Yf(n,e.type,e.stateNode);else e.stateNode=Gf(n,r,e.memoizedProps);else i!==r?(i===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):i.count--,r===null?Yf(n,e.type,e.stateNode):Gf(n,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,a.memoizedProps)}break;case 27:jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),a!==null&&r&4&&Wc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(jt(t,e),Gt(e),r&512&&(ct||a===null||Oa(a,a.return)),e.flags&32){n=e.stateNode;try{sn(n,"")}catch(w){Oe(e,e.return,w)}}r&4&&e.stateNode!=null&&(n=e.memoizedProps,Wc(e,n,a!==null?a.memoizedProps:n)),r&1024&&(tu=!0);break;case 6:if(jt(t,e),Gt(e),r&4){if(e.stateNode===null)throw Error(D(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(w){Oe(e,e.return,w)}}break;case 3:if(Yl=null,n=Ma,Ma=hs(t.containerInfo),jt(t,e),Ma=n,Gt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{hn(t.containerInfo)}catch(w){Oe(e,e.return,w)}tu&&(tu=!1,Kh(e));break;case 4:r=Ma,Ma=hs(e.stateNode.containerInfo),jt(t,e),Gt(e),Ma=r;break;case 12:jt(t,e),Gt(e);break;case 31:jt(t,e),Gt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 13:jt(t,e),Gt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(As=aa()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 22:n=e.memoizedState!==null;var u=a!==null&&a.memoizedState!==null,p=Ia,f=ct;if(Ia=p||n,ct=f||u,jt(t,e),ct=f,Ia=p,Gt(e),r&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(a===null||u||Ia||ct||ti(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){u=a=t;try{if(i=u.stateNode,n)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=u.stateNode;var b=u.memoizedProps.style,m=b!=null&&b.hasOwnProperty("display")?b.display:null;l.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(w){Oe(u,u.return,w)}}}else if(t.tag===6){if(a===null){u=t;try{u.stateNode.nodeValue=n?"":u.memoizedProps}catch(w){Oe(u,u.return,w)}}}else if(t.tag===18){if(a===null){u=t;try{var h=u.stateNode;n?Bf(h,!0):Bf(u.stateNode,!1)}catch(w){Oe(u,u.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,Sl(e,a))));break;case 19:jt(t,e),Gt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 30:break;case 21:break;default:jt(t,e),Gt(e)}}function Gt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(jh(r)){a=r;break}r=r.return}if(a==null)throw Error(D(160));switch(a.tag){case 27:var n=a.stateNode,i=eu(e);ss(e,i,n);break;case 5:var o=a.stateNode;a.flags&32&&(sn(o,""),a.flags&=-33);var l=eu(e);ss(e,l,o);break;case 3:case 4:var u=a.stateNode.containerInfo,p=eu(e);Qu(e,p,u);break;default:throw Error(D(161))}}catch(f){Oe(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Kh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Kh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qh(e,t.alternate,t),t=t.sibling}function ti(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gr(4,t,t.return),ti(t);break;case 1:Oa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Lh(t,t.return,a),ti(t);break;case 27:vo(t.stateNode);case 26:case 5:Oa(t,t.return),ti(t);break;case 22:t.memoizedState===null&&ti(t);break;case 30:ti(t);break;default:ti(t)}e=e.sibling}}function Pa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,n=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:Pa(n,i,a),Go(4,i);break;case 1:if(Pa(n,i,a),r=i,n=r.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(p){Oe(r,r.return,p)}if(r=i,n=r.updateQueue,n!==null){var l=r.stateNode;try{var u=n.shared.hiddenCallbacks;if(u!==null)for(n.shared.hiddenCallbacks=null,n=0;n<u.length;n++)$g(u[n],l)}catch(p){Oe(r,r.return,p)}}a&&o&64&&Oh(i),fo(i,i.return);break;case 27:Gh(i);case 26:case 5:Pa(n,i,a),a&&r===null&&o&4&&Hh(i),fo(i,i.return);break;case 12:Pa(n,i,a);break;case 31:Pa(n,i,a),a&&o&4&&$h(n,i);break;case 13:Pa(n,i,a),a&&o&4&&Vh(n,i);break;case 22:i.memoizedState===null&&Pa(n,i,a),fo(i,i.return);break;case 30:break;default:Pa(n,i,a)}t=t.sibling}}function Gp(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&&Ho(a))}function Qp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ho(e))}function Ea(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jh(e,t,a,r),t=t.sibling}function Jh(e,t,a,r){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Ea(e,t,a,r),n&2048&&Go(9,t);break;case 1:Ea(e,t,a,r);break;case 3:Ea(e,t,a,r),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ho(e)));break;case 12:if(n&2048){Ea(e,t,a,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(u){Oe(t,t.return,u)}}else Ea(e,t,a,r);break;case 31:Ea(e,t,a,r);break;case 13:Ea(e,t,a,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Ea(e,t,a,r):go(e,t):i._visibility&2?Ea(e,t,a,r):(i._visibility|=2,Li(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),n&2048&&Gp(o,t);break;case 24:Ea(e,t,a,r),n&2048&&Qp(t.alternate,t);break;default:Ea(e,t,a,r)}}function Li(e,t,a,r,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,l=a,u=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Li(i,o,l,u,n),Go(8,o);break;case 23:break;case 22:var f=o.stateNode;o.memoizedState!==null?f._visibility&2?Li(i,o,l,u,n):go(i,o):(f._visibility|=2,Li(i,o,l,u,n)),n&&p&2048&&Gp(o.alternate,o);break;case 24:Li(i,o,l,u,n),n&&p&2048&&Qp(o.alternate,o);break;default:Li(i,o,l,u,n)}t=t.sibling}}function go(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,n=r.flags;switch(r.tag){case 22:go(a,r),n&2048&&Gp(r.alternate,r);break;case 24:go(a,r),n&2048&&Qp(r.alternate,r);break;default:go(a,r)}t=t.sibling}}var io=8192;function Oi(e,t,a){if(e.subtreeFlags&io)for(e=e.child;e!==null;)Ph(e,t,a),e=e.sibling}function Ph(e,t,a){switch(e.tag){case 26:Oi(e,t,a),e.flags&io&&e.memoizedState!==null&&g1(a,Ma,e.memoizedState,e.memoizedProps);break;case 5:Oi(e,t,a);break;case 3:case 4:var r=Ma;Ma=hs(e.stateNode.containerInfo),Oi(e,t,a),Ma=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=io,io=16777216,Oi(e,t,a),io=r):Oi(e,t,a));break;default:Oi(e,t,a)}}function Fh(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 Fn(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];wt=r,Wh(r,e)}Fh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ih(e),e=e.sibling}function Ih(e){switch(e.tag){case 0:case 11:case 15:Fn(e),e.flags&2048&&Gr(9,e,e.return);break;case 3:Fn(e);break;case 12:Fn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Gl(e)):Fn(e);break;default:Fn(e)}}function Gl(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];wt=r,Wh(r,e)}Fh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gr(8,t,t.return),Gl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Gl(t));break;default:Gl(t)}e=e.sibling}}function Wh(e,t){for(;wt!==null;){var a=wt;switch(a.tag){case 0:case 11:case 15:Gr(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:Ho(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,wt=r;else e:for(a=e;wt!==null;){r=wt;var n=r.sibling,i=r.return;if(Yh(r),r===a){wt=null;break e}if(n!==null){n.return=i,wt=n;break e}wt=i}}}var Ay={getCacheForType:function(e){var t=Ct(ut),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Ct(ut).controller.signal}},Ry=typeof WeakMap=="function"?WeakMap:Map,Ae=0,Ge=null,ke=null,Ne=0,Be=0,It=null,qr=!1,_n=!1,Yp=!1,cr=0,it=0,Qr=0,oi=0,Xp=0,ta=0,dn=0,ho=null,Yt=null,Yu=!1,As=0,eb=0,cs=1/0,us=null,Ur=null,ht=0,Dr=null,mn=null,ir=0,Xu=0,$u=null,tb=null,bo=0,Vu=null;function na(){return(Ae&2)!==0&&Ne!==0?Ne&-Ne:me.T!==null?Vp():ug()}function ab(){if(ta===0)if((Ne&536870912)===0||Se){var e=gl;gl<<=1,(gl&3932160)===0&&(gl=262144),ta=e}else ta=536870912;return e=la.current,e!==null&&(e.flags|=32),ta}function Xt(e,t,a){(e===Ge&&(Be===2||Be===9)||e.cancelPendingCommit!==null)&&(fn(e,0),Er(e,Ne,ta,!1)),Bo(e,a),((Ae&2)===0||e!==Ge)&&(e===Ge&&((Ae&2)===0&&(oi|=a),it===4&&Er(e,Ne,ta,!1)),ja(e))}function rb(e,t,a){if((Ae&6)!==0)throw Error(D(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Do(e,t),n=r?By(e,t):au(e,t,!0),i=r;do{if(n===0){_n&&!r&&Er(e,t,0,!1);break}else{if(a=e.current.alternate,i&&!Uy(a)){n=au(e,t,!1),i=!1;continue}if(n===2){if(i=t,e.errorRecoveryDisabledLanes&i)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;n=ho;var u=l.current.memoizedState.isDehydrated;if(u&&(fn(l,o).flags|=256),o=au(l,o,!1),o!==2){if(Yp&&!u){l.errorRecoveryDisabledLanes|=i,oi|=i,n=4;break e}i=Yt,Yt=n,i!==null&&(Yt===null?Yt=i:Yt.push.apply(Yt,i))}n=o}if(i=!1,n!==2)continue}}if(n===1){fn(e,0),Er(e,t,0,!0);break}e:{switch(r=e,i=n,i){case 0:case 1:throw Error(D(345));case 4:if((t&4194048)!==t)break;case 6:Er(r,t,ta,!qr);break e;case 2:Yt=null;break;case 3:case 5:break;default:throw Error(D(329))}if((t&62914560)===t&&(n=As+300-aa(),10<n)){if(Er(r,t,ta,!qr),_s(r,0,!0)!==0)break e;ir=t,r.timeoutHandle=kb(_f.bind(null,r,a,Yt,us,Yu,t,ta,oi,dn,qr,i,"Throttled",-0,0),n);break e}_f(r,a,Yt,us,Yu,t,ta,oi,dn,qr,i,null,-0,0)}}break}while(!0);ja(e)}function _f(e,t,a,r,n,i,o,l,u,p,f,b,m,h){if(e.timeoutHandle=-1,b=t.subtreeFlags,b&8192||(b&16785408)===16785408){b={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:er},Ph(t,i,b);var w=(i&62914560)===i?As-aa():(i&4194048)===i?eb-aa():0;if(w=h1(b,w),w!==null){ir=i,e.cancelPendingCommit=w(kf.bind(null,e,t,i,a,r,n,o,l,u,f,b,null,m,h)),Er(e,i,o,!p);return}}kf(e,t,i,a,r,n,o,l,u)}function Uy(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 n=a[r],i=n.getSnapshot;n=n.value;try{if(!oa(i(),n))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 Er(e,t,a,r){t&=~Xp,t&=~oi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var n=t;0<n;){var i=31-ia(n),o=1<<i;r[i]=-1,n&=~o}a!==0&&lg(e,a,t)}function Rs(){return(Ae&6)===0?(Qo(0,!1),!1):!0}function $p(){if(ke!==null){if(Be===0)var e=ke.return;else e=ke,tr=hi=null,Tp(e),an=null,So=0,e=ke;for(;e!==null;)Bh(e.alternate,e),e=e.return;ke=null}}function fn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Iy(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ir=0,$p(),Ge=e,ke=a=ar(e.current,null),Ne=t,Be=0,It=null,qr=!1,_n=Do(e,t),Yp=!1,dn=ta=Xp=oi=Qr=it=0,Yt=ho=null,Yu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var n=31-ia(r),i=1<<n;t|=e[n],r&=~i}return cr=t,Ss(),a}function ib(e,t){he=null,me.H=qo,t===yn||t===qs?(t=Im(),Be=3):t===kp?(t=Im(),Be=4):Be=t===Hp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,ke===null&&(it=1,os(e,ba(t,e.current)))}function nb(){var e=la.current;return e===null?!0:(Ne&4194048)===Ne?wa===null:(Ne&62914560)===Ne||(Ne&536870912)!==0?e===wa:!1}function ob(){var e=me.H;return me.H=qo,e===null?qo:e}function lb(){var e=me.A;return me.A=Ay,e}function ps(){it=4,qr||(Ne&4194048)!==Ne&&la.current!==null||(_n=!0),(Qr&134217727)===0&&(oi&134217727)===0||Ge===null||Er(Ge,Ne,ta,!1)}function au(e,t,a){var r=Ae;Ae|=2;var n=ob(),i=lb();(Ge!==e||Ne!==t)&&(us=null,fn(e,t)),t=!1;var o=it;e:do try{if(Be!==0&&ke!==null){var l=ke,u=It;switch(Be){case 8:$p(),o=6;break e;case 3:case 2:case 9:case 6:la.current===null&&(t=!0);var p=Be;if(Be=0,It=null,Fi(e,l,u,p),a&&_n){o=0;break e}break;default:p=Be,Be=0,It=null,Fi(e,l,u,p)}}Dy(),o=it;break}catch(f){ib(e,f)}while(!0);return t&&e.shellSuspendCounter++,tr=hi=null,Ae=r,me.H=n,me.A=i,ke===null&&(Ge=null,Ne=0,Ss()),o}function Dy(){for(;ke!==null;)sb(ke)}function By(e,t){var a=Ae;Ae|=2;var r=ob(),n=lb();Ge!==e||Ne!==t?(us=null,cs=aa()+500,fn(e,t)):_n=Do(e,t);e:do try{if(Be!==0&&ke!==null){t=ke;var i=It;t:switch(Be){case 1:Be=0,It=null,Fi(e,t,i,1);break;case 2:case 9:if(Fm(i)){Be=0,It=null,xf(t);break}t=function(){Be!==2&&Be!==9||Ge!==e||(Be=7),ja(e)},i.then(t,t);break e;case 3:Be=7;break e;case 4:Be=5;break e;case 7:Fm(i)?(Be=0,It=null,xf(t)):(Be=0,It=null,Fi(e,t,i,7));break;case 5:var o=null;switch(ke.tag){case 26:o=ke.memoizedState;case 5:case 27:var l=ke;if(o?Eb(o):l.stateNode.complete){Be=0,It=null;var u=l.sibling;if(u!==null)ke=u;else{var p=l.return;p!==null?(ke=p,Us(p)):ke=null}break t}}Be=0,It=null,Fi(e,t,i,5);break;case 6:Be=0,It=null,Fi(e,t,i,6);break;case 8:$p(),it=6;break e;default:throw Error(D(462))}}Oy();break}catch(f){ib(e,f)}while(!0);return tr=hi=null,me.H=r,me.A=n,Ae=a,ke!==null?0:(Ge=null,Ne=0,Ss(),it)}function Oy(){for(;ke!==null&&!o0();)sb(ke)}function sb(e){var t=Dh(e.alternate,e,cr);e.memoizedProps=e.pendingProps,t===null?Us(e):ke=t}function xf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=gf(a,t,t.pendingProps,t.type,void 0,Ne);break;case 11:t=gf(a,t,t.pendingProps,t.type.render,t.ref,Ne);break;case 5:Tp(t);default:Bh(a,t),t=ke=Bg(t,cr),t=Dh(a,t,cr)}e.memoizedProps=e.pendingProps,t===null?Us(e):ke=t}function Fi(e,t,a,r){tr=hi=null,Tp(t),an=null,So=0;var n=t.return;try{if(Sy(e,n,t,a,Ne)){it=1,os(e,ba(a,e.current)),ke=null;return}}catch(i){if(n!==null)throw ke=n,i;it=1,os(e,ba(a,e.current)),ke=null;return}t.flags&32768?(Se||r===1?e=!0:_n||(Ne&536870912)!==0?e=!1:(qr=e=!0,(r===2||r===9||r===3||r===6)&&(r=la.current,r!==null&&r.tag===13&&(r.flags|=16384))),cb(t,e)):Us(t)}function Us(e){var t=e;do{if((t.flags&32768)!==0){cb(t,qr);return}e=t.return;var a=Ey(t.alternate,t,cr);if(a!==null){ke=a;return}if(t=t.sibling,t!==null){ke=t;return}ke=t=e}while(t!==null);it===0&&(it=5)}function cb(e,t){do{var a=My(e.alternate,e);if(a!==null){a.flags&=32767,ke=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){ke=e;return}ke=e=a}while(e!==null);it=6,ke=null}function kf(e,t,a,r,n,i,o,l,u){e.cancelPendingCommit=null;do Ds();while(ht!==0);if((Ae&6)!==0)throw Error(D(327));if(t!==null){if(t===e.current)throw Error(D(177));if(i=t.lanes|t.childLanes,i|=hp,h0(e,a,i,o,l,u),e===Ge&&(ke=Ge=null,Ne=0),mn=t,Dr=e,ir=a,Xu=i,$u=n,tb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Gy(Jl,function(){return fb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=me.T,me.T=null,n=Re.p,Re.p=2,o=Ae,Ae|=4;try{Ty(e,t,a)}finally{Ae=o,Re.p=n,me.T=r}}ht=1,ub(),pb(),db()}}function ub(){if(ht===1){ht=0;var e=Dr,t=mn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null;var r=Re.p;Re.p=2;var n=Ae;Ae|=4;try{Zh(t,e);var i=Pu,o=Eg(e.containerInfo),l=i.focusedElem,u=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&qg(l.ownerDocument.documentElement,l)){if(u!==null&&gp(l)){var p=u.start,f=u.end;if(f===void 0&&(f=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(f,l.value.length);else{var b=l.ownerDocument||document,m=b&&b.defaultView||window;if(m.getSelection){var h=m.getSelection(),w=l.textContent.length,E=Math.min(u.start,w),R=u.end===void 0?E:Math.min(u.end,w);!h.extend&&E>R&&(o=R,R=E,E=o);var d=Xm(l,E),c=Xm(l,R);if(d&&c&&(h.rangeCount!==1||h.anchorNode!==d.node||h.anchorOffset!==d.offset||h.focusNode!==c.node||h.focusOffset!==c.offset)){var g=b.createRange();g.setStart(d.node,d.offset),h.removeAllRanges(),E>R?(h.addRange(g),h.extend(c.node,c.offset)):(g.setEnd(c.node,c.offset),h.addRange(g))}}}}for(b=[],h=l;h=h.parentNode;)h.nodeType===1&&b.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<b.length;l++){var v=b[l];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}ws=!!Ju,Pu=Ju=null}finally{Ae=n,Re.p=r,me.T=a}}e.current=t,ht=2}}function pb(){if(ht===2){ht=0;var e=Dr,t=mn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=me.T,me.T=null;var r=Re.p;Re.p=2;var n=Ae;Ae|=4;try{Qh(e,t.alternate,t)}finally{Ae=n,Re.p=r,me.T=a}}ht=3}}function db(){if(ht===4||ht===3){ht=0,l0();var e=Dr,t=mn,a=ir,r=tb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ht=5:(ht=0,mn=Dr=null,mb(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(Ur=null),sp(a),t=t.stateNode,ra&&typeof ra.onCommitFiberRoot=="function")try{ra.onCommitFiberRoot(Uo,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=me.T,n=Re.p,Re.p=2,me.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];i(l.value,{componentStack:l.stack})}}finally{me.T=t,Re.p=n}}(ir&3)!==0&&Ds(),ja(e),n=e.pendingLanes,(a&261930)!==0&&(n&42)!==0?e===Vu?bo++:(bo=0,Vu=e):bo=0,Qo(0,!1)}}function mb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ho(t)))}function Ds(){return ub(),pb(),db(),fb()}function fb(){if(ht!==5)return!1;var e=Dr,t=Xu;Xu=0;var a=sp(ir),r=me.T,n=Re.p;try{Re.p=32>a?32:a,me.T=null,a=$u,$u=null;var i=Dr,o=ir;if(ht=0,mn=Dr=null,ir=0,(Ae&6)!==0)throw Error(D(331));var l=Ae;if(Ae|=4,Ih(i.current),Jh(i,i.current,o,a),Ae=l,Qo(0,!1),ra&&typeof ra.onPostCommitFiberRoot=="function")try{ra.onPostCommitFiberRoot(Uo,i)}catch{}return!0}finally{Re.p=n,me.T=r,mb(e,t)}}function Nf(e,t,a){t=ba(a,t),t=Hu(e.stateNode,t,2),e=Rr(e,t,2),e!==null&&(Bo(e,2),ja(e))}function Oe(e,t,a){if(e.tag===3)Nf(e,e,a);else for(;t!==null;){if(t.tag===3){Nf(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ur===null||!Ur.has(r))){e=ba(a,e),a=Mh(2),r=Rr(t,a,2),r!==null&&(Th(a,r,t,e),Bo(r,2),ja(r));break}}t=t.return}}function ru(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Ry;var n=new Set;r.set(t,n)}else n=r.get(t),n===void 0&&(n=new Set,r.set(t,n));n.has(a)||(Yp=!0,n.add(a),e=Ly.bind(null,e,t,a),t.then(e,e))}function Ly(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(Ne&a)===a&&(it===4||it===3&&(Ne&62914560)===Ne&&300>aa()-As?(Ae&2)===0&&fn(e,0):Xp|=a,dn===Ne&&(dn=0)),ja(e)}function gb(e,t){t===0&&(t=og()),e=gi(e,t),e!==null&&(Bo(e,t),ja(e))}function Hy(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),gb(e,a)}function jy(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,n=e.memoizedState;n!==null&&(a=n.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(D(314))}r!==null&&r.delete(t),gb(e,a)}function Gy(e,t){return op(e,t)}var ds=null,Hi=null,Zu=!1,ms=!1,iu=!1,Mr=0;function ja(e){e!==Hi&&e.next===null&&(Hi===null?ds=Hi=e:Hi=Hi.next=e),ms=!0,Zu||(Zu=!0,Yy())}function Qo(e,t){if(!iu&&ms){iu=!0;do for(var a=!1,r=ds;r!==null;){if(!t)if(e!==0){var n=r.pendingLanes;if(n===0)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-ia(42|e)+1)-1,i&=n&~(o&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,Sf(r,i))}else i=Ne,i=_s(r,r===Ge?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(i&3)===0||Do(r,i)||(a=!0,Sf(r,i));r=r.next}while(a);iu=!1}}function Qy(){hb()}function hb(){ms=Zu=!1;var e=0;Mr!==0&&Fy()&&(e=Mr);for(var t=aa(),a=null,r=ds;r!==null;){var n=r.next,i=bb(r,t);i===0?(r.next=null,a===null?ds=n:a.next=n,n===null&&(Hi=a)):(a=r,(e!==0||(i&3)!==0)&&(ms=!0)),r=n}ht!==0&&ht!==5||Qo(e,!1),Mr!==0&&(Mr=0)}function bb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,n=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-ia(i),l=1<<o,u=n[o];u===-1?((l&a)===0||(l&r)!==0)&&(n[o]=g0(l,t)):u<=t&&(e.expiredLanes|=l),i&=~l}if(t=Ge,a=Ne,a=_s(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Be===2||Be===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Rc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Do(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Rc(r),sp(a)){case 2:case 8:a=ig;break;case 32:a=Jl;break;case 268435456:a=ng;break;default:a=Jl}return r=vb.bind(null,e),a=op(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Rc(r),e.callbackPriority=2,e.callbackNode=null,2}function vb(e,t){if(ht!==0&&ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ds()&&e.callbackNode!==a)return null;var r=Ne;return r=_s(e,e===Ge?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(rb(e,r,t),bb(e,aa()),e.callbackNode!=null&&e.callbackNode===a?vb.bind(null,e):null)}function Sf(e,t){if(Ds())return null;rb(e,t,!0)}function Yy(){Wy(function(){(Ae&6)!==0?op(rg,Qy):hb()})}function Vp(){if(Mr===0){var e=cn;e===0&&(e=fl,fl<<=1,(fl&261888)===0&&(fl=256)),Mr=e}return Mr}function Cf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Al(""+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 Xy(e,t,a,r,n){if(t==="submit"&&a&&a.stateNode===n){var i=Cf((n[$t]||null).action),o=r.submitter;o&&(t=(t=o[$t]||null)?Cf(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var l=new xs("action","action",null,r,n);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Mr!==0){var u=o?qf(n,o):new FormData(n);Ou(a,{pending:!0,data:u,method:n.method,action:i},null,u)}}else typeof i=="function"&&(l.preventDefault(),u=o?qf(n,o):new FormData(n),Ou(a,{pending:!0,data:u,method:n.method,action:i},i,u))},currentTarget:n}]})}}for(Cl=0;Cl<Su.length;Cl++)ql=Su[Cl],Ef=ql.toLowerCase(),Mf=ql[0].toUpperCase()+ql.slice(1),Ta(Ef,"on"+Mf);var ql,Ef,Mf,Cl;Ta(Tg,"onAnimationEnd");Ta(zg,"onAnimationIteration");Ta(Ag,"onAnimationStart");Ta("dblclick","onDoubleClick");Ta("focusin","onFocus");Ta("focusout","onBlur");Ta(sy,"onTransitionRun");Ta(cy,"onTransitionStart");Ta(uy,"onTransitionCancel");Ta(Rg,"onTransitionEnd");ln("onMouseEnter",["mouseout","mouseover"]);ln("onMouseLeave",["mouseout","mouseover"]);ln("onPointerEnter",["pointerout","pointerover"]);ln("onPointerLeave",["pointerout","pointerover"]);di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));di("onBeforeInput",["compositionend","keypress","textInput","paste"]);di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eo="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(" "),$y=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Eo));function wb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],n=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],u=l.instance,p=l.currentTarget;if(l=l.listener,u!==i&&n.isPropagationStopped())break e;i=l,n.currentTarget=p;try{i(n)}catch(f){Fl(f)}n.currentTarget=null,i=u}else for(o=0;o<r.length;o++){if(l=r[o],u=l.instance,p=l.currentTarget,l=l.listener,u!==i&&n.isPropagationStopped())break e;i=l,n.currentTarget=p;try{i(n)}catch(f){Fl(f)}n.currentTarget=null,i=u}}}}function xe(e,t){var a=t[bu];a===void 0&&(a=t[bu]=new Set);var r=e+"__bubble";a.has(r)||(yb(t,e,2,!1),a.add(r))}function nu(e,t,a){var r=0;t&&(r|=4),yb(a,e,r,t)}var El="_reactListening"+Math.random().toString(36).slice(2);function Zp(e){if(!e[El]){e[El]=!0,pg.forEach(function(a){a!=="selectionchange"&&($y.has(a)||nu(a,!1,e),nu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[El]||(t[El]=!0,nu("selectionchange",!1,t))}}function yb(e,t,a,r){switch(Rb(t)){case 2:var n=w1;break;case 8:n=y1;break;default:n=Fp}a=n.bind(null,t,a,e),n=void 0,!xu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),r?n!==void 0?e.addEventListener(t,a,{capture:!0,passive:n}):e.addEventListener(t,a,!0):n!==void 0?e.addEventListener(t,a,{passive:n}):e.addEventListener(t,a,!1)}function ou(e,t,a,r,n){var i=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===n)break;if(o===4)for(o=r.return;o!==null;){var u=o.tag;if((u===3||u===4)&&o.stateNode.containerInfo===n)return;o=o.return}for(;l!==null;){if(o=Qi(l),o===null)return;if(u=o.tag,u===5||u===6||u===26||u===27){r=i=o;continue e}l=l.parentNode}}r=r.return}wg(function(){var p=i,f=pp(a),b=[];e:{var m=Ug.get(e);if(m!==void 0){var h=xs,w=e;switch(e){case"keypress":if(Ul(a)===0)break e;case"keydown":case"keyup":h=j0;break;case"focusin":w="focus",h=Lc;break;case"focusout":w="blur",h=Lc;break;case"beforeblur":case"afterblur":h=Lc;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=Dm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=E0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Y0;break;case Tg:case zg:case Ag:h=z0;break;case Rg:h=$0;break;case"scroll":case"scrollend":h=C0;break;case"wheel":h=Z0;break;case"copy":case"cut":case"paste":h=R0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Om;break;case"toggle":case"beforetoggle":h=J0}var E=(t&4)!==0,R=!E&&(e==="scroll"||e==="scrollend"),d=E?m!==null?m+"Capture":null:m;E=[];for(var c=p,g;c!==null;){var v=c;if(g=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||g===null||d===null||(v=yo(c,d),v!=null&&E.push(Mo(c,v,g))),R)break;c=c.return}0<E.length&&(m=new h(m,w,null,a,f),b.push({event:m,listeners:E}))}}if((t&7)===0){e:{if(m=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",m&&a!==_u&&(w=a.relatedTarget||a.fromElement)&&(Qi(w)||w[bn]))break e;if((h||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,h?(w=a.relatedTarget||a.toElement,h=p,w=w?Qi(w):null,w!==null&&(R=Ro(w),E=w.tag,w!==R||E!==5&&E!==27&&E!==6)&&(w=null)):(h=null,w=p),h!==w)){if(E=Dm,v="onMouseLeave",d="onMouseEnter",c="mouse",(e==="pointerout"||e==="pointerover")&&(E=Om,v="onPointerLeave",d="onPointerEnter",c="pointer"),R=h==null?m:ao(h),g=w==null?m:ao(w),m=new E(v,c+"leave",h,a,f),m.target=R,m.relatedTarget=g,v=null,Qi(f)===p&&(E=new E(d,c+"enter",w,a,f),E.target=g,E.relatedTarget=R,v=E),R=v,h&&w)t:{for(E=Vy,d=h,c=w,g=0,v=d;v;v=E(v))g++;v=0;for(var S=c;S;S=E(S))v++;for(;0<g-v;)d=E(d),g--;for(;0<v-g;)c=E(c),v--;for(;g--;){if(d===c||c!==null&&d===c.alternate){E=d;break t}d=E(d),c=E(c)}E=null}else E=null;h!==null&&Tf(b,m,h,E,!1),w!==null&&R!==null&&Tf(b,R,w,E,!0)}}e:{if(m=p?ao(p):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var M=Gm;else if(jm(m))if(Sg)M=ny;else{M=ry;var T=ay}else h=m.nodeName,!h||h.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?p&&up(p.elementType)&&(M=Gm):M=iy;if(M&&(M=M(e,p))){Ng(b,M,a,f);break e}T&&T(e,m,p),e==="focusout"&&p&&m.type==="number"&&p.memoizedProps.value!=null&&yu(m,"number",m.value)}switch(T=p?ao(p):window,e){case"focusin":(jm(T)||T.contentEditable==="true")&&($i=T,ku=p,lo=null);break;case"focusout":lo=ku=$i=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,$m(b,a,f);break;case"selectionchange":if(ly)break;case"keydown":case"keyup":$m(b,a,f)}var U;if(fp)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else Xi?xg(e,a)&&(j="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(j="onCompositionStart");j&&(_g&&a.locale!=="ko"&&(Xi||j!=="onCompositionStart"?j==="onCompositionEnd"&&Xi&&(U=yg()):(Cr=f,dp="value"in Cr?Cr.value:Cr.textContent,Xi=!0)),T=fs(p,j),0<T.length&&(j=new Bm(j,e,null,a,f),b.push({event:j,listeners:T}),U?j.data=U:(U=kg(a),U!==null&&(j.data=U)))),(U=F0?I0(e,a):W0(e,a))&&(j=fs(p,"onBeforeInput"),0<j.length&&(T=new Bm("onBeforeInput","beforeinput",null,a,f),b.push({event:T,listeners:j}),T.data=U)),Xy(b,e,p,a,f)}wb(b,t)})}function Mo(e,t,a){return{instance:e,listener:t,currentTarget:a}}function fs(e,t){for(var a=t+"Capture",r=[];e!==null;){var n=e,i=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||i===null||(n=yo(e,a),n!=null&&r.unshift(Mo(e,n,i)),n=yo(e,t),n!=null&&r.push(Mo(e,n,i))),e.tag===3)return r;e=e.return}return[]}function Vy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tf(e,t,a,r,n){for(var i=t._reactName,o=[];a!==null&&a!==r;){var l=a,u=l.alternate,p=l.stateNode;if(l=l.tag,u!==null&&u===r)break;l!==5&&l!==26&&l!==27||p===null||(u=p,n?(p=yo(a,i),p!=null&&o.unshift(Mo(a,p,u))):n||(p=yo(a,i),p!=null&&o.push(Mo(a,p,u)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var Zy=/\r\n?/g,Ky=/\u0000|\uFFFD/g;function zf(e){return(typeof e=="string"?e:""+e).replace(Zy,`
9
+ `).replace(Ky,"")}function _b(e,t){return t=zf(t),zf(e)===t}function He(e,t,a,r,n,i){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":bl(e,"class",r);break;case"tabIndex":bl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":bl(e,a,r);break;case"style":vg(e,r,i);break;case"data":if(t!=="object"){bl(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=Al(""+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 i=="function"&&(a==="formAction"?(t!=="input"&&He(e,t,"name",n.name,n,null),He(e,t,"formEncType",n.formEncType,n,null),He(e,t,"formMethod",n.formMethod,n,null),He(e,t,"formTarget",n.formTarget,n,null)):(He(e,t,"encType",n.encType,n,null),He(e,t,"method",n.method,n,null),He(e,t,"target",n.target,n,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Al(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=er);break;case"onScroll":r!=null&&xe("scroll",e);break;case"onScrollEnd":r!=null&&xe("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(D(61));if(a=r.__html,a!=null){if(n.children!=null)throw Error(D(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=Al(""+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":xe("beforetoggle",e),xe("toggle",e),zl(e,"popover",r);break;case"xlinkActuate":Va(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Va(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Va(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Va(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Va(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Va(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Va(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Va(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Va(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":zl(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=N0.get(a)||a,zl(e,a,r))}}function Ku(e,t,a,r,n,i){switch(a){case"style":vg(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(D(61));if(a=r.__html,a!=null){if(n.children!=null)throw Error(D(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&&xe("scroll",e);break;case"onScrollEnd":r!=null&&xe("scrollend",e);break;case"onClick":r!=null&&(e.onclick=er);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(n=a.endsWith("Capture"),t=a.slice(2,n?a.length-7:void 0),i=e[$t]||null,i=i!=null?i[a]:null,typeof i=="function"&&e.removeEventListener(t,i,n),typeof r=="function")){typeof i!="function"&&i!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,n);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):zl(e,a,r)}}}function qt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xe("error",e),xe("load",e);var r=!1,n=!1,i;for(i in a)if(a.hasOwnProperty(i)){var o=a[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(D(137,t));default:He(e,t,i,o,a,null)}}n&&He(e,t,"srcSet",a.srcSet,a,null),r&&He(e,t,"src",a.src,a,null);return;case"input":xe("invalid",e);var l=i=o=n=null,u=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var f=a[r];if(f!=null)switch(r){case"name":n=f;break;case"type":o=f;break;case"checked":u=f;break;case"defaultChecked":p=f;break;case"value":i=f;break;case"defaultValue":l=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(D(137,t));break;default:He(e,t,r,f,a,null)}}gg(e,i,l,u,p,o,n,!1);return;case"select":xe("invalid",e),r=o=i=null;for(n in a)if(a.hasOwnProperty(n)&&(l=a[n],l!=null))switch(n){case"value":i=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:He(e,t,n,l,a,null)}t=i,a=o,e.multiple=!!r,t!=null?Wi(e,!!r,t,!1):a!=null&&Wi(e,!!r,a,!0);return;case"textarea":xe("invalid",e),i=n=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":n=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(D(91));break;default:He(e,t,o,l,a,null)}bg(e,r,n,i);return;case"option":for(u in a)a.hasOwnProperty(u)&&(r=a[u],r!=null)&&(u==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":He(e,t,u,r,a,null));return;case"dialog":xe("beforetoggle",e),xe("toggle",e),xe("cancel",e),xe("close",e);break;case"iframe":case"object":xe("load",e);break;case"video":case"audio":for(r=0;r<Eo.length;r++)xe(Eo[r],e);break;case"image":xe("error",e),xe("load",e);break;case"details":xe("toggle",e);break;case"embed":case"source":case"link":xe("error",e),xe("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(D(137,t));default:He(e,t,p,r,a,null)}return;default:if(up(t)){for(f in a)a.hasOwnProperty(f)&&(r=a[f],r!==void 0&&Ku(e,t,f,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&He(e,t,l,r,a,null))}function Jy(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 n=null,i=null,o=null,l=null,u=null,p=null,f=null;for(h in a){var b=a[h];if(a.hasOwnProperty(h)&&b!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":u=b;default:r.hasOwnProperty(h)||He(e,t,h,null,r,b)}}for(var m in r){var h=r[m];if(b=a[m],r.hasOwnProperty(m)&&(h!=null||b!=null))switch(m){case"type":i=h;break;case"name":n=h;break;case"checked":p=h;break;case"defaultChecked":f=h;break;case"value":o=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(D(137,t));break;default:h!==b&&He(e,t,m,h,r,b)}}wu(e,o,l,u,p,f,i,n);return;case"select":h=o=l=m=null;for(i in a)if(u=a[i],a.hasOwnProperty(i)&&u!=null)switch(i){case"value":break;case"multiple":h=u;default:r.hasOwnProperty(i)||He(e,t,i,null,r,u)}for(n in r)if(i=r[n],u=a[n],r.hasOwnProperty(n)&&(i!=null||u!=null))switch(n){case"value":m=i;break;case"defaultValue":l=i;break;case"multiple":o=i;default:i!==u&&He(e,t,n,i,r,u)}t=l,a=o,r=h,m!=null?Wi(e,!!a,m,!1):!!r!=!!a&&(t!=null?Wi(e,!!a,t,!0):Wi(e,!!a,a?[]:"",!1));return;case"textarea":h=m=null;for(l in a)if(n=a[l],a.hasOwnProperty(l)&&n!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:He(e,t,l,null,r,n)}for(o in r)if(n=r[o],i=a[o],r.hasOwnProperty(o)&&(n!=null||i!=null))switch(o){case"value":m=n;break;case"defaultValue":h=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(D(91));break;default:n!==i&&He(e,t,o,n,r,i)}hg(e,m,h);return;case"option":for(var w in a)m=a[w],a.hasOwnProperty(w)&&m!=null&&!r.hasOwnProperty(w)&&(w==="selected"?e.selected=!1:He(e,t,w,null,r,m));for(u in r)m=r[u],h=a[u],r.hasOwnProperty(u)&&m!==h&&(m!=null||h!=null)&&(u==="selected"?e.selected=m&&typeof m!="function"&&typeof m!="symbol":He(e,t,u,m,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 E in a)m=a[E],a.hasOwnProperty(E)&&m!=null&&!r.hasOwnProperty(E)&&He(e,t,E,null,r,m);for(p in r)if(m=r[p],h=a[p],r.hasOwnProperty(p)&&m!==h&&(m!=null||h!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(D(137,t));break;default:He(e,t,p,m,r,h)}return;default:if(up(t)){for(var R in a)m=a[R],a.hasOwnProperty(R)&&m!==void 0&&!r.hasOwnProperty(R)&&Ku(e,t,R,void 0,r,m);for(f in r)m=r[f],h=a[f],!r.hasOwnProperty(f)||m===h||m===void 0&&h===void 0||Ku(e,t,f,m,r,h);return}}for(var d in a)m=a[d],a.hasOwnProperty(d)&&m!=null&&!r.hasOwnProperty(d)&&He(e,t,d,null,r,m);for(b in r)m=r[b],h=a[b],!r.hasOwnProperty(b)||m===h||m==null&&h==null||He(e,t,b,m,r,h)}function Af(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Py(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var n=a[r],i=n.transferSize,o=n.initiatorType,l=n.duration;if(i&&l&&Af(o)){for(o=0,l=n.responseEnd,r+=1;r<a.length;r++){var u=a[r],p=u.startTime;if(p>l)break;var f=u.transferSize,b=u.initiatorType;f&&Af(b)&&(u=u.responseEnd,o+=f*(u<l?1:(l-p)/(u-p)))}if(--r,t+=8*(i+o)/(n.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 Ju=null,Pu=null;function gs(e){return e.nodeType===9?e:e.ownerDocument}function Rf(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 xb(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 Fu(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 lu=null;function Fy(){var e=window.event;return e&&e.type==="popstate"?e===lu?!1:(lu=e,!0):(lu=null,!1)}var kb=typeof setTimeout=="function"?setTimeout:void 0,Iy=typeof clearTimeout=="function"?clearTimeout:void 0,Uf=typeof Promise=="function"?Promise:void 0,Wy=typeof queueMicrotask=="function"?queueMicrotask:typeof Uf<"u"?function(e){return Uf.resolve(null).then(e).catch(e1)}:kb;function e1(e){setTimeout(function(){throw e})}function Xr(e){return e==="head"}function Df(e,t){var a=t,r=0;do{var n=a.nextSibling;if(e.removeChild(a),n&&n.nodeType===8)if(a=n.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(n),hn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")vo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,vo(a);for(var i=a.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[Oo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=o}}else a==="body"&&vo(e.ownerDocument.body);a=n}while(a);hn(t)}function Bf(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 Iu(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":Iu(a),cp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function t1(e,t,a,r){for(;e.nodeType===1;){var n=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Oo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=ya(e.nextSibling),e===null)break}return null}function a1(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ya(e.nextSibling),e===null))return null;return e}function Nb(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ya(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$?"||e.data==="$~"}function ep(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function r1(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 ya(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 tp=null;function Of(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return ya(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Lf(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 Sb(e,t,a){switch(t=gs(a),e){case"html":if(e=t.documentElement,!e)throw Error(D(452));return e;case"head":if(e=t.head,!e)throw Error(D(453));return e;case"body":if(e=t.body,!e)throw Error(D(454));return e;default:throw Error(D(451))}}function vo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);cp(e)}var _a=new Map,Hf=new Set;function hs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ur=Re.d;Re.d={f:i1,r:n1,D:o1,C:l1,L:s1,m:c1,X:p1,S:u1,M:d1};function i1(){var e=ur.f(),t=Rs();return e||t}function n1(e){var t=vn(e);t!==null&&t.tag===5&&t.type==="form"?vh(t):ur.r(e)}var xn=typeof document>"u"?null:document;function Cb(e,t,a){var r=xn;if(r&&typeof t=="string"&&t){var n=ha(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof a=="string"&&(n+='[crossorigin="'+a+'"]'),Hf.has(n)||(Hf.add(n),e={rel:e,crossOrigin:a,href:t},r.querySelector(n)===null&&(t=r.createElement("link"),qt(t,"link",e),yt(t),r.head.appendChild(t)))}}function o1(e){ur.D(e),Cb("dns-prefetch",e,null)}function l1(e,t){ur.C(e,t),Cb("preconnect",e,t)}function s1(e,t,a){ur.L(e,t,a);var r=xn;if(r&&e&&t){var n='link[rel="preload"][as="'+ha(t)+'"]';t==="image"&&a&&a.imageSrcSet?(n+='[imagesrcset="'+ha(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(n+='[imagesizes="'+ha(a.imageSizes)+'"]')):n+='[href="'+ha(e)+'"]';var i=n;switch(t){case"style":i=gn(e);break;case"script":i=kn(e)}_a.has(i)||(e=Je({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),_a.set(i,e),r.querySelector(n)!==null||t==="style"&&r.querySelector(Yo(i))||t==="script"&&r.querySelector(Xo(i))||(t=r.createElement("link"),qt(t,"link",e),yt(t),r.head.appendChild(t)))}}function c1(e,t){ur.m(e,t);var a=xn;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+ha(r)+'"][href="'+ha(e)+'"]',i=n;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=kn(e)}if(!_a.has(i)&&(e=Je({rel:"modulepreload",href:e},t),_a.set(i,e),a.querySelector(n)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Xo(i)))return}r=a.createElement("link"),qt(r,"link",e),yt(r),a.head.appendChild(r)}}}function u1(e,t,a){ur.S(e,t,a);var r=xn;if(r&&e){var n=Ii(r).hoistableStyles,i=gn(e);t=t||"default";var o=n.get(i);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Yo(i)))l.loading=5;else{e=Je({rel:"stylesheet",href:e,"data-precedence":t},a),(a=_a.get(i))&&Kp(e,a);var u=o=r.createElement("link");yt(u),qt(u,"link",e),u._p=new Promise(function(p,f){u.onload=p,u.onerror=f}),u.addEventListener("load",function(){l.loading|=1}),u.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Ql(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},n.set(i,o)}}}function p1(e,t){ur.X(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,n=kn(e),i=r.get(n);i||(i=a.querySelector(Xo(n)),i||(e=Je({src:e,async:!0},t),(t=_a.get(n))&&Jp(e,t),i=a.createElement("script"),yt(i),qt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(n,i))}}function d1(e,t){ur.M(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,n=kn(e),i=r.get(n);i||(i=a.querySelector(Xo(n)),i||(e=Je({src:e,async:!0,type:"module"},t),(t=_a.get(n))&&Jp(e,t),i=a.createElement("script"),yt(i),qt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(n,i))}}function jf(e,t,a,r){var n=(n=Tr.current)?hs(n):null;if(!n)throw Error(D(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(n).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 i=Ii(n).hoistableStyles,o=i.get(e);if(o||(n=n.ownerDocument||n,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=n.querySelector(Yo(e)))&&!i._p&&(o.instance=i,o.state.loading=5),_a.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},_a.set(e,a),i||m1(n,e,a,o.state))),t&&r===null)throw Error(D(528,""));return o}if(t&&r!==null)throw Error(D(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(n).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(D(444,e))}}function gn(e){return'href="'+ha(e)+'"'}function Yo(e){return'link[rel="stylesheet"]['+e+"]"}function qb(e){return Je({},e,{"data-precedence":e.precedence,precedence:null})}function m1(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}),qt(t,"link",a),yt(t),e.head.appendChild(t))}function kn(e){return'[src="'+ha(e)+'"]'}function Xo(e){return"script[async]"+e}function Gf(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ha(a.href)+'"]');if(r)return t.instance=r,yt(r),r;var n=Je({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),yt(r),qt(r,"style",n),Ql(r,a.precedence,e),t.instance=r;case"stylesheet":n=gn(a.href);var i=e.querySelector(Yo(n));if(i)return t.state.loading|=4,t.instance=i,yt(i),i;r=qb(a),(n=_a.get(n))&&Kp(r,n),i=(e.ownerDocument||e).createElement("link"),yt(i);var o=i;return o._p=new Promise(function(l,u){o.onload=l,o.onerror=u}),qt(i,"link",r),t.state.loading|=4,Ql(i,a.precedence,e),t.instance=i;case"script":return i=kn(a.src),(n=e.querySelector(Xo(i)))?(t.instance=n,yt(n),n):(r=a,(n=_a.get(i))&&(r=Je({},a),Jp(r,n)),e=e.ownerDocument||e,n=e.createElement("script"),yt(n),qt(n,"link",r),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(D(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ql(r,a.precedence,e));return t.instance}function Ql(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=r.length?r[r.length-1]:null,i=n,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)i=l;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Kp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Jp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Yl=null;function Qf(e,t,a){if(Yl===null){var r=new Map,n=Yl=new Map;n.set(a,r)}else n=Yl,r=n.get(a),r||(r=new Map,n.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),n=0;n<a.length;n++){var i=a[n];if(!(i[Oo]||i[Nt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(i):r.set(o,[i])}}return r}function Yf(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function f1(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 Eb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function g1(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 n=gn(r.href),i=t.querySelector(Yo(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=bs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,yt(i);return}i=t.ownerDocument||t,r=qb(r),(n=_a.get(n))&&Kp(r,n),i=i.createElement("link"),yt(i);var o=i;o._p=new Promise(function(l,u){o.onload=l,o.onerror=u}),qt(i,"link",r),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=bs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var su=0;function h1(e,t){return e.stylesheets&&e.count===0&&Xl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Xl(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&su===0&&(su=62500*Py());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xl(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>su?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(n)}}:null}function bs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vs=null;function Xl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vs=new Map,t.forEach(b1,e),vs=null,bs.call(e))}function b1(e,t){if(!(t.state.loading&4)){var a=vs.get(e);if(a)var r=a.get(null);else{a=new Map,vs.set(e,a);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var o=n[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}n=t.instance,o=n.getAttribute("data-precedence"),i=a.get(o)||r,i===r&&a.set(null,n),a.set(o,n),this.count++,r=bs.bind(this),n.addEventListener("load",r),n.addEventListener("error",r),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var To={$$typeof:Wa,Provider:null,Consumer:null,_currentValue:ai,_currentValue2:ai,_threadCount:0};function v1(e,t,a,r,n,i,o,l,u){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=Uc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uc(0),this.hiddenUpdates=Uc(null),this.identifierPrefix=r,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function Mb(e,t,a,r,n,i,o,l,u,p,f,b){return e=new v1(e,t,a,o,u,p,f,b,l),t=1,i===!0&&(t|=24),i=ea(3,null,null,t),e.current=i,i.stateNode=e,t=_p(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:a,cache:t},Np(i),e}function Tb(e){return e?(e=Ki,e):Ki}function zb(e,t,a,r,n,i){n=Tb(n),r.context===null?r.context=n:r.pendingContext=n,r=Ar(t),r.payload={element:a},i=i===void 0?null:i,i!==null&&(r.callback=i),a=Rr(e,r,t),a!==null&&(Xt(a,e,t),co(a,e,t))}function Xf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Pp(e,t){Xf(e,t),(e=e.alternate)&&Xf(e,t)}function Ab(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&Xt(t,e,67108864),Pp(e,67108864)}}function $f(e){if(e.tag===13||e.tag===31){var t=na();t=lp(t);var a=gi(e,t);a!==null&&Xt(a,e,t),Pp(e,t)}}var ws=!0;function w1(e,t,a,r){var n=me.T;me.T=null;var i=Re.p;try{Re.p=2,Fp(e,t,a,r)}finally{Re.p=i,me.T=n}}function y1(e,t,a,r){var n=me.T;me.T=null;var i=Re.p;try{Re.p=8,Fp(e,t,a,r)}finally{Re.p=i,me.T=n}}function Fp(e,t,a,r){if(ws){var n=ap(r);if(n===null)ou(e,t,r,ys,a),Vf(e,r);else if(x1(n,e,t,a,r))r.stopPropagation();else if(Vf(e,r),t&4&&-1<_1.indexOf(e)){for(;n!==null;){var i=vn(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Wr(i.pendingLanes);if(o!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var u=1<<31-ia(o);l.entanglements[1]|=u,o&=~u}ja(i),(Ae&6)===0&&(cs=aa()+500,Qo(0,!1))}}break;case 31:case 13:l=gi(i,2),l!==null&&Xt(l,i,2),Rs(),Pp(i,2)}if(i=ap(r),i===null&&ou(e,t,r,ys,a),i===n)break;n=i}n!==null&&r.stopPropagation()}else ou(e,t,r,null,a)}}function ap(e){return e=pp(e),Ip(e)}var ys=null;function Ip(e){if(ys=null,e=Qi(e),e!==null){var t=Ro(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=If(t),e!==null)return e;e=null}else if(a===31){if(e=Wf(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 ys=e,null}function Rb(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(s0()){case rg:return 2;case ig:return 8;case Jl:case c0:return 32;case ng:return 268435456;default:return 32}default:return 32}}var rp=!1,Br=null,Or=null,Lr=null,zo=new Map,Ao=new Map,Nr=[],_1="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 Vf(e,t){switch(e){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Lr=null;break;case"pointerover":case"pointerout":zo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ao.delete(t.pointerId)}}function In(e,t,a,r,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:i,targetContainers:[n]},t!==null&&(t=vn(t),t!==null&&Ab(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function x1(e,t,a,r,n){switch(t){case"focusin":return Br=In(Br,e,t,a,r,n),!0;case"dragenter":return Or=In(Or,e,t,a,r,n),!0;case"mouseover":return Lr=In(Lr,e,t,a,r,n),!0;case"pointerover":var i=n.pointerId;return zo.set(i,In(zo.get(i)||null,e,t,a,r,n)),!0;case"gotpointercapture":return i=n.pointerId,Ao.set(i,In(Ao.get(i)||null,e,t,a,r,n)),!0}return!1}function Ub(e){var t=Qi(e.target);if(t!==null){var a=Ro(t);if(a!==null){if(t=a.tag,t===13){if(t=If(a),t!==null){e.blockedOn=t,Em(e.priority,function(){$f(a)});return}}else if(t===31){if(t=Wf(a),t!==null){e.blockedOn=t,Em(e.priority,function(){$f(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 $l(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ap(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);_u=r,a.target.dispatchEvent(r),_u=null}else return t=vn(a),t!==null&&Ab(t),e.blockedOn=a,!1;t.shift()}return!0}function Zf(e,t,a){$l(e)&&a.delete(t)}function k1(){rp=!1,Br!==null&&$l(Br)&&(Br=null),Or!==null&&$l(Or)&&(Or=null),Lr!==null&&$l(Lr)&&(Lr=null),zo.forEach(Zf),Ao.forEach(Zf)}function Ml(e,t){e.blockedOn===t&&(e.blockedOn=null,rp||(rp=!0,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,k1)))}var Tl=null;function Kf(e){Tl!==e&&(Tl=e,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,function(){Tl===e&&(Tl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],n=e[t+2];if(typeof r!="function"){if(Ip(r||a)===null)continue;break}var i=vn(a);i!==null&&(e.splice(t,3),t-=3,Ou(i,{pending:!0,data:n,method:a.method,action:r},r,n))}}))}function hn(e){function t(u){return Ml(u,e)}Br!==null&&Ml(Br,e),Or!==null&&Ml(Or,e),Lr!==null&&Ml(Lr,e),zo.forEach(t),Ao.forEach(t);for(var a=0;a<Nr.length;a++){var r=Nr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Nr.length&&(a=Nr[0],a.blockedOn===null);)Ub(a),a.blockedOn===null&&Nr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var n=a[r],i=a[r+1],o=n[$t]||null;if(typeof i=="function")o||Kf(a);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(n=i,o=i[$t]||null)l=o.formAction;else if(Ip(n)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),Kf(a)}}}function Db(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return n=o})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,n=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),n!==null&&(n(),n=null)}}}function Wp(e){this._internalRoot=e}Bs.prototype.render=Wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(D(409));var a=t.current,r=na();zb(a,r,e,t,null,null)};Bs.prototype.unmount=Wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zb(e.current,2,null,e,null,null),Rs(),t[bn]=null}};function Bs(e){this._internalRoot=e}Bs.prototype.unstable_scheduleHydration=function(e){if(e){var t=ug();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Nr.length&&t!==0&&t<Nr[a].priority;a++);Nr.splice(a,0,e),a===0&&Ub(e)}};var Jf=Pf.version;if(Jf!=="19.2.3")throw Error(D(527,Jf,"19.2.3"));Re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(D(188)):(e=Object.keys(e).join(","),Error(D(268,e)));return e=t0(t),e=e!==null?eg(e):null,e=e===null?null:e.stateNode,e};var N1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Wn=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Wn.isDisabled&&Wn.supportsFiber))try{Uo=Wn.inject(N1),ra=Wn}catch{}var Wn;Os.createRoot=function(e,t){if(!Ff(e))throw Error(D(299));var a=!1,r="",n=Ch,i=qh,o=Eh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Mb(e,1,!1,null,null,a,r,null,n,i,o,Db),e[bn]=t.current,Zp(e),new Wp(t)};Os.hydrateRoot=function(e,t,a){if(!Ff(e))throw Error(D(299));var r=!1,n="",i=Ch,o=qh,l=Eh,u=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(n=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(u=a.formState)),t=Mb(e,1,!0,t,a??null,r,n,u,i,o,l,Db),t.context=Tb(null),a=t.current,r=na(),r=lp(r),n=Ar(r),n.callback=null,Rr(a,n,r),a=r,t.current.lanes=a,Bo(t,a),ja(t),e[bn]=t.current,Zp(e),new Bs(t)};Os.version="19.2.3"});var Hb=Ra((W_,Lb)=>{"use strict";function Ob(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ob)}catch(e){console.error(e)}}Ob(),Lb.exports=Bb()});var Tv=Ra(js=>{"use strict";var T1=Symbol.for("react.transitional.element"),z1=Symbol.for("react.fragment");function Mv(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 n in t)n!=="key"&&(a[n]=t[n])}else a=t;return t=a.ref,{$$typeof:T1,type:e,key:r,ref:t!==void 0?t:null,props:a}}js.Fragment=z1;js.jsx=Mv;js.jsxs=Mv});var ae=Ra((Nk,zv)=>{"use strict";zv.exports=Tv()});var kw=Y(Hb());var jb=`/* 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
 
@@ -1238,7 +1238,19 @@ Error generating stack: `+r.message+`
1238
1238
  }
1239
1239
 
1240
1240
  :where(.app-wrapper) .basket-quote-request-error {
1241
- color: var(--red) !important;
1241
+ margin: 8px 0 0;
1242
+ padding: 10px 12px;
1243
+ border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
1244
+ border-radius: var(--radius-sm);
1245
+ background: var(--red-light);
1246
+ color: var(--red);
1247
+ font-size: 13px;
1248
+ line-height: 1.45;
1249
+ overflow-wrap: anywhere;
1250
+ }
1251
+
1252
+ :where(.app-wrapper) .basket-sidebar-input[aria-invalid="true"] {
1253
+ border-color: var(--red);
1242
1254
  }
1243
1255
 
1244
1256
  :where(.app-wrapper) .basket-quote-request-modal .modal-actions .cta-btn {
@@ -6742,11 +6754,11 @@ Error generating stack: `+r.message+`
6742
6754
  width: 100%;
6743
6755
  height: 100%;
6744
6756
  }
6745
- `;var it=Y(Ye());var Os={};function Gb(e){Os=e}function hi(){return Os}function ed(){return!!Os.apiBaseUrl}var S1=e=>e.replace(/\/$/,"");function Bt(e){let t=Os.apiBaseUrl;return t?`${S1(t)}${e.replace(/^\/api\//,"/v1/")}`:e}var Qb="boq-session-id",Yb="x-boq-session";function Xb(){if(typeof window>"u")return"server";try{let e=window.localStorage.getItem(Qb);return e||(e=crypto.randomUUID(),window.localStorage.setItem(Qb,e)),e}catch{return crypto.randomUUID()}}var C1="x-boq-client";function Ls(){return hi().client}function Ga(){let{client:e,apiKey:t}=hi();return ed()?t?{Authorization:`Bearer ${t}`}:{}:e?{[C1]:e}:{}}function bi(){return{...ed()?{}:{[Yb]:Xb()},...Ga()}}function q1(e){return e&&typeof e=="object"&&e.success===!0&&"data"in e?e.data:e}async function Zt(e){return q1(await e.json().catch(()=>({})))}var $b=9e4;async function Vb(e,t){let a=new AbortController,r=setTimeout(()=>a.abort(),$b),n;try{n=await fetch(e,{...t,signal:a.signal})}catch(o){throw o?.name==="AbortError"?new Error(`Request to ${e} timed out after ${$b/1e3}s. Please try again.`):o}finally{clearTimeout(r)}let i=await Zt(n);if(!n.ok||i?.error){let o=i;throw new Error(o.detail??o.message??o.error??`Server error ${n.status}`)}return i}function Zb(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"),Vb(Bt("/api/schedule"),{method:"POST",body:r,headers:bi()})}function Kb(e,t){let a=t?`?account=${encodeURIComponent(t)}`:"";return Vb(Bt(`/api/schedule/${e}${a}`),{headers:Ga()})}function Jb(e,t,a,r){let n=!1,i=null,o=performance.now();return{promise:new Promise((p,f)=>{let v=async()=>{if(!n)try{let d=await e();if(n)return;if(d.status==="completed"||d.status==="failed"){console.log(`[pollJob:${r??"job"}] ${d.status} (${Math.round(performance.now()-o)}ms)`),p(d);return}a?.(),i=setTimeout(v,t)}catch(d){n||f(d)}};i=setTimeout(v,t)}),cancel:()=>{n=!0,i&&(clearTimeout(i),i=null)}}}var sa=Y(Ye());var Pb=new URL("../assets/decking/boards/diagonal.webp",import.meta.url).href;var Fb=new URL("../assets/decking/boards/no-border.webp",import.meta.url).href;var Ib=new URL("../assets/decking/boards/picture-frame.webp",import.meta.url).href;var Wb=new URL("../assets/decking/boards/straight.webp",import.meta.url).href;var ev=new URL("../assets/fencing/gates/no-gate.webp",import.meta.url).href;var tv=new URL("../assets/fencing/gates/single-gate.webp",import.meta.url).href;var av=new URL("../assets/fencing/gravel-board.webp",import.meta.url).href;var rv=new URL("../assets/fencing/height/0.9.webp",import.meta.url).href;var iv=new URL("../assets/fencing/height/1.2.webp",import.meta.url).href;var nv=new URL("../assets/fencing/height/1.5.webp",import.meta.url).href;var ov=new URL("../assets/fencing/height/1.8.webp",import.meta.url).href;var lv=new URL("../assets/fencing/no-gravel-board.webp",import.meta.url).href;var sv=new URL("../assets/quick-order/paste-list.webp",import.meta.url).href;var cv=new URL("../assets/quick-order/photo-list.webp",import.meta.url).href;var uv=new URL("../assets/quick-order/upload-file.webp",import.meta.url).href;var pv=new URL("../assets/schedule-products/building-sand.webp",import.meta.url).href;var dv=new URL("../assets/schedule-products/drywall-screws.webp",import.meta.url).href;var mv=new URL("../assets/schedule-products/loft-insulation-roll.webp",import.meta.url).href;var fv=new URL("../assets/schedule-products/red-multi-stock-bricks.webp",import.meta.url).href;var gv=new URL("../assets/schedule-products/scrim-tape.webp",import.meta.url).href;var hv=new URL("../assets/schedule-products/wall-ties.webp",import.meta.url).href;var bv=new URL("../assets/tool-images/architrave.webp",import.meta.url).href;var vv=new URL("../assets/tool-images/brick-block.webp",import.meta.url).href;var wv=new URL("../assets/tool-images/concrete-aggregate.webp",import.meta.url).href;var yv=new URL("../assets/tool-images/decking.webp",import.meta.url).href;var _v=new URL("../assets/tool-images/fencing.webp",import.meta.url).href;var xv=new URL("../assets/tool-images/insulation.webp",import.meta.url).href;var kv=new URL("../assets/tool-images/paint.webp",import.meta.url).href;var Nv=new URL("../assets/tool-images/paving.webp",import.meta.url).href;var Sv=new URL("../assets/tool-images/plasterboard.webp",import.meta.url).href;var Cv=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 Ev=new URL("../assets/tool-images/truss.webp",import.meta.url).href;var qe=e=>typeof e=="string"?e:e.src,E1={"/decking/boards/diagonal.webp":qe(Pb),"/decking/boards/no-border.webp":qe(Fb),"/decking/boards/picture-frame.webp":qe(Ib),"/decking/boards/straight.webp":qe(Wb),"/fencing/gates/no-gate.webp":qe(ev),"/fencing/gates/single-gate.webp":qe(tv),"/fencing/gravel-board.webp":qe(av),"/fencing/height/0.9.webp":qe(rv),"/fencing/height/1.2.webp":qe(iv),"/fencing/height/1.5.webp":qe(nv),"/fencing/height/1.8.webp":qe(ov),"/fencing/no-gravel-board.webp":qe(lv),"/quick-order/paste-list.webp":qe(sv),"/quick-order/photo-list.webp":qe(cv),"/quick-order/upload-file.webp":qe(uv),"/schedule-products/building-sand.webp":qe(pv),"/schedule-products/drywall-screws.webp":qe(dv),"/schedule-products/loft-insulation-roll.webp":qe(mv),"/schedule-products/red-multi-stock-bricks.webp":qe(fv),"/schedule-products/scrim-tape.webp":qe(gv),"/schedule-products/wall-ties.webp":qe(hv),"/tool-images/architrave.webp":qe(bv),"/tool-images/brick-block.webp":qe(vv),"/tool-images/concrete-aggregate.webp":qe(wv),"/tool-images/decking.webp":qe(yv),"/tool-images/fencing.webp":qe(_v),"/tool-images/insulation.webp":qe(xv),"/tool-images/paint.webp":qe(kv),"/tool-images/paving.webp":qe(Nv),"/tool-images/plasterboard.webp":qe(Sv),"/tool-images/skirting.webp":qe(Cv),"/tool-images/timber.webp":qe(qv),"/tool-images/truss.webp":qe(Ev)};function Kt(e){return E1[e]??e}var td=Y(re());function Ot(){return(0,td.jsx)("svg",{className:"forward-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,td.jsx)("path",{d:"M3 8H13M13 8L9 4M13 8L9 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var ad=Y(re());function Xo(){return(0,ad.jsx)("svg",{className:"close-icon",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,ad.jsx)("path",{d:"M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}var kn={schedule:[".xlsx",".xls",".csv",".pdf",".docx"],photo:[".png",".jpg",".jpeg",".webp",".gif",".bmp",".heic",".heif"],email:[".eml",".msg"]};var Rv=(e,t)=>kn[t].some(a=>e.toLowerCase().endsWith(a)),$o=e=>e.type.startsWith("image/")||Rv(e.name,"photo"),z1=e=>$o(e)||Rv(e.name,"schedule"),Av=e=>`${Math.max(.1,Math.round(e/1048576*10)/10)} MB`;function rd(e,t=5242880){return z1(e)?e.size===0?"That file is empty.":e.size>t?`That file is ${Av(e.size)} - the limit is ${Av(t)}.`:null:`Please upload a list or image file (${[...kn.schedule,...kn.photo].join(", ")}).`}var A1=e=>e.split(`
6746
- `).map(t=>t.trim()).filter(Boolean);function Uv(e){let t=A1(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 Dv(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 n=r.getContext("2d");if(!n)return e;n.fillStyle="#fff",n.fillRect(0,0,r.width,r.height),n.drawImage(t,0,0,r.width,r.height),t.close();let i=await new Promise(o=>r.toBlob(o,"image/jpeg",.85));return!i||i.size>=e.size?e:new File([i],`${e.name.replace(/\.[^.]+$/,"")}.jpg`,{type:"image/jpeg"})}var $r=Y(Ye());var Gs=Y(Ye()),js=Y(re()),R1=[4,5,4],id=4e3;function pr(){let[e,t]=(0,Gs.useState)(0);(0,Gs.useEffect)(()=>{let r=setInterval(()=>t(n=>n+1),id);return()=>clearInterval(r)},[]);let a=0;return(0,js.jsx)("div",{className:"brick-wall","aria-hidden":!0,children:R1.map((r,n)=>(0,js.jsx)("div",{className:"brick-wall__course",children:Array.from({length:r},(i,o)=>(0,js.jsx)("span",{className:`brick-wall__brick${r===5&&(o===0||o===4)?" brick-wall__brick--half":""}`,style:{"--i":a++}},o))},n))},e)}var Vo=Y(re()),Qs=["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 Bv(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 Ov(){let e=(0,$r.useRef)(Bv(Qs.map((o,l)=>l))),t=(0,$r.useRef)(0),[a,r]=(0,$r.useState)(Qs[e.current[0]]),[n,i]=(0,$r.useState)(!0);return(0,$r.useEffect)(()=>{let o=setInterval(()=>{i(!1),window.setTimeout(()=>{t.current++,t.current>=e.current.length&&(e.current=Bv(Qs.map((l,u)=>u)),t.current=0),r(Qs[e.current[t.current]]),i(!0)},600)},id);return()=>clearInterval(o)},[]),(0,Vo.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",children:[(0,Vo.jsx)(pr,{}),(0,Vo.jsx)("p",{className:`banter-message${n?" is-visible":""}`,children:a})]})}var P=Y(re()),U1=[...kn.schedule,...kn.photo].join(","),D1={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."}]};function nd({onPasteSchedule:e,onUploadSchedule:t,onEntryModeChange:a}){let[r,n]=(0,sa.useState)(null),[i,o]=(0,sa.useState)(""),[l,u]=(0,sa.useState)(null),[p,f]=(0,sa.useState)(""),[v,d]=(0,sa.useState)(!1),[h,w]=(0,sa.useState)(!1),[E,U]=(0,sa.useState)(null),m=(0,sa.useRef)(0),c=(0,sa.useRef)(null),b=i.split(`
6747
- `).filter(X=>X.trim()).length,g=Uv(i),S=r==="paste"?!!i:!!l;(0,sa.useEffect)(()=>{if(!l||!$o(l)){U(null);return}let X=URL.createObjectURL(l);return U(X),()=>URL.revokeObjectURL(X)},[l]);let z=X=>{n(X),a(null)},T=()=>{n(null),a(null)},R=X=>{if(!X?.length)return;if(X.length>1)return f("Please choose one file at a time.");let K=X[0],Z=rd(K,$o(K)?1/0:void 0);if(Z)return f(Z);f(""),u(K)},j=async X=>{d(!0);try{await X()}finally{d(!1)}},W=async X=>{try{let K=await Dv(X),Z=rd(K);if(Z)throw new Error(Z);let de=new FormData;de.append("file",K);let Le=await fetch(Bt("/api/schedule/extract-photo"),{method:"POST",body:de,headers:Ga()}),ue=await Zt(Le);if(!Le.ok)throw new Error(ue?.error||ue?.message||"Failed to extract line items from image");let Ue=typeof ue?.text=="string"?ue.text.trim():"";if(!Ue)throw new Error("No line items were extracted from this image.");let Ee=Array.isArray(ue?.lines)?ue.lines.filter(dt=>!!(dt&&typeof dt=="object"&&typeof dt.text=="string")):void 0;await e(Ue,Ee,!1)}catch(K){f(K?.message||"Failed to extract line items from image")}},ve=()=>{if(l)return j(()=>$o(l)?W(l):t(l))},Se=X=>X.dataTransfer.types.includes("Files"),Re=X=>{Se(X)&&(X.preventDefault(),m.current+=1,w(!0))},Pe=X=>{Se(X)&&(m.current-=1,m.current<=0&&(m.current=0,w(!1)))},Me=X=>{Se(X)&&(X.preventDefault(),m.current=0,w(!1),R(X.dataTransfer.files),z("upload"))};return(0,P.jsxs)("div",{className:"wizard-step entry-stage",onDragEnter:Re,onDragOver:X=>Se(X)&&X.preventDefault(),onDragLeave:Pe,onDrop:Me,children:[h&&(0,P.jsx)("div",{className:"entry-drop-overlay","aria-hidden":"true",children:"Drop your file to upload"}),(0,P.jsxs)("div",{className:"quick-order-card",children:[(0,P.jsxs)("div",{className:"quick-order-alt",children:[(0,P.jsxs)("div",{className:"quick-order-entry-copy",children:[(0,P.jsx)("div",{className:"quick-order-alt-title",children:"How would you like to get started?"}),(0,P.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,P.jsxs)("div",{className:"entry-options entry-options--workflow entry-options--two",children:[(0,P.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--paste${r==="paste"?" entry-option-card--active":""}`,onClick:()=>z("paste"),children:[(0,P.jsxs)("span",{className:"entry-option-content",children:[(0,P.jsx)("span",{className:"entry-option-title",children:"Type or paste a list"}),(0,P.jsx)("span",{className:"entry-option-desc",children:"Enter your materials and quantities"})]}),(0,P.jsx)("span",{className:"entry-option-media entry-option-media--paste","aria-hidden":"true",children:(0,P.jsx)("img",{className:"fill-img",src:Kt("/quick-order/paste-list.webp"),alt:""})})]}),(0,P.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--upload${r==="upload"?" entry-option-card--active":""}`,onClick:()=>z("upload"),children:[(0,P.jsxs)("span",{className:"entry-option-content",children:[(0,P.jsx)("span",{className:"entry-option-title",children:"Upload a file"}),(0,P.jsx)("span",{className:"entry-option-desc",children:"A photo, spreadsheet, Word document or PDF"})]}),(0,P.jsx)("span",{className:"entry-option-media entry-option-media--upload","aria-hidden":"true",children:(0,P.jsx)("img",{className:"fill-img",src:Kt("/quick-order/photo-list.webp"),alt:""})})]})]})]}),r&&(0,P.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"quick-order-workflow-title",onClick:()=>!S&&T(),children:(0,P.jsxs)("section",{className:`quick-order-workflow-modal${v?" quick-order-workflow-modal--matching":""}`,onClick:X=>X.stopPropagation(),children:[(0,P.jsxs)("header",{className:"quick-order-workflow-modal-header",children:[(0,P.jsx)("h2",{id:"quick-order-workflow-title",children:r==="paste"?"Type or paste a list":"Upload a file"}),(0,P.jsx)("button",{type:"button",className:"quick-order-workflow-close",onClick:T,"aria-label":"Close",children:(0,P.jsx)(Xo,{})})]}),(0,P.jsxs)("div",{className:"quick-order-panel",children:[(0,P.jsxs)("div",{className:"quick-order-body","aria-hidden":v,children:[(0,P.jsx)("div",{className:"quick-order-body-main",children:r==="paste"?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("textarea",{className:"paste-textarea",placeholder:`Paste your line items here, one per line, e.g.
6757
+ `;var We=Y(Ye());var Ls={};function Gb(e){Ls=e}function bi(){return Ls}function ed(){return!!Ls.apiBaseUrl}var C1=e=>e.replace(/\/$/,"");function Ot(e){let t=Ls.apiBaseUrl;return t?`${C1(t)}${e.replace(/^\/api\//,"/v1/")}`:e}var Qb="boq-session-id",Yb="x-boq-session";function Xb(){if(typeof window>"u")return"server";try{let e=window.localStorage.getItem(Qb);return e||(e=crypto.randomUUID(),window.localStorage.setItem(Qb,e)),e}catch{return crypto.randomUUID()}}var q1="x-boq-client";function Hs(){return bi().client}function Ga(){let{client:e,apiKey:t}=bi();return ed()?t?{Authorization:`Bearer ${t}`}:{}:e?{[q1]:e}:{}}function vi(){return{...ed()?{}:{[Yb]:Xb()},...Ga()}}function E1(e){return e&&typeof e=="object"&&e.success===!0&&"data"in e?e.data:e}async function Zt(e){return E1(await e.json().catch(()=>({})))}var $b=9e4;async function Vb(e,t){let a=new AbortController,r=setTimeout(()=>a.abort(),$b),n;try{n=await fetch(e,{...t,signal:a.signal})}catch(o){throw o?.name==="AbortError"?new Error(`Request to ${e} timed out after ${$b/1e3}s. Please try again.`):o}finally{clearTimeout(r)}let i=await Zt(n);if(!n.ok||i?.error){let o=i;throw new Error(o.detail??o.message??o.error??`Server error ${n.status}`)}return i}function Zb(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"),Vb(Ot("/api/schedule"),{method:"POST",body:r,headers:vi()})}function Kb(e,t){let a=t?`?account=${encodeURIComponent(t)}`:"";return Vb(Ot(`/api/schedule/${e}${a}`),{headers:Ga()})}function Jb(e,t,a,r){let n=!1,i=null,o=performance.now();return{promise:new Promise((p,f)=>{let b=async()=>{if(!n)try{let m=await e();if(n)return;if(m.status==="completed"||m.status==="failed"){console.log(`[pollJob:${r??"job"}] ${m.status} (${Math.round(performance.now()-o)}ms)`),p(m);return}a?.(),i=setTimeout(b,t)}catch(m){n||f(m)}};i=setTimeout(b,t)}),cancel:()=>{n=!0,i&&(clearTimeout(i),i=null)}}}var sa=Y(Ye());var Pb=new URL("../assets/decking/boards/diagonal.webp",import.meta.url).href;var Fb=new URL("../assets/decking/boards/no-border.webp",import.meta.url).href;var Ib=new URL("../assets/decking/boards/picture-frame.webp",import.meta.url).href;var Wb=new URL("../assets/decking/boards/straight.webp",import.meta.url).href;var ev=new URL("../assets/fencing/gates/no-gate.webp",import.meta.url).href;var tv=new URL("../assets/fencing/gates/single-gate.webp",import.meta.url).href;var av=new URL("../assets/fencing/gravel-board.webp",import.meta.url).href;var rv=new URL("../assets/fencing/height/0.9.webp",import.meta.url).href;var iv=new URL("../assets/fencing/height/1.2.webp",import.meta.url).href;var nv=new URL("../assets/fencing/height/1.5.webp",import.meta.url).href;var ov=new URL("../assets/fencing/height/1.8.webp",import.meta.url).href;var lv=new URL("../assets/fencing/no-gravel-board.webp",import.meta.url).href;var sv=new URL("../assets/quick-order/paste-list.webp",import.meta.url).href;var cv=new URL("../assets/quick-order/photo-list.webp",import.meta.url).href;var uv=new URL("../assets/quick-order/upload-file.webp",import.meta.url).href;var pv=new URL("../assets/schedule-products/building-sand.webp",import.meta.url).href;var dv=new URL("../assets/schedule-products/drywall-screws.webp",import.meta.url).href;var mv=new URL("../assets/schedule-products/loft-insulation-roll.webp",import.meta.url).href;var fv=new URL("../assets/schedule-products/red-multi-stock-bricks.webp",import.meta.url).href;var gv=new URL("../assets/schedule-products/scrim-tape.webp",import.meta.url).href;var hv=new URL("../assets/schedule-products/wall-ties.webp",import.meta.url).href;var bv=new URL("../assets/tool-images/architrave.webp",import.meta.url).href;var vv=new URL("../assets/tool-images/brick-block.webp",import.meta.url).href;var wv=new URL("../assets/tool-images/concrete-aggregate.webp",import.meta.url).href;var yv=new URL("../assets/tool-images/decking.webp",import.meta.url).href;var _v=new URL("../assets/tool-images/fencing.webp",import.meta.url).href;var xv=new URL("../assets/tool-images/insulation.webp",import.meta.url).href;var kv=new URL("../assets/tool-images/paint.webp",import.meta.url).href;var Nv=new URL("../assets/tool-images/paving.webp",import.meta.url).href;var Sv=new URL("../assets/tool-images/plasterboard.webp",import.meta.url).href;var Cv=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 Ev=new URL("../assets/tool-images/truss.webp",import.meta.url).href;var ze=e=>typeof e=="string"?e:e.src,M1={"/decking/boards/diagonal.webp":ze(Pb),"/decking/boards/no-border.webp":ze(Fb),"/decking/boards/picture-frame.webp":ze(Ib),"/decking/boards/straight.webp":ze(Wb),"/fencing/gates/no-gate.webp":ze(ev),"/fencing/gates/single-gate.webp":ze(tv),"/fencing/gravel-board.webp":ze(av),"/fencing/height/0.9.webp":ze(rv),"/fencing/height/1.2.webp":ze(iv),"/fencing/height/1.5.webp":ze(nv),"/fencing/height/1.8.webp":ze(ov),"/fencing/no-gravel-board.webp":ze(lv),"/quick-order/paste-list.webp":ze(sv),"/quick-order/photo-list.webp":ze(cv),"/quick-order/upload-file.webp":ze(uv),"/schedule-products/building-sand.webp":ze(pv),"/schedule-products/drywall-screws.webp":ze(dv),"/schedule-products/loft-insulation-roll.webp":ze(mv),"/schedule-products/red-multi-stock-bricks.webp":ze(fv),"/schedule-products/scrim-tape.webp":ze(gv),"/schedule-products/wall-ties.webp":ze(hv),"/tool-images/architrave.webp":ze(bv),"/tool-images/brick-block.webp":ze(vv),"/tool-images/concrete-aggregate.webp":ze(wv),"/tool-images/decking.webp":ze(yv),"/tool-images/fencing.webp":ze(_v),"/tool-images/insulation.webp":ze(xv),"/tool-images/paint.webp":ze(kv),"/tool-images/paving.webp":ze(Nv),"/tool-images/plasterboard.webp":ze(Sv),"/tool-images/skirting.webp":ze(Cv),"/tool-images/timber.webp":ze(qv),"/tool-images/truss.webp":ze(Ev)};function Kt(e){return M1[e]??e}var td=Y(ae());function Lt(){return(0,td.jsx)("svg",{className:"forward-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,td.jsx)("path",{d:"M3 8H13M13 8L9 4M13 8L9 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var ad=Y(ae());function $o(){return(0,ad.jsx)("svg",{className:"close-icon",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,ad.jsx)("path",{d:"M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}var Nn={schedule:[".xlsx",".xls",".csv",".pdf",".docx"],photo:[".png",".jpg",".jpeg",".webp",".gif",".bmp",".heic",".heif"],email:[".eml",".msg"]};var Rv=(e,t)=>Nn[t].some(a=>e.toLowerCase().endsWith(a)),Vo=e=>e.type.startsWith("image/")||Rv(e.name,"photo"),A1=e=>Vo(e)||Rv(e.name,"schedule"),Av=e=>`${Math.max(.1,Math.round(e/1048576*10)/10)} MB`;function rd(e,t=5242880){return A1(e)?e.size===0?"That file is empty.":e.size>t?`That file is ${Av(e.size)} - the limit is ${Av(t)}.`:null:`Please upload a list or image file (${[...Nn.schedule,...Nn.photo].join(", ")}).`}var R1=e=>e.split(`
6758
+ `).map(t=>t.trim()).filter(Boolean);function Uv(e){let t=R1(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 Dv(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 n=r.getContext("2d");if(!n)return e;n.fillStyle="#fff",n.fillRect(0,0,r.width,r.height),n.drawImage(t,0,0,r.width,r.height),t.close();let i=await new Promise(o=>r.toBlob(o,"image/jpeg",.85));return!i||i.size>=e.size?e:new File([i],`${e.name.replace(/\.[^.]+$/,"")}.jpg`,{type:"image/jpeg"})}var $r=Y(Ye());var Qs=Y(Ye()),Gs=Y(ae()),U1=[4,5,4],id=4e3;function pr(){let[e,t]=(0,Qs.useState)(0);(0,Qs.useEffect)(()=>{let r=setInterval(()=>t(n=>n+1),id);return()=>clearInterval(r)},[]);let a=0;return(0,Gs.jsx)("div",{className:"brick-wall","aria-hidden":!0,children:U1.map((r,n)=>(0,Gs.jsx)("div",{className:"brick-wall__course",children:Array.from({length:r},(i,o)=>(0,Gs.jsx)("span",{className:`brick-wall__brick${r===5&&(o===0||o===4)?" brick-wall__brick--half":""}`,style:{"--i":a++}},o))},n))},e)}var Zo=Y(ae()),Ys=["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 Bv(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 Ov(){let e=(0,$r.useRef)(Bv(Ys.map((o,l)=>l))),t=(0,$r.useRef)(0),[a,r]=(0,$r.useState)(Ys[e.current[0]]),[n,i]=(0,$r.useState)(!0);return(0,$r.useEffect)(()=>{let o=setInterval(()=>{i(!1),window.setTimeout(()=>{t.current++,t.current>=e.current.length&&(e.current=Bv(Ys.map((l,u)=>u)),t.current=0),r(Ys[e.current[t.current]]),i(!0)},600)},id);return()=>clearInterval(o)},[]),(0,Zo.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",children:[(0,Zo.jsx)(pr,{}),(0,Zo.jsx)("p",{className:`banter-message${n?" is-visible":""}`,children:a})]})}var K=Y(ae()),D1=[...Nn.schedule,...Nn.photo].join(","),B1={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."}]};function nd({onPasteSchedule:e,onUploadSchedule:t,onEntryModeChange:a}){let[r,n]=(0,sa.useState)(null),[i,o]=(0,sa.useState)(""),[l,u]=(0,sa.useState)(null),[p,f]=(0,sa.useState)(""),[b,m]=(0,sa.useState)(!1),[h,w]=(0,sa.useState)(!1),[E,R]=(0,sa.useState)(null),d=(0,sa.useRef)(0),c=(0,sa.useRef)(null),g=i.split(`
6759
+ `).filter(X=>X.trim()).length,v=Uv(i),S=r==="paste"?!!i:!!l;(0,sa.useEffect)(()=>{if(!l||!Vo(l)){R(null);return}let X=URL.createObjectURL(l);return R(X),()=>URL.revokeObjectURL(X)},[l]);let M=X=>{n(X),a(null)},T=()=>{n(null),a(null)},U=X=>{if(!X?.length)return;if(X.length>1)return f("Please choose one file at a time.");let ie=X[0],ne=rd(ie,Vo(ie)?1/0:void 0);if(ne)return f(ne);f(""),u(ie)},j=async X=>{m(!0);try{await X()}finally{m(!1)}},F=async X=>{try{let ie=await Dv(X),ne=rd(ie);if(ne)throw new Error(ne);let I=new FormData;I.append("file",ie);let Me=await fetch(Ot("/api/schedule/extract-photo"),{method:"POST",body:I,headers:Ga()}),de=await Zt(Me);if(!Me.ok)throw new Error(de?.error||de?.message||"Failed to extract line items from image");let be=typeof de?.text=="string"?de.text.trim():"";if(!be)throw new Error("No line items were extracted from this image.");let qe=Array.isArray(de?.lines)?de.lines.filter(dt=>!!(dt&&typeof dt=="object"&&typeof dt.text=="string")):void 0;await e(be,qe,!1)}catch(ie){f(ie?.message||"Failed to extract line items from image")}},we=()=>{if(l)return j(()=>Vo(l)?F(l):t(l))},Ee=X=>X.dataTransfer.types.includes("Files"),De=X=>{Ee(X)&&(X.preventDefault(),d.current+=1,w(!0))},at=X=>{Ee(X)&&(d.current-=1,d.current<=0&&(d.current=0,w(!1)))},Ce=X=>{Ee(X)&&(X.preventDefault(),d.current=0,w(!1),U(X.dataTransfer.files),M("upload"))};return(0,K.jsxs)("div",{className:"wizard-step entry-stage",onDragEnter:De,onDragOver:X=>Ee(X)&&X.preventDefault(),onDragLeave:at,onDrop:Ce,children:[h&&(0,K.jsx)("div",{className:"entry-drop-overlay","aria-hidden":"true",children:"Drop your file to upload"}),(0,K.jsxs)("div",{className:"quick-order-card",children:[(0,K.jsxs)("div",{className:"quick-order-alt",children:[(0,K.jsxs)("div",{className:"quick-order-entry-copy",children:[(0,K.jsx)("div",{className:"quick-order-alt-title",children:"How would you like to get started?"}),(0,K.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,K.jsxs)("div",{className:"entry-options entry-options--workflow entry-options--two",children:[(0,K.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--paste${r==="paste"?" entry-option-card--active":""}`,onClick:()=>M("paste"),children:[(0,K.jsxs)("span",{className:"entry-option-content",children:[(0,K.jsx)("span",{className:"entry-option-title",children:"Type or paste a list"}),(0,K.jsx)("span",{className:"entry-option-desc",children:"Enter your materials and quantities"})]}),(0,K.jsx)("span",{className:"entry-option-media entry-option-media--paste","aria-hidden":"true",children:(0,K.jsx)("img",{className:"fill-img",src:Kt("/quick-order/paste-list.webp"),alt:""})})]}),(0,K.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--upload${r==="upload"?" entry-option-card--active":""}`,onClick:()=>M("upload"),children:[(0,K.jsxs)("span",{className:"entry-option-content",children:[(0,K.jsx)("span",{className:"entry-option-title",children:"Upload a file"}),(0,K.jsx)("span",{className:"entry-option-desc",children:"A photo, spreadsheet, Word document or PDF"})]}),(0,K.jsx)("span",{className:"entry-option-media entry-option-media--upload","aria-hidden":"true",children:(0,K.jsx)("img",{className:"fill-img",src:Kt("/quick-order/photo-list.webp"),alt:""})})]})]})]}),r&&(0,K.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"quick-order-workflow-title",onClick:()=>!S&&T(),children:(0,K.jsxs)("section",{className:`quick-order-workflow-modal${b?" quick-order-workflow-modal--matching":""}`,onClick:X=>X.stopPropagation(),children:[(0,K.jsxs)("header",{className:"quick-order-workflow-modal-header",children:[(0,K.jsx)("h2",{id:"quick-order-workflow-title",children:r==="paste"?"Type or paste a list":"Upload a file"}),(0,K.jsx)("button",{type:"button",className:"quick-order-workflow-close",onClick:T,"aria-label":"Close",children:(0,K.jsx)($o,{})})]}),(0,K.jsxs)("div",{className:"quick-order-panel",children:[(0,K.jsxs)("div",{className:"quick-order-body","aria-hidden":b,children:[(0,K.jsx)("div",{className:"quick-order-body-main",children:r==="paste"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("textarea",{className:"paste-textarea",placeholder:`Paste your line items here, one per line, e.g.
6748
6760
  insulated plasterboard 50mm
6749
- C24 timber 4.8m`,value:i,onChange:X=>o(X.target.value),"aria-label":"Paste schedule line items"}),g&&(0,P.jsxs)("div",{className:"error-box",role:"alert",children:[(0,P.jsx)("strong",{children:"Error:"})," ",g]}),(0,P.jsxs)("div",{className:"quick-order-hint",children:[(0,P.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,P.jsx)("div",{className:"quick-order-actions",children:(0,P.jsxs)("button",{type:"button",className:"cta-btn",disabled:!b||!!g,onClick:()=>{j(()=>e(i))},"aria-label":"Match pasted lines",children:[(0,P.jsx)("span",{children:"Match line items"}),(0,P.jsx)("span",{className:"arrow",children:(0,P.jsx)(Ot,{})})]})})]}):(0,P.jsxs)(P.Fragment,{children:[p&&(0,P.jsxs)("div",{className:"error-box",role:"alert",children:[(0,P.jsx)("strong",{children:"Error:"})," ",p]}),(0,P.jsxs)("div",{className:`upload-zone${l?" has-file":""}`,onClick:()=>c.current?.click(),onDragOver:X=>X.preventDefault(),onDrop:Me,role:"button",tabIndex:0,onKeyDown:X=>(X.key==="Enter"||X.key===" ")&&c.current?.click(),"aria-label":"Upload zone: click or drag a list or image file here",children:[E?(0,P.jsx)("img",{src:E,alt:l?.name??"Selected photo",className:"upload-zone-photo-preview"}):(0,P.jsx)("div",{className:"upload-zone-icon",children:(0,P.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,P.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,P.jsx)("polyline",{points:"14,2 14,8 20,8"}),(0,P.jsx)("polyline",{points:"9,15 11,17 15,13"})]})}),l?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"upload-zone-subtext",children:l.name}),(0,P.jsx)("button",{type:"button",className:"link-btn link-btn--underline",onClick:X=>{X.stopPropagation(),u(null),f(""),c.current&&(c.current.value="")},children:"Remove"})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"upload-zone-text",children:"Drop a photo, spreadsheet, Word document or PDF"}),(0,P.jsx)("div",{className:"upload-zone-subtext",children:"or click to choose a file"})]}),(0,P.jsx)("input",{ref:c,type:"file",accept:U1,className:"visually-hidden",onChange:X=>R(X.target.files),tabIndex:-1,"aria-hidden":"true"})]}),(0,P.jsx)("div",{className:"quick-order-actions",children:(0,P.jsxs)("button",{type:"button",className:"cta-btn",disabled:!l,onClick:()=>{ve()},"aria-label":"Match uploaded items",children:[(0,P.jsx)("span",{children:"Match items"}),(0,P.jsx)("span",{className:"arrow",children:(0,P.jsx)(Ot,{})})]})})]})}),(0,P.jsx)("aside",{className:"quick-order-sidebar",children:D1[r].map((X,K)=>(0,P.jsxs)("div",{className:"quick-order-step quick-order-step--rail",children:[(0,P.jsx)("span",{className:"quick-order-step-dot",children:K+1}),(0,P.jsxs)("div",{children:[(0,P.jsx)("div",{className:"quick-order-step-title",children:X.title}),(0,P.jsx)("div",{className:"quick-order-step-desc",children:X.desc})]})]},X.title))})]}),v&&(0,P.jsx)("div",{className:"quick-order-matching-overlay",children:(0,P.jsx)(Ov,{})})]})]})})]})]})}var we=Y(Ye());var od=Y(re());function Vr(){return(0,od.jsx)("svg",{className:"back-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,od.jsx)("path",{d:"M13 8H3M3 8L7 4M3 8L7 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var vi=Y(re());function ld(){return(0,vi.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,vi.jsx)("path",{d:"M3 12a9 9 0 0 1 15.36-6.36L21 8"}),(0,vi.jsx)("path",{d:"M21 3v5h-5"}),(0,vi.jsx)("path",{d:"M21 12a9 9 0 0 1-15.36 6.36L3 16"}),(0,vi.jsx)("path",{d:"M3 21v-5h5"})]})}var Zo=Y(re());function sd({unit:e}){return(0,Zo.jsx)(Zo.Fragment,{children:e.split(/([²³])/).map((t,a)=>t==="\xB2"||t==="\xB3"?(0,Zo.jsx)("span",{className:"unit-sup",children:t},a):t)})}var Lv=Y(re());function B1(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 xa(e,t){let a=(e??"").trim();if(!a||a==="-")return"";let r=/^each$/i.test(a)?"unit":a;return t!=null?B1(r,t):r}function ka(e,t){let a=xa(e,t);return a?(0,Lv.jsx)(sd,{unit:a}):null}function Ko(e){let t=(e??"").trim();if(!t)return"";let a=t.match(/^per\s+(.+)$/i);if(!a)return t;let r=xa(a[1]);return r?`per ${r}`:""}function wi(e){return e===0?"-":Number.isInteger(e)?e.toString():e<1?e.toFixed(2):e.toFixed(1)}function et(e){return`\xA3${e.toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Hv(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}var O1=[{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"}];function Qa(e,t,a){if(a)return a;let r=(e||"").toLowerCase(),n=O1.find(i=>i.match.some(o=>r.includes(o)));return n?Kt(n.path):r.includes("insulation")?Hv(`
6761
+ C24 timber 4.8m`,value:i,onChange:X=>o(X.target.value),"aria-label":"Paste schedule line items"}),v&&(0,K.jsxs)("div",{className:"error-box",role:"alert",children:[(0,K.jsx)("strong",{children:"Error:"})," ",v]}),(0,K.jsxs)("div",{className:"quick-order-hint",children:[(0,K.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,K.jsx)("div",{className:"quick-order-actions",children:(0,K.jsxs)("button",{type:"button",className:"cta-btn",disabled:!g||!!v,onClick:()=>{j(()=>e(i))},"aria-label":"Match pasted lines",children:[(0,K.jsx)("span",{children:"Match line items"}),(0,K.jsx)("span",{className:"arrow",children:(0,K.jsx)(Lt,{})})]})})]}):(0,K.jsxs)(K.Fragment,{children:[p&&(0,K.jsxs)("div",{className:"error-box",role:"alert",children:[(0,K.jsx)("strong",{children:"Error:"})," ",p]}),(0,K.jsxs)("div",{className:`upload-zone${l?" has-file":""}`,onClick:()=>c.current?.click(),onDragOver:X=>X.preventDefault(),onDrop:Ce,role:"button",tabIndex:0,onKeyDown:X=>(X.key==="Enter"||X.key===" ")&&c.current?.click(),"aria-label":"Upload zone: click or drag a list or image file here",children:[E?(0,K.jsx)("img",{src:E,alt:l?.name??"Selected photo",className:"upload-zone-photo-preview"}):(0,K.jsx)("div",{className:"upload-zone-icon",children:(0,K.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,K.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,K.jsx)("polyline",{points:"14,2 14,8 20,8"}),(0,K.jsx)("polyline",{points:"9,15 11,17 15,13"})]})}),l?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{className:"upload-zone-subtext",children:l.name}),(0,K.jsx)("button",{type:"button",className:"link-btn link-btn--underline",onClick:X=>{X.stopPropagation(),u(null),f(""),c.current&&(c.current.value="")},children:"Remove"})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{className:"upload-zone-text",children:"Drop a photo, spreadsheet, Word document or PDF"}),(0,K.jsx)("div",{className:"upload-zone-subtext",children:"or click to choose a file"})]}),(0,K.jsx)("input",{ref:c,type:"file",accept:D1,className:"visually-hidden",onChange:X=>U(X.target.files),tabIndex:-1,"aria-hidden":"true"})]}),(0,K.jsx)("div",{className:"quick-order-actions",children:(0,K.jsxs)("button",{type:"button",className:"cta-btn",disabled:!l,onClick:()=>{we()},"aria-label":"Match uploaded items",children:[(0,K.jsx)("span",{children:"Match items"}),(0,K.jsx)("span",{className:"arrow",children:(0,K.jsx)(Lt,{})})]})})]})}),(0,K.jsx)("aside",{className:"quick-order-sidebar",children:B1[r].map((X,ie)=>(0,K.jsxs)("div",{className:"quick-order-step quick-order-step--rail",children:[(0,K.jsx)("span",{className:"quick-order-step-dot",children:ie+1}),(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"quick-order-step-title",children:X.title}),(0,K.jsx)("div",{className:"quick-order-step-desc",children:X.desc})]})]},X.title))})]}),b&&(0,K.jsx)("div",{className:"quick-order-matching-overlay",children:(0,K.jsx)(Ov,{})})]})]})})]})]})}var ye=Y(Ye());var od=Y(ae());function Vr(){return(0,od.jsx)("svg",{className:"back-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,od.jsx)("path",{d:"M13 8H3M3 8L7 4M3 8L7 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var wi=Y(ae());function ld(){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 Ko=Y(ae());function sd({unit:e}){return(0,Ko.jsx)(Ko.Fragment,{children:e.split(/([²³])/).map((t,a)=>t==="\xB2"||t==="\xB3"?(0,Ko.jsx)("span",{className:"unit-sup",children:t},a):t)})}var Lv=Y(ae());function O1(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 xa(e,t){let a=(e??"").trim();if(!a||a==="-")return"";let r=/^each$/i.test(a)?"unit":a;return t!=null?O1(r,t):r}function ka(e,t){let a=xa(e,t);return a?(0,Lv.jsx)(sd,{unit:a}):null}function Jo(e){let t=(e??"").trim();if(!t)return"";let a=t.match(/^per\s+(.+)$/i);if(!a)return t;let r=xa(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 et(e){return`\xA3${e.toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Hv(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}var L1=[{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"}];function Qa(e,t,a){if(a)return a;let r=(e||"").toLowerCase(),n=L1.find(i=>i.match.some(o=>r.includes(o)));return n?Kt(n.path):r.includes("insulation")?Hv(`
6750
6762
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
6751
6763
  <rect width="640" height="420" fill="#fbf1cf"/>
6752
6764
  <rect x="88" y="78" width="432" height="264" rx="16" fill="#f0c43f"/>
@@ -6765,9 +6777,9 @@ C24 timber 4.8m`,value:i,onChange:X=>o(X.target.value),"aria-label":"Paste sched
6765
6777
  <rect x="168" y="188" width="250" height="24" rx="12" fill="#aab5c0"/>
6766
6778
  <rect x="168" y="232" width="220" height="24" rx="12" fill="#aab5c0"/>
6767
6779
  </svg>
6768
- `)}function Zr(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}}var Xv=e=>(e??"").trim().toLowerCase(),L1={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"},H1=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),jv=new Set(["box","bag","pack","pallet","roll","set","tub"]),Gv=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,Qv=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,yi=e=>{let t=Xv(e);return L1[t]??t},tt=(e,t)=>{let a=yi(e),r=yi(t);return a.length>0&&a===r},j1=(e,t)=>{let a=Xv(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},G1=e=>(e??"").split(",").map(t=>yi(t)).filter(Boolean),Q1=(e,t)=>{let a=G1(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||tt(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||tt(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||tt(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},Yv=(e,t)=>tt(t,"pallet")?e.itemsPerPallet??null:tt(t,"pack")?e.itemsPerPack??null:tt(t,"box")?e.itemsPerBox??null:null,Y1=(e,t,a)=>{if(!tt(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||!tt(r[3],a))return null;let n=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(n)&&n>0?n:null};function za(e,t){let a=e.qty,r=yi(e.unit)||"-",n=yi(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=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,u=l?e.sellUnitsOverride??null:null,p=g=>({requestedAmount:a,requestedUnit:r,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:n,calculatedSellUnits:null,requiredSellUnits:u,unitPrice:e.price,lineTotal:e.price!=null&&u!=null?e.price*u:null,calculation:u!=null?`${g} Manually set to ${u} ${n}.`:g,costingMode:"review"});if(!Q1(e,r))return p("Requested unit is not supported by this catalogue conversion.");let f=null,v="review",d=e.roundingRule,h=`Quantity review required, initial request needed ${a} ${r}.`,w=1+o,E=Y1(e,r,n),U=e.unitConversions?.find(g=>tt(g.requestUom,r));if(!!e.saleUnit&&(tt(r,n)||!!U||tt(r,"each")&&!jv.has(n)))if(tt(r,n))f=a*w/i,v="direct",h=`${a} ${r}${o>0?` x ${w}`:""}`;else if(U){f=a*w/U.quantityPerSaleUnit,v="derived";let g=1/U.quantityPerSaleUnit,S=Math.round(g);h=tt(n,"each")&&U.quantityPerSaleUnit<1&&Math.abs(g-S)<1e-9?`${a} ${r}${o>0?` x ${w}`:""} x ${S} per ${r}`:`${a} ${r}${o>0?` x ${w}`:""} / ${U.quantityPerSaleUnit} ${r} per ${n}`}else tt(r,"each")&&!jv.has(n)&&(f=a*w/i,v="derived",h=`${a} ${n}${o>0?` x ${w}`:""}`);else if(tt(r,n)&&i>0)f=a*w/i,v="direct",h=o>0?`${a} ${r} x ${w} / ${i} ${n} per sell unit`:`${a} ${r} / ${i} ${n} per sell unit`;else if(tt(r,"each")&&i>0&&H1.has(n))f=a*w/i,v="derived",h=o>0?`${a} each x ${w} / ${i} each per ${n}`:`${a} each / ${i} each per ${n}`;else if(Yv(e,r)!=null&&i>0){let g=Yv(e,r)??0;f=a*g*w/i,v="derived";let S=`${a} ${r} x ${g} each${o>0?` x ${w}`:""}`;h=i===1&&tt(n,"each")?S:`${S} / ${i} each per ${n}`}else if(E!=null)f=a*w/E,v="derived",d??(d="round_up_each"),h=`${a} m2 x ${w} / ${E} m2 per ${n} (from product description)`;else if(e.conversionType==="basket_line_unit"){let g=e.coverageQty??null;g!=null&&g>0&&tt(r,e.coverageUom)&&(f=a*w/g,v="derived",h=`${a} ${r} x ${w} / ${g} ${e.coverageUom} per ${n}`)}else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${r}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let g=e.coverageQty??e.derivedCoverageM2??null;tt(r,"m2")&&g!=null&&g>0&&(f=a*w/g,v="derived",h=`${a} m2 x ${w} / ${g} m2 per ${n}`)}else if(e.conversionType==="count_per_area"){let g=e.coverageQty??null;tt(r,"m2")&&g!=null&&g>0?(f=a/g,v="derived",h=`${a} m2 / ${g} m2 per sell unit`):tt(r,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&i>0&&(f=a*e.itemsPerM2*w/i,v="derived",h=`${a} m2 x ${e.itemsPerM2} ${n}/m2 x ${w} / ${i}`)}else if(e.conversionType==="length_from_dims"){let g=e.coverageQty??e.derivedLengthM??null;tt(r,"m")&&g!=null&&g>0&&(f=a*w/g,v="derived",h=`${a} m x ${w} / ${g} m per ${n}`)}else if(e.conversionType==="volume_from_description"){let g=Gv(a,r),S=Gv(e.coverageQty??0,yi(e.coverageUom));g!=null&&S!=null&&S>0&&(f=g*w/S,v="derived",h=`${a} ${r} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${n}`)}else if(e.conversionType==="weight_from_description"){let g=Qv(a,r),S=Qv(e.coverageQty??0,yi(e.coverageUom));g!=null&&S!=null&&S>0&&(f=g*w/S,v="derived",h=`${a} ${r} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${n}`)}else if(e.conversionType==="same_unit_volume"){let g=e.coverageQty??null;tt(r,"m3")&&g!=null&&g>0&&(f=a/g,v="derived",h=`${a} m3 / ${g} m3 per ${n}`)}}if(f==null||!Number.isFinite(f)||f<0)return p(`Quantity review required, initial request needed ${a} ${r}.`);let c=j1(f,d),b=l?e.sellUnitsOverride??null:c;return{requestedAmount:a,requestedUnit:r,salesUnitSize:i,sellUnit:n,calculatedSellUnits:c,requiredSellUnits:b,unitPrice:e.price,lineTotal:e.price!=null&&b!=null?e.price*b:null,calculation:l?`${h} = ${c} ${n} (manually set to ${b})`:`${h} = ${b} ${n}`,costingMode:v}}var $v=()=>import("./xlsx-K4MOA2QM.js"),Po=["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"],X1=Po.indexOf("Line total");function $1(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 Vv(e){let t=await $v(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),n=[Po],i=0;for(let u of e){let{item:p,best:f,qty:v,band:d,unmatchable:h,decision:w}=u,E=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),U=!h&&f?.price!=null?f.price*v:null;U!=null&&(i+=U),n.push([p.source_line_id,p.line_id,p.description_original||"(no description)",E,v,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?"-":f?.product_id??w?.selected_candidate_id??"-",h?"-":f?.description??"-",h?"-":f?.price_basis??"-",h?null:f?.price??null,U,h?"-":d,$1(u)])}n.push(Array(Po.length).fill(null));let o=Array(Po.length).fill(null);o[0]="Estimated total",o[X1]=i,n.push(o),n.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(Po.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(n);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 Jo=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function Zv(e,t){let a=await $v(),r=a.utils.book_new(),n=new Date().toISOString().slice(0,10),i=t?[["Account",t.name+" ("+t.id+")"],[],Jo]:[Jo],o=0;for(let p of e){let f=za(p),v=f.lineTotal;v!=null&&(o+=v),i.push([p.productId,p.description,f.costingMode,f.requestedAmount,xa(f.requestedUnit),f.salesUnitSize,xa(f.sellUnit),f.requiredSellUnits,f.unitPrice,v])}i.push(Array(Jo.length).fill(null));let l=Array(Jo.length).fill(null);l[0]="Estimated total",l[Jo.length-1]=o,i.push(l);let u=a.utils.aoa_to_sheet(i);u["!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,u,"Basket"),a.writeFile(r,t?`basket-${t.id}-${n}.xlsx`:`basket-${n}.xlsx`)}var s=Y(re()),ud="__none__",Fo=24,V1=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function Fv(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var Z1=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function K1(e,t){if(t!==ud){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);if(e?.decision?.technical_classification!=="no_suitable_candidate")return e?.candidates?.[0]}}function Kv(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 J1(e){return e?e.replace(/_/g," "):"not stated"}function P1({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 Sn(e,t){if(e==null)return"-";let a=Ko(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function pd(e){return e&&e.length>0?e.join(" x "):"-"}function F1(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Nn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Kr(e,t){return e.customer_display_label?.trim()||e.description_original||"(no description)"}var Jv=[{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 I1(e){let t=new Map;return[...new Set(e.filter(dr).map(r=>r.linked_group_id))].forEach((r,n)=>{let i=n%26;t.set(r,{token:String.fromCharCode(65+i),bubbleStyle:Jv[n%Jv.length]})}),t}function dr(e){return!1}function Cn(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 cd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function W1(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,5),l=o.some(u=>u.product_id===a)?void 0:e.find(u=>u.product_id===a);return l?[...o,l]:o}let n=new Map(e.map(o=>[o.product_id,o])),i=r.map(o=>n.get(o)).filter(o=>o!=null);if(a&&!i.some(o=>o.product_id===a)){let o=n.get(a);o&&i.unshift(o)}return[...new Map(i.map(o=>[o.product_id,o])).values()].slice(0,5)}function Ys(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 Xs(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 e_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:n}){let i=[...t].sort((l,u)=>u.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-i.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:Xs(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:n})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:Xs(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,u)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:Xs(l.durationMs)})]},`${l.key}-${u}`))})]}),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:i.map((l,u)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:Xs(l.durationMs)})]},`${l.key}-${u}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",i.length," of ",t.length," LLM calls."]})]})]})}function t_({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,n)=>(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:pd(r.measurements_mm)}),(0,s.jsx)("td",{children:Ko(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${n}`))})]})]},`${t.query}-${a}`))]})}function Pv({item:e,result:t}){let a=t?.retrieval_debug.map(n=>n.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Nn(e.procurement_aliases)],["Retrieval queries",Nn(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)",pd(e.attrs.measurements_mm)],["Stock length",F1(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",Nn(e.installation_clues)],["System clues",Nn(e.system_clues)],["Component requirements",Nn(e.component_requirements)],["Linked group",Cn(e)||"-"],["Flags",Nn(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(([n,i])=>(0,s.jsxs)(we.Fragment,{children:[(0,s.jsx)("dt",{children:n}),(0,s.jsx)("dd",{children:i})]},n))})]})}function a_({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)(we.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(we.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(we.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(we.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(we.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 r_({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,n])=>(0,s.jsxs)(we.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:n})]},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 i_({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:n=!1,linkedGroupMeta:i}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"Exact match not found:":`AI review (${t.confidence??"confidence not stated"}):`;return n?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]}),dr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",i?`Link ${i.token} - `:"",Cn(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(Pv,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Pv,{item:e,result:a}),r&&(0,s.jsx)(a_,{item:e}),r&&(0,s.jsx)(r_,{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]}),dr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",i?`Link ${i.token} - `:"",Cn(e)]}):null]}),r&&(0,s.jsx)(t_,{queries:a?.retrieval_debug??[]})]})}function n_({item:e,candidates:t,result:a,decision:r,unmatchable:n,selectedProductId:i,detailMode:o,onPick:l,onClear:u,showAll:p=!1,internal:f=!1,debugEnabled:v=!1,forceReviewNote:d=!1,linkedGroupMeta:h}){let w=f||o==="detailed",E=v&&o==="detailed",U=w||d?(0,s.jsx)(i_,{item:e,decision:r,result:a,showRetrievalDebug:E,reviewOnly:d&&!w,linkedGroupMeta:h}):null;if(n)return(0,s.jsxs)(s.Fragment,{children:[U,(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:[U,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let m=p||f||o==="detailed"?t:W1(t,a,i);return(0,s.jsxs)(s.Fragment,{children:[U,(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"}),E&&(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((c,b)=>{let g=c.product_id===i;return(0,s.jsxs)("tr",{className:g?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:c.description}),(0,s.jsx)("div",{className:"results-row-meta",children:c.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:pd(c.measurements_mm??c.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:Sn(c.price,c.price_basis)}),E&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(c.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.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)(P1,{band:Fv(c.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(c.scores?.overall??0).toFixed(2)})]})})]}),(0,s.jsx)("td",{children:(0,s.jsxs)("label",{className:"switch-toggle",title:g?"Currently selected":"Use this candidate",children:[(0,s.jsx)("input",{type:"checkbox",checked:g,onChange:()=>{g?u?.():l(c)},"aria-label":g?`${c.description} selected`:`Use ${c.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${c.product_id}-${b}`)})})]})]})}function dd({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:n,onGoToBasket:i,cartSeeded:o,onCartSeeded:l,reviewGateComplete:u,onReviewGateComplete:p,internal:f=!1}){let v=!f&&Ls()==="QZA6-MRA4",d=v?"quote":"basket",{results:h,lineItems:w,parseReport:E,timings:U}=e,[m,c]=(0,we.useState)({}),[b,g]=(0,we.useState)({}),[S,z]=(0,we.useState)({}),[T,R]=(0,we.useState)(""),[j,W]=(0,we.useState)(null),[ve,Se]=(0,we.useState)(1),[Re,Pe]=(0,we.useState)(!1);(0,we.useEffect)(()=>{Pe(new URLSearchParams(window.location.search).get("debug")==="1")},[]);let[Me,X]=(0,we.useState)("simple"),[K,Z]=(0,we.useState)(f?"list":"tile"),[de,Le]=(0,we.useState)(!1),[ue,Ue]=(0,we.useState)(null),[Ee,dt]=(0,we.useState)(""),[bt,Ht]=(0,we.useState)([]),[mt,nt]=(0,we.useState)(!1),[ft,G]=(0,we.useState)(null),[y,M]=(0,we.useState)(!1),[ee,le]=(0,we.useState)(null),pe=(0,we.useRef)(null),[Fe,xt]=(0,we.useState)(new Set),[k,H]=(0,we.useState)(new Set),[B,ne]=(0,we.useState)(!1);(0,we.useEffect)(()=>{Se(1)},[T,j,K]);let te=new Map(h.map(x=>[x.line_id,x])),C=I1(w),Q=w.map(x=>{let O=te.get(x.line_id),Ce=O?.decision,zt=Z1(x),Qe=m[x.line_id],Ft=K1(O,Qe),Mi=a[x.line_id],zw=Qe===ud?void 0:b[x.line_id]??(Mi&&Mi.productId!==Ft?.product_id?Kv(Mi):Ft),Kd=zt?void 0:zw,Aw=x.qty??0;return{item:x,result:O,decision:Ce,unmatchable:zt,best:Kd,qty:Aw,band:Fv(Kd?.scores?.overall)}}),J=0,fe=0;for(let x of Q)x.unmatchable||x.decision?.include_in_quote!==!0||!x.best||(x.best.price!=null?J+=x.best.price*x.qty:fe+=1);let ye=x=>!x.unmatchable&&!x.best&&x.decision?.technical_classification!=="no_suitable_candidate"&&Ys(x.result).length>0,$e=x=>x.best??Ys(x.result)[0],ca=Q.filter(x=>!x.unmatchable&&!x.best).filter(x=>!k.has(x.item.line_id)),il=Q.filter(x=>k.has(x.item.line_id)),ua=Q;if(T.trim()){let x=T.trim().toLowerCase();ua=ua.filter(O=>O.item.description_original?.toLowerCase().includes(x)||$e(O)?.description?.toLowerCase().includes(x))}if(j){let x=j==="asc"?1:-1;ua=[...ua].sort((O,Ce)=>x*(O.item.description_original||"").localeCompare(Ce.item.description_original||""))}let Bn=Math.max(1,Math.ceil(ua.length/Fo)),Pt=Math.min(ve,Bn),gr=ua.slice((Pt-1)*Fo,Pt*Fo),Xa=gr.filter(x=>!x.unmatchable&&x.best),Hd=gr.filter(x=>ye(x)),On=gr.filter(x=>!x.unmatchable&&(x.best||ye(x))),jd=gr.filter(x=>x.unmatchable||!x.best&&!ye(x)),F=ue?Q.find(x=>x.item.line_id===ue)??null:null,Nw=!f&&!u&&!F&&ca.length>0,Ln=(0,we.useRef)(null),Hn=()=>{let x=pe.current;if(!x)return;let{top:O,left:Ce,width:zt,height:Qe}=x.getBoundingClientRect(),Mi=x.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;le({top:O,left:Ce,width:Mi?Mi-Ce:zt,height:Qe})};(0,we.useEffect)(()=>(window.addEventListener("scroll",Hn,!0),window.addEventListener("resize",Hn),()=>{window.removeEventListener("scroll",Hn,!0),window.removeEventListener("resize",Hn)})),(0,we.useEffect)(()=>{let x=O=>{Ln.current&&!O.composedPath().includes(Ln.current)&&Ln.current.removeAttribute("open")};return document.addEventListener("click",x),()=>document.removeEventListener("click",x)},[]);let Ci=x=>{Ue(x),dt("")},Sw=()=>{if(!ue)return;let x=a[ue];if(x){c(O=>({...O,[ue]:x.productId})),g(O=>({...O,[ue]:Kv(x)}));return}c(O=>{let Ce={...O};return delete Ce[ue],Ce}),g(O=>{let Ce={...O};return delete Ce[ue],Ce})},hr=(x=!1)=>{let O=ue?a[ue]:void 0;!x&&O&&F?.best&&O.productId!==F.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(x||Sw(),Ue(null),ne(!1))},Cw=x=>{if(xt(O=>new Set(O).add(x)),ca.some(O=>O.item.line_id!==x)){hr(!0);return}p(),hr(!0)},qw=x=>{if(dc(x),H(O=>new Set(O).add(x)),ca.some(O=>O.item.line_id!==x)){hr(!0);return}p(),hr(!0)},Ew=()=>{H(x=>new Set([...x,...ca.map(O=>O.item.line_id)])),p()},Gd=()=>{F?.best&&(Yd(F.item.line_id,F.best),r(qi(F)),B?Cw(F.item.line_id):hr(!0))},Qd=jd.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:jd.map(x=>{let{item:O,qty:Ce}=x;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>Ci(O.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Kr(O,w)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},O.line_id)})})]}):null,dc=x=>{c(O=>({...O,[x]:ud})),g(O=>({...O,[x]:void 0})),z(O=>({...O,[x]:void 0})),n(x)},mc=(x,O)=>{c(Ce=>({...Ce,[x]:O.product_id})),g(Ce=>({...Ce,[x]:O}))},Yd=(x,O)=>{O.method==="catalogue_search"&&z(Ce=>({...Ce,[x]:O}))};function X_(){Vv(Q.map(({item:x,best:O,qty:Ce,band:zt,unmatchable:Qe,decision:Ft})=>({item:x,best:O,qty:Ce,band:zt,unmatchable:Qe,decision:Ft})))}function qi(x){let O=x.best??Ys(x.result)[0];return Zr(O,{lineId:x.item.line_id,description:x.item.description_original,unit:x.item.unit,qty:x.qty})}(0,we.useEffect)(()=>{if(!o){for(let x of Q)!x.unmatchable&&x.best&&r(qi(x));l()}},[o]),(0,we.useEffect)(()=>{for(let x of Q){let O=a[x.item.line_id];if(!O)continue;let Ce=qi(x);r({...Ce,qty:O.qty,sellUnitsOverride:O.sellUnitsOverride??null})}},[e]),(0,we.useEffect)(()=>{if(!ue){Ht([]),G(null),nt(!1);return}let x=Ee.trim();if(!x){Ht([]),G(null),nt(!1);return}let O=!1,Ce=window.setTimeout(async()=>{try{nt(!0),G(null);let zt=await fetch(Bt(`/api/catalogue/search?q=${encodeURIComponent(x)}`),{headers:bi()}),Qe=await Zt(zt);if(!zt.ok)throw new Error(Qe?.error||Qe?.message||"Failed to search catalogue");O||Ht(Array.isArray(Qe?.items)?Qe.items:[])}catch(zt){O||(Ht([]),G(zt?.message||"Failed to search catalogue"))}finally{O||nt(!1)}},250);return()=>{O=!0,window.clearTimeout(Ce)}},[Ee,ue]);let fc=Object.keys(a).length,qa=Ee.trim(),Xd=Ys(F?.result),nl=F?.decision?.technical_classification==="no_suitable_candidate"||!!F&&!F.best,$d=F?.decision?.technical_classification!=null,Vd=F?.decision?.reason??(nl?"No catalogue candidate found. Refine the request or search the catalogue.":null),Mw=bt.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"})),jn=qa?Mw:Xd,Ei=F?S[F.item.line_id]:void 0,Gn=!qa&&Ei&&!jn.some(x=>x.product_id===Ei.product_id)?[...jn,Ei]:jn,Zd=(()=>{let x=Gn.slice(0,qa?12:3);return qa||!Ei||x.some(O=>O.product_id===Ei.product_id)?x:[...x,Ei]})(),ol=!!F?.best&&a[F.item.line_id]?.productId===F.best.product_id,Tw=!!F?.best&&!!a[F.item.line_id]&&!ol;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${f?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${f?"":" quick-order-hero--customer"}`,children:f?(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:et(J)})," 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 ",v?"View Quote":"View Basket"," to continue."]})]}),(0,s.jsxs)("button",{type:"button",className:"results-total-action",onClick:i,"aria-label":v?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:v?"View Quote":"View Basket"}),(0,s.jsx)("strong",{children:et(J)})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Ot,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[Re&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":de,onClick:()=>Le(x=>!x),children:de?"Hide timings":"Show timings"})}),Re&&de&&(0,s.jsx)(e_,{...U}),!v&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!F&&(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:0},children:[fe>0&&(0,s.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,s.jsx)("strong",{children:fe})," 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:T,onChange:x=>R(x.target.value),"aria-label":"Search line items"}),!f&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${K==="tile"?" is-active":""}`,"aria-pressed":K==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>Z("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${K==="list"?" is-active":""}`,"aria-pressed":K==="list","aria-label":"List view",title:"List view",onClick:()=>Z("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"})]})})]}),Re&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>X(x=>x==="simple"?"detailed":"simple"),children:Me==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:Ln,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:V1.map(x=>{let O=j===x.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${O?" is-active":""}`,onClick:()=>{W(O?null:x.dir),Ln.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:O?"\u2713":""}),x.label]},x.dir)})})]})]})]})}),K==="tile"||F?(0,s.jsxs)(s.Fragment,{children:[F?(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Product options",onClick:()=>hr(),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:()=>hr(),"aria-label":"Close product options",children:(0,s.jsx)(Xo,{})}),(0,s.jsx)("div",{className:"results-review-page",children:f?(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:()=>hr(),children:[(0,s.jsx)(Vr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[Re&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>X(x=>x==="simple"?"detailed":"simple"),children:Me==="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:Ee,onChange:x=>dt(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:()=>dc(F.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:Qa($e(F)?.description||F.item.description_original,$e(F)?.product_id,$e(F)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Kr(F.item,w)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[wi(F.qty)," ",ka(F.item.unit,F.qty)]}),F.best?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:F.best.description}),F.best.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Sn(F.best.price,F.best.price_basis)}):null]}):$e(F)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:$e(F)?.description}),$e(F)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Sn($e(F)?.price??null,$e(F)?.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."}),dr(F.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(cd,{meta:C.get(F.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Cn(F.item)})]}):null,(0,s.jsx)("div",{className:"results-review-page__actions",children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[F.item.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[F.item.line_id]?n(F.item.line_id):(F.best&&Yd(F.item.line_id,F.best),r(qi(F)))},disabled:!F.best,"aria-label":a[F.item.line_id]?f?"Remove from selection":`Remove from ${d}`:f?"Add to selection":`Add to ${d}`,children:a[F.item.line_id]?"\u2713 Added":f?"+ Add to selection":`Add to ${d}`})})]})]}),mt?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!mt&&ft?(0,s.jsx)("div",{className:"results-empty-card",children:ft}):null,!mt&&!ft&&qa&&jn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!mt&&!ft?(0,s.jsx)(n_,{item:F.item,candidates:jn,result:F.result,decision:F.decision,unmatchable:F.unmatchable,selectedProductId:F.best?.product_id??null,detailMode:Me,linkedGroupMeta:dr(F.item)?C.get(F.item.linked_group_id):void 0,onPick:x=>mc(F.item.line_id,x),onClear:()=>dc(F.item.line_id),showAll:f||Re||qa.length>0,internal:f,debugEnabled:Re,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:Kr(F.item,w)||"Original request"})]}),Vd?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:nl?"Exact match not found:":"AI review:"})," ",Vd]}):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:nl?"We couldn't find a suitable product":$d?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:nl?Xd.length>0?"These AI-reviewed alternatives may be useful, but need approval.":"Search the catalogue to choose an alternative.":$d?`Select the option you want to add to your ${d}.`:"Search the catalogue to choose a product."})]})}),!qa&&Gn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:Zd.map(x=>{let O=x.product_id===F.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${O?" is-selected":""}`,onClick:()=>mc(F.item.line_id,x),"aria-pressed":O,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Qa(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${Sn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:O?"Selected":"Choose"})]},x.product_id)})}):null,Gn.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:Ee,onChange:x=>dt(x.target.value),"aria-label":"Search catalogue"})]}),qa&&mt?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,qa&&!mt&&ft?(0,s.jsx)("div",{className:"results-empty-card",children:ft}):null,qa&&!mt&&!ft&&Gn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,qa&&!mt&&!ft&&Gn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:Zd.map(x=>{let O=x.product_id===F.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${O?" is-selected":""}`,onClick:()=>mc(F.item.line_id,x),"aria-pressed":O,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Qa(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${Sn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:O?"Selected":"Choose"})]},x.product_id)})}):null]}),F.best?Tw?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{Gd()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>n(F.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${d}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${ol?" cta-btn-secondary":""}`,onClick:()=>{ol?n(F.item.line_id):Gd()},children:(0,s.jsx)("span",{children:ol?`Remove from ${d}`:`Add selected product to ${d}`})}):null,B?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>qw(F.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[ua.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,On.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:On.map(x=>{let{item:O,best:Ce,qty:zt}=x,Qe=$e(x),Ft=!Ce&&ye(x);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>Ci(O.line_id),"aria-label":`Review match for ${Kr(O,w)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[Ft||dr(O)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[dr(O)?(0,s.jsx)(cd,{meta:C.get(O.linked_group_id)}):(0,s.jsx)("span",{}),Ft?(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:Qa(Qe?.description||O.description_original,Qe?.product_id,Qe?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Qe?(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:Qe.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:Qe?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:Ft?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Kr(O,w)}),dr(O)?(0,s.jsx)("div",{className:"results-row-meta",children:Cn(O)}):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:[f&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ci(O.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[O.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[O.line_id]?n(O.line_id):r(qi(x))},disabled:!Qe,"aria-label":a[O.line_id]?f?"Remove from selection":`Remove from ${d}`:f?"Add to selection":`Add to ${d}`,children:a[O.line_id]?"\u2713 Added":f?"+ Add":`Add to ${d}`})]})]},O.line_id)})})}):null,Qd]})]}):(0,s.jsxs)(s.Fragment,{children:[ee&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:ee,"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"}}),Me==="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"}),Me==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:f?"Selection":v?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[ua.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:Me==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),On.map(x=>{let{item:O,result:Ce,decision:zt,best:Qe}=x;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>Ci(O.line_id),onMouseEnter:Ft=>{pe.current=Ft.currentTarget,Hn()},onMouseLeave:()=>{pe.current=null,le(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Kr(O,w)}),dr(O)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(cd,{meta:C.get(O.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Cn(O)})]}):null]}),(0,s.jsx)("td",{children:Qe?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Qe.description,children:Qe.description}),Me==="detailed"&&zt?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[J1(zt.technical_classification),zt.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Qe?.price!=null?Sn(Qe.price,Qe.price_basis):"-"}),Me==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[O.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:Ft=>{Ft.stopPropagation(),a[O.line_id]?n(O.line_id):r(qi(x))},"aria-label":a[O.line_id]?f?"Remove from selection":`Remove from ${d}`:f?"Add to selection":`Add to ${d}`,children:a[O.line_id]?"\u2713 Added":f?"+ Add":`Add to ${d}`})})]},O.line_id)})]})]})}),Qd]}),!F&&Bn>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(Pt-1)*Fo+1,"\u2013",Math.min(Pt*Fo,ua.length)," of ",ua.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Se(Pt-1),disabled:Pt===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",Pt," of ",Bn]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Se(Pt+1),disabled:Pt===Bn,children:"Next"})]})]}),(E.itemCount!=null||E.headingCount!=null||E.skippedCount!=null)&&(0,s.jsxs)("div",{className:"results-summary",style:{marginTop:16},children:[E.itemCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.itemCount})," items parsed"]}),E.headingCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.headingCount})," headings"]}),E.skippedCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.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."})]}),!F&&(0,s.jsxs)("div",{className:"btn-row results-actions",children:[(0,s.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:(fc>0,"0 1 30%"),gap:10,justifyContent:"center"},onClick:()=>M(!0),"aria-label":"Start over",children:[(0,s.jsx)(ld,{}),(0,s.jsx)("span",{children:"Start Over"})]}),fc>0&&(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:i,"aria-label":f?"View selection":v?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[f?"View Selection":v?"View Quote":"View Basket"," (",fc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Ot,{})})]})]})]})]}),Nw&&(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:ca.map(x=>{let O=Fe.has(x.item.line_id),Ce=ye(x);return(0,s.jsx)("div",{className:`review-gate-item${O?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{ne(!0),Ci(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Kr(x.item,w)}),(0,s.jsx)("span",{children:x.decision?.reason||(Ce?"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:O?"Choice made":"Choose a product"})]})},x.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:Ew,children:"Skip all"}),il.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),il.map(x=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{H(O=>{let Ce=new Set(O);return Ce.delete(x.item.line_id),Ce}),ne(!0),Ci(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Kr(x.item,w)}),(0,s.jsx)("span",{children:`Not added to your ${d}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},x.item.line_id))]}):null]})}),y&&(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 ",v?"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:()=>M(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{M(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var Et=Y(Ye());var q=Y(re()),o_=.2,Io=10,l_=(e,t)=>{let a=`${t.requestedAmount} ${xa(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${xa(t.sellUnit,t.requiredSellUnits??0)}`,n=e.unitConversions?.find(i=>i.requestUom===t.requestedUnit);return n&&n.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/n.quantityPerSaleUnit)} ${xa(t.sellUnit,2)} per ${xa(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 ${xa(e.sellUnit,1)}.`;function c_(){return(0,q.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,q.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,q.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,q.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,q.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function Wo(){return(0,q.jsx)("svg",{width:"8",height:"5",viewBox:"0 0 8 5",fill:"none",children:(0,q.jsx)("path",{d:"M1 4L4 1L7 4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function el({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:n,onBack:i,onStartNewQuote:o,internal:l=!1}){let u=(0,Et.useId)(),p=!l&&Ls()==="QZA6-MRA4",f=Object.values(e),[v,d]=(0,Et.useState)(""),[h,w]=(0,Et.useState)(!1),[E,U]=(0,Et.useState)(!1),[m,c]=(0,Et.useState)(""),[b,g]=(0,Et.useState)({}),[S,z]=(0,Et.useState)({}),[T,R]=(0,Et.useState)(1),[j,W]=(0,Et.useState)({}),[ve,Se]=(0,Et.useState)(!1),[Re,Pe]=(0,Et.useState)("0"),Me=(0,Et.useRef)(new Set);(0,Et.useEffect)(()=>{if(!r)return;let G=Object.values(e).filter(y=>y.productId!=="-"&&za(y).requiredSellUnits==null&&!Me.current.has(y.lineId));G.length!==0&&(G.forEach(y=>Me.current.add(y.lineId)),fetch(Bt("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:G.map(y=>({line_id:y.lineId,product_id:y.productId,requested_description:y.requestedDescription??y.description,requested_qty:y.qty,requested_uom:y.unit,selected_description:y.description,selected_uoi:y.uoi,selected_uoi_count:y.uoiCount,selected_conversion:{sales_uom_normalised:y.salesUomNormalised,conversion_type:y.conversionType,sales_unit_size:y.salesUnitSize,sales_unit_size_uom:y.salesUnitSizeUom,coverage_qty:y.coverageQty,coverage_uom:y.coverageUom}}))})}).then(y=>y.ok?Zt(y):null).then(y=>{let M={};for(let ee of y?.data?.items??y?.items??[]){let le=ee?.conversion;!le||typeof ee?.line_id!="string"||(M[ee.line_id]={conversionType:le.conversion_type,requestUomsSupported:le.request_uoms_supported,salesUomNormalised:le.sales_uom_normalised,salesUnitSize:le.sales_unit_size,salesUnitSizeUom:le.sales_unit_size_uom,coverageQty:le.coverage_qty,coverageUom:le.coverage_uom,roundingRule:le.rounding_rule,conversionConfidence:le.conversion_confidence,conversionNotes:le.conversion_notes})}Object.keys(M).length>0&&r(M)}).catch(()=>{}))},[e,r]);function X(G){g(y=>{let M={...y};return delete M[G],M})}function K(G,y){let M=parseFloat(y);!isNaN(M)&&M>=0&&t(G,M),X(G)}function Z(G,y,M){t(G,Math.max(0,y+M)),X(G)}function de(G){z(y=>{let M={...y};return delete M[G],M})}function Le(G,y){let M=parseFloat(y);!isNaN(M)&&M>=0&&a(G,M),de(G)}function ue(G,y,M){a(G,Math.max(0,y+M)),de(G)}async function Ue(){let G=v.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(G)){c("Enter a valid email address so we can send your better price.");return}c(""),U(!0);try{let y=await fetch(Bt("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({email:G,items:Ee.map(({item:M,pricing:ee})=>{let le=ee.requiredSellUnits??ee.requestedAmount,pe=ee.requiredSellUnits!=null?ee.sellUnit:ee.requestedUnit;return{product_id:M.productId,description:M.description,quantity:le,unit:xa(pe,le),unit_price:ee.requiredSellUnits!=null?ee.unitPrice:null,line_total:ee.lineTotal}})})});if(!y.ok){let M=await Zt(y);c(y.status===429?"You've sent a few requests already. Please try again in a few minutes.":M?.message??"Your request couldn't be sent. Please try again.");return}w(!0),window.scrollTo(0,0)}catch{c("Your request couldn't be sent. Check your connection and try again.")}finally{U(!1)}}let Ee=f.map(G=>({item:G,pricing:za(G,{wasteFactorEnabled:ve,wasteFactorOverride:Math.max(0,Number.parseFloat(Re)||0)/100})})),dt=Ee.reduce((G,y)=>G+(y.pricing.lineTotal??0),0),bt=dt*o_,Ht=dt+bt,mt=Math.max(1,Math.ceil(Ee.length/Io)),nt=Math.min(T,mt),ft=Ee.slice((nt-1)*Io,nt*Io);return h?(0,q.jsx)("div",{className:"wizard-step entry-stage",children:(0,q.jsxs)("div",{className:"quote-request-sent",role:"status",children:[(0,q.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,q.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,q.jsx)("polyline",{points:"5 12.5 10 17.5 19 7"})})}),(0,q.jsx)("h1",{children:"Quote requested"}),(0,q.jsxs)("p",{children:["You're all done. We'll email your sharper price to ",(0,q.jsx)("strong",{children:v.trim()}),", usually within one working day."]}),(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,q.jsx)("span",{children:"Start a new quote"})}),(0,q.jsx)("p",{className:"quote-request-sent-note",children:"Nothing is charged until you approve the quote."})]})}):(0,q.jsx)("div",{className:`wizard-step entry-stage${p?" basket-layout--qza6-mra4":""}`,children:(0,q.jsxs)("div",{className:`quick-order-card${l?"":" quick-order-card--customer"}`,children:[(0,q.jsxs)("div",{className:`quick-order-hero${l?"":" quick-order-hero--customer"}`,children:[l&&(0,q.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,q.jsxs)("div",{className:"basket-hero-copy",children:[p&&(0,q.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:i,children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]}),(0,q.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,q.jsx)("h1",{children:l?"Your Selection":p?"Request a quote":"Your Basket"}),l&&(0,q.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,q.jsx)("strong",{children:f.length})," ",f.length===1?"item":"items"]})]}),(0,q.jsx)("p",{children:l?"Review the items you've added before exporting them for review.":p?"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,q.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:f.length===0?(0,q.jsxs)("div",{className:"quick-order-history-empty",children:[(0,q.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:l?"\u{1F4CB}":"\u{1F9FA}"}),(0,q.jsx)("p",{children:l?"Your selection is empty.":p?"Your quote request is empty.":"Your basket is empty."}),(0,q.jsx)("p",{className:"basket-empty-hint",children:p?"Go back to your results and add items for your quote.":"Go back to your results and add quoted items."}),(0,q.jsx)("div",{className:"btn-row",style:{marginTop:20,justifyContent:"center"},children:(0,q.jsx)("button",{className:"cta-btn",style:{width:"auto",maxWidth:280},onClick:i,"aria-label":"Back to results",children:(0,q.jsx)("span",{children:"Back to Results"})})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("div",{className:"basket-layout",children:[(0,q.jsxs)("div",{className:"basket-main",children:[(0,q.jsx)("div",{className:"basket-list","aria-label":l?"Selection items":p?"Quote request items":"Basket items",children:ft.map(({item:G,pricing:y})=>{let M=b[G.lineId]??String(y.requestedAmount),ee=y.requestedUnit===y.sellUnit||y.costingMode==="review",le=y.requiredSellUnits==null||y.requestedAmount!==y.requiredSellUnits||y.requestedUnit!==y.sellUnit;return(0,q.jsxs)("article",{className:"basket-card",children:[(0,q.jsxs)("div",{className:"basket-card-top",children:[(0,q.jsx)("img",{className:"basket-card-thumb",src:Qa(G.description,G.productId,G.pdpPhotoUrl),alt:"",width:48,height:48}),(0,q.jsxs)("div",{className:"basket-card-info",children:[(0,q.jsx)("div",{className:"bom-component-name",children:G.description}),le&&y.costingMode!=="review"&&(0,q.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>W(pe=>({...pe,[G.lineId]:!pe[G.lineId]})),"aria-expanded":!!j[G.lineId],children:["How we calculated this",(0,q.jsx)("span",{className:`basket-calc-toggle-chevron${j[G.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,q.jsx)(Wo,{})})]})]}),(0,q.jsx)("div",{className:"basket-card-actions",children:(0,q.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>n(G.lineId),"aria-label":`Remove ${G.description}`,children:(0,q.jsx)(c_,{})})})]}),l&&(0,q.jsxs)("div",{className:"results-detail-block basket-internal-detail",children:[(0,q.jsxs)("dl",{className:"results-detail-grid",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion type"}),(0,q.jsx)("dd",{children:G.conversionType??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion confidence"}),(0,q.jsx)("dd",{children:G.conversionConfidence??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Sales unit"}),(0,q.jsx)("dd",{children:G.salesUnitSize!=null?(0,q.jsxs)(q.Fragment,{children:[G.salesUnitSize," ",ka(G.salesUnitSizeUom,G.salesUnitSize)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Coverage"}),(0,q.jsx)("dd",{children:G.coverageQty!=null?(0,q.jsxs)(q.Fragment,{children:[G.coverageQty," ",ka(G.coverageUom,G.coverageQty)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Waste factor"}),(0,q.jsx)("dd",{children:G.wasteFactorDefault??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Rounding rule"}),(0,q.jsx)("dd",{children:G.roundingRule??"-"})]})]}),G.conversionNotes&&(0,q.jsx)("p",{className:"results-rerank-note",children:G.conversionNotes})]}),y.costingMode==="review"?(0,q.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,q.jsx)("strong",{children:"Quantity needs confirmation."})," ",s_(y)]}):le&&j[G.lineId]?(0,q.jsx)("p",{className:"basket-calc-text",children:l_(G,y)}):null,(0,q.jsxs)("div",{className:"basket-card-stats",children:[(0,q.jsxs)("div",{className:"basket-stat",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Requested qty"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsxs)("div",{className:"basket-qty-field",children:[(0,q.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:M,disabled:ee,onChange:pe=>g(Fe=>({...Fe,[G.lineId]:pe.target.value})),onBlur:pe=>K(G.lineId,pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&pe.target.blur()},"aria-label":`${G.description} requested quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:ee,onClick:()=>Z(G.lineId,parseFloat(M)||0,1),"aria-label":`Increase ${G.description} quantity`,children:(0,q.jsx)(Wo,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:ee,onClick:()=>Z(G.lineId,parseFloat(M)||0,-1),"aria-label":`Decrease ${G.description} quantity`,children:(0,q.jsx)(Wo,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(y.requestedUnit,parseFloat(M)||0)})]})]}),(0,q.jsxs)("div",{className:"basket-stat basket-stat--right",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Order qty"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsxs)("div",{className:"basket-qty-field",children:[(0,q.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:S[G.lineId]??String(y.requiredSellUnits??""),onChange:pe=>z(Fe=>({...Fe,[G.lineId]:pe.target.value})),onBlur:pe=>Le(G.lineId,pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&pe.target.blur()},"aria-label":`${G.description} order quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>ue(G.lineId,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${G.description} order quantity`,children:(0,q.jsx)(Wo,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>ue(G.lineId,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${G.description} order quantity`,children:(0,q.jsx)(Wo,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(y.sellUnit,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0)})]})]}),(0,q.jsxs)("div",{className:"basket-stat basket-stat--total",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Total"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsx)("strong",{children:y.lineTotal!=null?et(y.lineTotal):"-"}),y.lineTotal!=null&&(0,q.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},G.lineId)})}),mt>1&&(0,q.jsxs)("div",{className:"results-pagination",children:[(0,q.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(nt-1)*Io+1,"\u2013",Math.min(nt*Io,Ee.length)," of ",Ee.length]}),(0,q.jsxs)("div",{className:"results-pagination-controls",children:[(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>R(nt-1),disabled:nt===1,children:"Previous"}),(0,q.jsxs)("span",{className:"results-pagination-page",children:["Page ",nt," of ",mt]}),(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>R(nt+1),disabled:nt===mt,children:"Next"})]})]})]}),(0,q.jsxs)("aside",{className:"basket-sidebar",children:[(0,q.jsx)("div",{className:"basket-sidebar-title",children:p?"Quote request summary":"Order summary"}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:p?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,q.jsx)("span",{children:et(dt)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:"VAT (20%)"}),(0,q.jsx)("span",{children:et(bt)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,q.jsx)("span",{children:p?"List price (inc. VAT)":"Total"}),(0,q.jsx)("span",{children:et(Ht)})]}),!p&&(0,q.jsx)("div",{className:"basket-summary-waste",children:(0,q.jsxs)("div",{className:"basket-waste-control",children:[(0,q.jsxs)("label",{className:"basket-global-waste",children:[(0,q.jsx)("input",{type:"checkbox",checked:ve,onChange:G=>Se(G.target.checked)}),(0,q.jsx)("span",{children:"Add waste factor"})]}),(0,q.jsxs)("label",{className:"basket-global-waste-percent",children:[(0,q.jsx)("input",{type:"number",inputMode:"decimal",min:"0",step:"0.1",value:Re,onChange:G=>Pe(G.target.value),disabled:!ve,"aria-label":"Waste factor percent"}),(0,q.jsx)("span",{children:"%"})]})]})}),(0,q.jsx)("label",{htmlFor:`${u}-basket-reference`,className:"basket-sidebar-label",children:p?"Enter email for your sharper quote":"Your reference (optional)"}),(0,q.jsx)("input",{id:`${u}-basket-reference`,type:p?"email":"text",className:"basket-sidebar-input",value:v,onChange:G=>{d(G.target.value),p&&c("")},placeholder:p?"you@example.com":"PO number or job reference"}),p&&m&&(0,q.jsx)("p",{className:"basket-quote-request-error",role:"alert",children:m}),p?(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{Ue()},disabled:E,"aria-busy":E,children:(0,q.jsx)("span",{children:E?"Sending\u2026":"Request our best quote"})}):(0,q.jsx)("button",{className:"cta-btn",onClick:()=>{Zv(f)},"aria-label":l?"Download selection":"Download basket",children:(0,q.jsx)("span",{children:l?"Download Quote":"Buy Now"})}),(0,q.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,q.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),p?"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,q.jsx)("div",{className:"btn-row results-actions",children:(0,q.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:i,"aria-label":"Back to results",children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]})})]})})]})})}var Mt=Y(Ye()),Iv=Y(re()),md=(0,Mt.createContext)(null);function $s({children:e,onOpenBasket:t}){let[a,r]=(0,Mt.useState)({}),n=(0,Mt.useCallback)(d=>{r(h=>({...h,[d.lineId]:d}))},[]),i=(0,Mt.useCallback)(d=>{r(h=>{let w={...h};for(let E of d)w[E.lineId]=E;return w})},[]),o=(0,Mt.useCallback)(d=>{r(h=>{let w={...h};return delete w[d],w})},[]),l=(0,Mt.useCallback)((d,h)=>{r(w=>w[d]?{...w,[d]:{...w[d],qty:h,sellUnitsOverride:null}}:w)},[]),u=(0,Mt.useCallback)((d,h)=>{r(w=>w[d]?{...w,[d]:{...w[d],sellUnitsOverride:h}}:w)},[]),p=(0,Mt.useCallback)(d=>{r(h=>{let w=!1,E={...h};for(let[U,m]of Object.entries(d))E[U]&&(E[U]={...E[U],...m},w=!0);return w?E:h})},[]),f=(0,Mt.useCallback)(()=>r({}),[]),v=(0,Mt.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:n,addManyToCart:i,removeFromCart:o,updateCartQty:l,updateCartSellUnits:u,updateCartConversions:p,clearCart:f,openBasket:t??(()=>{})}),[a,n,i,o,l,u,p,f,t]);return(0,Iv.jsx)(md.Provider,{value:v,children:e})}function qn(){let e=(0,Mt.useContext)(md);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function Vs(){return(0,Mt.useContext)(md)}var Aa=Y(re());function Zs(e){return(0,Aa.jsx)($s,{children:(0,Aa.jsx)(u_,{...e})})}function u_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,n]=(0,it.useState)("entry"),[i,o]=(0,it.useState)(null),[l,u]=(0,it.useState)(""),p=(0,it.useRef)(null),[f,v]=(0,it.useState)(0),[d,h]=(0,it.useState)(null),[w,E]=(0,it.useState)(!1),{cart:U,addToCart:m,removeFromCart:c,updateCartQty:b,updateCartSellUnits:g,updateCartConversions:S,clearCart:z}=qn(),[T,R]=(0,it.useState)(!1),j=(0,it.useRef)(new Map);(0,it.useEffect)(()=>{let K=Object.values(U).filter(Z=>{if(Z.productId==="-"||za(Z).requiredSellUnits!=null)return!1;let de=`${Z.productId}|${Z.qty}|${Z.unit}`;return j.current.get(Z.lineId)===de?!1:(j.current.set(Z.lineId,de),!0)});K.length!==0&&fetch(Bt("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:K.map(Z=>({line_id:Z.lineId,product_id:Z.productId,requested_description:Z.requestedDescription??Z.description,requested_qty:Z.qty,requested_uom:Z.unit,selected_description:Z.description,selected_uoi:Z.uoi,selected_uoi_count:Z.uoiCount,selected_conversion:{sales_uom_normalised:Z.salesUomNormalised,conversion_type:Z.conversionType,sales_unit_size:Z.salesUnitSize,sales_unit_size_uom:Z.salesUnitSizeUom,coverage_qty:Z.coverageQty,coverage_uom:Z.coverageUom}}))})}).then(Z=>Z.ok?Zt(Z):null).then(Z=>{let de={};for(let Le of Z?.data?.items??Z?.items??[]){let ue=Le?.conversion;!ue||typeof Le?.line_id!="string"||(de[Le.line_id]={conversionType:ue.conversion_type,requestUomsSupported:ue.request_uoms_supported,salesUomNormalised:ue.sales_uom_normalised,salesUnitSize:ue.sales_unit_size,salesUnitSizeUom:ue.sales_unit_size_uom,coverageQty:ue.coverage_qty,coverageUom:ue.coverage_uom,roundingRule:ue.rounding_rule,conversionConfidence:ue.conversion_confidence,conversionNotes:ue.conversion_notes})}Object.keys(de).length>0&&S(de)}).catch(()=>{})},[U,S]),(0,it.useEffect)(()=>{if(window.location.hash!=="#matched-products"&&window.location.hash!=="#quote-request")return;let K=new URL(window.location.href);K.hash="",window.history.replaceState({...window.history.state??{},boqQuoteStage:"entry"},"",K)},[]);let W=(0,it.useCallback)(K=>{if(typeof window>"u")return;let Z=new URL(window.location.href);Z.hash=K==="basket"?"quote-request":"matched-products";let de={...window.history.state??{},boqQuoteStage:K};window.history.pushState(de,"",Z)},[]);(0,it.useEffect)(()=>{let K=Z=>{let de=Z.state?.boqQuoteStage;n(de==="basket"?"basket":de==="results"&&d?"results":"entry")};return window.addEventListener("popstate",K),()=>window.removeEventListener("popstate",K)},[d]);let ve=(0,it.useCallback)(()=>{W("basket"),n("basket"),window.scrollTo(0,0)},[W]),Se=(0,it.useCallback)(()=>{window.history.state?.boqQuoteStage==="basket"?window.history.back():n(d?"results":"entry")},[d]),Re=()=>{n("entry"),o(null),u(""),v(0),h(null),E(!1),z(),R(!1)},Pe=(0,it.useCallback)(async(K,Z,de=!0)=>{u(""),v(0);let Le=0,ue=()=>{Le=Math.min(Le+1,3),v(Le)};try{let{jobId:Ue}=await Zb(K,Z,de),{promise:Ee,cancel:dt}=Jb(()=>Kb(Ue),5e3,ue,"schedule");p.current=dt;let bt=await Ee;if(bt.status==="failed"||!bt.result)throw new Error(bt.error||"Failed to process schedule");E(!1),h(bt.result),W("results"),n("results")}catch(Ue){u(Ue?.message||"Failed to process schedule"),n("entry")}finally{p.current?.(),p.current=null}},[W]),Me=(0,it.useCallback)(async(K,Z,de=!0)=>{let Le=K.trim();if(!Le)return;o("schedule");let ue=new File([Le],"pasted-schedule.txt",{type:"text/plain"});await Pe(ue,Z,de)},[Pe]),X=(0,it.useCallback)(async K=>{o("schedule"),await Pe(K)},[Pe]);return(0,Aa.jsx)("div",{className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:hi().theme,children:(0,Aa.jsxs)("main",{className:"main-content",children:[l&&(0,Aa.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Aa.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Aa.jsx)(nd,{onPasteSchedule:Me,onUploadSchedule:X,onEntryModeChange:o}),r==="results"&&i==="schedule"&&d&&(0,Aa.jsx)(dd,{scheduleResult:d,onStartOver:Re,cart:U,onAddToCart:m,onRemoveFromCart:c,onGoToBasket:ve,cartSeeded:T,onCartSeeded:()=>R(!0),reviewGateComplete:w,onReviewGateComplete:()=>E(!0),internal:a}),r==="basket"&&(0,Aa.jsx)(el,{cart:U,onUpdateQty:b,onUpdateSellUnits:g,onRemove:c,onBack:Se,onStartNewQuote:Re,internal:a})]})})}var cc=Y(Ye());var _i=Y(Ye()),ae=Y(re()),Wv=[{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"}],Ks=e=>Number.parseFloat(e)||0,ew=(e,t)=>Ks(e)*(t==="m"?1:.3048),fd=(e,t)=>Ks(e.quantity)*(2*ew(e.height,t)+ew(e.width,t)),p_=()=>({quantity:"1",width:"",height:""});function d_({profile:e}){return(0,ae.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,ae.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,ae.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,_i.useState)("m"),[i,o]=(0,_i.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,u]=(0,_i.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,f]=(0,_i.useState)([]),[v,d]=(0,_i.useState)("ogee"),[h,w]=(0,_i.useState)("2.4"),E=(S,z,T)=>{S(R=>({...R,[z]:T}))},U=fd(i,r)+fd(l,r)+p.reduce((S,z)=>S+fd(z,r),0),m=Ks(h)>0?Math.ceil(U/Ks(h)):0,c=Wv.find(S=>S.id===v)?.label??"",b=[{key:`architrave-${v}`,label:`Architrave (${c})`,qty:U,unit:"m",query:`${c} architrave`,category:"architrave"}],g=(S,z,T,R)=>(0,ae.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,ae.jsx)("span",{children:S}),(0,ae.jsx)("input",{"aria-label":`${S} quantity`,type:"number",min:"0",step:"1",value:z.quantity,onChange:j=>T("quantity",j.target.value)}),(0,ae.jsx)("input",{"aria-label":`${S} width`,type:"number",min:"0",step:"0.01",value:z.width,onChange:j=>T("width",j.target.value)}),(0,ae.jsx)("input",{"aria-label":`${S} height`,type:"number",min:"0",step:"0.01",value:z.height,onChange:j=>T("height",j.target.value)}),R?(0,ae.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:R,children:"Remove"}):null]});return(0,ae.jsx)(ae.Fragment,{children:(0,ae.jsxs)("div",{className:"truss-estimator",children:[(0,ae.jsxs)("div",{className:"quick-order-hero",children:[(0,ae.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ae.jsx)("h1",{children:"Architrave Calculator"}),(0,ae.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,ae.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,ae.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,ae.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,ae.jsxs)("div",{className:"architrave-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,ae.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,ae.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,ae.jsx)("span",{children:"Units"}),(0,ae.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,ae.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>n("m"),children:"Metres"}),(0,ae.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>n("ft"),children:"Feet"})]})]}),(0,ae.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,ae.jsx)("span",{children:"Opening"}),(0,ae.jsx)("span",{children:"Qty"}),(0,ae.jsxs)("span",{children:["Width (",r,")"]}),(0,ae.jsxs)("span",{children:["Height (",r,")"]}),(0,ae.jsx)("span",{})]}),g("Single doors",i,(S,z)=>E(o,S,z)),g("Double doors",l,(S,z)=>E(u,S,z)),p.map((S,z)=>g(`Alternative door ${z+1}`,S,(T,R)=>f(j=>j.map((W,ve)=>ve===z?{...W,[T]:R}:W)),()=>f(T=>T.filter((R,j)=>j!==z)))),(0,ae.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>f(S=>[...S,p_()]),children:"+ Add alternative-sized door"})]}),(0,ae.jsxs)("div",{className:"architrave-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,ae.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,ae.jsx)("div",{className:"architrave-calculator__profiles",children:Wv.map(S=>(0,ae.jsxs)("button",{type:"button",className:`truss-estimator__option-card${v===S.id?" is-selected":""}`,onClick:()=>d(S.id),children:[(0,ae.jsx)(d_,{profile:S.id}),(0,ae.jsx)("div",{className:"truss-estimator__option-title",children:S.label}),(0,ae.jsx)("div",{className:"truss-estimator__option-copy",children:S.blurb})]},S.id))})]}),(0,ae.jsxs)("div",{className:"architrave-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,ae.jsx)("div",{className:"architrave-calculator__options",children:(0,ae.jsxs)("label",{className:"truss-estimator__field",children:[(0,ae.jsx)("span",{children:"Board length (m)"}),(0,ae.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,ae.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,ae.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ae.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Architrave needed"}),(0,ae.jsxs)("strong",{children:[U.toFixed(2)," m"]})]}),(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Board lengths"}),(0,ae.jsx)("strong",{children:m})]})]})]}),(0,ae.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,ae.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ae.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(b),disabled:U<=0,children:a})]})]})]})})}var xi=Y(Ye()),ce=Y(re()),tw=60,aw=10,m_=.02,f_=.012,g_=.01,En=e=>Number.parseFloat(e)||0,h_=(e,t=2)=>e.toFixed(t);function hd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,xi.useState)("brick"),[i,o]=(0,xi.useState)("engineering-red"),[l,u]=(0,xi.useState)("metric"),[p,f]=(0,xi.useState)(""),[v,d]=(0,xi.useState)(""),[h,w]=(0,xi.useState)(!0),E=l==="metric"?En(p)*En(v):En(p)*En(v)*.092903,m=E*(r==="brick"?tw:aw),c=Math.ceil(m),b=E*(r==="brick"?m_:f_),g=Math.ceil(b/g_),S=l==="metric"?E:E*10.7639,z=[{key:r==="brick"?`brick-${i}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[i]:"Blocks",qty:c,unit:"each",query:r==="brick"?"facing brick":"concrete block",category:"masonry"},...h?[{key:"mortar",label:"Blue Circle Quality Assured Mortar Mix 20kg",qty:g,unit:"bag",query:"ready mixed mortar",category:"mortar"}]:[]],T=R=>{if(R===l)return;let j=R==="imperial"?3.28084:.3048;f((En(p)*j).toFixed(2)),d((En(v)*j).toFixed(2)),u(R)};return(0,ce.jsx)(ce.Fragment,{children:(0,ce.jsxs)("div",{className:"truss-estimator",children:[(0,ce.jsxs)("div",{className:"quick-order-hero",children:[(0,ce.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ce.jsx)("h1",{children:"Brick & Block Calculator"}),(0,ce.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,ce.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,ce.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,ce.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,ce.jsxs)("div",{className:"brick-calculator__section",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,ce.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([R,j])=>(0,ce.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===R?" is-selected":""}`,onClick:()=>n(R),children:[(0,ce.jsx)("div",{className:"truss-estimator__option-title",children:j}),(0,ce.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",R==="brick"?tw:aw," per m\xB2"]})]},R))})]}),r==="brick"&&(0,ce.jsxs)("div",{className:"brick-calculator__section",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,ce.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(([R,j,W])=>(0,ce.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i===R?" is-selected":""}`,onClick:()=>o(R),children:[(0,ce.jsx)("div",{className:"truss-estimator__option-title",children:j}),(0,ce.jsx)("div",{className:"truss-estimator__option-copy",children:W})]},R))})]}),(0,ce.jsxs)("div",{className:"brick-calculator__section",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,ce.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,ce.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>T("metric"),children:"Metric"}),(0,ce.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>T("imperial"),children:"Imperial"})]}),(0,ce.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,ce.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:R=>f(R.target.value)})]}),(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,ce.jsx)("input",{type:"number",min:"0",step:"0.01",value:v,onChange:R=>d(R.target.value)})]})]})]}),(0,ce.jsx)("div",{className:"brick-calculator__options",children:(0,ce.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,ce.jsx)("input",{type:"checkbox",checked:h,onChange:R=>w(R.target.checked)}),(0,ce.jsx)("span",{children:"Include ready-mixed mortar"})]})}),(0,ce.jsxs)("div",{className:"brick-calculator__totals",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ce.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,ce.jsxs)("div",{children:[(0,ce.jsx)("span",{children:"Wall area"}),(0,ce.jsxs)("strong",{children:[h_(S)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,ce.jsxs)("div",{children:[(0,ce.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,ce.jsx)("strong",{children:c.toLocaleString("en-GB")})]}),h?(0,ce.jsxs)("div",{children:[(0,ce.jsx)("span",{children:"Ready-mixed mortar"}),(0,ce.jsxs)("strong",{children:[g," x 20kg bags"]})]}):null]}),(0,ce.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,ce.jsxs)("div",{className:"brick-calculator__actions",children:[(0,ce.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ce.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(z),disabled:E<=0,children:a})]})]})]})})}var mr=Y(Ye());var rw=new Map;function b_(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 Jr(e,t,a=12,r){let n=`${e}||${t??""}||${a}||${r??""}`,i=rw.get(n);if(i)return i;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(Bt(`/api/catalogue/search?${o.toString()}`),{headers:bi()}),u=await Zt(l);if(!l.ok)throw new Error(u?.error||u?.message||"Could not reach the product catalogue");let p=Array.isArray(u?.items)?u.items.map(b_):[];return rw.set(n,p),p}async function iw(e,t){return await Promise.all(e.map(async r=>{try{return{requirement:r,candidates:await Jr(r.query,r.category,void 0,t)}}catch{return{requirement:r,candidates:[]}}}))}async function nw(){let e=await fetch(Bt("/api/catalogue"),{headers:bi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Zt(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var $=Y(re()),v_=1.54,w_=1440,y_=25,bd=800,__=1500,vd=e=>Number.parseFloat(e)||0,Mn={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 wd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let r=Vs(),[n,i]=(0,mr.useState)("m"),[o,l]=(0,mr.useState)(""),[u,p]=(0,mr.useState)(""),[f,v]=(0,mr.useState)(""),[d,h]=(0,mr.useState)("concrete"),[w,E]=(0,mr.useState)("mot"),[U,m]=(0,mr.useState)(!1),[c,b]=(0,mr.useState)(null),g=n==="m"?1:.3048,S=vd(o)*g*vd(u)*g*vd(f)*(n==="m"?.01:.0254),z=Mn[w],T=S*v_/7,R=T*w_,j=T*2,W=T*4,ve=Math.ceil(R/y_),Se=Math.ceil(j*Mn["sharp-sand"].density*1e3/bd),Re=Math.ceil(W*Mn.gravel.density*1e3/bd),Pe=Math.ceil(S*z.density*1e3/bd),Me=d==="concrete"?[{key:"cement",label:"Blue Circle General Purpose Grey Cement 25kg",qty:ve,productId:"6003004"},{key:"sharp-sand",label:"Sharp Sand Bulk Bag (800kg)",qty:Se,productId:"6001012"},{key:"gravel",label:"20mm Non Decorative Pea Shingle/Gravel Bulk Bag (800kg)",qty:Re,productId:"6001004"}]:[{key:w,label:`${z.label} Bulk Bag (800kg)`,qty:Pe,productId:z.productId}],X=()=>{if(t){t(Me.map(Z=>({key:Z.key,label:Z.label,qty:Z.qty,unit:"each",query:Z.productId})));return}K()},K=async()=>{let Z=Date.now();m(!0),b(null);try{let de=await Promise.all(Me.map(async ue=>{let Ue=(await Jr(ue.productId)).find(Ee=>Ee.product_id===ue.productId);if(!Ue)throw new Error(`${ue.label} is no longer available in this catalogue.`);return Zr(Ue,{lineId:`concrete-aggregate:${ue.key}`,description:ue.label,unit:"bag",qty:ue.qty})})),Le=__-(Date.now()-Z);Le>0&&await new Promise(ue=>window.setTimeout(ue,Le)),r?.clearCart(),r?.addManyToCart(de),r?.openBasket()}catch(de){b(de instanceof Error?de.message:"Could not add the products to your basket.")}finally{m(!1)}};return U?(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 Materials"}),(0,$.jsx)("p",{children:"Calculating quantities from the Concrete & Aggregate Calculator."})]}),(0,$.jsx)("div",{className:"truss-estimator__card",children:(0,$.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,$.jsx)(pr,{}),(0,$.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})}):(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:"Concrete & Aggregate Calculator"}),(0,$.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,$.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,$.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,$.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,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,$.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${d==="concrete"?" is-selected":""}`,onClick:()=>h("concrete"),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${d==="aggregate"?" is-selected":""}`,onClick:()=>h("aggregate"),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),d==="aggregate"&&(0,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,$.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Mn).map(Z=>(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===Z?" is-selected":""}`,onClick:()=>E(Z),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:Mn[Z].label}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:Mn[Z].blurb})]},Z))})]}),(0,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,$.jsxs)("div",{className:"materials-calculator__unit-row",children:[(0,$.jsx)("span",{children:"Units"}),(0,$.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,$.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metric"}),(0,$.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Imperial"})]})]}),(0,$.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsxs)("span",{children:["Length (",n,")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.01",value:o,onChange:Z=>l(Z.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsxs)("span",{children:["Width (",n,")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.01",value:u,onChange:Z=>p(Z.target.value)})]})]}),(0,$.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,$.jsxs)("span",{children:["Depth (",n==="m"?"cm":"inches",")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.1",value:f,onChange:Z=>v(Z.target.value)})]})]}),(0,$.jsxs)("div",{className:"materials-calculator__totals",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,$.jsx)("div",{className:"materials-calculator__result-grid",children:d==="concrete"?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Cement"}),(0,$.jsxs)("strong",{children:[R.toFixed(0)," kg"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Sharp sand"}),(0,$.jsxs)("strong",{children:[j.toFixed(2)," m\xB3"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"20mm aggregate"}),(0,$.jsxs)("strong",{children:[W.toFixed(2)," m\xB3"]})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:z.label}),(0,$.jsxs)("strong",{children:[S.toFixed(2)," m\xB3"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Approx. weight"}),(0,$.jsxs)("strong",{children:[(S*z.density).toFixed(2)," t"]})]}),(0,$.jsx)("div",{})]})}),(0,$.jsx)("p",{className:"materials-calculator__note",children:d==="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."})]}),c&&(0,$.jsx)("p",{className:"results-empty-hint estimator-products__error",children:c}),(0,$.jsxs)("div",{className:"materials-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",onClick:X,disabled:S<=0||U,children:U?"Adding products\u2026":a})]})]})]})})}var Ya=Y(Ye());var A=Y(re()),Tn=12,zn=8,Js=.56,ow=.21,Na={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}]}},ki=["range","grid","pictureFrame","substructure"],x_={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:""}},Ps=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),Fs=(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),k_=(e,t,a,r)=>{let n=Ps(e,t,a),i=Ps(e,t,r),o=Ps(a,r,e),l=Ps(a,r,t);return n===0&&Fs(e,t,a)||i===0&&Fs(e,t,r)||o===0&&Fs(a,r,e)||l===0&&Fs(a,r,t)?!0:n>0!=i>0&&o>0!=l>0},yd=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1){let n=e[(r+1)%e.length];for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&k_(e[r],n,e[i],e[(i+1)%e.length]))return!0}return!1};function _d({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Ya.useState)(0),[i,o]=(0,Ya.useState)(x_),[l,u]=(0,Ya.useState)(1),[p,f]=(0,Ya.useState)({x:0,y:0}),[v,d]=(0,Ya.useState)(null),h=(0,Ya.useRef)(null),w=(0,Ya.useRef)(null),E=(0,Ya.useRef)(null),U=ki[r],m=i.range?Na.ranges[i.range]:null,c=Tn/l,b=zn/l,g=(Tn-c)/2,S=(zn-b)/2,z=Math.max(-Tn,Math.min(Tn*2-c,g+p.x)),T=Math.max(-zn,Math.min(zn*2-b,S+p.y)),R=Number.parseFloat(i.quickLengthM),j=Number.parseFloat(i.quickWidthM),W=R>0&&j>0,ve=y=>Math.abs(y.reduce((M,ee,le)=>{let pe=y[(le+1)%y.length];return M+ee.x*pe.y-pe.x*ee.y},0))/2,Se=(y,M)=>Math.hypot(M.x-y.x,M.y-y.y),Re=i.isOutlineClosed?ve(i.points):0,Pe=i.isOutlineClosed?i.points.reduce((y,M,ee)=>y+Se(M,i.points[(ee+1)%i.points.length]),0):0,Me=i.isOutlineClosed?i.points.reduce((y,M,ee)=>y+(i.wallSegments.has(ee)?0:Se(M,i.points[(ee+1)%i.points.length])),0):0,X=i.points.reduce((y,M)=>({x:y.x+M.x/i.points.length,y:y.y+M.y/i.points.length}),{x:0,y:0}),K=i.points.length>1?(()=>{let y=i.points[0],M=i.points[1],ee=Se(y,M),le=ee?-(M.y-y.y)/ee:0,pe=ee?(M.x-y.x)/ee:0,Fe=(y.x+M.x)/2,xt=(y.y+M.y)/2,k=le*(Fe-X.x)+pe*(xt-X.y)>=0?1:-1;return{x:Fe+le*Js*k,y:xt+pe*Js*k}})():null,de=(()=>{let y=i.range?Na.ranges[i.range]:Na.ranges.meridian,M=i.deckSizeMode==="quick"?R*j:Re,ee=i.deckSizeMode==="quick"?2*(R+j):Me,le=i.direction==="diagonal"?Na.wastage.diagonal:Na.wastage.straight,pe=i.pictureFrame==="yes"?Na.pictureFrame.extraWastage:0,xt=M/(y.boardWidthM+Na.boardGapM)/y.boardLengthM,k=Math.ceil(xt*(1+le+pe)),H=Math.ceil(M*30*(1+le+pe)/200),B=Na.joist.spacingOptions.find(C=>C.id===i.joistSpacing)??Na.joist.spacingOptions[1],ne=M/B.spacingM,te=Math.ceil(ne/Na.joist.lengthM);return{range:y,area:M,boardCount:k,screwBoxes:H,joistLengthsNeeded:te,spacing:B}})(),Le=de?[{key:`boards-${i.range??"meridian"}`,label:`Deck boards (${de.range.label})`,qty:de.boardCount,unit:"each",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:de.joistLengthsNeeded,unit:"each",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:de.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],ue=()=>U==="range"?!!i.range:U==="grid"?i.deckSizeMode==="quick"?W:i.isOutlineClosed&&Re>0:U==="pictureFrame"?!!i.pictureFrame&&!!i.direction:U==="substructure"?!!i.joistSpacing:!0,Ue=r===ki.length-1?a:"Next",Ee=(y,M,ee=!1)=>{let le=E.current?.getBoundingClientRect();if(!le)return null;let pe=ee?1:.25;return{x:Math.round(Math.max(z,Math.min(z+c,z+(y-le.left)/le.width*c))/pe)*pe,y:Math.round(Math.max(T,Math.min(T+b,T+(M-le.top)/le.height*b))/pe)*pe}},dt=y=>{if(i.isOutlineClosed){let ee=y.target;if(ee!==y.currentTarget&&!ee.classList.contains("deck-outline__grid"))return;w.current={startX:y.clientX,startY:y.clientY,startViewX:z,startViewY:T},y.currentTarget.setPointerCapture(y.pointerId);return}if(i.drawMode!=="outline")return;let M=Ee(y.clientX,y.clientY,!0);M&&(d(null),o(ee=>{let le=[...ee.points,M];return yd(le,!1)?{...ee,drawError:"Edges cannot cross. Choose another corner."}:{...ee,points:le,drawError:""}}))},bt=(y,M)=>{if(!i.isOutlineClosed){y.stopPropagation(),M===0&&i.points.length>=3&&o(ee=>({...ee,isOutlineClosed:!0,drawMode:"edges"}));return}y.stopPropagation(),h.current=M,y.currentTarget.setPointerCapture(y.pointerId)},Ht=y=>{if(w.current){let le=E.current?.getBoundingClientRect();if(!le)return;let pe=w.current,Fe=pe.startViewX-(y.clientX-pe.startX)/le.width*c,xt=pe.startViewY-(y.clientY-pe.startY)/le.height*b;f({x:Fe-g,y:xt-S});return}!i.isOutlineClosed&&i.drawMode==="outline"&&d(Ee(y.clientX,y.clientY,!0));let M=h.current;if(M===null)return;let ee=Ee(y.clientX,y.clientY);ee&&o(le=>{let pe=le.points.map((Fe,xt)=>xt===M?ee:Fe);return yd(pe,!0)?{...le,drawError:"Edges cannot cross. Move the corner to a different position."}:{...le,points:pe,drawError:""}})},mt=y=>{w.current=null,h.current=null,y.currentTarget.hasPointerCapture(y.pointerId)&&y.currentTarget.releasePointerCapture(y.pointerId)},nt=y=>{o(M=>{let ee=new Set(M.wallSegments);return ee.has(y)?ee.delete(y):ee.add(y),{...M,wallSegments:ee}})},ft=()=>{r===0?e():n(y=>y-1)},G=()=>{ue()&&(r===ki.length-1?t?.(Le):n(y=>y+1))};return(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)("div",{className:"truss-estimator",children:[(0,A.jsxs)("div",{className:"quick-order-hero",children:[(0,A.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,A.jsx)("h1",{children:"Decking Calculator"}),(0,A.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,A.jsxs)("div",{className:"truss-estimator__card",children:[(0,A.jsxs)("div",{className:"truss-estimator__body",children:[U==="range"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,A.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,A.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.ranges).map(([y,M])=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.range===y?" is-selected":""}`,onClick:()=>o(ee=>({...ee,range:y})),children:[(0,A.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,A.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb}),(0,A.jsxs)("div",{className:"truss-estimator__option-copy",children:[M.boardLengthM,"m boards"]})]},y))})]}):null,U==="grid"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,A.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,A.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,A.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(y=>({...y,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,A.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(y=>({...y,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),i.deckSizeMode==="quick"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,A.jsxs)("label",{className:"truss-estimator__field",children:[(0,A.jsx)("span",{children:"Length (m)"}),(0,A.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:i.quickLengthM,onChange:y=>o(M=>({...M,quickLengthM:y.target.value}))})]}),(0,A.jsxs)("label",{className:"truss-estimator__field",children:[(0,A.jsx)("span",{children:"Width (m)"}),(0,A.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:i.quickWidthM,onChange:y=>o(M=>({...M,quickWidthM:y.target.value}))})]})]}),(0,A.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),W?(0,A.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,A.jsxs)("div",{children:[(R*j).toFixed(2)," m\xB2 deck"]}),(0,A.jsxs)("div",{children:[(2*(R+j)).toFixed(2)," m perimeter"]})]}):null]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,A.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,A.jsxs)("div",{className:"deck-outline__toolbar",children:[i.isOutlineClosed?(0,A.jsxs)("div",{className:"deck-outline__summary",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Deck area"}),(0,A.jsxs)("strong",{children:[Re.toFixed(2)," m\xB2"]})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Perimeter"}),(0,A.jsxs)("strong",{children:[Pe.toFixed(2)," m"]})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Wall edges"}),(0,A.jsx)("strong",{children:i.wallSegments.size>0?i.wallSegments.size:"None"})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Visible edge"}),(0,A.jsxs)("strong",{children:[Me.toFixed(2)," m"]})]})]}):null,(0,A.jsxs)("div",{className:"deck-outline__actions",children:[(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,points:y.points.slice(0,-1)})),disabled:i.points.length===0||i.isOutlineClosed,children:"Undo"}),(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{d(null),o(y=>({...y,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:i.points.length===0,children:"Clear"}),(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,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,A.jsx)("div",{className:"deck-editor-layout",children:(0,A.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,A.jsxs)("div",{className:"deck-outline",children:[(0,A.jsxs)("svg",{ref:E,className:`deck-outline__canvas${i.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${z} ${T} ${c} ${b}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:dt,onPointerMove:Ht,onPointerUp:mt,onPointerLeave:()=>{d(null),w.current||(h.current=null)},children:[(0,A.jsx)("defs",{children:(0,A.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,A.jsx)("rect",{x:-Tn,y:-zn,width:Tn*3,height:zn*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),i.points.length>1?(0,A.jsx)("polyline",{className:"deck-outline__preview",points:i.points.map(y=>`${y.x},${y.y}`).join(" ")}):null,i.isOutlineClosed?(0,A.jsx)("polygon",{className:"deck-outline__shape",points:i.points.map(y=>`${y.x},${y.y}`).join(" "),stroke:"none"}):null,i.points.length>1?i.points.slice(0,i.isOutlineClosed?void 0:-1).map((y,M)=>{let ee=i.points[i.isOutlineClosed?(M+1)%i.points.length:M+1],le=Se(y,ee),pe=le?-(ee.y-y.y)/le:0,Fe=le?(ee.x-y.x)/le:0,xt=(y.x+ee.x)/2,k=(y.y+ee.y)/2,H=pe*(xt-X.x)+Fe*(k-X.y)>=0?1:-1,B=xt+pe*Js*H,ne=k+Fe*Js*H;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{className:"deck-outline__edge-hit",x1:y.x,y1:y.y,x2:ee.x,y2:ee.y,onClick:i.isOutlineClosed?()=>nt(M):void 0}),(0,A.jsx)("line",{className:`deck-outline__edge${i.wallSegments.has(M)?" is-wall":""}`,x1:y.x,y1:y.y,x2:ee.x,y2:ee.y,pointerEvents:"none"}),(0,A.jsxs)("text",{className:`deck-outline__edge-label${i.wallSegments.has(M)?" is-wall":""}`,x:B,y:ne,textAnchor:"middle",dominantBaseline:"central",fontSize:ow/l,children:[le.toFixed(2)," m"]})]},`segment-${M}`)}):null,!i.isOutlineClosed&&i.points.length>0&&v?(()=>{let y=i.points[i.points.length-1],M=Se(y,v);if(!M)return null;let ee=-(v.y-y.y)/M,le=(v.x-y.x)/M,pe=(y.x+v.x)/2,Fe=(y.y+v.y)/2;return(0,A.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,A.jsx)("line",{x1:y.x,y1:y.y,x2:v.x,y2:v.y}),(0,A.jsxs)("text",{x:pe+ee*.34,y:Fe+le*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:ow/l,children:[M.toFixed(2)," m"]})]})})():null,i.points.map((y,M)=>(0,A.jsx)("circle",{className:"deck-outline__point",cx:y.x,cy:y.y,r:"0.13",onPointerDown:ee=>bt(ee,M)},`point-${M}`))]}),(0,A.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,A.jsx)("button",{type:"button",onClick:()=>u(y=>Math.max(.5,y-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,A.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,A.jsx)("button",{type:"button",onClick:()=>u(y=>Math.min(1,y+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),i.isOutlineClosed&&i.wallSegments.size===0&&K?(0,A.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(K.x-z)/c*100}%`,top:`${(K.y-T)/b*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!i.isOutlineClosed&&i.points.length>=3?(0,A.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(y=>yd(y.points,!0)?{...y,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...y,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,A.jsxs)("div",{className:"deck-outline__supporting",children:[(0,A.jsx)("div",{className:"truss-estimator__grid-hint",children:i.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),i.drawError?(0,A.jsx)("div",{className:"deck-outline__error",role:"alert",children:i.drawError}):null]})]})})]})]}):null,U==="pictureFrame"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,A.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,A.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(y=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.pictureFrame===y.id?" is-selected":""}`,onClick:()=>o(M=>({...M,pictureFrame:y.id})),children:[(0,A.jsx)("img",{className:"truss-estimator__visual-card-img",src:Kt(y.img),alt:""}),(0,A.jsx)("span",{children:y.label})]},y.id))}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,A.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(y=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.direction===y.id?" is-selected":""}`,onClick:()=>o(M=>({...M,direction:y.id})),children:[(0,A.jsx)("img",{className:"truss-estimator__visual-card-img",src:Kt(y.img),alt:""}),(0,A.jsx)("span",{children:y.label})]},y.id))})]})]}):null,U==="substructure"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,A.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,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,A.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Na.joist.spacingOptions.map(y=>(0,A.jsx)("button",{type:"button",className:`truss-estimator__option-card${i.joistSpacing===y.id?" is-selected":""}`,onClick:()=>o(M=>({...M,joistSpacing:y.id})),children:(0,A.jsx)("div",{className:"truss-estimator__option-title",children:y.label})},y.id))})]}):null]}),(0,A.jsxs)("div",{className:"truss-estimator__nav",children:[(0,A.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:ft,children:"Back"}),(0,A.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:G,disabled:!ue(),children:[(0,A.jsx)("span",{children:Ue}),(0,A.jsx)("span",{className:"arrow",children:(0,A.jsx)(Ot,{})})]})]})]})]})})}var Ca=Y(Ye());var L=Y(re()),lw=12,sw=30,An=12,Rn=8,cw=.56,Sa={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}}},Ni=["range","height","gate","posts"],N_={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:""}},Is=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),Ws=(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),S_=(e,t,a,r)=>{let n=Is(e,t,a),i=Is(e,t,r),o=Is(a,r,e),l=Is(a,r,t);return n===0&&Ws(e,t,a)||i===0&&Ws(e,t,r)||o===0&&Ws(a,r,e)||l===0&&Ws(a,r,t)?!0:n>0!=i>0&&o>0!=l>0},ec=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&S_(e[r],e[(r+1)%e.length],e[n],e[(n+1)%e.length]))return!0;return!1};function xd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Ca.useState)(0),[i,o]=(0,Ca.useState)(N_),l=(0,Ca.useRef)(null),u=(0,Ca.useRef)(null),[p,f]=(0,Ca.useState)(1),[v,d]=(0,Ca.useState)({x:0,y:0}),[h,w]=(0,Ca.useState)(null),E=(0,Ca.useRef)(null),U=(0,Ca.useRef)(null),m=(0,Ca.useRef)(null),c=Ni[r],b=i.range?Sa.ranges[i.range]:null,g=An/p,S=Rn/p,z=(An-g)/2,T=(Rn-S)/2,R=Math.max(-An,Math.min(An*2-g,z+v.x)),j=Math.max(-Rn,Math.min(Rn*2-S,T+v.y)),W=i.boundaryPoints.reduce((k,H)=>({x:k.x+H.x/Math.max(1,i.boundaryPoints.length),y:k.y+H.y/Math.max(1,i.boundaryPoints.length)}),{x:0,y:0}),ve=k=>{let H=new Set,B=[];return k.forEach(ne=>{let[te,C]=ne.split(",").map(Number),Q=[{key:`H,${te},${C}`,type:"H",x:te,y:C},{key:`H,${te},${C+1}`,type:"H",x:te,y:C+1},{key:`V,${te},${C}`,type:"V",x:te,y:C},{key:`V,${te+1},${C}`,type:"V",x:te+1,y:C}],J=[!k.has(`${te},${C-1}`),!k.has(`${te},${C+1}`),!k.has(`${te-1},${C}`),!k.has(`${te+1},${C}`)];Q.forEach((fe,ye)=>{J[ye]&&!H.has(fe.key)&&(H.add(fe.key),B.push(fe))})}),B},Se=(k,H)=>ve(k).filter(B=>!H.has(B.key)),Re=(k,H)=>Se(k,H).length,Pe=(k,H)=>{let B={};Se(k,H).forEach(te=>{var C,Q,J,fe;te.type==="H"?((B[C=`${te.x},${te.y}`]||(B[C]=[])).push("H"),(B[Q=`${te.x+1},${te.y}`]||(B[Q]=[])).push("H")):((B[J=`${te.x},${te.y}`]||(B[J]=[])).push("V"),(B[fe=`${te.x},${te.y+1}`]||(B[fe]=[])).push("V"))});let ne=0;return Object.values(B).forEach(te=>{(te.length===1||te.length===2&&te[0]!==te[1]||te.length>=3)&&(ne+=1)}),ne},X=(()=>{let k=i.range?Sa.ranges[i.range]:Sa.ranges.boundary,H=i.height??"1.8",B=i.boundaryMode==="quick"?Math.max(0,Number.parseFloat(i.quickLengthM)||0):i.boundaryClosed?i.boundaryPoints.slice(0,-1).reduce((Pt,gr,Xa)=>Pt+(i.excludedBoundaryEdges.has(Xa)?0:Math.hypot(i.boundaryPoints[Xa+1].x-gr.x,i.boundaryPoints[Xa+1].y-gr.y)),0):0,ne=i.gateType&&i.gateType!=="none"?Number.parseFloat(i.gateWidthM)||Sa.gate[i.gateType].widthDefault:0,te=Math.max(0,B-ne),C=te>0?Math.ceil(te/k.panelWidthM):0,Q=i.boundaryPoints.length>2&&i.boundaryPoints[0].x===i.boundaryPoints[i.boundaryPoints.length-1].x&&i.boundaryPoints[0].y===i.boundaryPoints[i.boundaryPoints.length-1].y,J=i.boundaryMode==="quick"?te>0?2:0:i.boundaryClosed?i.boundaryPoints.slice(0,Q?-1:void 0).reduce((Pt,gr,Xa)=>{let Hd=Xa>0&&!i.excludedBoundaryEdges.has(Xa-1),On=Xa<i.boundaryPoints.length-1&&!i.excludedBoundaryEdges.has(Xa);return Pt+(Hd||On?1:0)},0):0,fe=te>0?Math.ceil(te/k.panelWidthM)+1:0,ye=Math.max(0,fe-J),$e=i.mountingType?Sa.mounting[i.mountingType]:Sa.mounting.concrete,vt=i.gateType&&i.gateType!=="none"?2:0,ca=ye+J+vt,il=i.mountingType==="postcrete"?ca*Sa.mounting.postcrete.bagsPerPost:0,ua=i.gravelBoard==="yes"?C:0;return{range:k,height:H,totalEdgeM:B,fencedLengthM:te,gateWidthM:ne,panelsCount:C,cornerPostCount:J,intermediatePostCount:ye,gatePostCount:vt,totalPostCount:ca,bagsCount:il,gravelCount:ua,capCount:ca,mounting:$e}})(),K=i.gateType&&i.gateType!=="none"?Sa.gate[i.gateType].label:null,Z=Number(X.height)<=1.2?"6":"8",de=X?[{key:`panels-${i.range??"boundary"}-${X.height}`,label:`${X.range.label} panels (${X.height}m)`,qty:X.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...i.mountingType==="concrete"?[{key:`concrete-intermediate-${Z}`,label:"Intermediate concrete posts",qty:X.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${Z}`,label:"End and corner concrete posts",qty:X.cornerPostCount+X.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${Z}`,label:"Timber fence posts",qty:X.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:X.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...K?[{key:"gate",label:K,qty:1,unit:"each",query:"lap gate",category:"fencing"}]:[],...X.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:X.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],Le=()=>{if(c==="range"){let k=i.boundaryMode==="quick"?(Number.parseFloat(i.quickLengthM)||0)>0:i.boundaryClosed&&i.boundaryPoints.length>=2;return!!i.range&&k}return c==="height"?!!i.height&&!!i.gravelBoard:c==="gate"?!!i.gateType&&(i.gateType==="none"||i.gateWidthM.trim()!==""):c==="posts"?!!i.mountingType:!0},ue=r===Ni.length-1?a:"Next",Ue=k=>{o(H=>{let B=k(new Set(H.grid)),ne=new Set([...H.excludedEdges].filter(te=>ve(B).some(C=>C.key===te)));return{...H,grid:B,excludedEdges:ne}})},Ee=(k,H,B)=>{Ue(ne=>{let te=`${k},${H}`;return B?ne.add(te):ne.delete(te),ne})},dt=(k,H,B,ne,te)=>{let C=k,Q=H,J=Math.abs(B-k),fe=k<B?1:-1,ye=-Math.abs(ne-H),$e=H<ne?1:-1,vt=J+ye;for(;Ee(C,Q,te),!(C===B&&Q===ne);){let ca=2*vt;ca>=ye&&(vt+=ye,C+=fe),ca<=J&&(vt+=J,Q+=$e)}},bt=(k,H)=>{let B=u.current?.getBoundingClientRect();if(!B)return null;let ne=Math.floor((k-B.left)/sw),te=Math.floor((H-B.top)/sw);return ne<0||te<0||ne>=lw||te>=lw?null:{x:ne,y:te}},Ht=k=>{if(i.gridMode!=="draw")return;let H=bt(k.clientX,k.clientY);if(!H)return;k.preventDefault();let B=`${H.x},${H.y}`,ne=!i.grid.has(B);l.current={active:!0,paintValue:ne,lastX:H.x,lastY:H.y},k.currentTarget.setPointerCapture(k.pointerId),Ee(H.x,H.y,ne)},mt=k=>{let H=l.current;if(!H?.active)return;let B=bt(k.clientX,k.clientY);B&&(B.x===H.lastX&&B.y===H.lastY||(dt(H.lastX,H.lastY,B.x,B.y,H.paintValue),l.current={...H,lastX:B.x,lastY:B.y}))},nt=k=>{l.current?.active&&(l.current=null,k.currentTarget.releasePointerCapture(k.pointerId))},ft=(k,H,B=!1)=>{let ne=m.current?.getBoundingClientRect();if(!ne)return null;let te=B?1:.25;return{x:Math.round(Math.max(R,Math.min(R+g,R+(k-ne.left)/ne.width*g))/te)*te,y:Math.round(Math.max(j,Math.min(j+S,j+(H-ne.top)/ne.height*S))/te)*te}},G=k=>{if(i.boundaryClosed){let B=k.target;if(B!==k.currentTarget&&!B.classList.contains("fence-boundary__grid"))return;U.current={startX:k.clientX,startY:k.clientY,startViewX:R,startViewY:j},k.currentTarget.setPointerCapture(k.pointerId);return}let H=ft(k.clientX,k.clientY,!0);H&&(w(null),o(B=>{let ne=[...B.boundaryPoints,H];return ec(ne,!1)?{...B}:{...B,boundaryPoints:ne}}))},y=(k,H)=>{if(k.stopPropagation(),!i.boundaryClosed){if(H!==0||i.boundaryPoints.length<3)return;o(B=>ec(B.boundaryPoints,!0)?B:{...B,boundaryPoints:[...B.boundaryPoints,B.boundaryPoints[0]],boundaryClosed:!0});return}E.current=H,k.currentTarget.setPointerCapture(k.pointerId)},M=k=>{if(U.current){let B=m.current?.getBoundingClientRect();if(!B)return;let ne=U.current,te=ne.startViewX-(k.clientX-ne.startX)/B.width*g,C=ne.startViewY-(k.clientY-ne.startY)/B.height*S;d({x:te-z,y:C-T});return}if(i.boundaryClosed||w(ft(k.clientX,k.clientY,!0)),E.current===null)return;let H=ft(k.clientX,k.clientY);H&&o(B=>{let ne=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((C,Q)=>{let J=Q===E.current,fe=ne&&E.current===0&&Q===B.boundaryPoints.length-1;return J||fe?H:C});return ec(te,!1)?B:{...B,boundaryPoints:te}})},ee=k=>{U.current=null,E.current=null,k.currentTarget.hasPointerCapture(k.pointerId)&&k.currentTarget.releasePointerCapture(k.pointerId)},le=k=>{o(H=>{let B=new Set(H.excludedBoundaryEdges);return B.has(k)?B.delete(k):B.add(k),{...H,excludedBoundaryEdges:B}})},pe=()=>{r===0?e():n(k=>k-1)},Fe=()=>{Le()&&(r===Ni.length-1?t?.(de):n(k=>k+1))},xt=ve(i.grid);return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{className:"truss-estimator",children:[(0,L.jsxs)("div",{className:"quick-order-hero",children:[(0,L.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,L.jsx)("h1",{children:"Fencing Calculator"}),(0,L.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,L.jsxs)("div",{className:"truss-estimator__card",children:[(0,L.jsxs)("div",{className:"truss-estimator__body",children:[c==="range"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Sa.ranges).map(([k,H])=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.range===k?" is-selected":""}`,onClick:()=>o(B=>({...B,range:k})),children:[(0,L.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,L.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb})]},k))})]}):null,c==="range"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,L.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,L.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,L.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(k=>({...k,boundaryMode:"quick"})),children:"Quick estimate"}),(0,L.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(k=>({...k,boundaryMode:"draw"})),children:"Draw your boundary"})]}),i.boundaryMode==="quick"?(0,L.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,L.jsx)("span",{children:"Total fence length (m)"}),(0,L.jsx)("input",{type:"number",min:"0",step:"0.1",value:i.quickLengthM,onChange:k=>o(H=>({...H,quickLengthM:k.target.value}))})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"fence-boundary__toolbar",children:(0,L.jsxs)("div",{className:"fence-boundary__actions",children:[(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,boundaryPoints:k.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:i.boundaryPoints.length===0||i.boundaryClosed,children:"Undo"}),(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{d({x:0,y:0}),w(null),o(k=>({...k,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:i.boundaryPoints.length===0,children:"Clear"}),(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,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,L.jsxs)("div",{className:"fence-boundary",children:[(0,L.jsxs)("svg",{ref:m,className:`fence-boundary__canvas${i.boundaryClosed?" is-pan-mode":""}`,viewBox:`${R} ${j} ${g} ${S}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:G,onPointerMove:M,onPointerUp:ee,onPointerLeave:()=>{w(null),U.current||(E.current=null)},children:[(0,L.jsx)("defs",{children:(0,L.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,L.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,L.jsx)("rect",{x:-An,y:-Rn,width:An*3,height:Rn*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),i.boundaryPoints.length>1?(0,L.jsx)("polyline",{className:"fence-boundary__preview",points:i.boundaryPoints.map(k=>`${k.x},${k.y}`).join(" ")}):null,i.boundaryPoints.length>1?i.boundaryPoints.slice(0,-1).map((k,H)=>{let B=i.boundaryPoints[H+1],ne=Math.hypot(B.x-k.x,B.y-k.y),te=ne?-(B.y-k.y)/ne:0,C=ne?(B.x-k.x)/ne:0,Q=(k.x+B.x)/2,J=(k.y+B.y)/2,fe=te*(Q-W.x)+C*(J-W.y)>=0?1:-1,ye=Q+te*cw*fe,$e=J+C*cw*fe;return(0,L.jsxs)("g",{children:[(0,L.jsx)("line",{className:"fence-boundary__edge-hit",x1:k.x,y1:k.y,x2:B.x,y2:B.y,onClick:i.boundaryClosed?()=>le(H):void 0}),(0,L.jsx)("line",{className:`fence-boundary__edge${i.excludedBoundaryEdges.has(H)?" is-excluded":""}`,x1:k.x,y1:k.y,x2:B.x,y2:B.y,pointerEvents:"none"}),(0,L.jsxs)("text",{className:`fence-boundary__edge-label${i.excludedBoundaryEdges.has(H)?" is-excluded":""}`,x:ye,y:$e,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[ne.toFixed(2)," m"]})]},`fence-edge-${H}`)}):null,!i.boundaryClosed&&i.boundaryPoints.length>0&&h?(()=>{let k=i.boundaryPoints[i.boundaryPoints.length-1],H=Math.hypot(h.x-k.x,h.y-k.y);if(!H)return null;let B=-(h.y-k.y)/H,ne=(h.x-k.x)/H,te=(k.x+h.x)/2,C=(k.y+h.y)/2;return(0,L.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,L.jsx)("line",{x1:k.x,y1:k.y,x2:h.x,y2:h.y}),(0,L.jsxs)("text",{x:te+B*.34,y:C+ne*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[H.toFixed(2)," m"]})]})})():null,i.boundaryPoints.map((k,H)=>H>0&&H===i.boundaryPoints.length-1&&k.x===i.boundaryPoints[0]?.x&&k.y===i.boundaryPoints[0]?.y?null:(0,L.jsx)("circle",{className:`fence-boundary__point${!i.boundaryClosed&&H===0&&i.boundaryPoints.length>=3?" is-close-target":""}`,cx:k.x,cy:k.y,r:"0.13",onPointerDown:B=>y(B,H)},`fence-point-${H}`))]}),(0,L.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,L.jsx)("button",{type:"button",onClick:()=>f(k=>Math.max(.5,k-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,L.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,L.jsx)("button",{type:"button",onClick:()=>f(k=>Math.min(1,k+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!i.boundaryClosed&&i.boundaryPoints.length>=2?(0,L.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(k=>ec(k.boundaryPoints,!1)?k:{...k,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,L.jsx)("div",{className:"truss-estimator__grid-hint",children:i.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,L.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,L.jsx)("div",{children:i.boundaryMode==="quick"?`${(Number.parseFloat(i.quickLengthM)||0).toFixed(2)} m fence line`:`${X.totalEdgeM.toFixed(2)} m fence line`}),i.boundaryMode==="draw"&&i.boundaryClosed?(0,L.jsxs)("div",{children:[X.cornerPostCount," corner/end posts"]}):null]})]}):null,null,c==="height"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Sa.heights.map(k=>(0,L.jsx)("button",{type:"button",className:`truss-estimator__visual-card${i.height===k?" is-selected":""}`,onClick:()=>o(H=>({...H,height:k})),children:(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:Kt(`/fencing/height/${k}.webp`),alt:""})},k))}),(0,L.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,L.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(k=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.gravelBoard===k.id?" is-selected":""}`,onClick:()=>o(H=>({...H,gravelBoard:k.id})),children:[(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Kt(k.img),alt:""}),(0,L.jsx)("span",{children:k.label})]},k.id))})]}):null,c==="gate"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,L.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,L.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(k=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${i.gateType===k.id?" is-selected":""}`,onClick:()=>o(H=>({...H,gateType:k.id,gateWidthM:k.id==="none"?"":String(Sa.gate[k.id].widthDefault)})),children:[(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Kt(k.img),alt:""}),(0,L.jsx)("span",{children:k.label})]},k.id))}),i.gateType&&i.gateType!=="none"?(0,L.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,L.jsx)("span",{children:"Gate width (m)"}),(0,L.jsx)("input",{type:"text",inputMode:"decimal",value:i.gateWidthM,onChange:k=>o(H=>({...H,gateWidthM:k.target.value}))})]}):null]}):null,c==="posts"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Sa.mounting).map(([k,H])=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.mountingType===k?" is-selected":""}`,onClick:()=>o(B=>({...B,mountingType:k})),children:[(0,L.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,L.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb})]},k))})]}):null]}),(0,L.jsxs)("div",{className:"truss-estimator__nav",children:[(0,L.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:pe,children:"Back"}),(0,L.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Fe,disabled:!Le(),children:[(0,L.jsx)("span",{children:ue}),(0,L.jsx)("span",{className:"arrow",children:(0,L.jsx)(Ot,{})})]})]})]})]})})}var tc=Y(Ye()),be=Y(re()),uw={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 kd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,tc.useState)("floor"),[i,o]=(0,tc.useState)(""),[l,u]=(0,tc.useState)(""),p=Number.parseFloat(i)*Number.parseFloat(l)||0,f=uw[r],v=Math.ceil(p/f.coverage),d=[{key:`insulation-${r}`,label:`${f.product} ${f.thickness}`,qty:v,unit:f.salesUnit,query:f.product,category:"insulation"}],h=Object.entries(uw);return(0,be.jsx)(be.Fragment,{children:(0,be.jsxs)("div",{className:"truss-estimator",children:[(0,be.jsxs)("div",{className:"quick-order-hero",children:[(0,be.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,be.jsx)("h1",{children:"Insulation Calculator"}),(0,be.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,be.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,be.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,be.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,be.jsxs)("div",{className:"materials-calculator__section",children:[(0,be.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,be.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:h.map(([w,E])=>(0,be.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===w?" is-selected":""}`,onClick:()=>n(w),children:[(0,be.jsx)("div",{className:"truss-estimator__option-title",children:E.label}),(0,be.jsxs)("div",{className:"truss-estimator__option-copy",children:[E.product,", ",E.thickness]})]},w))})]}),(0,be.jsxs)("div",{className:"materials-calculator__section",children:[(0,be.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,be.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,be.jsxs)("label",{className:"truss-estimator__field",children:[(0,be.jsx)("span",{children:"Length (m)"}),(0,be.jsx)("input",{type:"number",min:"0",step:"0.01",value:i,onChange:w=>o(w.target.value)})]}),(0,be.jsxs)("label",{className:"truss-estimator__field",children:[(0,be.jsx)("span",{children:"Width (m)"}),(0,be.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:w=>u(w.target.value)})]})]})]}),(0,be.jsxs)("div",{className:"materials-calculator__totals",children:[(0,be.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,be.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,be.jsxs)("div",{children:[(0,be.jsx)("span",{children:"Insulated area"}),(0,be.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("span",{children:f.product}),(0,be.jsxs)("strong",{children:[v," packs"]})]})]}),(0,be.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,be.jsxs)("div",{className:"materials-calculator__actions",children:[(0,be.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,be.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(d),disabled:p<=0,children:a})]})]})]})})}var Un=Y(Ye()),V=Y(re()),C_=10,q_=1.9*.762,E_=1.9*1.524,ac=()=>({height:"",width:""}),rc=e=>Number.parseFloat(e)||0,pw=({height:e,width:t})=>rc(e)*rc(t);function Nd({onBack:e}){let[t,a]=(0,Un.useState)([ac()]),[r,n]=(0,Un.useState)([ac()]),[i,o]=(0,Un.useState)("0"),[l,u]=(0,Un.useState)("0"),[p,f]=(0,Un.useState)(1),v=t.reduce((m,c)=>m+pw(c),0),d=r.reduce((m,c)=>m+pw(c),0),h=rc(i)*q_+rc(l)*E_,w=Math.max(0,v-d-h),E=w*p/C_,U=(m,c,b,g)=>{m(S=>S.map((z,T)=>T===c?{...z,[b]:g}:z))};return(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:"Paint Calculator"}),(0,V.jsx)("p",{children:"Estimate how much paint you need for your walls, including multiple coats and excluded areas."})]}),(0,V.jsxs)("div",{className:"truss-estimator__card paint-calculator",children:[(0,V.jsx)("h2",{className:"truss-estimator__step-title",children:"Walls, exclusions and coats"}),(0,V.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,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,V.jsx)("p",{className:"paint-calculator__hint",children:"Enter the height and width of each wall you want to paint."}),(0,V.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,V.jsx)("span",{}),(0,V.jsx)("span",{children:"Height (m)"}),(0,V.jsx)("span",{children:"Width (m)"}),(0,V.jsx)("span",{})]}),t.map((m,c)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",c+1]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,V.jsx)("input",{"aria-label":`Wall ${c+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>U(a,c,"height",b.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,V.jsx)("input",{"aria-label":`Wall ${c+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>U(a,c,"width",b.target.value)})]}),t.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>a(b=>b.filter((g,S)=>S!==c)),children:"Remove"}):null]},`wall-${c}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>a(m=>[...m,ac()]),children:"+ Add another wall"})]}),(0,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Areas to exclude"}),(0,V.jsx)("p",{className:"paint-calculator__hint",children:"Add windows, sockets, skirting boards or other areas that will not be painted."}),(0,V.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,V.jsx)("span",{}),(0,V.jsx)("span",{children:"Height (m)"}),(0,V.jsx)("span",{children:"Width (m)"}),(0,V.jsx)("span",{})]}),r.map((m,c)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",c+1]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,V.jsx)("input",{"aria-label":`Area ${c+1} height in metres`,type:"number",min:"0",step:"0.01",value:m.height,onChange:b=>U(n,c,"height",b.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,V.jsx)("input",{"aria-label":`Area ${c+1} width in metres`,type:"number",min:"0",step:"0.01",value:m.width,onChange:b=>U(n,c,"width",b.target.value)})]}),r.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>n(b=>b.filter((g,S)=>S!==c)),children:"Remove"}):null]},`excluded-${c}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>n(m=>[...m,ac()]),children:"+ Add another area"})]}),(0,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Doors and coats"}),(0,V.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,V.jsxs)("div",{className:"truss-estimator__field-grid paint-calculator__small-fields",children:[(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Doors"}),(0,V.jsx)("input",{type:"number",min:"0",step:"1",value:i,onChange:m=>o(m.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Double doors"}),(0,V.jsx)("input",{type:"number",min:"0",step:"1",value:l,onChange:m=>u(m.target.value)})]})]}),(0,V.jsxs)("div",{className:"paint-calculator__coat-field",children:[(0,V.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,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Number of coats"}),(0,V.jsxs)("select",{value:p,onChange:m=>f(Number(m.target.value)),children:[(0,V.jsx)("option",{value:"1",children:"1 coat"}),(0,V.jsx)("option",{value:"2",children:"2 coats"}),(0,V.jsx)("option",{value:"3",children:"3 coats"})]})]})]})]}),(0,V.jsxs)("div",{className:"paint-calculator__totals",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,V.jsxs)("div",{className:"paint-calculator__result-grid",children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paintable area"}),(0,V.jsxs)("strong",{children:[w.toFixed(2)," m\xB2"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Coverage"}),(0,V.jsxs)("strong",{children:[p," ",p===1?"coat":"coats"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paint required"}),(0,V.jsxs)("strong",{children:[E.toFixed(1)," litres"]})]})]}),(0,V.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,V.jsxs)("div",{className:"paint-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",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var fr=Y(Ye()),ie=Y(re()),ic=e=>Number.parseFloat(e)||0,Sd={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 Cd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,fr.useState)("paving"),[i,o]=(0,fr.useState)("council"),[l,u]=(0,fr.useState)(""),[p,f]=(0,fr.useState)(""),[v,d]=(0,fr.useState)("100"),[h,w]=(0,fr.useState)("50"),[E,U]=(0,fr.useState)(!0),[m,c]=(0,fr.useState)(!0),b=ic(l)*ic(p),g=b,S=b*(ic(v)/1e3),z=b*.04,T=b*(ic(h)/1e3),R=Math.ceil(g/.36),j=Math.ceil(g/.1),W=Math.ceil(S*1700/800),ve=Math.ceil(z*1600/800),Se=Math.ceil(T*1600/800),Re=r==="paving"?{qty:R,unit:"each"}:r==="block"?{qty:g,unit:"m2"}:{qty:Se,unit:"bag"},Pe={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],Me=[{key:`surface-${i}`,label:Sd[r].find(K=>K.id===i)?.label??"Surface material",qty:Re.qty,unit:Re.unit,query:Pe,category:"landscaping"},...E?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:W,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...m?[{key:"bedding",label:"Sharp sand bedding",qty:ve,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];return(0,ie.jsx)(ie.Fragment,{children:(0,ie.jsxs)("div",{className:"truss-estimator",children:[(0,ie.jsxs)("div",{className:"quick-order-hero",children:[(0,ie.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ie.jsx)("h1",{children:"Paving & Driveway Calculator"}),(0,ie.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,ie.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ie.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,ie.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,ie.jsxs)("div",{className:"materials-calculator__section",children:[(0,ie.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,ie.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(([K,Z,de])=>(0,ie.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===K?" is-selected":""}`,onClick:()=>{n(K),o(Sd[K][0].id)},children:[(0,ie.jsx)("div",{className:"truss-estimator__option-title",children:Z}),(0,ie.jsx)("div",{className:"truss-estimator__option-copy",children:de})]},K))}),(0,ie.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ie.jsx)("span",{children:"Finish"}),(0,ie.jsx)("select",{value:i,onChange:K=>o(K.target.value),children:Sd[r].map(K=>(0,ie.jsx)("option",{value:K.id,children:K.label},K.id))})]})]}),(0,ie.jsxs)("div",{className:"materials-calculator__section",children:[(0,ie.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,ie.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ie.jsxs)("label",{className:"truss-estimator__field",children:[(0,ie.jsx)("span",{children:"Length (m)"}),(0,ie.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:K=>u(K.target.value)})]}),(0,ie.jsxs)("label",{className:"truss-estimator__field",children:[(0,ie.jsx)("span",{children:"Width (m)"}),(0,ie.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:K=>f(K.target.value)})]})]}),r==="gravel"&&(0,ie.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ie.jsx)("span",{children:"Gravel depth (mm)"}),(0,ie.jsx)("input",{type:"number",min:"0",step:"10",value:h,onChange:K=>w(K.target.value)})]}),E&&(0,ie.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,ie.jsx)("span",{children:"Sub-base depth (mm)"}),(0,ie.jsx)("input",{type:"number",min:"0",step:"10",value:v,onChange:K=>d(K.target.value)})]}),(0,ie.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ie.jsx)("input",{type:"checkbox",checked:E,onChange:K=>U(K.target.checked)}),(0,ie.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,ie.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,ie.jsx)("input",{type:"checkbox",checked:m,onChange:K=>c(K.target.checked)}),(0,ie.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,ie.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ie.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ie.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ie.jsxs)("div",{children:[(0,ie.jsx)("span",{children:"Surface area"}),(0,ie.jsxs)("strong",{children:[b.toFixed(2)," m\xB2"]})]}),(0,ie.jsxs)("div",{children:[(0,ie.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,ie.jsx)("strong",{children:r==="paving"?`${R} slabs`:r==="block"?`${g.toFixed(2)} m\xB2`:`${Se} bulk bags`})]}),E&&(0,ie.jsxs)("div",{children:[(0,ie.jsx)("span",{children:"MOT Type 1"}),(0,ie.jsxs)("strong",{children:[W," bulk bags"]})]}),m&&(0,ie.jsxs)("div",{children:[(0,ie.jsx)("span",{children:"Sharp sand"}),(0,ie.jsxs)("strong",{children:[ve," bulk bags"]})]})]}),(0,ie.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,ie.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ie.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ie.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(Me),disabled:b<=0,children:a})]})]})]})})}var tl=Y(Ye()),oe=Y(re()),M_=2.88,dw=[{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 Ed({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,tl.useState)([mw()]),[i,o]=(0,tl.useState)(""),[l,u]=(0,tl.useState)("standard"),[p,f]=(0,tl.useState)("screws"),v=r.reduce((z,T)=>z+qd(T.length)*qd(T.height),0),d=Math.max(0,v-qd(i)),h=Math.ceil(d/M_),w=Math.ceil(d*12),E=Math.ceil(w/1e3),U=Math.ceil(d*1.2),m=Math.ceil(U/90),c=Math.ceil(d/3.5),b=dw.find(z=>z.id===l)?.label??"Standard",g=[{key:"board",label:`${b} plasterboard`,qty:h,unit:"sheet",query:`${b} plasterboard`,category:"plasterboard"},...p==="screws"?[{key:"screws",label:"Drywall screws",qty:E,unit:"box",query:"drywall screws",category:"fixings"}]:[{key:"adhesive",label:"Board adhesive",qty:c,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:m,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],S=(z,T,R)=>{n(j=>j.map((W,ve)=>ve===z?{...W,[T]:R}:W))};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:dw.map(z=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===z.id?" is-selected":""}`,onClick:()=>u(z.id),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:z.label}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:z.blurb})]},z.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(([z,T,R])=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===z?" is-selected":""}`,onClick:()=>f(z),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:R})]},z))})]}),(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((z,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:z.length,onChange:R=>S(T,"length",R.target.value)}),(0,oe.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:z.height,onChange:R=>S(T,"height",R.target.value)}),r.length>1?(0,oe.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>n(R=>R.filter((j,W)=>W!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,oe.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>n(z=>[...z,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:i,onChange:z=>o(z.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:[d.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} (${E} boxes)`:`${c} bags`})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Joint tape"}),(0,oe.jsxs)("strong",{children:[U," 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?.(g),disabled:d<=0,children:a})]})]})]})})}var al=Y(Ye());var _=Y(re()),Tt={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}}}},nc=["range","pitchAndDimensions","quantityAndGirders","bracing"],T_={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,n=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,${n}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function A_({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",n="#d3d8de",i="#7c8494",o=(f,v,d,h,w=8,E)=>{let U=d-f,m=h-v,c=Math.hypot(U,m)||1,b=-m/c,g=U/c,S=w*.2;return(0,_.jsxs)("g",{children:[(0,_.jsx)("line",{x1:f,y1:v,x2:d,y2:h,stroke:a,strokeWidth:w+3,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:f,y1:v,x2:d,y2:h,stroke:t,strokeWidth:w,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:f-b*S,y1:v-g*S,x2:d-b*S,y2:h-g*S,stroke:r,strokeWidth:Math.max(1.5,w*.24),strokeLinecap:"round",opacity:"0.9"})]},E)},l=(f,v,d)=>(0,_.jsxs)("g",{children:[(0,_.jsx)("rect",{x:f-7.5,y:v-5.5,width:"15",height:"11",rx:"2",fill:n,stroke:i,strokeWidth:"1"}),(0,_.jsx)("circle",{cx:f-4,cy:v-2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f+4,cy:v-2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f-4,cy:v+2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f+4,cy:v+2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f,cy:v,r:"1",fill:i})]},d),u=(f,v)=>(0,_.jsx)("rect",{x:f-9,y:"110",width:"18",height:"10",fill:a},v),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,u(26,"wl"),u(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,u(26,"wl"),u(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,u(26,"wl"),u(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 R_({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 fw({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 Md({onBack:e}){let[t,a]=(0,al.useState)(0),[r,n]=(0,al.useState)(T_),[i,o]=(0,al.useState)(!1),[l,u]=(0,al.useState)(!1),p=()=>{let m=Number.parseFloat(r.roofLengthM)||0,c=Number.parseFloat(r.centres??"");return m<=0||!c?0:Math.ceil(m*1e3/c)+1},v=(()=>{let m=r.range?Tt.ranges[r.range]:Tt.ranges.standard,c=r.pitch??"22.5",b=Tt.pitchMultipliers[c],g=(Number.parseFloat(r.spanMM)||0)/1e3,z=(Number.parseFloat(r.overhangMM)||0)>Tt.overhang.thresholdMM,T=p(),R=T+r.girderCount,j=Number.parseFloat(r.roofLengthM)||0,W=r.treatment?Tt.treatment[r.treatment]:Tt.treatment.untreated,ve=Tt.estimate.ranges[r.range??"standard"],Se=ve.supplyAt8m*Math.max(.7,g/8)*b*(1+W.surchargePct)+(z?Tt.overhang.surchargePerTruss:0),Re=T*Se,Pe=r.girderCount*Se*Tt.estimate.girderMultiplier,Me=r.bracing==="yes"?j*Tt.estimate.bracingPerMetre:0,X=Re+Pe+Me+Tt.estimate.delivery,K=Tt.estimate.design+T*ve.installPerTruss+r.girderCount*40,Z=X+K,de=Z*.2;return{range:m,count:T,girderCount:r.girderCount,overhangApplies:z,overhangUnits:R,roofLengthM:j,treatment:W,trussSupply:Re,bracingMaterials:Me,delivery:Tt.estimate.delivery,labour:K,subtotal:Z,vat:de,total:Z+de}})(),d=()=>{let m=nc[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===nc.length-1?"View truss request":"Next",w=()=>{i?o(!1):t===0?e():a(m=>m-1)},E=()=>{d()&&(t===nc.length-1?(u(!1),o(!0)):a(m=>m+1))},U=()=>{let m=nc[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(Tt.ranges).map(([c,b])=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===c?" is-selected":""}`,onClick:()=>n(g=>({...g,range:c})),children:[(0,_.jsx)(A_,{type:c}),(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})]})]},c))})]}):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:c=>n(b=>({...b,spanMM:c.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:c=>n(b=>({...b,overhangMM:c.target.value}))}),(0,_.jsxs)("small",{children:["Overhangs beyond ",Tt.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:Tt.pitches.map(c=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===c?" is-selected":""}`,onClick:()=>n(b=>({...b,pitch:c})),children:[(0,_.jsx)(z_,{degrees:Number.parseFloat(c)}),(0,_.jsxs)("span",{children:[c,"\xB0"]})]},c))})]}):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:c=>n(b=>({...b,roofLengthM:c.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:Tt.centresOptions.map(c=>(0,_.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===c?" is-selected":""}`,onClick:()=>n(b=>({...b,centres:c})),children:(0,_.jsxs)("div",{className:"truss-estimator__option-title",children:[c,"mm centres"]})},c))}),(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:()=>n(c=>({...c,girderCount:Math.max(0,c.girderCount-1)})),children:"\u2212"}),(0,_.jsx)("span",{children:r.girderCount}),(0,_.jsx)("button",{type:"button",onClick:()=>n(c=>({...c,girderCount:Math.min(3,c.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(c=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===c.id?" is-selected":""}`,onClick:()=>n(b=>({...b,bracing:c.id})),children:[(0,_.jsx)(R_,{enabled:c.id==="yes"}),(0,_.jsx)("span",{children:c.label})]},c.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:()=>n(c=>({...c,treatment:"untreated"})),children:[(0,_.jsx)(fw,{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:()=>n(c=>({...c,treatment:"treated"})),children:[(0,_.jsx)(fw,{treated:!0}),(0,_.jsx)("span",{children:"Treated (+8% cost)"}),(0,_.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return i?(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:[v.range.label," roof trusses"]})]}),(0,_.jsxs)("strong",{children:[v.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:v.treatment.label})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Girder trusses"}),(0,_.jsx)("strong",{children:v.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:et(v.trussSupply)})]}),v.bracingMaterials>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing materials allowance"}),(0,_.jsx)("strong",{children:et(v.bracingMaterials)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Delivery allowance"}),(0,_.jsx)("strong",{children:et(v.delivery)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Design and installation labour"}),(0,_.jsx)("strong",{children:et(v.labour)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,_.jsx)("strong",{children:et(v.subtotal)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"VAT (20%)"}),(0,_.jsx)("strong",{children:et(v.vat)})]}),(0,_.jsxs)("div",{className:"truss-request__price-total",children:[(0,_.jsx)("span",{children:"Estimated total"}),(0,_.jsx)("strong",{children:et(v.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:()=>u(!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:U()}),(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:E,disabled:!d(),children:[(0,_.jsx)("span",{children:h}),(0,_.jsx)("span",{className:"arrow",children:(0,_.jsx)(Ot,{})})]})]})]})]})})}var Si=Y(Ye()),I=Y(re()),bw=e=>Number.parseFloat(e)||0,oc=(e,t)=>bw(e)*(t==="m"?1:.3048),gw=()=>({length:"",width:""}),hw=[{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 U_({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 Td({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Si.useState)("total"),[i,o]=(0,Si.useState)("m"),[l,u]=(0,Si.useState)(""),[p,f]=(0,Si.useState)([gw()]),[v,d]=(0,Si.useState)(""),[h,w]=(0,Si.useState)("chamfered"),E="4.2",U=r==="total"?oc(l,i):p.reduce((S,z)=>S+2*(oc(z.length,i)+oc(z.width,i)),0),m=Math.max(0,U-oc(v,i)),c=Math.ceil(m/bw(E)),b=[{key:`skirting-${h}`,label:`${hw.find(S=>S.id===h)?.label} skirting board`,qty:m,unit:"m",query:"skirting board",category:"skirting"}],g=(S,z,T)=>{f(R=>R.map((j,W)=>W===S?{...j,[z]:T}:j))};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:()=>n("total"),children:"Total length"}),(0,I.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>n("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:i==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,I.jsx)("button",{type:"button",className:i==="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 (",i,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:S=>u(S.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 (",i,")"]}),(0,I.jsxs)("span",{children:["Width (",i,")"]}),(0,I.jsx)("span",{})]}),p.map((S,z)=>(0,I.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,I.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",z+1]}),(0,I.jsx)("input",{"aria-label":`Room ${z+1} length in ${i}`,type:"number",min:"0",step:"0.01",value:S.length,onChange:T=>g(z,"length",T.target.value)}),(0,I.jsx)("input",{"aria-label":`Room ${z+1} width in ${i}`,type:"number",min:"0",step:"0.01",value:S.width,onChange:T=>g(z,"width",T.target.value)}),p.length>1?(0,I.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>f(T=>T.filter((R,j)=>j!==z)),children:"Remove"}):null]},`room-${z}`)),(0,I.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>f(S=>[...S,gw()]),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 (",i,") ",(0,I.jsx)("small",{children:"optional"})]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:v,onChange:S=>d(S.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:hw.map(S=>(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${h===S.id?" is-selected":""}`,onClick:()=>w(S.id),children:[(0,I.jsx)(U_,{profile:S.id}),(0,I.jsx)("div",{className:"truss-estimator__option-title",children:S.label}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:S.blurb})]},S.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:c})]})]}),(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 Dn=Y(Ye()),se=Y(re()),rl=e=>Number.parseFloat(e)||0;function zd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Dn.useState)("studs"),[i,o]=(0,Dn.useState)(""),[l,u]=(0,Dn.useState)(""),[p,f]=(0,Dn.useState)("600"),[v,d]=(0,Dn.useState)("2.4"),h=i&&l&&p?Math.ceil(rl(l)/(rl(p)/1e3))+1:0,w=h*rl(i),E=rl(v)>0?Math.ceil(w/rl(v)):0,U=[{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,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:"Timber Calculator"}),(0,se.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,se.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,se.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,se.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,se.jsxs)("div",{className:"materials-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,se.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(m).map(g=>(0,se.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===g?" is-selected":""}`,onClick:()=>n(g),children:[(0,se.jsx)("div",{className:"truss-estimator__option-title",children:m[g][0]}),(0,se.jsx)("div",{className:"truss-estimator__option-copy",children:m[g][1]})]},g))})]}),(0,se.jsxs)("div",{className:"materials-calculator__section",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,se.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:[b.member," (m)"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:i,onChange:g=>o(g.target.value)})]}),(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsxs)("span",{children:[b.overall," (m)"]}),(0,se.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:g=>u(g.target.value)})]})]}),(0,se.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsx)("span",{children:"Centres (mm)"}),(0,se.jsxs)("select",{value:p,onChange:g=>f(g.target.value),children:[(0,se.jsx)("option",{value:"300",children:"300 mm"}),(0,se.jsx)("option",{value:"400",children:"400 mm"}),(0,se.jsx)("option",{value:"450",children:"450 mm"}),(0,se.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,se.jsxs)("label",{className:"truss-estimator__field",children:[(0,se.jsx)("span",{children:"Stock length (m)"}),(0,se.jsxs)("select",{value:v,onChange:g=>d(g.target.value),children:[(0,se.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,se.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,se.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(0,se.jsxs)("div",{className:"materials-calculator__totals",children:[(0,se.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,se.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:b.count}),(0,se.jsx)("strong",{children:h})]}),(0,se.jsxs)("div",{children:[(0,se.jsx)("span",{children:"Linear metres"}),(0,se.jsxs)("strong",{children:[w.toFixed(2)," m"]})]}),(0,se.jsxs)("div",{children:[(0,se.jsxs)("span",{children:[v," m lengths"]}),(0,se.jsx)("strong",{children:E})]})]}),(0,se.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,se.jsxs)("div",{className:"materials-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?.(U),disabled:w<=0,children:a})]})]})]})})}var Ad=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Md},{id:"fencing",title:"Fencing Calculator",desc:"Estimate fence panels, posts, gravel boards and fixings.",imageUrl:"/tool-images/fencing.webp",Component:xd},{id:"decking",title:"Decking Calculator",desc:"Estimate boards, substructure and fixing quantities.",imageUrl:"/tool-images/decking.webp",Component:_d},{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:hd},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Nd},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:Td},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:gd},{id:"concrete-aggregate",title:"Concrete & Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:wd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:Ed},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:kd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:zd},{id:"paving",title:"Paving & Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:Cd}];var sc=Y(Ye());var Oe=Y(Ye());var N=Y(re()),D_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],Rd={wasteFactorEnabled:!0},B_=3e3,vw=null;function lc(e,t){let a=Ko(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function O_(e){return e&&e.length>0?e.join(" x "):"-"}function Ud({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:n}){let i=Vs(),o=`${e}~${t.map(C=>`${C.key}|${C.query}|${C.category??""}|${C.qty}`).join("~")}`,l=o!==vw,[u,p]=(0,Oe.useState)(null),[f,v]=(0,Oe.useState)([]),[d,h]=(0,Oe.useState)(l),[w,E]=(0,Oe.useState)(null),[U,m]=(0,Oe.useState)("tile"),[c,b]=(0,Oe.useState)(null),[g,S]=(0,Oe.useState)(""),[z,T]=(0,Oe.useState)(null),[R,j]=(0,Oe.useState)(""),[W,ve]=(0,Oe.useState)([]),[Se,Re]=(0,Oe.useState)(new Set),[Pe,Me]=(0,Oe.useState)(null),[X,K]=(0,Oe.useState)(""),[Z,de]=(0,Oe.useState)([]),Le=(0,Oe.useRef)(null),ue=(0,Oe.useRef)(!1),Ue=C=>`${e}:${C}`,Ee=C=>Zr(C.chosen,{lineId:Ue(C.requirement.key),description:C.requirement.label,unit:C.requirement.unit,qty:C.requirement.qty}),dt=(0,Oe.useMemo)(()=>t.map(C=>`${C.key}|${C.query}|${C.category??""}`).join("~"),[t]);(0,Oe.useEffect)(()=>{let C=!1;return nw().then(Q=>{C||p(Q.itemCount>0)}).catch(()=>{C||p(!1)}),()=>{C=!0}},[]),(0,Oe.useEffect)(()=>{if(!a||!u)return;let C=!1,Q;l&&h(!0),E(null);let J=Date.now();return(async()=>{let fe=null;try{fe=(await iw(t)).map(({requirement:$e,candidates:vt})=>({requirement:$e,candidates:vt,chosen:vt[0]??null}))}catch(ye){C||E(ye instanceof Error?ye.message:"Could not load products")}if(!C){if(vw=o,l){let ye=B_-(Date.now()-J);ye>0&&await new Promise($e=>{Q=window.setTimeout($e,ye)})}C||(fe&&(v(fe),!ue.current&&i&&(ue.current=!0,i.addManyToCart(fe.filter(ye=>ye.chosen).map(Ee)))),h(!1))}})(),()=>{C=!0,window.clearTimeout(Q)}},[a,u,dt]),(0,Oe.useEffect)(()=>{if(!z)return;let C=R.trim();if(!C){ve([]);return}let Q=!1,J=window.setTimeout(()=>{Jr(C).then(fe=>{Q||ve(fe)}).catch(()=>{Q||ve([])})},250);return()=>{Q=!0,window.clearTimeout(J)}},[z,R]),(0,Oe.useEffect)(()=>{if(!Pe)return;let C=X.trim();if(!C){de([]);return}let Q=!1,J=window.setTimeout(()=>{Jr(C).then(fe=>{Q||de(fe)}).catch(()=>{Q||de([])})},250);return()=>{Q=!0,window.clearTimeout(J)}},[Pe,X]);let bt=(0,Oe.useMemo)(()=>{let C=g.trim().toLowerCase(),Q=C?f.filter(J=>J.requirement.label.toLowerCase().includes(C)||(J.chosen?.description??"").toLowerCase().includes(C)||(J.chosen?.product_id??"").toLowerCase().includes(C)):f;return c?[...Q].sort((J,fe)=>{let ye=J.requirement.label.localeCompare(fe.requirement.label);return c==="asc"?ye:-ye}):Q},[f,g,c]),Ht=bt.filter(C=>C.chosen),mt=bt.filter(C=>!C.chosen),nt=f.filter(C=>C.chosen),ft=nt.filter(C=>C.chosen?.price==null).length,G=nt.reduce((C,Q)=>C+(za(Ee(Q),Rd).lineTotal??0),0);if((0,Oe.useEffect)(()=>{n?.(G)},[G,n]),!a||u===!1)return null;let y=i?nt.filter(C=>i.cart[Ue(C.requirement.key)]).length:0,M=Pe?f.find(C=>C.requirement.key===Pe)??null:null,le=X.trim()?Z:M?.candidates??[],pe=C=>{let Q=z===C.requirement.key;T(Q?null:C.requirement.key),j(Q?"":C.requirement.query)},Fe=(C,Q)=>{let J=f.find(fe=>fe.requirement.key===C);v(fe=>fe.map(ye=>ye.requirement.key===C?{...ye,chosen:Q}:ye)),i&&J&&i.cart[Ue(C)]&&i.addToCart(Ee({...J,chosen:Q})),T(null),j("")},xt=C=>{v(Q=>Q.map(J=>J.requirement.key===C?{...J,chosen:null}:J)),i?.cart[Ue(C)]&&i.removeFromCart(Ue(C))},k=C=>{Me(C.requirement.key),K(""),de([])},H=()=>{Me(null),K(""),de([])},B=C=>{if(!i)return;let Q=Ue(C.requirement.key);i.cart[Q]?i.removeFromCart(Q):i.addToCart(Ee(C))},ne=C=>{Re(Q=>{let J=new Set(Q);return J.has(C)?J.delete(C):J.add(C),J})},te=C=>{let Q=W.length>0?W:C.candidates;return(0,N.jsxs)("div",{className:"estimator-products__picker",children:[(0,N.jsx)("input",{type:"text",className:"results-search-input",value:R,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:J=>j(J.target.value),"aria-label":`Search a product for ${C.requirement.label}`}),(0,N.jsxs)("div",{className:"estimator-products__options",children:[Q.map(J=>(0,N.jsxs)("button",{type:"button",className:`estimator-products__option${J.product_id===C.chosen?.product_id?" is-selected":""}`,onClick:()=>Fe(C.requirement.key,J),children:[(0,N.jsx)("span",{children:J.description}),(0,N.jsxs)("span",{className:"results-row-meta",children:[J.product_id,J.price!=null&&` \xB7 ${et(J.price)}`]})]},J.product_id)),Q.length===0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,N.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!d&&(0,N.jsxs)("div",{className:"estimator-products__head",children:[(0,N.jsxs)("div",{className:"results-tile-section__head",children:[(0,N.jsx)("h3",{children:"Matched Products"}),(0,N.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!M&&(0,N.jsxs)("div",{className:"results-summary estimator-products__toolbar",children:[ft>0&&(0,N.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,N.jsx)("strong",{children:ft})," need pricing"]}),(0,N.jsxs)("div",{className:"estimator-products__controls",children:[(0,N.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:g,onChange:C=>S(C.target.value),"aria-label":"Search matched products"}),(0,N.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,N.jsx)("button",{type:"button",className:`results-view-toggle__btn${U==="tile"?" is-active":""}`,"aria-pressed":U==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>m("tile"),children:(0,N.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,N.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,N.jsx)("button",{type:"button",className:`results-view-toggle__btn${U==="list"?" is-active":""}`,"aria-pressed":U==="list","aria-label":"List view",title:"List view",onClick:()=>m("list"),children:(0,N.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,N.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,N.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,N.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,N.jsxs)("details",{ref:Le,style:{position:"relative"},children:[(0,N.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,N.jsx)("div",{className:"sort-menu-panel",children:D_.map(C=>{let Q=c===C.dir;return(0,N.jsxs)("button",{type:"button",className:`sort-menu-item${Q?" is-active":""}`,onClick:()=>{b(Q?null:C.dir),Le.current?.removeAttribute("open")},children:[(0,N.jsx)("span",{className:"sort-menu-item__check",children:Q?"\u2713":""}),C.label]},C.dir)})})]})]})]})]}),M&&(0,N.jsxs)("div",{className:"results-review-page",children:[(0,N.jsxs)("div",{className:"results-review-page__top",children:[(0,N.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:H,children:[(0,N.jsx)(Vr,{}),"Back to results"]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,N.jsx)("div",{className:"results-review-searchbar",children:(0,N.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:X,onChange:C=>K(C.target.value),"aria-label":`Search a product for ${M.requirement.label}`})}),M.chosen&&(0,N.jsx)("div",{className:"results-candidate-actions",children:(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>xt(M.requirement.key),children:"Clear selected product"})})]})]}),(0,N.jsxs)("div",{className:"results-review-page__hero",children:[(0,N.jsx)("div",{className:"results-review-page__image-wrap",children:(0,N.jsx)("img",{className:"fill-img results-review-page__image",src:Qa(M.chosen?.description||M.requirement.label,M.chosen?.product_id,M.chosen?.pdp_photo_url),alt:""})}),(0,N.jsxs)("div",{className:"results-review-page__summary",children:[(0,N.jsx)("h2",{children:M.requirement.label}),(0,N.jsxs)("p",{className:"results-review-page__meta",children:[wi(M.requirement.qty)," ",ka(M.requirement.unit,M.requirement.qty)]}),M.chosen?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"results-review-page__product",children:M.chosen.description}),(0,N.jsxs)("div",{className:"results-row-meta",children:[M.chosen.product_id,M.chosen.price!=null?` \xB7 ${lc(M.chosen.price,M.chosen.price_basis)}`:""]})]}):(0,N.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,N.jsx)("div",{className:"results-review-page__actions",children:(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${i?.cart[Ue(M.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(M),disabled:!M.chosen||!i,children:i?.cart[Ue(M.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),le.length===0?(0,N.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,N.jsxs)("table",{className:"score-breakdown-table",children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{children:"Product"}),(0,N.jsx)("th",{children:"Dims (mm)"}),(0,N.jsx)("th",{children:"Price"}),(0,N.jsx)("th",{"aria-label":"Actions"})]})}),(0,N.jsx)("tbody",{children:le.map(C=>{let Q=C.product_id===M.chosen?.product_id;return(0,N.jsxs)("tr",{className:Q?"score-breakdown-row--best":"",children:[(0,N.jsxs)("td",{children:[(0,N.jsx)("div",{children:C.description}),(0,N.jsx)("div",{className:"results-row-meta",children:C.product_id})]}),(0,N.jsx)("td",{children:(0,N.jsx)("span",{className:"unit-badge",children:O_(C.measurements_mm)})}),(0,N.jsx)("td",{children:C.price!=null?lc(C.price,C.price_basis):"-"}),(0,N.jsx)("td",{children:(0,N.jsxs)("label",{className:"switch-toggle",title:Q?"Currently selected":"Use this candidate",children:[(0,N.jsx)("input",{type:"checkbox",checked:Q,onChange:()=>{Q?xt(M.requirement.key):Fe(M.requirement.key,C)},"aria-label":Q?`${C.description} selected`:`Use ${C.description}`}),(0,N.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},C.product_id)})})]})]}),!M&&d&&(0,N.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,N.jsx)(pr,{}),(0,N.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!M&&w&&(0,N.jsx)("p",{className:"results-empty-hint estimator-products__error",children:w}),!M&&!d&&!w&&bt.length===0&&f.length>0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!M&&!d&&!w&&U==="tile"&&Ht.length>0&&(0,N.jsx)("div",{className:"results-tile-grid",children:Ht.map(C=>{let{requirement:Q,chosen:J}=C,fe=J?za(Ee(C),Rd):null,ye=i?!!i.cart[Ue(Q.key)]:!1;return(0,N.jsxs)("article",{className:"results-tile-card",children:[(0,N.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>k(C),"aria-label":`Review match for ${Q.label}`,children:[(0,N.jsx)("div",{className:"results-tile-card__media",children:(0,N.jsx)("img",{className:"fill-img results-tile-card__image",src:Qa(J?.description||Q.label,J?.product_id,J?.pdp_photo_url),alt:""})}),(0,N.jsxs)("div",{className:"results-tile-card__body",children:[J?(0,N.jsxs)("div",{className:"results-tile-card__heading",children:[(0,N.jsx)("div",{className:"results-tile-card__title",children:J.description}),(0,N.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,N.jsx)("span",{children:J.product_id}),J.price!=null?(0,N.jsx)("span",{children:lc(J.price,J.price_basis)}):null]})]}):(0,N.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,N.jsxs)("div",{className:"results-tile-card__match",children:[(0,N.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,N.jsx)("div",{className:"results-tile-card__match-name",children:Q.label}),(0,N.jsxs)("div",{className:"results-tile-card__meta",children:[wi(Q.qty)," ",ka(Q.unit,Q.qty)]}),fe?.requiredSellUnits!=null?(0,N.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",fe.requiredSellUnits," ",fe.sellUnit,fe.lineTotal!=null?` \xB7 ${et(fe.lineTotal)}`:""]}):J?(0,N.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,N.jsxs)("div",{className:"results-tile-card__actions",children:[(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>k(C),children:"Review"}),(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${ye?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(C),disabled:!J||!i,children:ye?"\u2713 Added":"+ Add"})]})]},Q.key)})}),!M&&!d&&!w&&U==="list"&&Ht.length>0&&(0,N.jsx)("div",{className:"bom-table-wrap",children:(0,N.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,N.jsxs)("colgroup",{children:[(0,N.jsx)("col",{style:{width:"56px"}}),(0,N.jsx)("col",{className:"col-item"}),(0,N.jsx)("col",{style:{width:"90px"}}),(0,N.jsx)("col",{style:{width:"80px"}}),(0,N.jsx)("col",{style:{width:"220px"}}),(0,N.jsx)("col",{style:{width:"110px"}})]}),(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{className:"bom-col-header",children:[(0,N.jsx)("th",{"aria-label":"Expand"}),(0,N.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,N.jsx)("tbody",{children:Ht.map(C=>{let{requirement:Q,chosen:J}=C,fe=J?za(Ee(C),Rd):null,ye=i?!!i.cart[Ue(Q.key)]:!1,$e=Se.has(Q.key);return(0,N.jsxs)(Oe.Fragment,{children:[(0,N.jsxs)("tr",{className:"bom-row",children:[(0,N.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,N.jsx)("button",{type:"button",className:"link-btn",onClick:()=>ne(Q.key),"aria-expanded":$e,"aria-label":$e?"Collapse product options":"Expand product options",children:$e?"\u25BE":"\u25B8"})}),(0,N.jsxs)("td",{style:{paddingLeft:0},children:[(0,N.jsx)("div",{className:"bom-component-name",children:Q.label}),fe?.requiredSellUnits!=null&&(0,N.jsxs)("div",{className:"results-row-meta",children:["Order ",fe.requiredSellUnits," ",fe.sellUnit,fe.lineTotal!=null?` \xB7 ${et(fe.lineTotal)}`:""]})]}),(0,N.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:wi(Q.qty)}),(0,N.jsx)("td",{style:{textAlign:"center"},children:ka(Q.unit,Q.qty)}),(0,N.jsx)("td",{style:{textAlign:"center"},children:J?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"bom-component-name",children:J.description}),(0,N.jsxs)("div",{className:"results-row-meta",children:[J.product_id,J.price!=null&&` \xB7 ${lc(J.price,J.price_basis)}`]})]}):(0,N.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,N.jsx)("td",{style:{textAlign:"center"},children:(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${ye?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(C),disabled:!J||!i,children:ye?"\u2713 Added":"+ Add"})})]}),$e&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:z===Q.key?te(C):(0,N.jsxs)("div",{className:"estimator-products__picker",children:[(0,N.jsxs)("div",{className:"estimator-products__options",children:[C.candidates.map(vt=>(0,N.jsxs)("button",{type:"button",className:`estimator-products__option${vt.product_id===J?.product_id?" is-selected":""}`,onClick:()=>Fe(Q.key,vt),children:[(0,N.jsx)("span",{children:vt.description}),(0,N.jsxs)("span",{className:"results-row-meta",children:[vt.product_id,vt.price!=null&&` \xB7 ${et(vt.price)}`]})]},vt.product_id)),C.candidates.length===0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>pe(C),children:"Search the catalogue"})]})})})]},Q.key)})})]})}),!M&&!d&&!w&&mt.length>0&&(0,N.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,N.jsxs)("div",{className:"results-tile-section__head",children:[(0,N.jsx)("h3",{children:"Require Matching"}),(0,N.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,N.jsx)("div",{className:"results-unmatched-list",children:mt.map(C=>(0,N.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>k(C),children:[(0,N.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,N.jsx)("span",{className:"results-unmatched-card__title",children:C.requirement.label}),(0,N.jsxs)("span",{className:"results-row-meta",children:[wi(C.requirement.qty)," ",ka(C.requirement.unit,C.requirement.qty)]})]}),(0,N.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},C.requirement.key))})]}),!d&&!w&&f.length>0&&(0,N.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,N.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,N.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."})]}),!M&&!d&&!w&&(r||y>0)&&(0,N.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,N.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),y>0&&i&&(0,N.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:i.openBasket,children:[(0,N.jsxs)("span",{children:["View Basket (",y,")"]}),(0,N.jsx)("span",{className:"arrow",children:(0,N.jsx)(Ot,{})})]})]})]})}var Lt=Y(re());function Dd({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[n,i]=(0,sc.useState)(0),o=(0,sc.useCallback)(l=>i(l),[]);return(0,Lt.jsx)(Lt.Fragment,{children:(0,Lt.jsxs)("div",{className:"truss-estimator",children:[(0,Lt.jsxs)("div",{className:"quick-order-hero",children:[(0,Lt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Lt.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Lt.jsx)("h1",{children:"Your Materials"}),n>0&&(0,Lt.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Lt.jsx)("strong",{children:et(n)})," Est. total"]})]}),(0,Lt.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Lt.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Lt.jsx)(Ud,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var L_=(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 ww(e,t){if(e==="paint"||e==="concrete-aggregate")return null;let a=t.map(r=>{let n=L_(e,r);return n?{key:r.key,productId:n,qty:r.qty,unit:r.unit}:null});return a.every(Boolean)?a:null}var Bd=Y(Ye());var Jt=Y(re()),H_=1500;function yw(e){let{addManyToCart:t,clearCart:a,openBasket:r}=qn(),[n,i]=(0,Bd.useState)(!1),[o,l]=(0,Bd.useState)(null);return{adding:n,basketError:o,addToBasket:async(p,f)=>{let v=Date.now();i(!0),l(null);try{let d=await Promise.all(p.filter(w=>w.qty>0).map(async w=>{let E=(await Jr(w.productId)).find(U=>U.product_id===w.productId);if(!E)throw new Error("A selected product is no longer available in this catalogue.");return Zr(E,{lineId:`${e}:${w.key}`,description:E.description,unit:w.unit??"each",qty:w.qty,calculatorWasteIncluded:f})})),h=H_-(Date.now()-v);h>0&&await new Promise(w=>window.setTimeout(w,h)),a(),t(d),r()}catch(d){l(d instanceof Error?d.message:"Could not add the products to your basket.")}finally{i(!1)}}}}function _w({toolTitle:e}){return(0,Jt.jsx)(Jt.Fragment,{children:(0,Jt.jsxs)("div",{className:"truss-estimator",children:[(0,Jt.jsxs)("div",{className:"quick-order-hero",children:[(0,Jt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Jt.jsx)("h1",{children:"Your Materials"}),(0,Jt.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Jt.jsx)("div",{className:"truss-estimator__card",children:(0,Jt.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Jt.jsx)(pr,{}),(0,Jt.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Ae=Y(re());function uc(e){let[t,a]=(0,cc.useState)(!1);return(0,Ae.jsx)($s,{onOpenBasket:()=>a(!0),children:(0,Ae.jsx)(j_,{...e,showBasket:t,onShowBasket:a})})}function j_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:n}){let[i,o]=(0,cc.useState)(null),[l,u]=(0,cc.useState)(null),p=Ad.find(g=>g.id===i),{cart:f,updateCartQty:v,updateCartSellUnits:d,updateCartConversions:h,removeFromCart:w,clearCart:E}=qn(),{adding:U,basketError:m,addToBasket:c}=yw(p?.title??"calculator"),b=g=>{if(!p)return;let S=ww(p.id,g);S?c(S,g[0]?.calculatorWasteIncluded??!1):u(g)};return(0,Ae.jsx)("div",{className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}`,style:hi().theme,children:(0,Ae.jsx)("main",{className:"main-content",children:r?(0,Ae.jsx)(el,{cart:f,onUpdateQty:v,onUpdateSellUnits:d,onResolveConversions:h,onRemove:w,onBack:()=>n(!1),onStartNewQuote:()=>{E(),o(null),u(null),n(!1)},internal:a}):U&&p?(0,Ae.jsx)(_w,{toolTitle:p.title}):p?(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)("div",{hidden:l!==null,children:(0,Ae.jsx)(p.Component,{onBack:()=>o(null),onReview:b})}),m&&(0,Ae.jsx)("p",{className:"results-empty-hint estimator-products__error",children:m}),l!==null&&(0,Ae.jsx)(Dd,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>u(null)})]}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)("div",{className:"quick-order-card",children:[(0,Ae.jsxs)("div",{className:"quick-order-hero",children:[(0,Ae.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,Ae.jsx)("h1",{children:"Estimating Tools"}),(0,Ae.jsx)("p",{children:"Trade-specific calculators for trusses, fencing, decking, masonry and painting. Dial in your specs and get an instant material estimate."})]}),(0,Ae.jsxs)("div",{className:"quick-order-alt",children:[(0,Ae.jsx)("div",{className:"quick-order-alt-title",children:"Choose a Calculator"}),(0,Ae.jsx)("div",{className:"estimator-tools-grid",children:Ad.map(g=>(0,Ae.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{o(g.id),u(null)},children:[(0,Ae.jsx)("span",{className:"estimator-tool-card__image-wrap",children:(0,Ae.jsx)("img",{className:"fill-img estimator-tool-card__image",src:Kt(g.imageUrl),alt:""})}),(0,Ae.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Ae.jsx)("span",{className:"estimator-tool-card__title",children:g.title}),(0,Ae.jsx)("span",{className:"estimator-tool-card__desc",children:g.desc})]})]},g.id))})]})]})})})})}var pc=Y(re());function Od({config:e,children:t}){return Gb(e),(0,pc.jsx)(pc.Fragment,{children:t})}var Ld=Y(re()),G_="https://api.metronlabs.ai",Q_=["client","api-key","api-url","theme","hide-header"];function kw(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.19",!this.root){let n=document.createElement("div"),i=document.createElement("style");i.textContent=`:host { display: block; }
6780
+ `)}function Zr(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}}var Xv=e=>(e??"").trim().toLowerCase(),H1={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"},j1=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),jv=new Set(["box","bag","pack","pallet","roll","set","tub"]),Gv=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,Qv=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,_i=e=>{let t=Xv(e);return H1[t]??t},tt=(e,t)=>{let a=_i(e),r=_i(t);return a.length>0&&a===r},G1=(e,t)=>{let a=Xv(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},Q1=e=>(e??"").split(",").map(t=>_i(t)).filter(Boolean),Y1=(e,t)=>{let a=Q1(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||tt(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||tt(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||tt(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},Yv=(e,t)=>tt(t,"pallet")?e.itemsPerPallet??null:tt(t,"pack")?e.itemsPerPack??null:tt(t,"box")?e.itemsPerBox??null:null,X1=(e,t,a)=>{if(!tt(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||!tt(r[3],a))return null;let n=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(n)&&n>0?n:null};function za(e,t){let a=e.qty,r=_i(e.unit)||"-",n=_i(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=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,u=l?e.sellUnitsOverride??null:null,p=v=>({requestedAmount:a,requestedUnit:r,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:n,calculatedSellUnits:null,requiredSellUnits:u,unitPrice:e.price,lineTotal:e.price!=null&&u!=null?e.price*u:null,calculation:u!=null?`${v} Manually set to ${u} ${n}.`:v,costingMode:"review"});if(!Y1(e,r))return p("Requested unit is not supported by this catalogue conversion.");let f=null,b="review",m=e.roundingRule,h=`Quantity review required, initial request needed ${a} ${r}.`,w=1+o,E=X1(e,r,n),R=e.unitConversions?.find(v=>tt(v.requestUom,r));if(!!e.saleUnit&&(tt(r,n)||!!R||tt(r,"each")&&!jv.has(n)))if(tt(r,n))f=a*w/i,b="direct",h=`${a} ${r}${o>0?` x ${w}`:""}`;else if(R){f=a*w/R.quantityPerSaleUnit,b="derived";let v=1/R.quantityPerSaleUnit,S=Math.round(v);h=tt(n,"each")&&R.quantityPerSaleUnit<1&&Math.abs(v-S)<1e-9?`${a} ${r}${o>0?` x ${w}`:""} x ${S} per ${r}`:`${a} ${r}${o>0?` x ${w}`:""} / ${R.quantityPerSaleUnit} ${r} per ${n}`}else tt(r,"each")&&!jv.has(n)&&(f=a*w/i,b="derived",h=`${a} ${n}${o>0?` x ${w}`:""}`);else if(tt(r,n)&&i>0)f=a*w/i,b="direct",h=o>0?`${a} ${r} x ${w} / ${i} ${n} per sell unit`:`${a} ${r} / ${i} ${n} per sell unit`;else if(tt(r,"each")&&i>0&&j1.has(n))f=a*w/i,b="derived",h=o>0?`${a} each x ${w} / ${i} each per ${n}`:`${a} each / ${i} each per ${n}`;else if(Yv(e,r)!=null&&i>0){let v=Yv(e,r)??0;f=a*v*w/i,b="derived";let S=`${a} ${r} x ${v} each${o>0?` x ${w}`:""}`;h=i===1&&tt(n,"each")?S:`${S} / ${i} each per ${n}`}else if(E!=null)f=a*w/E,b="derived",m??(m="round_up_each"),h=`${a} m2 x ${w} / ${E} m2 per ${n} (from product description)`;else if(e.conversionType==="basket_line_unit"){let v=e.coverageQty??null;v!=null&&v>0&&tt(r,e.coverageUom)&&(f=a*w/v,b="derived",h=`${a} ${r} x ${w} / ${v} ${e.coverageUom} per ${n}`)}else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${r}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let v=e.coverageQty??e.derivedCoverageM2??null;tt(r,"m2")&&v!=null&&v>0&&(f=a*w/v,b="derived",h=`${a} m2 x ${w} / ${v} m2 per ${n}`)}else if(e.conversionType==="count_per_area"){let v=e.coverageQty??null;tt(r,"m2")&&v!=null&&v>0?(f=a/v,b="derived",h=`${a} m2 / ${v} m2 per sell unit`):tt(r,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&i>0&&(f=a*e.itemsPerM2*w/i,b="derived",h=`${a} m2 x ${e.itemsPerM2} ${n}/m2 x ${w} / ${i}`)}else if(e.conversionType==="length_from_dims"){let v=e.coverageQty??e.derivedLengthM??null;tt(r,"m")&&v!=null&&v>0&&(f=a*w/v,b="derived",h=`${a} m x ${w} / ${v} m per ${n}`)}else if(e.conversionType==="volume_from_description"){let v=Gv(a,r),S=Gv(e.coverageQty??0,_i(e.coverageUom));v!=null&&S!=null&&S>0&&(f=v*w/S,b="derived",h=`${a} ${r} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${n}`)}else if(e.conversionType==="weight_from_description"){let v=Qv(a,r),S=Qv(e.coverageQty??0,_i(e.coverageUom));v!=null&&S!=null&&S>0&&(f=v*w/S,b="derived",h=`${a} ${r} x ${w} / ${e.coverageQty} ${e.coverageUom} per ${n}`)}else if(e.conversionType==="same_unit_volume"){let v=e.coverageQty??null;tt(r,"m3")&&v!=null&&v>0&&(f=a/v,b="derived",h=`${a} m3 / ${v} m3 per ${n}`)}}if(f==null||!Number.isFinite(f)||f<0)return p(`Quantity review required, initial request needed ${a} ${r}.`);let c=G1(f,m),g=l?e.sellUnitsOverride??null:c;return{requestedAmount:a,requestedUnit:r,salesUnitSize:i,sellUnit:n,calculatedSellUnits:c,requiredSellUnits:g,unitPrice:e.price,lineTotal:e.price!=null&&g!=null?e.price*g:null,calculation:l?`${h} = ${c} ${n} (manually set to ${g})`:`${h} = ${g} ${n}`,costingMode:b}}var $v=()=>import("./xlsx-K4MOA2QM.js"),Fo=["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"],$1=Fo.indexOf("Line total");function V1(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 Vv(e){let t=await $v(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),n=[Fo],i=0;for(let u of e){let{item:p,best:f,qty:b,band:m,unmatchable:h,decision:w}=u,E=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),R=!h&&f?.price!=null?f.price*b:null;R!=null&&(i+=R),n.push([p.source_line_id,p.line_id,p.description_original||"(no description)",E,b,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?"-":f?.product_id??w?.selected_candidate_id??"-",h?"-":f?.description??"-",h?"-":f?.price_basis??"-",h?null:f?.price??null,R,h?"-":m,V1(u)])}n.push(Array(Fo.length).fill(null));let o=Array(Fo.length).fill(null);o[0]="Estimated total",o[$1]=i,n.push(o),n.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(Fo.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(n);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 Po=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function Zv(e,t){let a=await $v(),r=a.utils.book_new(),n=new Date().toISOString().slice(0,10),i=t?[["Account",t.name+" ("+t.id+")"],[],Po]:[Po],o=0;for(let p of e){let f=za(p),b=f.lineTotal;b!=null&&(o+=b),i.push([p.productId,p.description,f.costingMode,f.requestedAmount,xa(f.requestedUnit),f.salesUnitSize,xa(f.sellUnit),f.requiredSellUnits,f.unitPrice,b])}i.push(Array(Po.length).fill(null));let l=Array(Po.length).fill(null);l[0]="Estimated total",l[Po.length-1]=o,i.push(l);let u=a.utils.aoa_to_sheet(i);u["!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,u,"Basket"),a.writeFile(r,t?`basket-${t.id}-${n}.xlsx`:`basket-${n}.xlsx`)}var s=Y(ae()),ud="__none__",Io=24,Z1=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function Fv(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var K1=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function J1(e,t){if(t!==ud){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);if(e?.decision?.technical_classification!=="no_suitable_candidate")return e?.candidates?.[0]}}function Kv(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 P1(e){return e?e.replace(/_/g," "):"not stated"}function F1({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 Cn(e,t){if(e==null)return"-";let a=Jo(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function pd(e){return e&&e.length>0?e.join(" x "):"-"}function I1(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Sn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Kr(e,t){return e.customer_display_label?.trim()||e.description_original||"(no description)"}var Jv=[{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 W1(e){let t=new Map;return[...new Set(e.filter(dr).map(r=>r.linked_group_id))].forEach((r,n)=>{let i=n%26;t.set(r,{token:String.fromCharCode(65+i),bubbleStyle:Jv[n%Jv.length]})}),t}function dr(e){return!1}function qn(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 cd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function e_(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,5),l=o.some(u=>u.product_id===a)?void 0:e.find(u=>u.product_id===a);return l?[...o,l]:o}let n=new Map(e.map(o=>[o.product_id,o])),i=r.map(o=>n.get(o)).filter(o=>o!=null);if(a&&!i.some(o=>o.product_id===a)){let o=n.get(a);o&&i.unshift(o)}return[...new Map(i.map(o=>[o.product_id,o])).values()].slice(0,5)}function Xs(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 $s(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 t_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:n}){let i=[...t].sort((l,u)=>u.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-i.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:$s(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:n})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:$s(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,u)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:$s(l.durationMs)})]},`${l.key}-${u}`))})]}),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:i.map((l,u)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:$s(l.durationMs)})]},`${l.key}-${u}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",i.length," of ",t.length," LLM calls."]})]})]})}function a_({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,n)=>(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:pd(r.measurements_mm)}),(0,s.jsx)("td",{children:Jo(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${n}`))})]})]},`${t.query}-${a}`))]})}function Pv({item:e,result:t}){let a=t?.retrieval_debug.map(n=>n.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Sn(e.procurement_aliases)],["Retrieval queries",Sn(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)",pd(e.attrs.measurements_mm)],["Stock length",I1(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",Sn(e.installation_clues)],["System clues",Sn(e.system_clues)],["Component requirements",Sn(e.component_requirements)],["Linked group",qn(e)||"-"],["Flags",Sn(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(([n,i])=>(0,s.jsxs)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:n}),(0,s.jsx)("dd",{children:i})]},n))})]})}function r_({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)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(ye.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 i_({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,n])=>(0,s.jsxs)(ye.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:n})]},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 n_({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:n=!1,linkedGroupMeta:i}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"Exact match not found:":`AI review (${t.confidence??"confidence not stated"}):`;return n?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]}),dr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",i?`Link ${i.token} - `:"",qn(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(Pv,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Pv,{item:e,result:a}),r&&(0,s.jsx)(r_,{item:e}),r&&(0,s.jsx)(i_,{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]}),dr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",i?`Link ${i.token} - `:"",qn(e)]}):null]}),r&&(0,s.jsx)(a_,{queries:a?.retrieval_debug??[]})]})}function o_({item:e,candidates:t,result:a,decision:r,unmatchable:n,selectedProductId:i,detailMode:o,onPick:l,onClear:u,showAll:p=!1,internal:f=!1,debugEnabled:b=!1,forceReviewNote:m=!1,linkedGroupMeta:h}){let w=f||o==="detailed",E=b&&o==="detailed",R=w||m?(0,s.jsx)(n_,{item:e,decision:r,result:a,showRetrievalDebug:E,reviewOnly:m&&!w,linkedGroupMeta:h}):null;if(n)return(0,s.jsxs)(s.Fragment,{children:[R,(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:[R,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let d=p||f||o==="detailed"?t:e_(t,a,i);return(0,s.jsxs)(s.Fragment,{children:[R,(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"}),E&&(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:d.map((c,g)=>{let v=c.product_id===i;return(0,s.jsxs)("tr",{className:v?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:c.description}),(0,s.jsx)("div",{className:"results-row-meta",children:c.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:pd(c.measurements_mm??c.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:Cn(c.price,c.price_basis)}),E&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(c.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(c.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)(F1,{band:Fv(c.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(c.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?u?.():l(c)},"aria-label":v?`${c.description} selected`:`Use ${c.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${c.product_id}-${g}`)})})]})]})}function dd({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:n,onGoToBasket:i,cartSeeded:o,onCartSeeded:l,reviewGateComplete:u,onReviewGateComplete:p,internal:f=!1}){let b=!f&&Hs()==="QZA6-MRA4",m=b?"quote":"basket",{results:h,lineItems:w,parseReport:E,timings:R}=e,[d,c]=(0,ye.useState)({}),[g,v]=(0,ye.useState)({}),[S,M]=(0,ye.useState)({}),[T,U]=(0,ye.useState)(""),[j,F]=(0,ye.useState)(null),[we,Ee]=(0,ye.useState)(1),[De,at]=(0,ye.useState)(!1);(0,ye.useEffect)(()=>{at(new URLSearchParams(window.location.search).get("debug")==="1")},[]);let[Ce,X]=(0,ye.useState)("simple"),[ie,ne]=(0,ye.useState)(f?"list":"tile"),[I,Me]=(0,ye.useState)(!1),[de,be]=(0,ye.useState)(null),[qe,dt]=(0,ye.useState)(""),[Rt,mt]=(0,ye.useState)([]),[ft,nt]=(0,ye.useState)(!1),[gt,G]=(0,ye.useState)(null),[y,z]=(0,ye.useState)(!1),[W,se]=(0,ye.useState)(null),pe=(0,ye.useRef)(null),[Pe,xt]=(0,ye.useState)(new Set),[k,H]=(0,ye.useState)(new Set),[B,oe]=(0,ye.useState)(!1);(0,ye.useEffect)(()=>{Ee(1)},[T,j,ie]);let ee=new Map(h.map(x=>[x.line_id,x])),C=W1(w),Q=w.map(x=>{let O=ee.get(x.line_id),Te=O?.decision,zt=K1(x),Qe=d[x.line_id],Ft=J1(O,Qe),Ti=a[x.line_id],Aw=Qe===ud?void 0:g[x.line_id]??(Ti&&Ti.productId!==Ft?.product_id?Kv(Ti):Ft),Kd=zt?void 0:Aw,Rw=x.qty??0;return{item:x,result:O,decision:Te,unmatchable:zt,best:Kd,qty:Rw,band:Fv(Kd?.scores?.overall)}}),Z=0,fe=0;for(let x of Q)x.unmatchable||x.decision?.include_in_quote!==!0||!x.best||(x.best.price!=null?Z+=x.best.price*x.qty:fe+=1);let _e=x=>!x.unmatchable&&!x.best&&x.decision?.technical_classification!=="no_suitable_candidate"&&Xs(x.result).length>0,$e=x=>x.best??Xs(x.result)[0],ca=Q.filter(x=>!x.unmatchable&&!x.best).filter(x=>!k.has(x.item.line_id)),nl=Q.filter(x=>k.has(x.item.line_id)),ua=Q;if(T.trim()){let x=T.trim().toLowerCase();ua=ua.filter(O=>O.item.description_original?.toLowerCase().includes(x)||$e(O)?.description?.toLowerCase().includes(x))}if(j){let x=j==="asc"?1:-1;ua=[...ua].sort((O,Te)=>x*(O.item.description_original||"").localeCompare(Te.item.description_original||""))}let On=Math.max(1,Math.ceil(ua.length/Io)),Pt=Math.min(we,On),gr=ua.slice((Pt-1)*Io,Pt*Io),Xa=gr.filter(x=>!x.unmatchable&&x.best),Hd=gr.filter(x=>_e(x)),Ln=gr.filter(x=>!x.unmatchable&&(x.best||_e(x))),jd=gr.filter(x=>x.unmatchable||!x.best&&!_e(x)),J=de?Q.find(x=>x.item.line_id===de)??null:null,Sw=!f&&!u&&!J&&ca.length>0,Hn=(0,ye.useRef)(null),jn=()=>{let x=pe.current;if(!x)return;let{top:O,left:Te,width:zt,height:Qe}=x.getBoundingClientRect(),Ti=x.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;se({top:O,left:Te,width:Ti?Ti-Te:zt,height:Qe})};(0,ye.useEffect)(()=>(window.addEventListener("scroll",jn,!0),window.addEventListener("resize",jn),()=>{window.removeEventListener("scroll",jn,!0),window.removeEventListener("resize",jn)})),(0,ye.useEffect)(()=>{let x=O=>{Hn.current&&!O.composedPath().includes(Hn.current)&&Hn.current.removeAttribute("open")};return document.addEventListener("click",x),()=>document.removeEventListener("click",x)},[]);let qi=x=>{be(x),dt("")},Cw=()=>{if(!de)return;let x=a[de];if(x){c(O=>({...O,[de]:x.productId})),v(O=>({...O,[de]:Kv(x)}));return}c(O=>{let Te={...O};return delete Te[de],Te}),v(O=>{let Te={...O};return delete Te[de],Te})},hr=(x=!1)=>{let O=de?a[de]:void 0;!x&&O&&J?.best&&O.productId!==J.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(x||Cw(),be(null),oe(!1))},qw=x=>{if(xt(O=>new Set(O).add(x)),ca.some(O=>O.item.line_id!==x)){hr(!0);return}p(),hr(!0)},Ew=x=>{if(dc(x),H(O=>new Set(O).add(x)),ca.some(O=>O.item.line_id!==x)){hr(!0);return}p(),hr(!0)},Mw=()=>{H(x=>new Set([...x,...ca.map(O=>O.item.line_id)])),p()},Gd=()=>{J?.best&&(Yd(J.item.line_id,J.best),r(Ei(J)),B?qw(J.item.line_id):hr(!0))},Qd=jd.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:jd.map(x=>{let{item:O,qty:Te}=x;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>qi(O.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Kr(O,w)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},O.line_id)})})]}):null,dc=x=>{c(O=>({...O,[x]:ud})),v(O=>({...O,[x]:void 0})),M(O=>({...O,[x]:void 0})),n(x)},mc=(x,O)=>{c(Te=>({...Te,[x]:O.product_id})),v(Te=>({...Te,[x]:O}))},Yd=(x,O)=>{O.method==="catalogue_search"&&M(Te=>({...Te,[x]:O}))};function $_(){Vv(Q.map(({item:x,best:O,qty:Te,band:zt,unmatchable:Qe,decision:Ft})=>({item:x,best:O,qty:Te,band:zt,unmatchable:Qe,decision:Ft})))}function Ei(x){let O=x.best??Xs(x.result)[0];return Zr(O,{lineId:x.item.line_id,description:x.item.description_original,unit:x.item.unit,qty:x.qty})}(0,ye.useEffect)(()=>{if(!o){for(let x of Q)!x.unmatchable&&x.best&&r(Ei(x));l()}},[o]),(0,ye.useEffect)(()=>{for(let x of Q){let O=a[x.item.line_id];if(!O)continue;let Te=Ei(x);r({...Te,qty:O.qty,sellUnitsOverride:O.sellUnitsOverride??null})}},[e]),(0,ye.useEffect)(()=>{if(!de){mt([]),G(null),nt(!1);return}let x=qe.trim();if(!x){mt([]),G(null),nt(!1);return}let O=!1,Te=window.setTimeout(async()=>{try{nt(!0),G(null);let zt=await fetch(Ot(`/api/catalogue/search?q=${encodeURIComponent(x)}`),{headers:vi()}),Qe=await Zt(zt);if(!zt.ok)throw new Error(Qe?.error||Qe?.message||"Failed to search catalogue");O||mt(Array.isArray(Qe?.items)?Qe.items:[])}catch(zt){O||(mt([]),G(zt?.message||"Failed to search catalogue"))}finally{O||nt(!1)}},250);return()=>{O=!0,window.clearTimeout(Te)}},[qe,de]);let fc=Object.keys(a).length,qa=qe.trim(),Xd=Xs(J?.result),ol=J?.decision?.technical_classification==="no_suitable_candidate"||!!J&&!J.best,$d=J?.decision?.technical_classification!=null,Vd=J?.decision?.reason??(ol?"No catalogue candidate found. Refine the request or search the catalogue.":null),Tw=Rt.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"})),Gn=qa?Tw:Xd,Mi=J?S[J.item.line_id]:void 0,Qn=!qa&&Mi&&!Gn.some(x=>x.product_id===Mi.product_id)?[...Gn,Mi]:Gn,Zd=(()=>{let x=Qn.slice(0,qa?12:3);return qa||!Mi||x.some(O=>O.product_id===Mi.product_id)?x:[...x,Mi]})(),ll=!!J?.best&&a[J.item.line_id]?.productId===J.best.product_id,zw=!!J?.best&&!!a[J.item.line_id]&&!ll;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${f?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${f?"":" quick-order-hero--customer"}`,children:f?(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:et(Z)})," 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 ",b?"View Quote":"View Basket"," to continue."]})]}),(0,s.jsxs)("button",{type:"button",className:"results-total-action",onClick:i,"aria-label":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:b?"View Quote":"View Basket"}),(0,s.jsx)("strong",{children:et(Z)})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Lt,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[De&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":I,onClick:()=>Me(x=>!x),children:I?"Hide timings":"Show timings"})}),De&&I&&(0,s.jsx)(t_,{...R}),!b&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!J&&(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:0},children:[fe>0&&(0,s.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,s.jsx)("strong",{children:fe})," 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:T,onChange:x=>U(x.target.value),"aria-label":"Search line items"}),!f&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${ie==="tile"?" is-active":""}`,"aria-pressed":ie==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>ne("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${ie==="list"?" is-active":""}`,"aria-pressed":ie==="list","aria-label":"List view",title:"List view",onClick:()=>ne("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"})]})})]}),De&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>X(x=>x==="simple"?"detailed":"simple"),children:Ce==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:Hn,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:Z1.map(x=>{let O=j===x.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${O?" is-active":""}`,onClick:()=>{F(O?null:x.dir),Hn.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:O?"\u2713":""}),x.label]},x.dir)})})]})]})]})}),ie==="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:()=>hr(),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:()=>hr(),"aria-label":"Close product options",children:(0,s.jsx)($o,{})}),(0,s.jsx)("div",{className:"results-review-page",children:f?(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:()=>hr(),children:[(0,s.jsx)(Vr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[De&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>X(x=>x==="simple"?"detailed":"simple"),children:Ce==="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:qe,onChange:x=>dt(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:()=>dc(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:Qa($e(J)?.description||J.item.description_original,$e(J)?.product_id,$e(J)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Kr(J.item,w)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[yi(J.qty)," ",ka(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:Cn(J.best.price,J.best.price_basis)}):null]}):$e(J)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:$e(J)?.description}),$e(J)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:Cn($e(J)?.price??null,$e(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."}),dr(J.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(cd,{meta:C.get(J.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:qn(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]?n(J.item.line_id):(J.best&&Yd(J.item.line_id,J.best),r(Ei(J)))},disabled:!J.best,"aria-label":a[J.item.line_id]?f?"Remove from selection":`Remove from ${m}`:f?"Add to selection":`Add to ${m}`,children:a[J.item.line_id]?"\u2713 Added":f?"+ Add to selection":`Add to ${m}`})})]})]}),ft?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!ft&&gt?(0,s.jsx)("div",{className:"results-empty-card",children:gt}):null,!ft&&!gt&&qa&&Gn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!ft&&!gt?(0,s.jsx)(o_,{item:J.item,candidates:Gn,result:J.result,decision:J.decision,unmatchable:J.unmatchable,selectedProductId:J.best?.product_id??null,detailMode:Ce,linkedGroupMeta:dr(J.item)?C.get(J.item.linked_group_id):void 0,onPick:x=>mc(J.item.line_id,x),onClear:()=>dc(J.item.line_id),showAll:f||De||qa.length>0,internal:f,debugEnabled:De,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:Kr(J.item,w)||"Original request"})]}),Vd?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:ol?"Exact match not found:":"AI review:"})," ",Vd]}):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:ol?"We couldn't find a suitable product":$d?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:ol?Xd.length>0?"These AI-reviewed alternatives may be useful, but need approval.":"Search the catalogue to choose an alternative.":$d?`Select the option you want to add to your ${m}.`:"Search the catalogue to choose a product."})]})}),!qa&&Qn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:Zd.map(x=>{let O=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${O?" is-selected":""}`,onClick:()=>mc(J.item.line_id,x),"aria-pressed":O,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Qa(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${Cn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:O?"Selected":"Choose"})]},x.product_id)})}):null,Qn.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:qe,onChange:x=>dt(x.target.value),"aria-label":"Search catalogue"})]}),qa&&ft?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,qa&&!ft&&gt?(0,s.jsx)("div",{className:"results-empty-card",children:gt}):null,qa&&!ft&&!gt&&Qn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,qa&&!ft&&!gt&&Qn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:Zd.map(x=>{let O=x.product_id===J.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${O?" is-selected":""}`,onClick:()=>mc(J.item.line_id,x),"aria-pressed":O,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Qa(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${Cn(x.price,x.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:O?"Selected":"Choose"})]},x.product_id)})}):null]}),J.best?zw?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{Gd()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>n(J.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${m}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${ll?" cta-btn-secondary":""}`,onClick:()=>{ll?n(J.item.line_id):Gd()},children:(0,s.jsx)("span",{children:ll?`Remove from ${m}`:`Add selected product to ${m}`})}):null,B?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>Ew(J.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[ua.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,Ln.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:Ln.map(x=>{let{item:O,best:Te,qty:zt}=x,Qe=$e(x),Ft=!Te&&_e(x);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>qi(O.line_id),"aria-label":`Review match for ${Kr(O,w)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[Ft||dr(O)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[dr(O)?(0,s.jsx)(cd,{meta:C.get(O.linked_group_id)}):(0,s.jsx)("span",{}),Ft?(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:Qa(Qe?.description||O.description_original,Qe?.product_id,Qe?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Qe?(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:Qe.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:Qe?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:Ft?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Kr(O,w)}),dr(O)?(0,s.jsx)("div",{className:"results-row-meta",children:qn(O)}):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:[f&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>qi(O.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[O.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[O.line_id]?n(O.line_id):r(Ei(x))},disabled:!Qe,"aria-label":a[O.line_id]?f?"Remove from selection":`Remove from ${m}`:f?"Add to selection":`Add to ${m}`,children:a[O.line_id]?"\u2713 Added":f?"+ Add":`Add to ${m}`})]})]},O.line_id)})})}):null,Qd]})]}):(0,s.jsxs)(s.Fragment,{children:[W&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:W,"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"}}),Ce==="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"}),Ce==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:f?"Selection":b?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[ua.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:Ce==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),Ln.map(x=>{let{item:O,result:Te,decision:zt,best:Qe}=x;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>qi(O.line_id),onMouseEnter:Ft=>{pe.current=Ft.currentTarget,jn()},onMouseLeave:()=>{pe.current=null,se(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Kr(O,w)}),dr(O)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(cd,{meta:C.get(O.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:qn(O)})]}):null]}),(0,s.jsx)("td",{children:Qe?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Qe.description,children:Qe.description}),Ce==="detailed"&&zt?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[P1(zt.technical_classification),zt.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Qe?.price!=null?Cn(Qe.price,Qe.price_basis):"-"}),Ce==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[O.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:Ft=>{Ft.stopPropagation(),a[O.line_id]?n(O.line_id):r(Ei(x))},"aria-label":a[O.line_id]?f?"Remove from selection":`Remove from ${m}`:f?"Add to selection":`Add to ${m}`,children:a[O.line_id]?"\u2713 Added":f?"+ Add":`Add to ${m}`})})]},O.line_id)})]})]})}),Qd]}),!J&&On>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(Pt-1)*Io+1,"\u2013",Math.min(Pt*Io,ua.length)," of ",ua.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ee(Pt-1),disabled:Pt===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",Pt," of ",On]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ee(Pt+1),disabled:Pt===On,children:"Next"})]})]}),(E.itemCount!=null||E.headingCount!=null||E.skippedCount!=null)&&(0,s.jsxs)("div",{className:"results-summary",style:{marginTop:16},children:[E.itemCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.itemCount})," items parsed"]}),E.headingCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.headingCount})," headings"]}),E.skippedCount!=null&&(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:E.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:(fc>0,"0 1 30%"),gap:10,justifyContent:"center"},onClick:()=>z(!0),"aria-label":"Start over",children:[(0,s.jsx)(ld,{}),(0,s.jsx)("span",{children:"Start Over"})]}),fc>0&&(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:i,"aria-label":f?"View selection":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[f?"View Selection":b?"View Quote":"View Basket"," (",fc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Lt,{})})]})]})]})]}),Sw&&(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:ca.map(x=>{let O=Pe.has(x.item.line_id),Te=_e(x);return(0,s.jsx)("div",{className:`review-gate-item${O?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{oe(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Kr(x.item,w)}),(0,s.jsx)("span",{children:x.decision?.reason||(Te?"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:O?"Choice made":"Choose a product"})]})},x.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:Mw,children:"Skip all"}),nl.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),nl.map(x=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{H(O=>{let Te=new Set(O);return Te.delete(x.item.line_id),Te}),oe(!0),qi(x.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Kr(x.item,w)}),(0,s.jsx)("span",{children:`Not added to your ${m}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},x.item.line_id))]}):null]})}),y&&(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 ",b?"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:()=>z(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{z(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var Et=Y(Ye());var q=Y(ae()),l_=.2,Wo=10,Iv="Enter a valid email address so we can send your quote.",s_=(e,t)=>{let a=`${t.requestedAmount} ${xa(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${xa(t.sellUnit,t.requiredSellUnits??0)}`,n=e.unitConversions?.find(i=>i.requestUom===t.requestedUnit);return n&&n.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/n.quantityPerSaleUnit)} ${xa(t.sellUnit,2)} per ${xa(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}`},c_=e=>["box","pack"].includes(e.requestedUnit)?"Pack size needed to calculate the order quantity.":`This product is sold by ${xa(e.sellUnit,1)}.`;function u_(){return(0,q.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,q.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,q.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,q.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,q.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function el(){return(0,q.jsx)("svg",{width:"8",height:"5",viewBox:"0 0 8 5",fill:"none",children:(0,q.jsx)("path",{d:"M1 4L4 1L7 4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function tl({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:n,onBack:i,onStartNewQuote:o,internal:l=!1}){let u=(0,Et.useId)(),p=!l&&Hs()==="QZA6-MRA4",f=Object.values(e),[b,m]=(0,Et.useState)(""),[h,w]=(0,Et.useState)(!1),[E,R]=(0,Et.useState)(!1),[d,c]=(0,Et.useState)(""),[g,v]=(0,Et.useState)({}),[S,M]=(0,Et.useState)({}),[T,U]=(0,Et.useState)(1),[j,F]=(0,Et.useState)({}),[we,Ee]=(0,Et.useState)(!1),[De,at]=(0,Et.useState)("0"),Ce=(0,Et.useRef)(new Set);(0,Et.useEffect)(()=>{if(!r)return;let G=Object.values(e).filter(y=>y.productId!=="-"&&za(y).requiredSellUnits==null&&!Ce.current.has(y.lineId));G.length!==0&&(G.forEach(y=>Ce.current.add(y.lineId)),fetch(Ot("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:G.map(y=>({line_id:y.lineId,product_id:y.productId,requested_description:y.requestedDescription??y.description,requested_qty:y.qty,requested_uom:y.unit,selected_description:y.description,selected_uoi:y.uoi,selected_uoi_count:y.uoiCount,selected_conversion:{sales_uom_normalised:y.salesUomNormalised,conversion_type:y.conversionType,sales_unit_size:y.salesUnitSize,sales_unit_size_uom:y.salesUnitSizeUom,coverage_qty:y.coverageQty,coverage_uom:y.coverageUom}}))})}).then(y=>y.ok?Zt(y):null).then(y=>{let z={};for(let W of y?.data?.items??y?.items??[]){let se=W?.conversion;!se||typeof W?.line_id!="string"||(z[W.line_id]={conversionType:se.conversion_type,requestUomsSupported:se.request_uoms_supported,salesUomNormalised:se.sales_uom_normalised,salesUnitSize:se.sales_unit_size,salesUnitSizeUom:se.sales_unit_size_uom,coverageQty:se.coverage_qty,coverageUom:se.coverage_uom,roundingRule:se.rounding_rule,conversionConfidence:se.conversion_confidence,conversionNotes:se.conversion_notes})}Object.keys(z).length>0&&r(z)}).catch(()=>{}))},[e,r]);function X(G){v(y=>{let z={...y};return delete z[G],z})}function ie(G,y){let z=parseFloat(y);!isNaN(z)&&z>=0&&t(G,z),X(G)}function ne(G,y,z){t(G,Math.max(0,y+z)),X(G)}function I(G){M(y=>{let z={...y};return delete z[G],z})}function Me(G,y){let z=parseFloat(y);!isNaN(z)&&z>=0&&a(G,z),I(G)}function de(G,y,z){a(G,Math.max(0,y+z)),I(G)}async function be(){let G=b.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(G)){c(Iv);return}c(""),R(!0);try{let y=await fetch(Ot("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({email:G,items:qe.map(({item:z,pricing:W})=>{let se=W.requiredSellUnits??W.requestedAmount,pe=W.requiredSellUnits!=null?W.sellUnit:W.requestedUnit;return{product_id:z.productId,description:z.description,quantity:se,unit:xa(pe,se),unit_price:W.requiredSellUnits!=null?W.unitPrice:null,line_total:W.lineTotal}})})});if(!y.ok){let z=await Zt(y);console.error("Quote request failed",y.status,z?.message),c(y.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}w(!0),window.scrollTo(0,0)}catch{c("Your request couldn't be sent. Check your connection and try again.")}finally{R(!1)}}let qe=f.map(G=>({item:G,pricing:za(G,{wasteFactorEnabled:we,wasteFactorOverride:Math.max(0,Number.parseFloat(De)||0)/100})})),dt=qe.reduce((G,y)=>G+(y.pricing.lineTotal??0),0),Rt=dt*l_,mt=dt+Rt,ft=Math.max(1,Math.ceil(qe.length/Wo)),nt=Math.min(T,ft),gt=qe.slice((nt-1)*Wo,nt*Wo);return h?(0,q.jsx)("div",{className:"wizard-step entry-stage",children:(0,q.jsxs)("div",{className:"quote-request-sent",role:"status",children:[(0,q.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,q.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,q.jsx)("polyline",{points:"5 12.5 10 17.5 19 7"})})}),(0,q.jsx)("h1",{children:"Quote requested"}),(0,q.jsxs)("p",{children:["You're all done. We'll email your sharper price to ",(0,q.jsx)("strong",{children:b.trim()}),", usually within one working day."]}),(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,q.jsx)("span",{children:"Start a new quote"})}),(0,q.jsx)("p",{className:"quote-request-sent-note",children:"Nothing is charged until you approve the quote."})]})}):(0,q.jsx)("div",{className:`wizard-step entry-stage${p?" basket-layout--qza6-mra4":""}`,children:(0,q.jsxs)("div",{className:`quick-order-card${l?"":" quick-order-card--customer"}`,children:[(0,q.jsxs)("div",{className:`quick-order-hero${l?"":" quick-order-hero--customer"}`,children:[l&&(0,q.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,q.jsxs)("div",{className:"basket-hero-copy",children:[p&&(0,q.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:i,children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]}),(0,q.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,q.jsx)("h1",{children:l?"Your Selection":p?"Request a quote":"Your Basket"}),l&&(0,q.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,q.jsx)("strong",{children:f.length})," ",f.length===1?"item":"items"]})]}),(0,q.jsx)("p",{children:l?"Review the items you've added before exporting them for review.":p?"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,q.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:f.length===0?(0,q.jsxs)("div",{className:"quick-order-history-empty",children:[(0,q.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:l?"\u{1F4CB}":"\u{1F9FA}"}),(0,q.jsx)("p",{children:l?"Your selection is empty.":p?"Your quote request is empty.":"Your basket is empty."}),(0,q.jsx)("p",{className:"basket-empty-hint",children:p?"Go back to your results and add items for your quote.":"Go back to your results and add quoted items."}),(0,q.jsx)("div",{className:"btn-row",style:{marginTop:20,justifyContent:"center"},children:(0,q.jsx)("button",{className:"cta-btn",style:{width:"auto",maxWidth:280},onClick:i,"aria-label":"Back to results",children:(0,q.jsx)("span",{children:"Back to Results"})})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("div",{className:"basket-layout",children:[(0,q.jsxs)("div",{className:"basket-main",children:[(0,q.jsx)("div",{className:"basket-list","aria-label":l?"Selection items":p?"Quote request items":"Basket items",children:gt.map(({item:G,pricing:y})=>{let z=g[G.lineId]??String(y.requestedAmount),W=y.requestedUnit===y.sellUnit||y.costingMode==="review",se=y.requiredSellUnits==null||y.requestedAmount!==y.requiredSellUnits||y.requestedUnit!==y.sellUnit;return(0,q.jsxs)("article",{className:"basket-card",children:[(0,q.jsxs)("div",{className:"basket-card-top",children:[(0,q.jsx)("img",{className:"basket-card-thumb",src:Qa(G.description,G.productId,G.pdpPhotoUrl),alt:"",width:48,height:48}),(0,q.jsxs)("div",{className:"basket-card-info",children:[(0,q.jsx)("div",{className:"bom-component-name",children:G.description}),se&&y.costingMode!=="review"&&(0,q.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>F(pe=>({...pe,[G.lineId]:!pe[G.lineId]})),"aria-expanded":!!j[G.lineId],children:["How we calculated this",(0,q.jsx)("span",{className:`basket-calc-toggle-chevron${j[G.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,q.jsx)(el,{})})]})]}),(0,q.jsx)("div",{className:"basket-card-actions",children:(0,q.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>n(G.lineId),"aria-label":`Remove ${G.description}`,children:(0,q.jsx)(u_,{})})})]}),l&&(0,q.jsxs)("div",{className:"results-detail-block basket-internal-detail",children:[(0,q.jsxs)("dl",{className:"results-detail-grid",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion type"}),(0,q.jsx)("dd",{children:G.conversionType??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion confidence"}),(0,q.jsx)("dd",{children:G.conversionConfidence??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Sales unit"}),(0,q.jsx)("dd",{children:G.salesUnitSize!=null?(0,q.jsxs)(q.Fragment,{children:[G.salesUnitSize," ",ka(G.salesUnitSizeUom,G.salesUnitSize)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Coverage"}),(0,q.jsx)("dd",{children:G.coverageQty!=null?(0,q.jsxs)(q.Fragment,{children:[G.coverageQty," ",ka(G.coverageUom,G.coverageQty)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Waste factor"}),(0,q.jsx)("dd",{children:G.wasteFactorDefault??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Rounding rule"}),(0,q.jsx)("dd",{children:G.roundingRule??"-"})]})]}),G.conversionNotes&&(0,q.jsx)("p",{className:"results-rerank-note",children:G.conversionNotes})]}),y.costingMode==="review"?(0,q.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,q.jsx)("strong",{children:"Quantity needs confirmation."})," ",c_(y)]}):se&&j[G.lineId]?(0,q.jsx)("p",{className:"basket-calc-text",children:s_(G,y)}):null,(0,q.jsxs)("div",{className:"basket-card-stats",children:[(0,q.jsxs)("div",{className:"basket-stat",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Requested qty"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsxs)("div",{className:"basket-qty-field",children:[(0,q.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:z,disabled:W,onChange:pe=>v(Pe=>({...Pe,[G.lineId]:pe.target.value})),onBlur:pe=>ie(G.lineId,pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&pe.target.blur()},"aria-label":`${G.description} requested quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:W,onClick:()=>ne(G.lineId,parseFloat(z)||0,1),"aria-label":`Increase ${G.description} quantity`,children:(0,q.jsx)(el,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:W,onClick:()=>ne(G.lineId,parseFloat(z)||0,-1),"aria-label":`Decrease ${G.description} quantity`,children:(0,q.jsx)(el,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(y.requestedUnit,parseFloat(z)||0)})]})]}),(0,q.jsxs)("div",{className:"basket-stat basket-stat--right",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Order qty"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsxs)("div",{className:"basket-qty-field",children:[(0,q.jsx)("input",{className:"bom-qty-edit",type:"number",inputMode:"decimal",min:"0",placeholder:"-",value:S[G.lineId]??String(y.requiredSellUnits??""),onChange:pe=>M(Pe=>({...Pe,[G.lineId]:pe.target.value})),onBlur:pe=>Me(G.lineId,pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&pe.target.blur()},"aria-label":`${G.description} order quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>de(G.lineId,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${G.description} order quantity`,children:(0,q.jsx)(el,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>de(G.lineId,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${G.description} order quantity`,children:(0,q.jsx)(el,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(y.sellUnit,parseFloat(S[G.lineId]??String(y.requiredSellUnits??"0"))||0)})]})]}),(0,q.jsxs)("div",{className:"basket-stat basket-stat--total",children:[(0,q.jsx)("span",{className:"basket-stat-label",children:"Total"}),(0,q.jsxs)("div",{className:"basket-stat-value",children:[(0,q.jsx)("strong",{children:y.lineTotal!=null?et(y.lineTotal):"-"}),y.lineTotal!=null&&(0,q.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},G.lineId)})}),ft>1&&(0,q.jsxs)("div",{className:"results-pagination",children:[(0,q.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(nt-1)*Wo+1,"\u2013",Math.min(nt*Wo,qe.length)," of ",qe.length]}),(0,q.jsxs)("div",{className:"results-pagination-controls",children:[(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>U(nt-1),disabled:nt===1,children:"Previous"}),(0,q.jsxs)("span",{className:"results-pagination-page",children:["Page ",nt," of ",ft]}),(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>U(nt+1),disabled:nt===ft,children:"Next"})]})]})]}),(0,q.jsxs)("aside",{className:"basket-sidebar",children:[(0,q.jsx)("div",{className:"basket-sidebar-title",children:p?"Quote request summary":"Order summary"}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:p?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,q.jsx)("span",{children:et(dt)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:"VAT (20%)"}),(0,q.jsx)("span",{children:et(Rt)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,q.jsx)("span",{children:p?"List price (inc. VAT)":"Total"}),(0,q.jsx)("span",{children:et(mt)})]}),!p&&(0,q.jsx)("div",{className:"basket-summary-waste",children:(0,q.jsxs)("div",{className:"basket-waste-control",children:[(0,q.jsxs)("label",{className:"basket-global-waste",children:[(0,q.jsx)("input",{type:"checkbox",checked:we,onChange:G=>Ee(G.target.checked)}),(0,q.jsx)("span",{children:"Add waste factor"})]}),(0,q.jsxs)("label",{className:"basket-global-waste-percent",children:[(0,q.jsx)("input",{type:"number",inputMode:"decimal",min:"0",step:"0.1",value:De,onChange:G=>at(G.target.value),disabled:!we,"aria-label":"Waste factor percent"}),(0,q.jsx)("span",{children:"%"})]})]})}),(0,q.jsx)("label",{htmlFor:`${u}-basket-reference`,className:"basket-sidebar-label",children:p?"Enter email for your sharper quote":"Your reference (optional)"}),(0,q.jsx)("input",{id:`${u}-basket-reference`,type:p?"email":"text",className:"basket-sidebar-input",value:b,onChange:G=>{m(G.target.value),p&&c("")},placeholder:p?"you@example.com":"PO number or job reference","aria-invalid":p&&d===Iv,"aria-describedby":p&&d?`${u}-basket-reference-error`:void 0}),p&&d&&(0,q.jsx)("p",{id:`${u}-basket-reference-error`,className:"basket-quote-request-error",role:"alert",children:d}),p?(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{be()},disabled:E,"aria-busy":E,children:(0,q.jsx)("span",{children:E?"Sending\u2026":"Request our best quote"})}):(0,q.jsx)("button",{className:"cta-btn",onClick:()=>{Zv(f)},"aria-label":l?"Download selection":"Download basket",children:(0,q.jsx)("span",{children:l?"Download Quote":"Buy Now"})}),(0,q.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,q.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),p?"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,q.jsx)("div",{className:"btn-row results-actions",children:(0,q.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:i,"aria-label":"Back to results",children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]})})]})})]})})}var Mt=Y(Ye()),Wv=Y(ae()),md=(0,Mt.createContext)(null);function Vs({children:e,onOpenBasket:t}){let[a,r]=(0,Mt.useState)({}),n=(0,Mt.useCallback)(m=>{r(h=>({...h,[m.lineId]:m}))},[]),i=(0,Mt.useCallback)(m=>{r(h=>{let w={...h};for(let E of m)w[E.lineId]=E;return w})},[]),o=(0,Mt.useCallback)(m=>{r(h=>{let w={...h};return delete w[m],w})},[]),l=(0,Mt.useCallback)((m,h)=>{r(w=>w[m]?{...w,[m]:{...w[m],qty:h,sellUnitsOverride:null}}:w)},[]),u=(0,Mt.useCallback)((m,h)=>{r(w=>w[m]?{...w,[m]:{...w[m],sellUnitsOverride:h}}:w)},[]),p=(0,Mt.useCallback)(m=>{r(h=>{let w=!1,E={...h};for(let[R,d]of Object.entries(m))E[R]&&(E[R]={...E[R],...d},w=!0);return w?E:h})},[]),f=(0,Mt.useCallback)(()=>r({}),[]),b=(0,Mt.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:n,addManyToCart:i,removeFromCart:o,updateCartQty:l,updateCartSellUnits:u,updateCartConversions:p,clearCart:f,openBasket:t??(()=>{})}),[a,n,i,o,l,u,p,f,t]);return(0,Wv.jsx)(md.Provider,{value:b,children:e})}function En(){let e=(0,Mt.useContext)(md);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function Zs(){return(0,Mt.useContext)(md)}var Aa=Y(ae());function Ks(e){return(0,Aa.jsx)(Vs,{children:(0,Aa.jsx)(p_,{...e})})}function p_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,n]=(0,We.useState)("entry"),[i,o]=(0,We.useState)(null),[l,u]=(0,We.useState)(""),p=(0,We.useRef)(null),[f,b]=(0,We.useState)(0),[m,h]=(0,We.useState)(null),[w,E]=(0,We.useState)(!1),{cart:R,addToCart:d,removeFromCart:c,updateCartQty:g,updateCartSellUnits:v,updateCartConversions:S,clearCart:M}=En(),[T,U]=(0,We.useState)(!1),j=(0,We.useRef)(new Map);(0,We.useEffect)(()=>{let ne=Object.values(R).filter(I=>{if(I.productId==="-"||za(I).requiredSellUnits!=null)return!1;let Me=`${I.productId}|${I.qty}|${I.unit}`;return j.current.get(I.lineId)===Me?!1:(j.current.set(I.lineId,Me),!0)});ne.length!==0&&fetch(Ot("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Ga()},body:JSON.stringify({lines:ne.map(I=>({line_id:I.lineId,product_id:I.productId,requested_description:I.requestedDescription??I.description,requested_qty:I.qty,requested_uom:I.unit,selected_description:I.description,selected_uoi:I.uoi,selected_uoi_count:I.uoiCount,selected_conversion:{sales_uom_normalised:I.salesUomNormalised,conversion_type:I.conversionType,sales_unit_size:I.salesUnitSize,sales_unit_size_uom:I.salesUnitSizeUom,coverage_qty:I.coverageQty,coverage_uom:I.coverageUom}}))})}).then(I=>I.ok?Zt(I):null).then(I=>{let Me={};for(let de of I?.data?.items??I?.items??[]){let be=de?.conversion;!be||typeof de?.line_id!="string"||(Me[de.line_id]={conversionType:be.conversion_type,requestUomsSupported:be.request_uoms_supported,salesUomNormalised:be.sales_uom_normalised,salesUnitSize:be.sales_unit_size,salesUnitSizeUom:be.sales_unit_size_uom,coverageQty:be.coverage_qty,coverageUom:be.coverage_uom,roundingRule:be.rounding_rule,conversionConfidence:be.conversion_confidence,conversionNotes:be.conversion_notes})}Object.keys(Me).length>0&&S(Me)}).catch(()=>{})},[R,S]),(0,We.useEffect)(()=>{if(window.location.hash!=="#matched-products"&&window.location.hash!=="#quote-request")return;let ne=new URL(window.location.href);ne.hash="",window.history.replaceState({...window.history.state??{},boqQuoteStage:"entry"},"",ne)},[]);let F=(0,We.useCallback)(ne=>{if(typeof window>"u")return;let I=new URL(window.location.href);I.hash=ne==="basket"?"quote-request":"matched-products";let Me={...window.history.state??{},boqQuoteStage:ne};window.history.pushState(Me,"",I)},[]);(0,We.useEffect)(()=>{let ne=I=>{let Me=I.state?.boqQuoteStage;n(Me==="basket"?"basket":Me==="results"&&m?"results":"entry")};return window.addEventListener("popstate",ne),()=>window.removeEventListener("popstate",ne)},[m]);let we=(0,We.useCallback)(()=>{F("basket"),n("basket")},[F]),Ee=(0,We.useCallback)(()=>{window.history.state?.boqQuoteStage==="basket"?window.history.back():n(m?"results":"entry")},[m]),De=(0,We.useRef)(r);(0,We.useEffect)(()=>{De.current!==r&&(De.current=r,window.scrollTo(0,0))},[r]);let at=()=>{n("entry"),o(null),u(""),b(0),h(null),E(!1),M(),U(!1)},Ce=(0,We.useCallback)(async(ne,I,Me=!0)=>{u(""),b(0);let de=0,be=()=>{de=Math.min(de+1,3),b(de)};try{let{jobId:qe}=await Zb(ne,I,Me),{promise:dt,cancel:Rt}=Jb(()=>Kb(qe),5e3,be,"schedule");p.current=Rt;let mt=await dt;if(mt.status==="failed"||!mt.result)throw new Error(mt.error||"Failed to process schedule");E(!1),h(mt.result),F("results"),n("results")}catch(qe){u(qe?.message||"Failed to process schedule"),n("entry")}finally{p.current?.(),p.current=null}},[F]),X=(0,We.useCallback)(async(ne,I,Me=!0)=>{let de=ne.trim();if(!de)return;o("schedule");let be=new File([de],"pasted-schedule.txt",{type:"text/plain"});await Ce(be,I,Me)},[Ce]),ie=(0,We.useCallback)(async ne=>{o("schedule"),await Ce(ne)},[Ce]);return(0,Aa.jsx)("div",{className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:bi().theme,children:(0,Aa.jsxs)("main",{className:"main-content",children:[l&&(0,Aa.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Aa.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Aa.jsx)(nd,{onPasteSchedule:X,onUploadSchedule:ie,onEntryModeChange:o}),r==="results"&&i==="schedule"&&m&&(0,Aa.jsx)(dd,{scheduleResult:m,onStartOver:at,cart:R,onAddToCart:d,onRemoveFromCart:c,onGoToBasket:we,cartSeeded:T,onCartSeeded:()=>U(!0),reviewGateComplete:w,onReviewGateComplete:()=>E(!0),internal:a}),r==="basket"&&(0,Aa.jsx)(tl,{cart:R,onUpdateQty:g,onUpdateSellUnits:v,onRemove:c,onBack:Ee,onStartNewQuote:at,internal:a})]})})}var Pr=Y(Ye());var xi=Y(Ye()),te=Y(ae()),ew=[{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"}],Js=e=>Number.parseFloat(e)||0,tw=(e,t)=>Js(e)*(t==="m"?1:.3048),fd=(e,t)=>Js(e.quantity)*(2*tw(e.height,t)+tw(e.width,t)),d_=()=>({quantity:"1",width:"",height:""});function m_({profile:e}){return(0,te.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,te.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,te.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,xi.useState)("m"),[i,o]=(0,xi.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,u]=(0,xi.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,f]=(0,xi.useState)([]),[b,m]=(0,xi.useState)("ogee"),[h,w]=(0,xi.useState)("2.4"),E=(S,M,T)=>{S(U=>({...U,[M]:T}))},R=fd(i,r)+fd(l,r)+p.reduce((S,M)=>S+fd(M,r),0),d=Js(h)>0?Math.ceil(R/Js(h)):0,c=ew.find(S=>S.id===b)?.label??"",g=[{key:`architrave-${b}`,label:`Architrave (${c})`,qty:R,unit:"m",query:`${c} architrave`,category:"architrave"}],v=(S,M,T,U)=>(0,te.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,te.jsx)("span",{children:S}),(0,te.jsx)("input",{"aria-label":`${S} quantity`,type:"number",min:"0",step:"1",value:M.quantity,onChange:j=>T("quantity",j.target.value)}),(0,te.jsx)("input",{"aria-label":`${S} width`,type:"number",min:"0",step:"0.01",value:M.width,onChange:j=>T("width",j.target.value)}),(0,te.jsx)("input",{"aria-label":`${S} height`,type:"number",min:"0",step:"0.01",value:M.height,onChange:j=>T("height",j.target.value)}),U?(0,te.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:U,children:"Remove"}):null]});return(0,te.jsx)(te.Fragment,{children:(0,te.jsxs)("div",{className:"truss-estimator",children:[(0,te.jsxs)("div",{className:"quick-order-hero",children:[(0,te.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,te.jsx)("h1",{children:"Architrave Calculator"}),(0,te.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,te.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,te.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,te.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,te.jsxs)("div",{className:"architrave-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,te.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,te.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,te.jsx)("span",{children:"Units"}),(0,te.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,te.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>n("m"),children:"Metres"}),(0,te.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>n("ft"),children:"Feet"})]})]}),(0,te.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,te.jsx)("span",{children:"Opening"}),(0,te.jsx)("span",{children:"Qty"}),(0,te.jsxs)("span",{children:["Width (",r,")"]}),(0,te.jsxs)("span",{children:["Height (",r,")"]}),(0,te.jsx)("span",{})]}),v("Single doors",i,(S,M)=>E(o,S,M)),v("Double doors",l,(S,M)=>E(u,S,M)),p.map((S,M)=>v(`Alternative door ${M+1}`,S,(T,U)=>f(j=>j.map((F,we)=>we===M?{...F,[T]:U}:F)),()=>f(T=>T.filter((U,j)=>j!==M)))),(0,te.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>f(S=>[...S,d_()]),children:"+ Add alternative-sized door"})]}),(0,te.jsxs)("div",{className:"architrave-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,te.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,te.jsx)("div",{className:"architrave-calculator__profiles",children:ew.map(S=>(0,te.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b===S.id?" is-selected":""}`,onClick:()=>m(S.id),children:[(0,te.jsx)(m_,{profile:S.id}),(0,te.jsx)("div",{className:"truss-estimator__option-title",children:S.label}),(0,te.jsx)("div",{className:"truss-estimator__option-copy",children:S.blurb})]},S.id))})]}),(0,te.jsxs)("div",{className:"architrave-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,te.jsx)("div",{className:"architrave-calculator__options",children:(0,te.jsxs)("label",{className:"truss-estimator__field",children:[(0,te.jsx)("span",{children:"Board length (m)"}),(0,te.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,te.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,te.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,te.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Architrave needed"}),(0,te.jsxs)("strong",{children:[R.toFixed(2)," m"]})]}),(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Board lengths"}),(0,te.jsx)("strong",{children:d})]})]})]}),(0,te.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,te.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,te.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:R<=0,children:a})]})]})]})})}var ki=Y(Ye()),ue=Y(ae()),aw=60,rw=10,f_=.02,g_=.012,h_=.01,Mn=e=>Number.parseFloat(e)||0,b_=(e,t=2)=>e.toFixed(t);function hd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,ki.useState)("brick"),[i,o]=(0,ki.useState)("engineering-red"),[l,u]=(0,ki.useState)("metric"),[p,f]=(0,ki.useState)(""),[b,m]=(0,ki.useState)(""),[h,w]=(0,ki.useState)(!0),E=l==="metric"?Mn(p)*Mn(b):Mn(p)*Mn(b)*.092903,d=E*(r==="brick"?aw:rw),c=Math.ceil(d),g=E*(r==="brick"?f_:g_),v=Math.ceil(g/h_),S=l==="metric"?E:E*10.7639,M=[{key:r==="brick"?`brick-${i}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[i]:"Blocks",qty:c,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=U=>{if(U===l)return;let j=U==="imperial"?3.28084:.3048;f((Mn(p)*j).toFixed(2)),m((Mn(b)*j).toFixed(2)),u(U)};return(0,ue.jsx)(ue.Fragment,{children:(0,ue.jsxs)("div",{className:"truss-estimator",children:[(0,ue.jsxs)("div",{className:"quick-order-hero",children:[(0,ue.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ue.jsx)("h1",{children:"Brick & Block Calculator"}),(0,ue.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,ue.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,ue.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,ue.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,ue.jsxs)("div",{className:"brick-calculator__section",children:[(0,ue.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,ue.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([U,j])=>(0,ue.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===U?" is-selected":""}`,onClick:()=>n(U),children:[(0,ue.jsx)("div",{className:"truss-estimator__option-title",children:j}),(0,ue.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",U==="brick"?aw:rw," per m\xB2"]})]},U))})]}),r==="brick"&&(0,ue.jsxs)("div",{className:"brick-calculator__section",children:[(0,ue.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,ue.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(([U,j,F])=>(0,ue.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i===U?" is-selected":""}`,onClick:()=>o(U),children:[(0,ue.jsx)("div",{className:"truss-estimator__option-title",children:j}),(0,ue.jsx)("div",{className:"truss-estimator__option-copy",children:F})]},U))})]}),(0,ue.jsxs)("div",{className:"brick-calculator__section",children:[(0,ue.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,ue.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,ue.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>T("metric"),children:"Metric"}),(0,ue.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>T("imperial"),children:"Imperial"})]}),(0,ue.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ue.jsxs)("label",{className:"truss-estimator__field",children:[(0,ue.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,ue.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:U=>f(U.target.value)})]}),(0,ue.jsxs)("label",{className:"truss-estimator__field",children:[(0,ue.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,ue.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:U=>m(U.target.value)})]})]})]}),(0,ue.jsx)("div",{className:"brick-calculator__options",children:(0,ue.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,ue.jsx)("input",{type:"checkbox",checked:h,onChange:U=>w(U.target.checked)}),(0,ue.jsx)("span",{children:"Include ready-mixed mortar"})]})}),(0,ue.jsxs)("div",{className:"brick-calculator__totals",children:[(0,ue.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ue.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,ue.jsxs)("div",{children:[(0,ue.jsx)("span",{children:"Wall area"}),(0,ue.jsxs)("strong",{children:[b_(S)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,ue.jsxs)("div",{children:[(0,ue.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,ue.jsx)("strong",{children:c.toLocaleString("en-GB")})]}),h?(0,ue.jsxs)("div",{children:[(0,ue.jsx)("span",{children:"Ready-mixed mortar"}),(0,ue.jsxs)("strong",{children:[v," x 20kg bags"]})]}):null]}),(0,ue.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,ue.jsxs)("div",{className:"brick-calculator__actions",children:[(0,ue.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ue.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(M),disabled:E<=0,children:a})]})]})]})})}var mr=Y(Ye());var iw=new Map;function v_(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 Jr(e,t,a=12,r){let n=`${e}||${t??""}||${a}||${r??""}`,i=iw.get(n);if(i)return i;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(Ot(`/api/catalogue/search?${o.toString()}`),{headers:vi()}),u=await Zt(l);if(!l.ok)throw new Error(u?.error||u?.message||"Could not reach the product catalogue");let p=Array.isArray(u?.items)?u.items.map(v_):[];return iw.set(n,p),p}async function nw(e,t){return await Promise.all(e.map(async r=>{try{return{requirement:r,candidates:await Jr(r.query,r.category,void 0,t)}}catch{return{requirement:r,candidates:[]}}}))}async function ow(){let e=await fetch(Ot("/api/catalogue"),{headers:vi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Zt(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var $=Y(ae()),w_=1.54,y_=1440,__=25,bd=800,x_=1500,vd=e=>Number.parseFloat(e)||0,Tn={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 wd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let r=Zs(),[n,i]=(0,mr.useState)("m"),[o,l]=(0,mr.useState)(""),[u,p]=(0,mr.useState)(""),[f,b]=(0,mr.useState)(""),[m,h]=(0,mr.useState)("concrete"),[w,E]=(0,mr.useState)("mot"),[R,d]=(0,mr.useState)(!1),[c,g]=(0,mr.useState)(null),v=n==="m"?1:.3048,S=vd(o)*v*vd(u)*v*vd(f)*(n==="m"?.01:.0254),M=Tn[w],T=S*w_/7,U=T*y_,j=T*2,F=T*4,we=Math.ceil(U/__),Ee=Math.ceil(j*Tn["sharp-sand"].density*1e3/bd),De=Math.ceil(F*Tn.gravel.density*1e3/bd),at=Math.ceil(S*M.density*1e3/bd),Ce=m==="concrete"?[{key:"cement",label:"Blue Circle General Purpose Grey Cement 25kg",qty:we,productId:"6003004"},{key:"sharp-sand",label:"Sharp Sand Bulk Bag (800kg)",qty:Ee,productId:"6001012"},{key:"gravel",label:"20mm Non Decorative Pea Shingle/Gravel Bulk Bag (800kg)",qty:De,productId:"6001004"}]:[{key:w,label:`${M.label} Bulk Bag (800kg)`,qty:at,productId:M.productId}],X=()=>{if(t){t(Ce.map(ne=>({key:ne.key,label:ne.label,qty:ne.qty,unit:"each",query:ne.productId})));return}ie()},ie=async()=>{let ne=Date.now();d(!0),g(null);try{let I=await Promise.all(Ce.map(async de=>{let be=(await Jr(de.productId)).find(qe=>qe.product_id===de.productId);if(!be)throw new Error(`${de.label} is no longer available in this catalogue.`);return Zr(be,{lineId:`concrete-aggregate:${de.key}`,description:de.label,unit:"bag",qty:de.qty})})),Me=x_-(Date.now()-ne);Me>0&&await new Promise(de=>window.setTimeout(de,Me)),r?.clearCart(),r?.addManyToCart(I),r?.openBasket()}catch(I){g(I instanceof Error?I.message:"Could not add the products to your basket.")}finally{d(!1)}};return R?(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 Materials"}),(0,$.jsx)("p",{children:"Calculating quantities from the Concrete & Aggregate Calculator."})]}),(0,$.jsx)("div",{className:"truss-estimator__card",children:(0,$.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,$.jsx)(pr,{}),(0,$.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})}):(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:"Concrete & Aggregate Calculator"}),(0,$.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,$.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,$.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,$.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,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,$.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${m==="concrete"?" is-selected":""}`,onClick:()=>h("concrete"),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${m==="aggregate"?" is-selected":""}`,onClick:()=>h("aggregate"),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),m==="aggregate"&&(0,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,$.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Tn).map(ne=>(0,$.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===ne?" is-selected":""}`,onClick:()=>E(ne),children:[(0,$.jsx)("div",{className:"truss-estimator__option-title",children:Tn[ne].label}),(0,$.jsx)("div",{className:"truss-estimator__option-copy",children:Tn[ne].blurb})]},ne))})]}),(0,$.jsxs)("div",{className:"materials-calculator__section",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,$.jsxs)("div",{className:"materials-calculator__unit-row",children:[(0,$.jsx)("span",{children:"Units"}),(0,$.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,$.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metric"}),(0,$.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Imperial"})]})]}),(0,$.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsxs)("span",{children:["Length (",n,")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.01",value:o,onChange:ne=>l(ne.target.value)})]}),(0,$.jsxs)("label",{className:"truss-estimator__field",children:[(0,$.jsxs)("span",{children:["Width (",n,")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.01",value:u,onChange:ne=>p(ne.target.value)})]})]}),(0,$.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,$.jsxs)("span",{children:["Depth (",n==="m"?"cm":"inches",")"]}),(0,$.jsx)("input",{type:"number",min:"0",step:"0.1",value:f,onChange:ne=>b(ne.target.value)})]})]}),(0,$.jsxs)("div",{className:"materials-calculator__totals",children:[(0,$.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,$.jsx)("div",{className:"materials-calculator__result-grid",children:m==="concrete"?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Cement"}),(0,$.jsxs)("strong",{children:[U.toFixed(0)," kg"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Sharp sand"}),(0,$.jsxs)("strong",{children:[j.toFixed(2)," m\xB3"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"20mm aggregate"}),(0,$.jsxs)("strong",{children:[F.toFixed(2)," m\xB3"]})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:M.label}),(0,$.jsxs)("strong",{children:[S.toFixed(2)," m\xB3"]})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:"Approx. weight"}),(0,$.jsxs)("strong",{children:[(S*M.density).toFixed(2)," t"]})]}),(0,$.jsx)("div",{})]})}),(0,$.jsx)("p",{className:"materials-calculator__note",children:m==="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."})]}),c&&(0,$.jsx)("p",{className:"results-empty-hint estimator-products__error",children:c}),(0,$.jsxs)("div",{className:"materials-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",onClick:X,disabled:S<=0||R,children:R?"Adding products\u2026":a})]})]})]})})}var Ya=Y(Ye());var A=Y(ae()),zn=12,An=8,Ps=.56,lw=.21,Na={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"],k_={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:""}},Fs=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),Is=(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),N_=(e,t,a,r)=>{let n=Fs(e,t,a),i=Fs(e,t,r),o=Fs(a,r,e),l=Fs(a,r,t);return n===0&&Is(e,t,a)||i===0&&Is(e,t,r)||o===0&&Is(a,r,e)||l===0&&Is(a,r,t)?!0:n>0!=i>0&&o>0!=l>0},yd=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1){let n=e[(r+1)%e.length];for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&N_(e[r],n,e[i],e[(i+1)%e.length]))return!0}return!1};function _d({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Ya.useState)(0),[i,o]=(0,Ya.useState)(k_),[l,u]=(0,Ya.useState)(1),[p,f]=(0,Ya.useState)({x:0,y:0}),[b,m]=(0,Ya.useState)(null),h=(0,Ya.useRef)(null),w=(0,Ya.useRef)(null),E=(0,Ya.useRef)(null),R=Ni[r],d=i.range?Na.ranges[i.range]:null,c=zn/l,g=An/l,v=(zn-c)/2,S=(An-g)/2,M=Math.max(-zn,Math.min(zn*2-c,v+p.x)),T=Math.max(-An,Math.min(An*2-g,S+p.y)),U=Number.parseFloat(i.quickLengthM),j=Number.parseFloat(i.quickWidthM),F=U>0&&j>0,we=y=>Math.abs(y.reduce((z,W,se)=>{let pe=y[(se+1)%y.length];return z+W.x*pe.y-pe.x*W.y},0))/2,Ee=(y,z)=>Math.hypot(z.x-y.x,z.y-y.y),De=i.isOutlineClosed?we(i.points):0,at=i.isOutlineClosed?i.points.reduce((y,z,W)=>y+Ee(z,i.points[(W+1)%i.points.length]),0):0,Ce=i.isOutlineClosed?i.points.reduce((y,z,W)=>y+(i.wallSegments.has(W)?0:Ee(z,i.points[(W+1)%i.points.length])),0):0,X=i.points.reduce((y,z)=>({x:y.x+z.x/i.points.length,y:y.y+z.y/i.points.length}),{x:0,y:0}),ie=i.points.length>1?(()=>{let y=i.points[0],z=i.points[1],W=Ee(y,z),se=W?-(z.y-y.y)/W:0,pe=W?(z.x-y.x)/W:0,Pe=(y.x+z.x)/2,xt=(y.y+z.y)/2,k=se*(Pe-X.x)+pe*(xt-X.y)>=0?1:-1;return{x:Pe+se*Ps*k,y:xt+pe*Ps*k}})():null,I=(()=>{let y=i.range?Na.ranges[i.range]:Na.ranges.meridian,z=i.deckSizeMode==="quick"?U*j:De,W=i.deckSizeMode==="quick"?2*(U+j):Ce,se=i.direction==="diagonal"?Na.wastage.diagonal:Na.wastage.straight,pe=i.pictureFrame==="yes"?Na.pictureFrame.extraWastage:0,xt=z/(y.boardWidthM+Na.boardGapM)/y.boardLengthM,k=Math.ceil(xt*(1+se+pe)),H=Math.ceil(z*30*(1+se+pe)/200),B=Na.joist.spacingOptions.find(C=>C.id===i.joistSpacing)??Na.joist.spacingOptions[1],oe=z/B.spacingM,ee=Math.ceil(oe/Na.joist.lengthM);return{range:y,area:z,boardCount:k,screwBoxes:H,joistLengthsNeeded:ee,spacing:B}})(),Me=I?[{key:`boards-${i.range??"meridian"}`,label:`Deck boards (${I.range.label})`,qty:I.boardCount,unit:"each",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:I.joistLengthsNeeded,unit:"each",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:I.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],de=()=>R==="range"?!!i.range:R==="grid"?i.deckSizeMode==="quick"?F:i.isOutlineClosed&&De>0:R==="pictureFrame"?!!i.pictureFrame&&!!i.direction:R==="substructure"?!!i.joistSpacing:!0,be=r===Ni.length-1?a:"Next",qe=(y,z,W=!1)=>{let se=E.current?.getBoundingClientRect();if(!se)return null;let pe=W?1:.25;return{x:Math.round(Math.max(M,Math.min(M+c,M+(y-se.left)/se.width*c))/pe)*pe,y:Math.round(Math.max(T,Math.min(T+g,T+(z-se.top)/se.height*g))/pe)*pe}},dt=y=>{if(i.isOutlineClosed){let W=y.target;if(W!==y.currentTarget&&!W.classList.contains("deck-outline__grid"))return;w.current={startX:y.clientX,startY:y.clientY,startViewX:M,startViewY:T},y.currentTarget.setPointerCapture(y.pointerId);return}if(i.drawMode!=="outline")return;let z=qe(y.clientX,y.clientY,!0);z&&(m(null),o(W=>{let se=[...W.points,z];return yd(se,!1)?{...W,drawError:"Edges cannot cross. Choose another corner."}:{...W,points:se,drawError:""}}))},Rt=(y,z)=>{if(!i.isOutlineClosed){y.stopPropagation(),z===0&&i.points.length>=3&&o(W=>({...W,isOutlineClosed:!0,drawMode:"edges"}));return}y.stopPropagation(),h.current=z,y.currentTarget.setPointerCapture(y.pointerId)},mt=y=>{if(w.current){let se=E.current?.getBoundingClientRect();if(!se)return;let pe=w.current,Pe=pe.startViewX-(y.clientX-pe.startX)/se.width*c,xt=pe.startViewY-(y.clientY-pe.startY)/se.height*g;f({x:Pe-v,y:xt-S});return}!i.isOutlineClosed&&i.drawMode==="outline"&&m(qe(y.clientX,y.clientY,!0));let z=h.current;if(z===null)return;let W=qe(y.clientX,y.clientY);W&&o(se=>{let pe=se.points.map((Pe,xt)=>xt===z?W:Pe);return yd(pe,!0)?{...se,drawError:"Edges cannot cross. Move the corner to a different position."}:{...se,points:pe,drawError:""}})},ft=y=>{w.current=null,h.current=null,y.currentTarget.hasPointerCapture(y.pointerId)&&y.currentTarget.releasePointerCapture(y.pointerId)},nt=y=>{o(z=>{let W=new Set(z.wallSegments);return W.has(y)?W.delete(y):W.add(y),{...z,wallSegments:W}})},gt=()=>{r===0?e():n(y=>y-1)},G=()=>{de()&&(r===Ni.length-1?t?.(Me):n(y=>y+1))};return(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)("div",{className:"truss-estimator",children:[(0,A.jsxs)("div",{className:"quick-order-hero",children:[(0,A.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,A.jsx)("h1",{children:"Decking Calculator"}),(0,A.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,A.jsxs)("div",{className:"truss-estimator__card",children:[(0,A.jsxs)("div",{className:"truss-estimator__body",children:[R==="range"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,A.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,A.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.ranges).map(([y,z])=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.range===y?" is-selected":""}`,onClick:()=>o(W=>({...W,range:y})),children:[(0,A.jsx)("div",{className:"truss-estimator__option-title",children:z.label}),(0,A.jsx)("div",{className:"truss-estimator__option-copy",children:z.blurb}),(0,A.jsxs)("div",{className:"truss-estimator__option-copy",children:[z.boardLengthM,"m boards"]})]},y))})]}):null,R==="grid"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,A.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,A.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,A.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(y=>({...y,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,A.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(y=>({...y,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),i.deckSizeMode==="quick"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,A.jsxs)("label",{className:"truss-estimator__field",children:[(0,A.jsx)("span",{children:"Length (m)"}),(0,A.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:i.quickLengthM,onChange:y=>o(z=>({...z,quickLengthM:y.target.value}))})]}),(0,A.jsxs)("label",{className:"truss-estimator__field",children:[(0,A.jsx)("span",{children:"Width (m)"}),(0,A.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:i.quickWidthM,onChange:y=>o(z=>({...z,quickWidthM:y.target.value}))})]})]}),(0,A.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),F?(0,A.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,A.jsxs)("div",{children:[(U*j).toFixed(2)," m\xB2 deck"]}),(0,A.jsxs)("div",{children:[(2*(U+j)).toFixed(2)," m perimeter"]})]}):null]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,A.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,A.jsxs)("div",{className:"deck-outline__toolbar",children:[i.isOutlineClosed?(0,A.jsxs)("div",{className:"deck-outline__summary",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Deck area"}),(0,A.jsxs)("strong",{children:[De.toFixed(2)," m\xB2"]})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Perimeter"}),(0,A.jsxs)("strong",{children:[at.toFixed(2)," m"]})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Wall edges"}),(0,A.jsx)("strong",{children:i.wallSegments.size>0?i.wallSegments.size:"None"})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{children:"Visible edge"}),(0,A.jsxs)("strong",{children:[Ce.toFixed(2)," m"]})]})]}):null,(0,A.jsxs)("div",{className:"deck-outline__actions",children:[(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,points:y.points.slice(0,-1)})),disabled:i.points.length===0||i.isOutlineClosed,children:"Undo"}),(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{m(null),o(y=>({...y,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:i.points.length===0,children:"Clear"}),(0,A.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(y=>({...y,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,A.jsx)("div",{className:"deck-editor-layout",children:(0,A.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,A.jsxs)("div",{className:"deck-outline",children:[(0,A.jsxs)("svg",{ref:E,className:`deck-outline__canvas${i.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${M} ${T} ${c} ${g}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:dt,onPointerMove:mt,onPointerUp:ft,onPointerLeave:()=>{m(null),w.current||(h.current=null)},children:[(0,A.jsx)("defs",{children:(0,A.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,A.jsx)("rect",{x:-zn,y:-An,width:zn*3,height:An*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),i.points.length>1?(0,A.jsx)("polyline",{className:"deck-outline__preview",points:i.points.map(y=>`${y.x},${y.y}`).join(" ")}):null,i.isOutlineClosed?(0,A.jsx)("polygon",{className:"deck-outline__shape",points:i.points.map(y=>`${y.x},${y.y}`).join(" "),stroke:"none"}):null,i.points.length>1?i.points.slice(0,i.isOutlineClosed?void 0:-1).map((y,z)=>{let W=i.points[i.isOutlineClosed?(z+1)%i.points.length:z+1],se=Ee(y,W),pe=se?-(W.y-y.y)/se:0,Pe=se?(W.x-y.x)/se:0,xt=(y.x+W.x)/2,k=(y.y+W.y)/2,H=pe*(xt-X.x)+Pe*(k-X.y)>=0?1:-1,B=xt+pe*Ps*H,oe=k+Pe*Ps*H;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{className:"deck-outline__edge-hit",x1:y.x,y1:y.y,x2:W.x,y2:W.y,onClick:i.isOutlineClosed?()=>nt(z):void 0}),(0,A.jsx)("line",{className:`deck-outline__edge${i.wallSegments.has(z)?" is-wall":""}`,x1:y.x,y1:y.y,x2:W.x,y2:W.y,pointerEvents:"none"}),(0,A.jsxs)("text",{className:`deck-outline__edge-label${i.wallSegments.has(z)?" is-wall":""}`,x:B,y:oe,textAnchor:"middle",dominantBaseline:"central",fontSize:lw/l,children:[se.toFixed(2)," m"]})]},`segment-${z}`)}):null,!i.isOutlineClosed&&i.points.length>0&&b?(()=>{let y=i.points[i.points.length-1],z=Ee(y,b);if(!z)return null;let W=-(b.y-y.y)/z,se=(b.x-y.x)/z,pe=(y.x+b.x)/2,Pe=(y.y+b.y)/2;return(0,A.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,A.jsx)("line",{x1:y.x,y1:y.y,x2:b.x,y2:b.y}),(0,A.jsxs)("text",{x:pe+W*.34,y:Pe+se*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:lw/l,children:[z.toFixed(2)," m"]})]})})():null,i.points.map((y,z)=>(0,A.jsx)("circle",{className:"deck-outline__point",cx:y.x,cy:y.y,r:"0.13",onPointerDown:W=>Rt(W,z)},`point-${z}`))]}),(0,A.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,A.jsx)("button",{type:"button",onClick:()=>u(y=>Math.max(.5,y-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,A.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,A.jsx)("button",{type:"button",onClick:()=>u(y=>Math.min(1,y+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),i.isOutlineClosed&&i.wallSegments.size===0&&ie?(0,A.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(ie.x-M)/c*100}%`,top:`${(ie.y-T)/g*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!i.isOutlineClosed&&i.points.length>=3?(0,A.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(y=>yd(y.points,!0)?{...y,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...y,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,A.jsxs)("div",{className:"deck-outline__supporting",children:[(0,A.jsx)("div",{className:"truss-estimator__grid-hint",children:i.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),i.drawError?(0,A.jsx)("div",{className:"deck-outline__error",role:"alert",children:i.drawError}):null]})]})})]})]}):null,R==="pictureFrame"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,A.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,A.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(y=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.pictureFrame===y.id?" is-selected":""}`,onClick:()=>o(z=>({...z,pictureFrame:y.id})),children:[(0,A.jsx)("img",{className:"truss-estimator__visual-card-img",src:Kt(y.img),alt:""}),(0,A.jsx)("span",{children:y.label})]},y.id))}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,A.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(y=>(0,A.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.direction===y.id?" is-selected":""}`,onClick:()=>o(z=>({...z,direction:y.id})),children:[(0,A.jsx)("img",{className:"truss-estimator__visual-card-img",src:Kt(y.img),alt:""}),(0,A.jsx)("span",{children:y.label})]},y.id))})]})]}):null,R==="substructure"?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Ni.length]}),(0,A.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,A.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,A.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,A.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Na.joist.spacingOptions.map(y=>(0,A.jsx)("button",{type:"button",className:`truss-estimator__option-card${i.joistSpacing===y.id?" is-selected":""}`,onClick:()=>o(z=>({...z,joistSpacing:y.id})),children:(0,A.jsx)("div",{className:"truss-estimator__option-title",children:y.label})},y.id))})]}):null]}),(0,A.jsxs)("div",{className:"truss-estimator__nav",children:[(0,A.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:gt,children:"Back"}),(0,A.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:G,disabled:!de(),children:[(0,A.jsx)("span",{children:be}),(0,A.jsx)("span",{className:"arrow",children:(0,A.jsx)(Lt,{})})]})]})]})]})})}var Ca=Y(Ye());var L=Y(ae()),sw=12,cw=30,Rn=12,Un=8,uw=.56,Sa={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"],S_={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:""}},Ws=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),ec=(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),C_=(e,t,a,r)=>{let n=Ws(e,t,a),i=Ws(e,t,r),o=Ws(a,r,e),l=Ws(a,r,t);return n===0&&ec(e,t,a)||i===0&&ec(e,t,r)||o===0&&ec(a,r,e)||l===0&&ec(a,r,t)?!0:n>0!=i>0&&o>0!=l>0},tc=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&C_(e[r],e[(r+1)%e.length],e[n],e[(n+1)%e.length]))return!0;return!1};function xd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Ca.useState)(0),[i,o]=(0,Ca.useState)(S_),l=(0,Ca.useRef)(null),u=(0,Ca.useRef)(null),[p,f]=(0,Ca.useState)(1),[b,m]=(0,Ca.useState)({x:0,y:0}),[h,w]=(0,Ca.useState)(null),E=(0,Ca.useRef)(null),R=(0,Ca.useRef)(null),d=(0,Ca.useRef)(null),c=Si[r],g=i.range?Sa.ranges[i.range]:null,v=Rn/p,S=Un/p,M=(Rn-v)/2,T=(Un-S)/2,U=Math.max(-Rn,Math.min(Rn*2-v,M+b.x)),j=Math.max(-Un,Math.min(Un*2-S,T+b.y)),F=i.boundaryPoints.reduce((k,H)=>({x:k.x+H.x/Math.max(1,i.boundaryPoints.length),y:k.y+H.y/Math.max(1,i.boundaryPoints.length)}),{x:0,y:0}),we=k=>{let H=new Set,B=[];return k.forEach(oe=>{let[ee,C]=oe.split(",").map(Number),Q=[{key:`H,${ee},${C}`,type:"H",x:ee,y:C},{key:`H,${ee},${C+1}`,type:"H",x:ee,y:C+1},{key:`V,${ee},${C}`,type:"V",x:ee,y:C},{key:`V,${ee+1},${C}`,type:"V",x:ee+1,y:C}],Z=[!k.has(`${ee},${C-1}`),!k.has(`${ee},${C+1}`),!k.has(`${ee-1},${C}`),!k.has(`${ee+1},${C}`)];Q.forEach((fe,_e)=>{Z[_e]&&!H.has(fe.key)&&(H.add(fe.key),B.push(fe))})}),B},Ee=(k,H)=>we(k).filter(B=>!H.has(B.key)),De=(k,H)=>Ee(k,H).length,at=(k,H)=>{let B={};Ee(k,H).forEach(ee=>{var C,Q,Z,fe;ee.type==="H"?((B[C=`${ee.x},${ee.y}`]||(B[C]=[])).push("H"),(B[Q=`${ee.x+1},${ee.y}`]||(B[Q]=[])).push("H")):((B[Z=`${ee.x},${ee.y}`]||(B[Z]=[])).push("V"),(B[fe=`${ee.x},${ee.y+1}`]||(B[fe]=[])).push("V"))});let oe=0;return Object.values(B).forEach(ee=>{(ee.length===1||ee.length===2&&ee[0]!==ee[1]||ee.length>=3)&&(oe+=1)}),oe},X=(()=>{let k=i.range?Sa.ranges[i.range]:Sa.ranges.boundary,H=i.height??"1.8",B=i.boundaryMode==="quick"?Math.max(0,Number.parseFloat(i.quickLengthM)||0):i.boundaryClosed?i.boundaryPoints.slice(0,-1).reduce((Pt,gr,Xa)=>Pt+(i.excludedBoundaryEdges.has(Xa)?0:Math.hypot(i.boundaryPoints[Xa+1].x-gr.x,i.boundaryPoints[Xa+1].y-gr.y)),0):0,oe=i.gateType&&i.gateType!=="none"?Number.parseFloat(i.gateWidthM)||Sa.gate[i.gateType].widthDefault:0,ee=Math.max(0,B-oe),C=ee>0?Math.ceil(ee/k.panelWidthM):0,Q=i.boundaryPoints.length>2&&i.boundaryPoints[0].x===i.boundaryPoints[i.boundaryPoints.length-1].x&&i.boundaryPoints[0].y===i.boundaryPoints[i.boundaryPoints.length-1].y,Z=i.boundaryMode==="quick"?ee>0?2:0:i.boundaryClosed?i.boundaryPoints.slice(0,Q?-1:void 0).reduce((Pt,gr,Xa)=>{let Hd=Xa>0&&!i.excludedBoundaryEdges.has(Xa-1),Ln=Xa<i.boundaryPoints.length-1&&!i.excludedBoundaryEdges.has(Xa);return Pt+(Hd||Ln?1:0)},0):0,fe=ee>0?Math.ceil(ee/k.panelWidthM)+1:0,_e=Math.max(0,fe-Z),$e=i.mountingType?Sa.mounting[i.mountingType]:Sa.mounting.concrete,vt=i.gateType&&i.gateType!=="none"?2:0,ca=_e+Z+vt,nl=i.mountingType==="postcrete"?ca*Sa.mounting.postcrete.bagsPerPost:0,ua=i.gravelBoard==="yes"?C:0;return{range:k,height:H,totalEdgeM:B,fencedLengthM:ee,gateWidthM:oe,panelsCount:C,cornerPostCount:Z,intermediatePostCount:_e,gatePostCount:vt,totalPostCount:ca,bagsCount:nl,gravelCount:ua,capCount:ca,mounting:$e}})(),ie=i.gateType&&i.gateType!=="none"?Sa.gate[i.gateType].label:null,ne=Number(X.height)<=1.2?"6":"8",I=X?[{key:`panels-${i.range??"boundary"}-${X.height}`,label:`${X.range.label} panels (${X.height}m)`,qty:X.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...i.mountingType==="concrete"?[{key:`concrete-intermediate-${ne}`,label:"Intermediate concrete posts",qty:X.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${ne}`,label:"End and corner concrete posts",qty:X.cornerPostCount+X.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${ne}`,label:"Timber fence posts",qty:X.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:X.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...ie?[{key:"gate",label:ie,qty:1,unit:"each",query:"lap gate",category:"fencing"}]:[],...X.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:X.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],Me=()=>{if(c==="range"){let k=i.boundaryMode==="quick"?(Number.parseFloat(i.quickLengthM)||0)>0:i.boundaryClosed&&i.boundaryPoints.length>=2;return!!i.range&&k}return c==="height"?!!i.height&&!!i.gravelBoard:c==="gate"?!!i.gateType&&(i.gateType==="none"||i.gateWidthM.trim()!==""):c==="posts"?!!i.mountingType:!0},de=r===Si.length-1?a:"Next",be=k=>{o(H=>{let B=k(new Set(H.grid)),oe=new Set([...H.excludedEdges].filter(ee=>we(B).some(C=>C.key===ee)));return{...H,grid:B,excludedEdges:oe}})},qe=(k,H,B)=>{be(oe=>{let ee=`${k},${H}`;return B?oe.add(ee):oe.delete(ee),oe})},dt=(k,H,B,oe,ee)=>{let C=k,Q=H,Z=Math.abs(B-k),fe=k<B?1:-1,_e=-Math.abs(oe-H),$e=H<oe?1:-1,vt=Z+_e;for(;qe(C,Q,ee),!(C===B&&Q===oe);){let ca=2*vt;ca>=_e&&(vt+=_e,C+=fe),ca<=Z&&(vt+=Z,Q+=$e)}},Rt=(k,H)=>{let B=u.current?.getBoundingClientRect();if(!B)return null;let oe=Math.floor((k-B.left)/cw),ee=Math.floor((H-B.top)/cw);return oe<0||ee<0||oe>=sw||ee>=sw?null:{x:oe,y:ee}},mt=k=>{if(i.gridMode!=="draw")return;let H=Rt(k.clientX,k.clientY);if(!H)return;k.preventDefault();let B=`${H.x},${H.y}`,oe=!i.grid.has(B);l.current={active:!0,paintValue:oe,lastX:H.x,lastY:H.y},k.currentTarget.setPointerCapture(k.pointerId),qe(H.x,H.y,oe)},ft=k=>{let H=l.current;if(!H?.active)return;let B=Rt(k.clientX,k.clientY);B&&(B.x===H.lastX&&B.y===H.lastY||(dt(H.lastX,H.lastY,B.x,B.y,H.paintValue),l.current={...H,lastX:B.x,lastY:B.y}))},nt=k=>{l.current?.active&&(l.current=null,k.currentTarget.releasePointerCapture(k.pointerId))},gt=(k,H,B=!1)=>{let oe=d.current?.getBoundingClientRect();if(!oe)return null;let ee=B?1:.25;return{x:Math.round(Math.max(U,Math.min(U+v,U+(k-oe.left)/oe.width*v))/ee)*ee,y:Math.round(Math.max(j,Math.min(j+S,j+(H-oe.top)/oe.height*S))/ee)*ee}},G=k=>{if(i.boundaryClosed){let B=k.target;if(B!==k.currentTarget&&!B.classList.contains("fence-boundary__grid"))return;R.current={startX:k.clientX,startY:k.clientY,startViewX:U,startViewY:j},k.currentTarget.setPointerCapture(k.pointerId);return}let H=gt(k.clientX,k.clientY,!0);H&&(w(null),o(B=>{let oe=[...B.boundaryPoints,H];return tc(oe,!1)?{...B}:{...B,boundaryPoints:oe}}))},y=(k,H)=>{if(k.stopPropagation(),!i.boundaryClosed){if(H!==0||i.boundaryPoints.length<3)return;o(B=>tc(B.boundaryPoints,!0)?B:{...B,boundaryPoints:[...B.boundaryPoints,B.boundaryPoints[0]],boundaryClosed:!0});return}E.current=H,k.currentTarget.setPointerCapture(k.pointerId)},z=k=>{if(R.current){let B=d.current?.getBoundingClientRect();if(!B)return;let oe=R.current,ee=oe.startViewX-(k.clientX-oe.startX)/B.width*v,C=oe.startViewY-(k.clientY-oe.startY)/B.height*S;m({x:ee-M,y:C-T});return}if(i.boundaryClosed||w(gt(k.clientX,k.clientY,!0)),E.current===null)return;let H=gt(k.clientX,k.clientY);H&&o(B=>{let oe=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,ee=B.boundaryPoints.map((C,Q)=>{let Z=Q===E.current,fe=oe&&E.current===0&&Q===B.boundaryPoints.length-1;return Z||fe?H:C});return tc(ee,!1)?B:{...B,boundaryPoints:ee}})},W=k=>{R.current=null,E.current=null,k.currentTarget.hasPointerCapture(k.pointerId)&&k.currentTarget.releasePointerCapture(k.pointerId)},se=k=>{o(H=>{let B=new Set(H.excludedBoundaryEdges);return B.has(k)?B.delete(k):B.add(k),{...H,excludedBoundaryEdges:B}})},pe=()=>{r===0?e():n(k=>k-1)},Pe=()=>{Me()&&(r===Si.length-1?t?.(I):n(k=>k+1))},xt=we(i.grid);return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{className:"truss-estimator",children:[(0,L.jsxs)("div",{className:"quick-order-hero",children:[(0,L.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,L.jsx)("h1",{children:"Fencing Calculator"}),(0,L.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,L.jsxs)("div",{className:"truss-estimator__card",children:[(0,L.jsxs)("div",{className:"truss-estimator__body",children:[c==="range"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Sa.ranges).map(([k,H])=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.range===k?" is-selected":""}`,onClick:()=>o(B=>({...B,range:k})),children:[(0,L.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,L.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb})]},k))})]}):null,c==="range"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,L.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,L.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,L.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(k=>({...k,boundaryMode:"quick"})),children:"Quick estimate"}),(0,L.jsx)("button",{type:"button",className:`truss-estimator__toggle${i.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(k=>({...k,boundaryMode:"draw"})),children:"Draw your boundary"})]}),i.boundaryMode==="quick"?(0,L.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,L.jsx)("span",{children:"Total fence length (m)"}),(0,L.jsx)("input",{type:"number",min:"0",step:"0.1",value:i.quickLengthM,onChange:k=>o(H=>({...H,quickLengthM:k.target.value}))})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"fence-boundary__toolbar",children:(0,L.jsxs)("div",{className:"fence-boundary__actions",children:[(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,boundaryPoints:k.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:i.boundaryPoints.length===0||i.boundaryClosed,children:"Undo"}),(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{m({x:0,y:0}),w(null),o(k=>({...k,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:i.boundaryPoints.length===0,children:"Clear"}),(0,L.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(k=>({...k,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,L.jsxs)("div",{className:"fence-boundary",children:[(0,L.jsxs)("svg",{ref:d,className:`fence-boundary__canvas${i.boundaryClosed?" is-pan-mode":""}`,viewBox:`${U} ${j} ${v} ${S}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:G,onPointerMove:z,onPointerUp:W,onPointerLeave:()=>{w(null),R.current||(E.current=null)},children:[(0,L.jsx)("defs",{children:(0,L.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,L.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,L.jsx)("rect",{x:-Rn,y:-Un,width:Rn*3,height:Un*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),i.boundaryPoints.length>1?(0,L.jsx)("polyline",{className:"fence-boundary__preview",points:i.boundaryPoints.map(k=>`${k.x},${k.y}`).join(" ")}):null,i.boundaryPoints.length>1?i.boundaryPoints.slice(0,-1).map((k,H)=>{let B=i.boundaryPoints[H+1],oe=Math.hypot(B.x-k.x,B.y-k.y),ee=oe?-(B.y-k.y)/oe:0,C=oe?(B.x-k.x)/oe:0,Q=(k.x+B.x)/2,Z=(k.y+B.y)/2,fe=ee*(Q-F.x)+C*(Z-F.y)>=0?1:-1,_e=Q+ee*uw*fe,$e=Z+C*uw*fe;return(0,L.jsxs)("g",{children:[(0,L.jsx)("line",{className:"fence-boundary__edge-hit",x1:k.x,y1:k.y,x2:B.x,y2:B.y,onClick:i.boundaryClosed?()=>se(H):void 0}),(0,L.jsx)("line",{className:`fence-boundary__edge${i.excludedBoundaryEdges.has(H)?" is-excluded":""}`,x1:k.x,y1:k.y,x2:B.x,y2:B.y,pointerEvents:"none"}),(0,L.jsxs)("text",{className:`fence-boundary__edge-label${i.excludedBoundaryEdges.has(H)?" is-excluded":""}`,x:_e,y:$e,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[oe.toFixed(2)," m"]})]},`fence-edge-${H}`)}):null,!i.boundaryClosed&&i.boundaryPoints.length>0&&h?(()=>{let k=i.boundaryPoints[i.boundaryPoints.length-1],H=Math.hypot(h.x-k.x,h.y-k.y);if(!H)return null;let B=-(h.y-k.y)/H,oe=(h.x-k.x)/H,ee=(k.x+h.x)/2,C=(k.y+h.y)/2;return(0,L.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,L.jsx)("line",{x1:k.x,y1:k.y,x2:h.x,y2:h.y}),(0,L.jsxs)("text",{x:ee+B*.34,y:C+oe*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[H.toFixed(2)," m"]})]})})():null,i.boundaryPoints.map((k,H)=>H>0&&H===i.boundaryPoints.length-1&&k.x===i.boundaryPoints[0]?.x&&k.y===i.boundaryPoints[0]?.y?null:(0,L.jsx)("circle",{className:`fence-boundary__point${!i.boundaryClosed&&H===0&&i.boundaryPoints.length>=3?" is-close-target":""}`,cx:k.x,cy:k.y,r:"0.13",onPointerDown:B=>y(B,H)},`fence-point-${H}`))]}),(0,L.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,L.jsx)("button",{type:"button",onClick:()=>f(k=>Math.max(.5,k-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,L.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,L.jsx)("button",{type:"button",onClick:()=>f(k=>Math.min(1,k+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!i.boundaryClosed&&i.boundaryPoints.length>=2?(0,L.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(k=>tc(k.boundaryPoints,!1)?k:{...k,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,L.jsx)("div",{className:"truss-estimator__grid-hint",children:i.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,L.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,L.jsx)("div",{children:i.boundaryMode==="quick"?`${(Number.parseFloat(i.quickLengthM)||0).toFixed(2)} m fence line`:`${X.totalEdgeM.toFixed(2)} m fence line`}),i.boundaryMode==="draw"&&i.boundaryClosed?(0,L.jsxs)("div",{children:[X.cornerPostCount," corner/end posts"]}):null]})]}):null,null,c==="height"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Sa.heights.map(k=>(0,L.jsx)("button",{type:"button",className:`truss-estimator__visual-card${i.height===k?" is-selected":""}`,onClick:()=>o(H=>({...H,height:k})),children:(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:Kt(`/fencing/height/${k}.webp`),alt:""})},k))}),(0,L.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,L.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(k=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${i.gravelBoard===k.id?" is-selected":""}`,onClick:()=>o(H=>({...H,gravelBoard:k.id})),children:[(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Kt(k.img),alt:""}),(0,L.jsx)("span",{children:k.label})]},k.id))})]}):null,c==="gate"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,L.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,L.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(k=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${i.gateType===k.id?" is-selected":""}`,onClick:()=>o(H=>({...H,gateType:k.id,gateWidthM:k.id==="none"?"":String(Sa.gate[k.id].widthDefault)})),children:[(0,L.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Kt(k.img),alt:""}),(0,L.jsx)("span",{children:k.label})]},k.id))}),i.gateType&&i.gateType!=="none"?(0,L.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,L.jsx)("span",{children:"Gate width (m)"}),(0,L.jsx)("input",{type:"text",inputMode:"decimal",value:i.gateWidthM,onChange:k=>o(H=>({...H,gateWidthM:k.target.value}))})]}):null]}):null,c==="posts"?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,L.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,L.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,L.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Sa.mounting).map(([k,H])=>(0,L.jsxs)("button",{type:"button",className:`truss-estimator__option-card${i.mountingType===k?" is-selected":""}`,onClick:()=>o(B=>({...B,mountingType:k})),children:[(0,L.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,L.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb})]},k))})]}):null]}),(0,L.jsxs)("div",{className:"truss-estimator__nav",children:[(0,L.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:pe,children:"Back"}),(0,L.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Pe,disabled:!Me(),children:[(0,L.jsx)("span",{children:de}),(0,L.jsx)("span",{className:"arrow",children:(0,L.jsx)(Lt,{})})]})]})]})]})})}var ac=Y(Ye()),ve=Y(ae()),pw={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 kd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,ac.useState)("floor"),[i,o]=(0,ac.useState)(""),[l,u]=(0,ac.useState)(""),p=Number.parseFloat(i)*Number.parseFloat(l)||0,f=pw[r],b=Math.ceil(p/f.coverage),m=[{key:`insulation-${r}`,label:`${f.product} ${f.thickness}`,qty:b,unit:f.salesUnit,query:f.product,category:"insulation"}],h=Object.entries(pw);return(0,ve.jsx)(ve.Fragment,{children:(0,ve.jsxs)("div",{className:"truss-estimator",children:[(0,ve.jsxs)("div",{className:"quick-order-hero",children:[(0,ve.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ve.jsx)("h1",{children:"Insulation Calculator"}),(0,ve.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,ve.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ve.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,ve.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,ve.jsxs)("div",{className:"materials-calculator__section",children:[(0,ve.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,ve.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:h.map(([w,E])=>(0,ve.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===w?" is-selected":""}`,onClick:()=>n(w),children:[(0,ve.jsx)("div",{className:"truss-estimator__option-title",children:E.label}),(0,ve.jsxs)("div",{className:"truss-estimator__option-copy",children:[E.product,", ",E.thickness]})]},w))})]}),(0,ve.jsxs)("div",{className:"materials-calculator__section",children:[(0,ve.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,ve.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ve.jsxs)("label",{className:"truss-estimator__field",children:[(0,ve.jsx)("span",{children:"Length (m)"}),(0,ve.jsx)("input",{type:"number",min:"0",step:"0.01",value:i,onChange:w=>o(w.target.value)})]}),(0,ve.jsxs)("label",{className:"truss-estimator__field",children:[(0,ve.jsx)("span",{children:"Width (m)"}),(0,ve.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:w=>u(w.target.value)})]})]})]}),(0,ve.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ve.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ve.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ve.jsxs)("div",{children:[(0,ve.jsx)("span",{children:"Insulated area"}),(0,ve.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,ve.jsxs)("div",{children:[(0,ve.jsx)("span",{children:f.product}),(0,ve.jsxs)("strong",{children:[b," packs"]})]})]}),(0,ve.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,ve.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ve.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ve.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(m),disabled:p<=0,children:a})]})]})]})})}var Dn=Y(Ye()),V=Y(ae()),q_=10,E_=1.9*.762,M_=1.9*1.524,rc=()=>({height:"",width:""}),ic=e=>Number.parseFloat(e)||0,dw=({height:e,width:t})=>ic(e)*ic(t);function Nd({onBack:e}){let[t,a]=(0,Dn.useState)([rc()]),[r,n]=(0,Dn.useState)([rc()]),[i,o]=(0,Dn.useState)("0"),[l,u]=(0,Dn.useState)("0"),[p,f]=(0,Dn.useState)(1),b=t.reduce((d,c)=>d+dw(c),0),m=r.reduce((d,c)=>d+dw(c),0),h=ic(i)*E_+ic(l)*M_,w=Math.max(0,b-m-h),E=w*p/q_,R=(d,c,g,v)=>{d(S=>S.map((M,T)=>T===c?{...M,[g]:v}:M))};return(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:"Paint Calculator"}),(0,V.jsx)("p",{children:"Estimate how much paint you need for your walls, including multiple coats and excluded areas."})]}),(0,V.jsxs)("div",{className:"truss-estimator__card paint-calculator",children:[(0,V.jsx)("h2",{className:"truss-estimator__step-title",children:"Walls, exclusions and coats"}),(0,V.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,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,V.jsx)("p",{className:"paint-calculator__hint",children:"Enter the height and width of each wall you want to paint."}),(0,V.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,V.jsx)("span",{}),(0,V.jsx)("span",{children:"Height (m)"}),(0,V.jsx)("span",{children:"Width (m)"}),(0,V.jsx)("span",{})]}),t.map((d,c)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",c+1]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,V.jsx)("input",{"aria-label":`Wall ${c+1} height in metres`,type:"number",min:"0",step:"0.01",value:d.height,onChange:g=>R(a,c,"height",g.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,V.jsx)("input",{"aria-label":`Wall ${c+1} width in metres`,type:"number",min:"0",step:"0.01",value:d.width,onChange:g=>R(a,c,"width",g.target.value)})]}),t.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>a(g=>g.filter((v,S)=>S!==c)),children:"Remove"}):null]},`wall-${c}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>a(d=>[...d,rc()]),children:"+ Add another wall"})]}),(0,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Areas to exclude"}),(0,V.jsx)("p",{className:"paint-calculator__hint",children:"Add windows, sockets, skirting boards or other areas that will not be painted."}),(0,V.jsxs)("div",{className:"paint-calculator__dimensions-header","aria-hidden":"true",children:[(0,V.jsx)("span",{}),(0,V.jsx)("span",{children:"Height (m)"}),(0,V.jsx)("span",{children:"Width (m)"}),(0,V.jsx)("span",{})]}),r.map((d,c)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",c+1]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Height (m)"}),(0,V.jsx)("input",{"aria-label":`Area ${c+1} height in metres`,type:"number",min:"0",step:"0.01",value:d.height,onChange:g=>R(n,c,"height",g.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{className:"sr-only",children:"Width (m)"}),(0,V.jsx)("input",{"aria-label":`Area ${c+1} width in metres`,type:"number",min:"0",step:"0.01",value:d.width,onChange:g=>R(n,c,"width",g.target.value)})]}),r.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>n(g=>g.filter((v,S)=>S!==c)),children:"Remove"}):null]},`excluded-${c}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>n(d=>[...d,rc()]),children:"+ Add another area"})]}),(0,V.jsxs)("div",{className:"paint-calculator__section",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Doors and coats"}),(0,V.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,V.jsxs)("div",{className:"truss-estimator__field-grid paint-calculator__small-fields",children:[(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Doors"}),(0,V.jsx)("input",{type:"number",min:"0",step:"1",value:i,onChange:d=>o(d.target.value)})]}),(0,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Double doors"}),(0,V.jsx)("input",{type:"number",min:"0",step:"1",value:l,onChange:d=>u(d.target.value)})]})]}),(0,V.jsxs)("div",{className:"paint-calculator__coat-field",children:[(0,V.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,V.jsxs)("label",{className:"truss-estimator__field",children:[(0,V.jsx)("span",{children:"Number of coats"}),(0,V.jsxs)("select",{value:p,onChange:d=>f(Number(d.target.value)),children:[(0,V.jsx)("option",{value:"1",children:"1 coat"}),(0,V.jsx)("option",{value:"2",children:"2 coats"}),(0,V.jsx)("option",{value:"3",children:"3 coats"})]})]})]})]}),(0,V.jsxs)("div",{className:"paint-calculator__totals",children:[(0,V.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,V.jsxs)("div",{className:"paint-calculator__result-grid",children:[(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paintable area"}),(0,V.jsxs)("strong",{children:[w.toFixed(2)," m\xB2"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Coverage"}),(0,V.jsxs)("strong",{children:[p," ",p===1?"coat":"coats"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paint required"}),(0,V.jsxs)("strong",{children:[E.toFixed(1)," litres"]})]})]}),(0,V.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,V.jsxs)("div",{className:"paint-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",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var fr=Y(Ye()),re=Y(ae()),nc=e=>Number.parseFloat(e)||0,Sd={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 Cd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,fr.useState)("paving"),[i,o]=(0,fr.useState)("council"),[l,u]=(0,fr.useState)(""),[p,f]=(0,fr.useState)(""),[b,m]=(0,fr.useState)("100"),[h,w]=(0,fr.useState)("50"),[E,R]=(0,fr.useState)(!0),[d,c]=(0,fr.useState)(!0),g=nc(l)*nc(p),v=g,S=g*(nc(b)/1e3),M=g*.04,T=g*(nc(h)/1e3),U=Math.ceil(v/.36),j=Math.ceil(v/.1),F=Math.ceil(S*1700/800),we=Math.ceil(M*1600/800),Ee=Math.ceil(T*1600/800),De=r==="paving"?{qty:U,unit:"each"}:r==="block"?{qty:v,unit:"m2"}:{qty:Ee,unit:"bag"},at={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],Ce=[{key:`surface-${i}`,label:Sd[r].find(ie=>ie.id===i)?.label??"Surface material",qty:De.qty,unit:De.unit,query:at,category:"landscaping"},...E?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:F,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...d?[{key:"bedding",label:"Sharp sand bedding",qty:we,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];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:"Paving & Driveway Calculator"}),(0,re.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,re.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,re.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,re.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,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,re.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(([ie,ne,I])=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===ie?" is-selected":""}`,onClick:()=>{n(ie),o(Sd[ie][0].id)},children:[(0,re.jsx)("div",{className:"truss-estimator__option-title",children:ne}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:I})]},ie))}),(0,re.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,re.jsx)("span",{children:"Finish"}),(0,re.jsx)("select",{value:i,onChange:ie=>o(ie.target.value),children:Sd[r].map(ie=>(0,re.jsx)("option",{value:ie.id,children:ie.label},ie.id))})]})]}),(0,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,re.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,re.jsxs)("label",{className:"truss-estimator__field",children:[(0,re.jsx)("span",{children:"Length (m)"}),(0,re.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:ie=>u(ie.target.value)})]}),(0,re.jsxs)("label",{className:"truss-estimator__field",children:[(0,re.jsx)("span",{children:"Width (m)"}),(0,re.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:ie=>f(ie.target.value)})]})]}),r==="gravel"&&(0,re.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,re.jsx)("span",{children:"Gravel depth (mm)"}),(0,re.jsx)("input",{type:"number",min:"0",step:"10",value:h,onChange:ie=>w(ie.target.value)})]}),E&&(0,re.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,re.jsx)("span",{children:"Sub-base depth (mm)"}),(0,re.jsx)("input",{type:"number",min:"0",step:"10",value:b,onChange:ie=>m(ie.target.value)})]}),(0,re.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,re.jsx)("input",{type:"checkbox",checked:E,onChange:ie=>R(ie.target.checked)}),(0,re.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,re.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,re.jsx)("input",{type:"checkbox",checked:d,onChange:ie=>c(ie.target.checked)}),(0,re.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,re.jsxs)("div",{className:"materials-calculator__totals",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,re.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Surface area"}),(0,re.jsxs)("strong",{children:[g.toFixed(2)," m\xB2"]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,re.jsx)("strong",{children:r==="paving"?`${U} slabs`:r==="block"?`${v.toFixed(2)} m\xB2`:`${Ee} bulk bags`})]}),E&&(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"MOT Type 1"}),(0,re.jsxs)("strong",{children:[F," bulk bags"]})]}),d&&(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Sharp sand"}),(0,re.jsxs)("strong",{children:[we," bulk bags"]})]})]}),(0,re.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,re.jsxs)("div",{className:"materials-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?.(Ce),disabled:g<=0,children:a})]})]})]})})}var al=Y(Ye()),le=Y(ae()),T_=2.88,mw=[{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"}],fw=()=>({length:"",height:""}),qd=e=>Number.parseFloat(e)||0;function Ed({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,al.useState)([fw()]),[i,o]=(0,al.useState)(""),[l,u]=(0,al.useState)("standard"),[p,f]=(0,al.useState)("screws"),b=r.reduce((M,T)=>M+qd(T.length)*qd(T.height),0),m=Math.max(0,b-qd(i)),h=Math.ceil(m/T_),w=Math.ceil(m*12),E=Math.ceil(w/1e3),R=Math.ceil(m*1.2),d=Math.ceil(R/90),c=Math.ceil(m/3.5),g=mw.find(M=>M.id===l)?.label??"Standard",v=[{key:"board",label:`${g} plasterboard`,qty:h,unit:"sheet",query:`${g} plasterboard`,category:"plasterboard"},...p==="screws"?[{key:"screws",label:"Drywall screws",qty:E,unit:"box",query:"drywall screws",category:"fixings"}]:[{key:"adhesive",label:"Board adhesive",qty:c,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:d,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],S=(M,T,U)=>{n(j=>j.map((F,we)=>we===M?{...F,[T]:U}:F))};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:"Plasterboard & Drylining Calculator"}),(0,le.jsx)("p",{children:"Estimate boards, fixings and jointing materials for walls and ceilings."})]}),(0,le.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,le.jsx)("h2",{className:"truss-estimator__step-title",children:"Boards, fixings and jointing"}),(0,le.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,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Board type"}),(0,le.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:mw.map(M=>(0,le.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===M.id?" is-selected":""}`,onClick:()=>u(M.id),children:[(0,le.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,le.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb})]},M.id))})]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Fixing method"}),(0,le.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(([M,T,U])=>(0,le.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===M?" is-selected":""}`,onClick:()=>f(M),children:[(0,le.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,le.jsx)("div",{className:"truss-estimator__option-copy",children:U})]},M))})]}),(0,le.jsxs)("div",{className:"materials-calculator__section",children:[(0,le.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall and ceiling areas"}),(0,le.jsx)("p",{className:"materials-calculator__hint",children:"Add each surface separately so different wall sizes are easy to measure."}),(0,le.jsxs)("div",{className:"materials-calculator__dimensions-header",children:[(0,le.jsx)("span",{children:"Surface"}),(0,le.jsx)("span",{children:"Length (m)"}),(0,le.jsx)("span",{children:"Height (m)"}),(0,le.jsx)("span",{})]}),r.map((M,T)=>(0,le.jsxs)("div",{className:"materials-calculator__surface-row",children:[(0,le.jsxs)("span",{children:["Surface ",T+1]}),(0,le.jsx)("input",{"aria-label":`Surface ${T+1} length`,type:"number",min:"0",step:"0.01",value:M.length,onChange:U=>S(T,"length",U.target.value)}),(0,le.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:M.height,onChange:U=>S(T,"height",U.target.value)}),r.length>1?(0,le.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>n(U=>U.filter((j,F)=>F!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,le.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>n(M=>[...M,fw()]),children:"+ Add another surface"}),(0,le.jsxs)("label",{className:"truss-estimator__field materials-calculator__openings",children:[(0,le.jsxs)("span",{children:["Openings to deduct (m\xB2) ",(0,le.jsx)("small",{children:"optional"})]}),(0,le.jsx)("input",{type:"number",min:"0",step:"0.01",value:i,onChange:M=>o(M.target.value)})]})]}),(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:"Board area"}),(0,le.jsxs)("strong",{children:[m.toFixed(2)," m\xB2"]})]}),(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:"2.4 x 1.2 m boards"}),(0,le.jsx)("strong",{children:h})]}),(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:p==="screws"?"Drywall screws":"Board adhesive"}),(0,le.jsx)("strong",{children:p==="screws"?`${w} (${E} boxes)`:`${c} bags`})]}),(0,le.jsxs)("div",{children:[(0,le.jsx)("span",{children:"Joint tape"}),(0,le.jsxs)("strong",{children:[R," m (",d," rolls)"]})]})]}),(0,le.jsx)("p",{className:"materials-calculator__note",children:"Figures are estimates. Confirm board specification, fixing patterns and fire or acoustic requirements before ordering."})]}),(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?.(v),disabled:m<=0,children:a})]})]})]})})}var rl=Y(Ye());var _=Y(ae()),Tt={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}}}},oc=["range","pitchAndDimensions","quantityAndGirders","bracing"],z_={range:null,pitch:null,spanMM:"",overhangMM:"",roofLengthM:"",centres:null,girderCount:0,bracing:null,treatment:null,contact:{name:"",email:""}};function A_({degrees:e}){let a=e*Math.PI/180,n=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,${n}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function R_({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",n="#d3d8de",i="#7c8494",o=(f,b,m,h,w=8,E)=>{let R=m-f,d=h-b,c=Math.hypot(R,d)||1,g=-d/c,v=R/c,S=w*.2;return(0,_.jsxs)("g",{children:[(0,_.jsx)("line",{x1:f,y1:b,x2:m,y2:h,stroke:a,strokeWidth:w+3,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:f,y1:b,x2:m,y2:h,stroke:t,strokeWidth:w,strokeLinecap:"square"}),(0,_.jsx)("line",{x1:f-g*S,y1:b-v*S,x2:m-g*S,y2:h-v*S,stroke:r,strokeWidth:Math.max(1.5,w*.24),strokeLinecap:"round",opacity:"0.9"})]},E)},l=(f,b,m)=>(0,_.jsxs)("g",{children:[(0,_.jsx)("rect",{x:f-7.5,y:b-5.5,width:"15",height:"11",rx:"2",fill:n,stroke:i,strokeWidth:"1"}),(0,_.jsx)("circle",{cx:f-4,cy:b-2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f+4,cy:b-2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f-4,cy:b+2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f+4,cy:b+2.5,r:"1",fill:i}),(0,_.jsx)("circle",{cx:f,cy:b,r:"1",fill:i})]},m),u=(f,b)=>(0,_.jsx)("rect",{x:f-9,y:"110",width:"18",height:"10",fill:a},b),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,u(26,"wl"),u(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,u(26,"wl"),u(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,u(26,"wl"),u(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 U_({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 gw({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 Md({onBack:e}){let[t,a]=(0,rl.useState)(0),[r,n]=(0,rl.useState)(z_),[i,o]=(0,rl.useState)(!1),[l,u]=(0,rl.useState)(!1),p=()=>{let d=Number.parseFloat(r.roofLengthM)||0,c=Number.parseFloat(r.centres??"");return d<=0||!c?0:Math.ceil(d*1e3/c)+1},b=(()=>{let d=r.range?Tt.ranges[r.range]:Tt.ranges.standard,c=r.pitch??"22.5",g=Tt.pitchMultipliers[c],v=(Number.parseFloat(r.spanMM)||0)/1e3,M=(Number.parseFloat(r.overhangMM)||0)>Tt.overhang.thresholdMM,T=p(),U=T+r.girderCount,j=Number.parseFloat(r.roofLengthM)||0,F=r.treatment?Tt.treatment[r.treatment]:Tt.treatment.untreated,we=Tt.estimate.ranges[r.range??"standard"],Ee=we.supplyAt8m*Math.max(.7,v/8)*g*(1+F.surchargePct)+(M?Tt.overhang.surchargePerTruss:0),De=T*Ee,at=r.girderCount*Ee*Tt.estimate.girderMultiplier,Ce=r.bracing==="yes"?j*Tt.estimate.bracingPerMetre:0,X=De+at+Ce+Tt.estimate.delivery,ie=Tt.estimate.design+T*we.installPerTruss+r.girderCount*40,ne=X+ie,I=ne*.2;return{range:d,count:T,girderCount:r.girderCount,overhangApplies:M,overhangUnits:U,roofLengthM:j,treatment:F,trussSupply:De,bracingMaterials:Ce,delivery:Tt.estimate.delivery,labour:ie,subtotal:ne,vat:I,total:ne+I}})(),m=()=>{let d=oc[t];return d==="range"?!!r.range:d==="pitchAndDimensions"?!!r.pitch&&r.spanMM.trim()!==""&&r.overhangMM.trim()!=="":d==="quantityAndGirders"?r.roofLengthM.trim()!==""&&!!r.centres:d==="bracing"?!!r.bracing&&!!r.treatment:!0},h=t===oc.length-1?"View truss request":"Next",w=()=>{i?o(!1):t===0?e():a(d=>d-1)},E=()=>{m()&&(t===oc.length-1?(u(!1),o(!0)):a(d=>d+1))},R=()=>{let d=oc[t];return d==="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(Tt.ranges).map(([c,g])=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===c?" is-selected":""}`,onClick:()=>n(v=>({...v,range:c})),children:[(0,_.jsx)(R_,{type:c}),(0,_.jsxs)("div",{className:"truss-estimator__option-info",children:[(0,_.jsx)("div",{className:"truss-estimator__option-title",children:g.label}),(0,_.jsx)("div",{className:"truss-estimator__option-copy",children:g.blurb})]})]},c))})]}):d==="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:c=>n(g=>({...g,spanMM:c.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:c=>n(g=>({...g,overhangMM:c.target.value}))}),(0,_.jsxs)("small",{children:["Overhangs beyond ",Tt.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:Tt.pitches.map(c=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===c?" is-selected":""}`,onClick:()=>n(g=>({...g,pitch:c})),children:[(0,_.jsx)(A_,{degrees:Number.parseFloat(c)}),(0,_.jsxs)("span",{children:[c,"\xB0"]})]},c))})]}):d==="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:c=>n(g=>({...g,roofLengthM:c.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:Tt.centresOptions.map(c=>(0,_.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===c?" is-selected":""}`,onClick:()=>n(g=>({...g,centres:c})),children:(0,_.jsxs)("div",{className:"truss-estimator__option-title",children:[c,"mm centres"]})},c))}),(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:()=>n(c=>({...c,girderCount:Math.max(0,c.girderCount-1)})),children:"\u2212"}),(0,_.jsx)("span",{children:r.girderCount}),(0,_.jsx)("button",{type:"button",onClick:()=>n(c=>({...c,girderCount:Math.min(3,c.girderCount+1)})),children:"+"})]})]}):d==="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(c=>(0,_.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===c.id?" is-selected":""}`,onClick:()=>n(g=>({...g,bracing:c.id})),children:[(0,_.jsx)(U_,{enabled:c.id==="yes"}),(0,_.jsx)("span",{children:c.label})]},c.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:()=>n(c=>({...c,treatment:"untreated"})),children:[(0,_.jsx)(gw,{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:()=>n(c=>({...c,treatment:"treated"})),children:[(0,_.jsx)(gw,{treated:!0}),(0,_.jsx)("span",{children:"Treated (+8% cost)"}),(0,_.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return i?(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:[b.range.label," roof trusses"]})]}),(0,_.jsxs)("strong",{children:[b.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:b.treatment.label})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Girder trusses"}),(0,_.jsx)("strong",{children:b.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:et(b.trussSupply)})]}),b.bracingMaterials>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Bracing materials allowance"}),(0,_.jsx)("strong",{children:et(b.bracingMaterials)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Delivery allowance"}),(0,_.jsx)("strong",{children:et(b.delivery)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Design and installation labour"}),(0,_.jsx)("strong",{children:et(b.labour)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,_.jsx)("strong",{children:et(b.subtotal)})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{children:"VAT (20%)"}),(0,_.jsx)("strong",{children:et(b.vat)})]}),(0,_.jsxs)("div",{className:"truss-request__price-total",children:[(0,_.jsx)("span",{children:"Estimated total"}),(0,_.jsx)("strong",{children:et(b.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:()=>u(!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:R()}),(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:E,disabled:!m(),children:[(0,_.jsx)("span",{children:h}),(0,_.jsx)("span",{className:"arrow",children:(0,_.jsx)(Lt,{})})]})]})]})]})})}var Ci=Y(Ye()),P=Y(ae()),vw=e=>Number.parseFloat(e)||0,lc=(e,t)=>vw(e)*(t==="m"?1:.3048),hw=()=>({length:"",width:""}),bw=[{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 D_({profile:e}){return(0,P.jsxs)("svg",{className:"skirting-calculator__profile-diagram",viewBox:"0 0 120 84","aria-hidden":"true",children:[(0,P.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,P.jsx)("line",{x1:"12",y1:"70",x2:"108",y2:"70"})]})}function Td({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Ci.useState)("total"),[i,o]=(0,Ci.useState)("m"),[l,u]=(0,Ci.useState)(""),[p,f]=(0,Ci.useState)([hw()]),[b,m]=(0,Ci.useState)(""),[h,w]=(0,Ci.useState)("chamfered"),E="4.2",R=r==="total"?lc(l,i):p.reduce((S,M)=>S+2*(lc(M.length,i)+lc(M.width,i)),0),d=Math.max(0,R-lc(b,i)),c=Math.ceil(d/vw(E)),g=[{key:`skirting-${h}`,label:`${bw.find(S=>S.id===h)?.label} skirting board`,qty:d,unit:"m",query:"skirting board",category:"skirting"}],v=(S,M,T)=>{f(U=>U.map((j,F)=>F===S?{...j,[M]:T}:j))};return(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)("div",{className:"truss-estimator",children:[(0,P.jsxs)("div",{className:"quick-order-hero",children:[(0,P.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,P.jsx)("h1",{children:"Skirting Board Calculator"}),(0,P.jsx)("p",{children:"Work out how many skirting board lengths you need for one room or a whole project."})]}),(0,P.jsxs)("div",{className:"truss-estimator__card skirting-calculator",children:[(0,P.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure by room or total length"}),(0,P.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,P.jsxs)("div",{className:"skirting-calculator__section",children:[(0,P.jsx)("div",{className:"truss-estimator__section-heading",children:"How would you like to measure?"}),(0,P.jsxs)("div",{className:"brick-calculator__unit-toggle skirting-calculator__mode-toggle",role:"group","aria-label":"Calculation method",children:[(0,P.jsx)("button",{type:"button",className:r==="total"?"is-selected":"",onClick:()=>n("total"),children:"Total length"}),(0,P.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>n("rooms"),children:"Room by room"})]})]}),(0,P.jsxs)("div",{className:"skirting-calculator__section",children:[(0,P.jsx)("div",{className:"truss-estimator__section-heading",children:"Measurements"}),(0,P.jsxs)("div",{className:"skirting-calculator__unit-row",children:[(0,P.jsx)("span",{children:"Units"}),(0,P.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,P.jsx)("button",{type:"button",className:i==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,P.jsx)("button",{type:"button",className:i==="ft"?"is-selected":"",onClick:()=>o("ft"),children:"Feet"})]})]}),r==="total"?(0,P.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,P.jsxs)("span",{children:["Total skirting length (",i,")"]}),(0,P.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:S=>u(S.target.value)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"skirting-calculator__dimensions-header",children:[(0,P.jsx)("span",{children:"Room"}),(0,P.jsxs)("span",{children:["Length (",i,")"]}),(0,P.jsxs)("span",{children:["Width (",i,")"]}),(0,P.jsx)("span",{})]}),p.map((S,M)=>(0,P.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,P.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",M+1]}),(0,P.jsx)("input",{"aria-label":`Room ${M+1} length in ${i}`,type:"number",min:"0",step:"0.01",value:S.length,onChange:T=>v(M,"length",T.target.value)}),(0,P.jsx)("input",{"aria-label":`Room ${M+1} width in ${i}`,type:"number",min:"0",step:"0.01",value:S.width,onChange:T=>v(M,"width",T.target.value)}),p.length>1?(0,P.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>f(T=>T.filter((U,j)=>j!==M)),children:"Remove"}):null]},`room-${M}`)),(0,P.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>f(S=>[...S,hw()]),children:"+ Add another room"})]}),(0,P.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,P.jsxs)("span",{children:["Openings and doorways to deduct (",i,") ",(0,P.jsx)("small",{children:"optional"})]}),(0,P.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:S=>m(S.target.value)})]})]}),(0,P.jsxs)("div",{className:"skirting-calculator__section",children:[(0,P.jsx)("div",{className:"truss-estimator__section-heading",children:"Profile"}),(0,P.jsx)("p",{className:"skirting-calculator__hint",children:"Choose the finish you want for the fixed 4.2m white-primed MDF boards."}),(0,P.jsx)("div",{className:"architrave-calculator__profiles",children:bw.map(S=>(0,P.jsxs)("button",{type:"button",className:`truss-estimator__option-card${h===S.id?" is-selected":""}`,onClick:()=>w(S.id),children:[(0,P.jsx)(D_,{profile:S.id}),(0,P.jsx)("div",{className:"truss-estimator__option-title",children:S.label}),(0,P.jsx)("div",{className:"truss-estimator__option-copy",children:S.blurb})]},S.id))})]}),(0,P.jsxs)("div",{className:"skirting-calculator__section",children:[(0,P.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,P.jsx)("div",{className:"truss-estimator__field-grid skirting-calculator__options-grid",children:(0,P.jsxs)("label",{className:"truss-estimator__field",children:[(0,P.jsx)("span",{children:"Board length"}),(0,P.jsx)("input",{value:"4.20 m",disabled:!0})]})}),(0,P.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,P.jsxs)("div",{className:"skirting-calculator__totals",children:[(0,P.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,P.jsxs)("div",{className:"skirting-calculator__result-grid",children:[(0,P.jsxs)("div",{children:[(0,P.jsx)("span",{children:"Net skirting"}),(0,P.jsxs)("strong",{children:[d.toFixed(2)," m"]})]}),(0,P.jsxs)("div",{children:[(0,P.jsx)("span",{children:"Board lengths"}),(0,P.jsx)("strong",{children:c})]})]}),(0,P.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,P.jsxs)("div",{className:"skirting-calculator__actions",children:[(0,P.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,P.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:d<=0,children:a})]})]})]})})}var Bn=Y(Ye()),ce=Y(ae()),il=e=>Number.parseFloat(e)||0;function zd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,n]=(0,Bn.useState)("studs"),[i,o]=(0,Bn.useState)(""),[l,u]=(0,Bn.useState)(""),[p,f]=(0,Bn.useState)("600"),[b,m]=(0,Bn.useState)("2.4"),h=i&&l&&p?Math.ceil(il(l)/(il(p)/1e3))+1:0,w=h*il(i),E=il(b)>0?Math.ceil(w/il(b)):0,R=[{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"}],d={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"]},g={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,ce.jsx)(ce.Fragment,{children:(0,ce.jsxs)("div",{className:"truss-estimator",children:[(0,ce.jsxs)("div",{className:"quick-order-hero",children:[(0,ce.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ce.jsx)("h1",{children:"Timber Calculator"}),(0,ce.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,ce.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ce.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,ce.jsxs)("p",{className:"truss-estimator__step-sub",children:[g.help," Enter the member length and centres to estimate the number of pieces and stock lengths."]}),(0,ce.jsxs)("div",{className:"materials-calculator__section",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,ce.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(d).map(v=>(0,ce.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===v?" is-selected":""}`,onClick:()=>n(v),children:[(0,ce.jsx)("div",{className:"truss-estimator__option-title",children:d[v][0]}),(0,ce.jsx)("div",{className:"truss-estimator__option-copy",children:d[v][1]})]},v))})]}),(0,ce.jsxs)("div",{className:"materials-calculator__section",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,ce.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsxs)("span",{children:[g.member," (m)"]}),(0,ce.jsx)("input",{type:"number",min:"0",step:"0.01",value:i,onChange:v=>o(v.target.value)})]}),(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsxs)("span",{children:[g.overall," (m)"]}),(0,ce.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:v=>u(v.target.value)})]})]}),(0,ce.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsx)("span",{children:"Centres (mm)"}),(0,ce.jsxs)("select",{value:p,onChange:v=>f(v.target.value),children:[(0,ce.jsx)("option",{value:"300",children:"300 mm"}),(0,ce.jsx)("option",{value:"400",children:"400 mm"}),(0,ce.jsx)("option",{value:"450",children:"450 mm"}),(0,ce.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,ce.jsxs)("label",{className:"truss-estimator__field",children:[(0,ce.jsx)("span",{children:"Stock length (m)"}),(0,ce.jsxs)("select",{value:b,onChange:v=>m(v.target.value),children:[(0,ce.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,ce.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,ce.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(0,ce.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ce.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ce.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ce.jsxs)("div",{children:[(0,ce.jsx)("span",{children:g.count}),(0,ce.jsx)("strong",{children:h})]}),(0,ce.jsxs)("div",{children:[(0,ce.jsx)("span",{children:"Linear metres"}),(0,ce.jsxs)("strong",{children:[w.toFixed(2)," m"]})]}),(0,ce.jsxs)("div",{children:[(0,ce.jsxs)("span",{children:[b," m lengths"]}),(0,ce.jsx)("strong",{children:E})]})]}),(0,ce.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,ce.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ce.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ce.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(R),disabled:w<=0,children:a})]})]})]})})}var Ad=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Md},{id:"fencing",title:"Fencing Calculator",desc:"Estimate fence panels, posts, gravel boards and fixings.",imageUrl:"/tool-images/fencing.webp",Component:xd},{id:"decking",title:"Decking Calculator",desc:"Estimate boards, substructure and fixing quantities.",imageUrl:"/tool-images/decking.webp",Component:_d},{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:hd},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Nd},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:Td},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:gd},{id:"concrete-aggregate",title:"Concrete & Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:wd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:Ed},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:kd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:zd},{id:"paving",title:"Paving & Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:Cd}];var cc=Y(Ye());var Le=Y(Ye());var N=Y(ae()),B_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],Rd={wasteFactorEnabled:!0},O_=3e3,ww=null;function sc(e,t){let a=Jo(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function L_(e){return e&&e.length>0?e.join(" x "):"-"}function Ud({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:n}){let i=Zs(),o=`${e}~${t.map(C=>`${C.key}|${C.query}|${C.category??""}|${C.qty}`).join("~")}`,l=o!==ww,[u,p]=(0,Le.useState)(null),[f,b]=(0,Le.useState)([]),[m,h]=(0,Le.useState)(l),[w,E]=(0,Le.useState)(null),[R,d]=(0,Le.useState)("tile"),[c,g]=(0,Le.useState)(null),[v,S]=(0,Le.useState)(""),[M,T]=(0,Le.useState)(null),[U,j]=(0,Le.useState)(""),[F,we]=(0,Le.useState)([]),[Ee,De]=(0,Le.useState)(new Set),[at,Ce]=(0,Le.useState)(null),[X,ie]=(0,Le.useState)(""),[ne,I]=(0,Le.useState)([]),Me=(0,Le.useRef)(null),de=(0,Le.useRef)(!1),be=C=>`${e}:${C}`,qe=C=>Zr(C.chosen,{lineId:be(C.requirement.key),description:C.requirement.label,unit:C.requirement.unit,qty:C.requirement.qty}),dt=(0,Le.useMemo)(()=>t.map(C=>`${C.key}|${C.query}|${C.category??""}`).join("~"),[t]);(0,Le.useEffect)(()=>{let C=!1;return ow().then(Q=>{C||p(Q.itemCount>0)}).catch(()=>{C||p(!1)}),()=>{C=!0}},[]),(0,Le.useEffect)(()=>{if(!a||!u)return;let C=!1,Q;l&&h(!0),E(null);let Z=Date.now();return(async()=>{let fe=null;try{fe=(await nw(t)).map(({requirement:$e,candidates:vt})=>({requirement:$e,candidates:vt,chosen:vt[0]??null}))}catch(_e){C||E(_e instanceof Error?_e.message:"Could not load products")}if(!C){if(ww=o,l){let _e=O_-(Date.now()-Z);_e>0&&await new Promise($e=>{Q=window.setTimeout($e,_e)})}C||(fe&&(b(fe),!de.current&&i&&(de.current=!0,i.addManyToCart(fe.filter(_e=>_e.chosen).map(qe)))),h(!1))}})(),()=>{C=!0,window.clearTimeout(Q)}},[a,u,dt]),(0,Le.useEffect)(()=>{if(!M)return;let C=U.trim();if(!C){we([]);return}let Q=!1,Z=window.setTimeout(()=>{Jr(C).then(fe=>{Q||we(fe)}).catch(()=>{Q||we([])})},250);return()=>{Q=!0,window.clearTimeout(Z)}},[M,U]),(0,Le.useEffect)(()=>{if(!at)return;let C=X.trim();if(!C){I([]);return}let Q=!1,Z=window.setTimeout(()=>{Jr(C).then(fe=>{Q||I(fe)}).catch(()=>{Q||I([])})},250);return()=>{Q=!0,window.clearTimeout(Z)}},[at,X]);let Rt=(0,Le.useMemo)(()=>{let C=v.trim().toLowerCase(),Q=C?f.filter(Z=>Z.requirement.label.toLowerCase().includes(C)||(Z.chosen?.description??"").toLowerCase().includes(C)||(Z.chosen?.product_id??"").toLowerCase().includes(C)):f;return c?[...Q].sort((Z,fe)=>{let _e=Z.requirement.label.localeCompare(fe.requirement.label);return c==="asc"?_e:-_e}):Q},[f,v,c]),mt=Rt.filter(C=>C.chosen),ft=Rt.filter(C=>!C.chosen),nt=f.filter(C=>C.chosen),gt=nt.filter(C=>C.chosen?.price==null).length,G=nt.reduce((C,Q)=>C+(za(qe(Q),Rd).lineTotal??0),0);if((0,Le.useEffect)(()=>{n?.(G)},[G,n]),!a||u===!1)return null;let y=i?nt.filter(C=>i.cart[be(C.requirement.key)]).length:0,z=at?f.find(C=>C.requirement.key===at)??null:null,se=X.trim()?ne:z?.candidates??[],pe=C=>{let Q=M===C.requirement.key;T(Q?null:C.requirement.key),j(Q?"":C.requirement.query)},Pe=(C,Q)=>{let Z=f.find(fe=>fe.requirement.key===C);b(fe=>fe.map(_e=>_e.requirement.key===C?{..._e,chosen:Q}:_e)),i&&Z&&i.cart[be(C)]&&i.addToCart(qe({...Z,chosen:Q})),T(null),j("")},xt=C=>{b(Q=>Q.map(Z=>Z.requirement.key===C?{...Z,chosen:null}:Z)),i?.cart[be(C)]&&i.removeFromCart(be(C))},k=C=>{Ce(C.requirement.key),ie(""),I([])},H=()=>{Ce(null),ie(""),I([])},B=C=>{if(!i)return;let Q=be(C.requirement.key);i.cart[Q]?i.removeFromCart(Q):i.addToCart(qe(C))},oe=C=>{De(Q=>{let Z=new Set(Q);return Z.has(C)?Z.delete(C):Z.add(C),Z})},ee=C=>{let Q=F.length>0?F:C.candidates;return(0,N.jsxs)("div",{className:"estimator-products__picker",children:[(0,N.jsx)("input",{type:"text",className:"results-search-input",value:U,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:Z=>j(Z.target.value),"aria-label":`Search a product for ${C.requirement.label}`}),(0,N.jsxs)("div",{className:"estimator-products__options",children:[Q.map(Z=>(0,N.jsxs)("button",{type:"button",className:`estimator-products__option${Z.product_id===C.chosen?.product_id?" is-selected":""}`,onClick:()=>Pe(C.requirement.key,Z),children:[(0,N.jsx)("span",{children:Z.description}),(0,N.jsxs)("span",{className:"results-row-meta",children:[Z.product_id,Z.price!=null&&` \xB7 ${et(Z.price)}`]})]},Z.product_id)),Q.length===0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,N.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!m&&(0,N.jsxs)("div",{className:"estimator-products__head",children:[(0,N.jsxs)("div",{className:"results-tile-section__head",children:[(0,N.jsx)("h3",{children:"Matched Products"}),(0,N.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!z&&(0,N.jsxs)("div",{className:"results-summary estimator-products__toolbar",children:[gt>0&&(0,N.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,N.jsx)("strong",{children:gt})," need pricing"]}),(0,N.jsxs)("div",{className:"estimator-products__controls",children:[(0,N.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:v,onChange:C=>S(C.target.value),"aria-label":"Search matched products"}),(0,N.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,N.jsx)("button",{type:"button",className:`results-view-toggle__btn${R==="tile"?" is-active":""}`,"aria-pressed":R==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>d("tile"),children:(0,N.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,N.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,N.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,N.jsx)("button",{type:"button",className:`results-view-toggle__btn${R==="list"?" is-active":""}`,"aria-pressed":R==="list","aria-label":"List view",title:"List view",onClick:()=>d("list"),children:(0,N.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,N.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,N.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,N.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,N.jsxs)("details",{ref:Me,style:{position:"relative"},children:[(0,N.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,N.jsx)("div",{className:"sort-menu-panel",children:B_.map(C=>{let Q=c===C.dir;return(0,N.jsxs)("button",{type:"button",className:`sort-menu-item${Q?" is-active":""}`,onClick:()=>{g(Q?null:C.dir),Me.current?.removeAttribute("open")},children:[(0,N.jsx)("span",{className:"sort-menu-item__check",children:Q?"\u2713":""}),C.label]},C.dir)})})]})]})]})]}),z&&(0,N.jsxs)("div",{className:"results-review-page",children:[(0,N.jsxs)("div",{className:"results-review-page__top",children:[(0,N.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:H,children:[(0,N.jsx)(Vr,{}),"Back to results"]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,N.jsx)("div",{className:"results-review-searchbar",children:(0,N.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:X,onChange:C=>ie(C.target.value),"aria-label":`Search a product for ${z.requirement.label}`})}),z.chosen&&(0,N.jsx)("div",{className:"results-candidate-actions",children:(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>xt(z.requirement.key),children:"Clear selected product"})})]})]}),(0,N.jsxs)("div",{className:"results-review-page__hero",children:[(0,N.jsx)("div",{className:"results-review-page__image-wrap",children:(0,N.jsx)("img",{className:"fill-img results-review-page__image",src:Qa(z.chosen?.description||z.requirement.label,z.chosen?.product_id,z.chosen?.pdp_photo_url),alt:""})}),(0,N.jsxs)("div",{className:"results-review-page__summary",children:[(0,N.jsx)("h2",{children:z.requirement.label}),(0,N.jsxs)("p",{className:"results-review-page__meta",children:[yi(z.requirement.qty)," ",ka(z.requirement.unit,z.requirement.qty)]}),z.chosen?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"results-review-page__product",children:z.chosen.description}),(0,N.jsxs)("div",{className:"results-row-meta",children:[z.chosen.product_id,z.chosen.price!=null?` \xB7 ${sc(z.chosen.price,z.chosen.price_basis)}`:""]})]}):(0,N.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,N.jsx)("div",{className:"results-review-page__actions",children:(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${i?.cart[be(z.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(z),disabled:!z.chosen||!i,children:i?.cart[be(z.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),se.length===0?(0,N.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,N.jsxs)("table",{className:"score-breakdown-table",children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{children:"Product"}),(0,N.jsx)("th",{children:"Dims (mm)"}),(0,N.jsx)("th",{children:"Price"}),(0,N.jsx)("th",{"aria-label":"Actions"})]})}),(0,N.jsx)("tbody",{children:se.map(C=>{let Q=C.product_id===z.chosen?.product_id;return(0,N.jsxs)("tr",{className:Q?"score-breakdown-row--best":"",children:[(0,N.jsxs)("td",{children:[(0,N.jsx)("div",{children:C.description}),(0,N.jsx)("div",{className:"results-row-meta",children:C.product_id})]}),(0,N.jsx)("td",{children:(0,N.jsx)("span",{className:"unit-badge",children:L_(C.measurements_mm)})}),(0,N.jsx)("td",{children:C.price!=null?sc(C.price,C.price_basis):"-"}),(0,N.jsx)("td",{children:(0,N.jsxs)("label",{className:"switch-toggle",title:Q?"Currently selected":"Use this candidate",children:[(0,N.jsx)("input",{type:"checkbox",checked:Q,onChange:()=>{Q?xt(z.requirement.key):Pe(z.requirement.key,C)},"aria-label":Q?`${C.description} selected`:`Use ${C.description}`}),(0,N.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},C.product_id)})})]})]}),!z&&m&&(0,N.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,N.jsx)(pr,{}),(0,N.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!z&&w&&(0,N.jsx)("p",{className:"results-empty-hint estimator-products__error",children:w}),!z&&!m&&!w&&Rt.length===0&&f.length>0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!z&&!m&&!w&&R==="tile"&&mt.length>0&&(0,N.jsx)("div",{className:"results-tile-grid",children:mt.map(C=>{let{requirement:Q,chosen:Z}=C,fe=Z?za(qe(C),Rd):null,_e=i?!!i.cart[be(Q.key)]:!1;return(0,N.jsxs)("article",{className:"results-tile-card",children:[(0,N.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>k(C),"aria-label":`Review match for ${Q.label}`,children:[(0,N.jsx)("div",{className:"results-tile-card__media",children:(0,N.jsx)("img",{className:"fill-img results-tile-card__image",src:Qa(Z?.description||Q.label,Z?.product_id,Z?.pdp_photo_url),alt:""})}),(0,N.jsxs)("div",{className:"results-tile-card__body",children:[Z?(0,N.jsxs)("div",{className:"results-tile-card__heading",children:[(0,N.jsx)("div",{className:"results-tile-card__title",children:Z.description}),(0,N.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,N.jsx)("span",{children:Z.product_id}),Z.price!=null?(0,N.jsx)("span",{children:sc(Z.price,Z.price_basis)}):null]})]}):(0,N.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,N.jsxs)("div",{className:"results-tile-card__match",children:[(0,N.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,N.jsx)("div",{className:"results-tile-card__match-name",children:Q.label}),(0,N.jsxs)("div",{className:"results-tile-card__meta",children:[yi(Q.qty)," ",ka(Q.unit,Q.qty)]}),fe?.requiredSellUnits!=null?(0,N.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",fe.requiredSellUnits," ",fe.sellUnit,fe.lineTotal!=null?` \xB7 ${et(fe.lineTotal)}`:""]}):Z?(0,N.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,N.jsxs)("div",{className:"results-tile-card__actions",children:[(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>k(C),children:"Review"}),(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${_e?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(C),disabled:!Z||!i,children:_e?"\u2713 Added":"+ Add"})]})]},Q.key)})}),!z&&!m&&!w&&R==="list"&&mt.length>0&&(0,N.jsx)("div",{className:"bom-table-wrap",children:(0,N.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,N.jsxs)("colgroup",{children:[(0,N.jsx)("col",{style:{width:"56px"}}),(0,N.jsx)("col",{className:"col-item"}),(0,N.jsx)("col",{style:{width:"90px"}}),(0,N.jsx)("col",{style:{width:"80px"}}),(0,N.jsx)("col",{style:{width:"220px"}}),(0,N.jsx)("col",{style:{width:"110px"}})]}),(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{className:"bom-col-header",children:[(0,N.jsx)("th",{"aria-label":"Expand"}),(0,N.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,N.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,N.jsx)("tbody",{children:mt.map(C=>{let{requirement:Q,chosen:Z}=C,fe=Z?za(qe(C),Rd):null,_e=i?!!i.cart[be(Q.key)]:!1,$e=Ee.has(Q.key);return(0,N.jsxs)(Le.Fragment,{children:[(0,N.jsxs)("tr",{className:"bom-row",children:[(0,N.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,N.jsx)("button",{type:"button",className:"link-btn",onClick:()=>oe(Q.key),"aria-expanded":$e,"aria-label":$e?"Collapse product options":"Expand product options",children:$e?"\u25BE":"\u25B8"})}),(0,N.jsxs)("td",{style:{paddingLeft:0},children:[(0,N.jsx)("div",{className:"bom-component-name",children:Q.label}),fe?.requiredSellUnits!=null&&(0,N.jsxs)("div",{className:"results-row-meta",children:["Order ",fe.requiredSellUnits," ",fe.sellUnit,fe.lineTotal!=null?` \xB7 ${et(fe.lineTotal)}`:""]})]}),(0,N.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:yi(Q.qty)}),(0,N.jsx)("td",{style:{textAlign:"center"},children:ka(Q.unit,Q.qty)}),(0,N.jsx)("td",{style:{textAlign:"center"},children:Z?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"bom-component-name",children:Z.description}),(0,N.jsxs)("div",{className:"results-row-meta",children:[Z.product_id,Z.price!=null&&` \xB7 ${sc(Z.price,Z.price_basis)}`]})]}):(0,N.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,N.jsx)("td",{style:{textAlign:"center"},children:(0,N.jsx)("button",{type:"button",className:`bom-toolbar-btn${_e?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>B(C),disabled:!Z||!i,children:_e?"\u2713 Added":"+ Add"})})]}),$e&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:M===Q.key?ee(C):(0,N.jsxs)("div",{className:"estimator-products__picker",children:[(0,N.jsxs)("div",{className:"estimator-products__options",children:[C.candidates.map(vt=>(0,N.jsxs)("button",{type:"button",className:`estimator-products__option${vt.product_id===Z?.product_id?" is-selected":""}`,onClick:()=>Pe(Q.key,vt),children:[(0,N.jsx)("span",{children:vt.description}),(0,N.jsxs)("span",{className:"results-row-meta",children:[vt.product_id,vt.price!=null&&` \xB7 ${et(vt.price)}`]})]},vt.product_id)),C.candidates.length===0&&(0,N.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,N.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>pe(C),children:"Search the catalogue"})]})})})]},Q.key)})})]})}),!z&&!m&&!w&&ft.length>0&&(0,N.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,N.jsxs)("div",{className:"results-tile-section__head",children:[(0,N.jsx)("h3",{children:"Require Matching"}),(0,N.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,N.jsx)("div",{className:"results-unmatched-list",children:ft.map(C=>(0,N.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>k(C),children:[(0,N.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,N.jsx)("span",{className:"results-unmatched-card__title",children:C.requirement.label}),(0,N.jsxs)("span",{className:"results-row-meta",children:[yi(C.requirement.qty)," ",ka(C.requirement.unit,C.requirement.qty)]})]}),(0,N.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},C.requirement.key))})]}),!m&&!w&&f.length>0&&(0,N.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,N.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,N.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."})]}),!z&&!m&&!w&&(r||y>0)&&(0,N.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,N.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),y>0&&i&&(0,N.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:i.openBasket,children:[(0,N.jsxs)("span",{children:["View Basket (",y,")"]}),(0,N.jsx)("span",{className:"arrow",children:(0,N.jsx)(Lt,{})})]})]})]})}var Ht=Y(ae());function Dd({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[n,i]=(0,cc.useState)(0),o=(0,cc.useCallback)(l=>i(l),[]);return(0,Ht.jsx)(Ht.Fragment,{children:(0,Ht.jsxs)("div",{className:"truss-estimator",children:[(0,Ht.jsxs)("div",{className:"quick-order-hero",children:[(0,Ht.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Ht.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Ht.jsx)("h1",{children:"Your Materials"}),n>0&&(0,Ht.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Ht.jsx)("strong",{children:et(n)})," Est. total"]})]}),(0,Ht.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Ht.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Ht.jsx)(Ud,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var H_=(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 yw(e,t){if(e==="paint"||e==="concrete-aggregate")return null;let a=t.map(r=>{let n=H_(e,r);return n?{key:r.key,productId:n,qty:r.qty,unit:r.unit}:null});return a.every(Boolean)?a:null}var Bd=Y(Ye());var Jt=Y(ae()),j_=1500;function _w(e){let{addManyToCart:t,clearCart:a,openBasket:r}=En(),[n,i]=(0,Bd.useState)(!1),[o,l]=(0,Bd.useState)(null);return{adding:n,basketError:o,addToBasket:async(p,f)=>{let b=Date.now();i(!0),l(null);try{let m=await Promise.all(p.filter(w=>w.qty>0).map(async w=>{let E=(await Jr(w.productId)).find(R=>R.product_id===w.productId);if(!E)throw new Error("A selected product is no longer available in this catalogue.");return Zr(E,{lineId:`${e}:${w.key}`,description:E.description,unit:w.unit??"each",qty:w.qty,calculatorWasteIncluded:f})})),h=j_-(Date.now()-b);h>0&&await new Promise(w=>window.setTimeout(w,h)),a(),t(m),r()}catch(m){l(m instanceof Error?m.message:"Could not add the products to your basket.")}finally{i(!1)}}}}function xw({toolTitle:e}){return(0,Jt.jsx)(Jt.Fragment,{children:(0,Jt.jsxs)("div",{className:"truss-estimator",children:[(0,Jt.jsxs)("div",{className:"quick-order-hero",children:[(0,Jt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Jt.jsx)("h1",{children:"Your Materials"}),(0,Jt.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Jt.jsx)("div",{className:"truss-estimator__card",children:(0,Jt.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Jt.jsx)(pr,{}),(0,Jt.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Ue=Y(ae());function uc(e){let[t,a]=(0,Pr.useState)(!1);return(0,Ue.jsx)(Vs,{onOpenBasket:()=>a(!0),children:(0,Ue.jsx)(G_,{...e,showBasket:t,onShowBasket:a})})}function G_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:n}){let[i,o]=(0,Pr.useState)(null),[l,u]=(0,Pr.useState)(null),p=Ad.find(M=>M.id===i),{cart:f,updateCartQty:b,updateCartSellUnits:m,updateCartConversions:h,removeFromCart:w,clearCart:E}=En(),{adding:R,basketError:d,addToBasket:c}=_w(p?.title??"calculator"),g=r?"basket":R?"adding":l?"review":i??"list",v=(0,Pr.useRef)(g);(0,Pr.useEffect)(()=>{v.current!==g&&(v.current=g,window.scrollTo(0,0))},[g]);let S=M=>{if(!p)return;let T=yw(p.id,M);T?c(T,M[0]?.calculatorWasteIncluded??!1):u(M)};return(0,Ue.jsx)("div",{className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}`,style:bi().theme,children:(0,Ue.jsx)("main",{className:"main-content",children:r?(0,Ue.jsx)(tl,{cart:f,onUpdateQty:b,onUpdateSellUnits:m,onResolveConversions:h,onRemove:w,onBack:()=>n(!1),onStartNewQuote:()=>{E(),o(null),u(null),n(!1)},internal:a}):R&&p?(0,Ue.jsx)(xw,{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:S})}),d&&(0,Ue.jsx)("p",{className:"results-empty-hint estimator-products__error",children:d}),l!==null&&(0,Ue.jsx)(Dd,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>u(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:Ad.map(M=>(0,Ue.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{o(M.id),u(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:Kt(M.imageUrl),alt:""})}),(0,Ue.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Ue.jsx)("span",{className:"estimator-tool-card__title",children:M.title}),(0,Ue.jsx)("span",{className:"estimator-tool-card__desc",children:M.desc})]})]},M.id))})]})]})})})})}var pc=Y(ae());function Od({config:e,children:t}){return Gb(e),(0,pc.jsx)(pc.Fragment,{children:t})}var Ld=Y(ae()),Q_="https://api.metronlabs.ai",Y_=["client","api-key","api-url","theme","hide-header"];function Nw(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.21",!this.root){let n=document.createElement("div"),i=document.createElement("style");i.textContent=`:host { display: block; }
6769
6781
  :host > div { all: initial; display: block; }
6770
- ${jb}`,this.shadowRoot.replaceChildren(i,n),this.root=(0,xw.createRoot)(n)}this.renderWidget()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||!this.root||(this.root.unmount(),this.root=null)})}attributeChangedCallback(){this.root&&this.renderWidget()}renderWidget(){let n=this.getAttribute("client")??void 0,i=this.getAttribute("api-key")??void 0;(!n||!i)&&console.error(`<${e}> needs client and api-key attributes.`);let o={apiBaseUrl:this.getAttribute("api-url")||G_,client:n,apiKey:i,theme:Y_(e,this.getAttribute("theme"))};this.root.render((0,Ld.jsx)(Od,{config:o,children:(0,Ld.jsx)(t,{hideHeader:this.hasAttribute("hide-header")})}))}},a.observedAttributes=Q_,a))}function Y_(e,t){if(t)try{return JSON.parse(t)}catch{console.error(`<${e}> theme attribute isn't valid JSON; using the default colours.`);return}}kw("metron-labs-quick-quote",Zs);kw("metron-labs-estimating-tools",uc);
6782
+ ${jb}`,this.shadowRoot.replaceChildren(i,n),this.root=(0,kw.createRoot)(n)}this.renderWidget()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||!this.root||(this.root.unmount(),this.root=null)})}attributeChangedCallback(){this.root&&this.renderWidget()}renderWidget(){let n=this.getAttribute("client")??void 0,i=this.getAttribute("api-key")??void 0;(!n||!i)&&console.error(`<${e}> needs client and api-key attributes.`);let o={apiBaseUrl:this.getAttribute("api-url")||Q_,client:n,apiKey:i,theme:X_(e,this.getAttribute("theme"))};this.root.render((0,Ld.jsx)(Od,{config:o,children:(0,Ld.jsx)(t,{hideHeader:this.hasAttribute("hide-header")})}))}},a.observedAttributes=Y_,a))}function X_(e,t){if(t)try{return JSON.parse(t)}catch{console.error(`<${e}> theme attribute isn't valid JSON; using the default colours.`);return}}Nw("metron-labs-quick-quote",Ks);Nw("metron-labs-estimating-tools",uc);
6771
6783
  /*! Bundled license information:
6772
6784
 
6773
6785
  scheduler/cjs/scheduler.production.js: