@metron-labs/quote-react 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/embed/quote.js
CHANGED
|
@@ -5,8 +5,8 @@ import{a as Aa,b as Y}from"./chunk-SQE76S5B.js";var Em=Aa(tt=>{"use strict";func
|
|
|
5
5
|
`);for(i=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;i<p.length&&!p[i].includes("DetermineComponentFrameRoot");)i++;if(r===c.length||i===p.length)for(r=c.length-1,i=p.length-1;1<=r&&0<=i&&c[r]!==p[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==p[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==p[i]){var m=`
|
|
6
6
|
`+c[r].replace(" at new "," at ");return e.displayName&&m.includes("<anonymous>")&&(m=m.replace("<anonymous>",e.displayName)),m}while(1<=r&&0<=i);break}}}finally{Kc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Jr(a):""}function H0(e,t){switch(e.tag){case 26:case 27:case 5:return Jr(e.type);case 16:return Jr("Lazy");case 13:return e.child!==t&&t!==null?Jr("Suspense Fallback"):Jr("Suspense");case 19:return Jr("SuspenseList");case 0:case 15:return Pc(e.type,!1);case 11:return Pc(e.type.render,!1);case 1:return Pc(e.type,!0);case 31:return Jr("Activity");default:return""}}function Fm(e){try{var t="",a=null;do t+=H0(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 Au=Object.prototype.hasOwnProperty,kp=bt.unstable_scheduleCallback,Jc=bt.unstable_cancelCallback,j0=bt.unstable_shouldYield,Q0=bt.unstable_requestPaint,na=bt.unstable_now,G0=bt.unstable_getCurrentPriorityLevel,qh=bt.unstable_ImmediatePriority,Eh=bt.unstable_UserBlockingPriority,rs=bt.unstable_NormalPriority,Y0=bt.unstable_LowPriority,Mh=bt.unstable_IdlePriority,$0=bt.log,V0=bt.unstable_setDisableYieldValue,jo=null,oa=null;function Sr(e){if(typeof $0=="function"&&V0(e),oa&&typeof oa.setStrictMode=="function")try{oa.setStrictMode(jo,e)}catch{}}var la=Math.clz32?Math.clz32:K0,X0=Math.log,Z0=Math.LN2;function K0(e){return e>>>=0,e===0?32:31-(X0(e)/Z0|0)|0}var xl=256,kl=262144,Sl=4194304;function Fr(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 Ms(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~n,r!==0?i=Fr(r):(o&=l,o!==0?i=Fr(o):a||(a=l&~e,a!==0&&(i=Fr(a))))):(l=r&~n,l!==0?i=Fr(l):o!==0?i=Fr(o):a||(a=r&~e,a!==0&&(i=Fr(a)))),i===0?0:t!==0&&t!==i&&(t&n)===0&&(n=i&-i,a=t&-t,n>=a||n===32&&(a&4194048)!==0)?t:i}function Qo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function P0(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 Th(){var e=Sl;return Sl<<=1,(Sl&62914560)===0&&(Sl=4194304),e}function Fc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Go(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function J0(e,t,a,r,i,n){var o=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var m=31-la(a),b=1<<m;l[m]=0,c[m]=-1;var f=p[m];if(f!==null)for(p[m]=null,m=0;m<f.length;m++){var w=f[m];w!==null&&(w.lane&=-536870913)}a&=~b}r!==0&&zh(e,r,0),n!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=n&~(o&~t))}function zh(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-la(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function Rh(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-la(a),i=1<<r;i&t|e[r]&t&&(e[r]|=t),a&=~i}}function Ah(e,t){var a=t&-t;return a=(a&42)!==0?1:Sp(a),(a&(e.suspendedLanes|t))!==0?0:a}function Sp(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 Np(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Uh(){var e=Ue.p;return e!==0?e:(e=window.event,e===void 0?32:rw(e.type))}function Im(e,t){var a=Ue.p;try{return Ue.p=e,t()}finally{Ue.p=a}}var Gr=Math.random().toString(36).slice(2),Et="__reactFiber$"+Gr,Pt="__reactProps$"+Gr,bn="__reactContainer$"+Gr,Uu="__reactEvents$"+Gr,F0="__reactListeners$"+Gr,I0="__reactHandles$"+Gr,Wm="__reactResources$"+Gr,Yo="__reactMarker$"+Gr;function Cp(e){delete e[Et],delete e[Pt],delete e[Uu],delete e[F0],delete e[I0]}function Gi(e){var t=e[Et];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[Et]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=sh(e);e!==null;){if(a=e[Et])return a;e=sh(e)}return t}e=a,a=e.parentNode}return null}function wn(e){if(e=e[Et]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function so(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Ii(e){var t=e[Wm];return t||(t=e[Wm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function _t(e){e[Yo]=!0}var Dh=new Set,Oh={};function ui(e,t){ln(e,t),ln(e+"Capture",t)}function ln(e,t){for(Oh[e]=t,e=0;e<t.length;e++)Dh.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]*$"),ef={},tf={};function ey(e){return Au.call(tf,e)?!0:Au.call(ef,e)?!1:W0.test(e)?tf[e]=!0:(ef[e]=!0,!1)}function Hl(e,t,a){if(ey(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 Nl(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 Za(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 Bh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ty(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){a=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(o){a=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Du(e){if(!e._valueTracker){var t=Bh(e)?"checked":"value";e._valueTracker=ty(e,t,""+e[t])}}function Lh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Bh(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function is(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 ay=/[\n"\\]/g;function ga(e){return e.replace(ay,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ou(e,t,a,r,i,n,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ma(t)):e.value!==""+ma(t)&&(e.value=""+ma(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Bu(e,o,ma(t)):a!=null?Bu(e,o,ma(a)):r!=null&&e.removeAttribute("value"),i==null&&n!=null&&(e.defaultChecked=!!n),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+ma(l):e.removeAttribute("name")}function Hh(e,t,a,r,i,n,o,l){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||a!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){Du(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??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Du(e)}function Bu(e,t,a){t==="number"&&is(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Wi(e,t,a,r){if(e=e.options,t){t={};for(var i=0;i<a.length;i++)t["$"+a[i]]=!0;for(a=0;a<e.length;a++)i=t.hasOwnProperty("$"+e[a].value),e[a].selected!==i&&(e[a].selected=i),i&&r&&(e[a].defaultSelected=!0)}else{for(a=""+ma(a),t=null,i=0;i<e.length;i++){if(e[i].value===a){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function jh(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 Qh(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(L(92));if(lo(r)){if(1<r.length)throw Error(L(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),Du(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 ry=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 af(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||ry.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Gh(e,t,a){if(t!=null&&typeof t!="object")throw Error(L(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&a[i]!==r&&af(e,i,r)}else for(var n in t)t.hasOwnProperty(n)&&af(e,n,t[n])}function qp(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 iy=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"]]),ny=/^[\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 jl(e){return ny.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function tr(){}var Lu=null;function Ep(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 rf(e){var t=wn(e);if(t&&(e=t.stateNode)){var a=e[Pt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ou(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="'+ga(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var i=r[Pt]||null;if(!i)throw Error(L(90));Ou(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Lh(r)}break e;case"textarea":jh(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Wi(e,!!a.multiple,t,!1)}}}var Ic=!1;function Yh(e,t,a){if(Ic)return e(t,a);Ic=!0;try{var r=e(t);return r}finally{if(Ic=!1,(Yi!==null||en!==null)&&(Qs(),Yi&&(t=Yi,e=en,en=Yi=null,rf(t),e)))for(t=0;t<e.length;t++)rf(e[t])}}function Co(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Pt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(L(231,t,typeof a));return a}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hu=!1;if(or)try{Di={},Object.defineProperty(Di,"passive",{get:function(){Hu=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{Hu=!1}var Di,Nr=null,Mp=null,Ql=null;function $h(){if(Ql)return Ql;var e,t=Mp,a=t.length,r,i="value"in Nr?Nr.value:Nr.textContent,n=i.length;for(e=0;e<a&&t[e]===i[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===i[n-r];r++);return Ql=i.slice(e,1<r?1-r:void 0)}function Gl(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 Cl(){return!0}function nf(){return!1}function Jt(e){function t(a,r,i,n,o){this._reactName=a,this._targetInst=i,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?Cl:nf,this.isPropagationStopped=nf,this}return et(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=Cl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),t}var pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ts=Jt(pi),$o=et({},pi,{view:0,detail:0}),oy=Jt($o),Wc,eu,eo,zs=et({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tp,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!==eo&&(eo&&e.type==="mousemove"?(Wc=e.screenX-eo.screenX,eu=e.screenY-eo.screenY):eu=Wc=0,eo=e),Wc)},movementY:function(e){return"movementY"in e?e.movementY:eu}}),of=Jt(zs),ly=et({},zs,{dataTransfer:0}),sy=Jt(ly),cy=et({},$o,{relatedTarget:0}),tu=Jt(cy),uy=et({},pi,{animationName:0,elapsedTime:0,pseudoElement:0}),py=Jt(uy),dy=et({},pi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),my=Jt(dy),fy=et({},pi,{data:0}),lf=Jt(fy),hy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gy={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"},by={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=by[e])?!!t[e]:!1}function Tp(){return wy}var vy=et({},$o,{key:function(e){if(e.key){var t=hy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tp,charCode:function(e){return e.type==="keypress"?Gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yy=Jt(vy),_y=et({},zs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sf=Jt(_y),xy=et({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tp}),ky=Jt(xy),Sy=et({},pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ny=Jt(Sy),Cy=et({},zs,{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}),qy=Jt(Cy),Ey=et({},pi,{newState:0,oldState:0}),My=Jt(Ey),Ty=[9,13,27,32],zp=or&&"CompositionEvent"in window,po=null;or&&"documentMode"in document&&(po=document.documentMode);var zy=or&&"TextEvent"in window&&!po,Vh=or&&(!zp||po&&8<po&&11>=po),cf=" ",uf=!1;function Xh(e,t){switch(e){case"keyup":return Ty.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $i=!1;function Ry(e,t){switch(e){case"compositionend":return Zh(t);case"keypress":return t.which!==32?null:(uf=!0,cf);case"textInput":return e=t.data,e===cf&&uf?null:e;default:return null}}function Ay(e,t){if($i)return e==="compositionend"||!zp&&Xh(e,t)?(e=$h(),Ql=Mp=Nr=null,$i=!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 Vh&&t.locale!=="ko"?null:t.data;default:return null}}var Uy={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 pf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Uy[e.type]:t==="textarea"}function Kh(e,t,a,r){Yi?en?en.push(r):en=[r]:Yi=r,t=xs(t,"onChange"),0<t.length&&(a=new Ts("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var mo=null,qo=null;function Dy(e){Yb(e,0)}function Rs(e){var t=so(e);if(Lh(t))return e}function df(e,t){if(e==="change")return t}var Ph=!1;or&&(or?(El="oninput"in document,El||(au=document.createElement("div"),au.setAttribute("oninput","return;"),El=typeof au.oninput=="function"),ql=El):ql=!1,Ph=ql&&(!document.documentMode||9<document.documentMode));var ql,El,au;function mf(){mo&&(mo.detachEvent("onpropertychange",Jh),qo=mo=null)}function Jh(e){if(e.propertyName==="value"&&Rs(qo)){var t=[];Kh(t,qo,e,Ep(e)),Yh(Dy,t)}}function Oy(e,t,a){e==="focusin"?(mf(),mo=t,qo=a,mo.attachEvent("onpropertychange",Jh)):e==="focusout"&&mf()}function By(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rs(qo)}function Ly(e,t){if(e==="click")return Rs(t)}function Hy(e,t){if(e==="input"||e==="change")return Rs(t)}function jy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ca=typeof Object.is=="function"?Object.is:jy;function Eo(e,t){if(ca(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var i=a[r];if(!Au.call(t,i)||!ca(e[i],t[i]))return!1}return!0}function ff(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hf(e,t){var a=ff(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=ff(a)}}function Fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ih(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=is(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=is(e.document)}return t}function Rp(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 Qy=or&&"documentMode"in document&&11>=document.documentMode,Vi=null,ju=null,fo=null,Qu=!1;function gf(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Qu||Vi==null||Vi!==is(r)||(r=Vi,"selectionStart"in r&&Rp(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}),fo&&Eo(fo,r)||(fo=r,r=xs(ju,"onSelect"),0<r.length&&(t=new Ts("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Vi)))}function Pr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Xi={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")},ru={},Wh={};or&&(Wh=document.createElement("div").style,"AnimationEvent"in window||(delete Xi.animationend.animation,delete Xi.animationiteration.animation,delete Xi.animationstart.animation),"TransitionEvent"in window||delete Xi.transitionend.transition);function di(e){if(ru[e])return ru[e];if(!Xi[e])return e;var t=Xi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Wh)return ru[e]=t[a];return e}var eg=di("animationend"),tg=di("animationiteration"),ag=di("animationstart"),Gy=di("transitionrun"),Yy=di("transitionstart"),$y=di("transitioncancel"),rg=di("transitionend"),ig=new Map,Gu="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(" ");Gu.push("scrollEnd");function Ta(e,t){ig.set(e,t),ui(t,[e])}var ns=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,Ap=0;function As(){for(var e=Zi,t=Ap=Zi=0;t<e;){var a=da[t];da[t++]=null;var r=da[t];da[t++]=null;var i=da[t];da[t++]=null;var n=da[t];if(da[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}n!==0&&ng(a,i,n)}}function Us(e,t,a,r){da[Zi++]=e,da[Zi++]=t,da[Zi++]=a,da[Zi++]=r,Ap|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Up(e,t,a,r){return Us(e,t,a,r),os(e)}function mi(e,t){return Us(e,null,null,t),os(e)}function ng(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var i=!1,n=e.return;n!==null;)n.childLanes|=a,r=n.alternate,r!==null&&(r.childLanes|=a),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(i=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,i&&t!==null&&(i=31-la(a),e=n.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=a|536870912),n):null}function os(e){if(50<ko)throw ko=0,cp=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ki={};function Vy(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(e,t,a,r){return new Vy(e,t,a,r)}function Dp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rr(e,t){var a=e.alternate;return a===null?(a=ra(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function og(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 Yl(e,t,a,r,i,n){var o=0;if(r=e,typeof e=="function")Dp(e)&&(o=1);else if(typeof e=="string")o=K1(e,a,La.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Mu:return e=ra(31,a,t,i),e.elementType=Mu,e.lanes=n,e;case ji:return ti(a.children,i,n,t);case Nh:o=8,i|=24;break;case Cu:return e=ra(12,a,t,i|2),e.elementType=Cu,e.lanes=n,e;case qu:return e=ra(13,a,t,i),e.elementType=qu,e.lanes=n,e;case Eu:return e=ra(19,a,t,i),e.elementType=Eu,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case er:o=10;break e;case Ch:o=9;break e;case _p:o=11;break e;case xp:o=14;break e;case wr:o=16,r=null;break e}o=29,a=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=ra(o,a,t,i),t.elementType=e,t.type=r,t.lanes=n,t}function ti(e,t,a,r){return e=ra(7,e,r,t),e.lanes=a,e}function iu(e,t,a){return e=ra(6,e,null,t),e.lanes=a,e}function lg(e){var t=ra(18,null,null,0);return t.stateNode=e,t}function nu(e,t,a){return t=ra(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var bf=new WeakMap;function ba(e,t){if(typeof e=="object"&&e!==null){var a=bf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Fm(t)},bf.set(e,t),t)}return{value:e,source:t,stack:Fm(t)}}var Pi=[],Ji=0,ls=null,Mo=0,fa=[],ha=0,Lr=null,Da=1,Oa="";function Ia(e,t){Pi[Ji++]=Mo,Pi[Ji++]=ls,ls=e,Mo=t}function sg(e,t,a){fa[ha++]=Da,fa[ha++]=Oa,fa[ha++]=Lr,Lr=e;var r=Da;e=Oa;var i=32-la(r)-1;r&=~(1<<i),a+=1;var n=32-la(t)+i;if(30<n){var o=i-i%5;n=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Da=1<<32-la(t)+i|a<<i|r,Oa=n+e}else Da=1<<n|a<<i|r,Oa=e}function Op(e){e.return!==null&&(Ia(e,1),sg(e,1,0))}function Bp(e){for(;e===ls;)ls=Pi[--Ji],Pi[Ji]=null,Mo=Pi[--Ji],Pi[Ji]=null;for(;e===Lr;)Lr=fa[--ha],fa[ha]=null,Oa=fa[--ha],fa[ha]=null,Da=fa[--ha],fa[ha]=null}function cg(e,t){fa[ha++]=Da,fa[ha++]=Oa,fa[ha++]=Lr,Da=t.id,Oa=t.overflow,Lr=e}var Mt=null,We=null,Ce=!1,Tr=null,wa=!1,Yu=Error(L(519));function Hr(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw To(ba(t,e)),Yu}function wf(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Et]=e,t[Pt]=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<Uo.length;a++)_e(Uo[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),Hh(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),Qh(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||Vb(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=tr),t=!0):t=!1,t||Hr(e,!0)}function vf(e){for(Mt=e.return;Mt;)switch(Mt.tag){case 5:case 31:case 13:wa=!1;return;case 27:case 3:wa=!0;return;default:Mt=Mt.return}}function Oi(e){if(e!==Mt)return!1;if(!Ce)return vf(e),Ce=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||fp(e.type,e.memoizedProps)),a=!a),a&&We&&Hr(e),vf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));We=lh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));We=lh(e)}else t===27?(t=We,Yr(e.type)?(e=wp,wp=null,We=e):We=t):We=Mt?ya(e.stateNode.nextSibling):null;return!0}function ni(){We=Mt=null,Ce=!1}function ou(){var e=Tr;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Tr=null),e}function To(e){Tr===null?Tr=[e]:Tr.push(e)}var $u=Ha(null),fi=null,ar=null;function yr(e,t,a){Pe($u,t._currentValue),t._currentValue=a}function ir(e){e._currentValue=$u.current,xt($u)}function Vu(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 Xu(e,t,a,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var n=i.dependencies;if(n!==null){var o=i.child;n=n.firstContext;e:for(;n!==null;){var l=n;n=i;for(var c=0;c<t.length;c++)if(l.context===t[c]){n.lanes|=a,l=n.alternate,l!==null&&(l.lanes|=a),Vu(n.return,a,e),r||(o=null);break e}n=l.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=a,n=o.alternate,n!==null&&(n.lanes|=a),Vu(o,a,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function vn(e,t,a,r){e=null;for(var i=t,n=!1;i!==null;){if(!n){if((i.flags&524288)!==0)n=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(L(387));if(o=o.memoizedProps,o!==null){var l=i.type;ca(i.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(i===es.current){if(o=i.alternate,o===null)throw Error(L(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Oo):e=[Oo])}i=i.return}e!==null&&Xu(t,e,a,r),t.flags|=262144}function ss(e){for(e=e.firstContext;e!==null;){if(!ca(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oi(e){fi=e,ar=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return ug(fi,e)}function Ml(e,t){return fi===null&&oi(e),ug(e,t)}function ug(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ar===null){if(e===null)throw Error(L(308));ar=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ar=ar.next=t;return a}var Xy=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()})}},Zy=bt.unstable_scheduleCallback,Ky=bt.unstable_NormalPriority,mt={$$typeof:er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lp(){return{controller:new Xy,data:new Map,refCount:0}}function Vo(e){e.refCount--,e.refCount===0&&Zy(Ky,function(){e.controller.abort()})}var ho=null,Zu=0,cn=0,tn=null;function Py(e,t){if(ho===null){var a=ho=[];Zu=0,cn=cd(),tn={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Zu++,t.then(yf,yf),t}function yf(){if(--Zu===0&&ho!==null){tn!==null&&(tn.status="fulfilled");var e=ho;ho=null,cn=0,tn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Jy(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(i){a.push(i)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var i=0;i<a.length;i++)(0,a[i])(t)},function(i){for(r.status="rejected",r.reason=i,i=0;i<a.length;i++)(0,a[i])(void 0)}),r}var _f=se.S;se.S=function(e,t){Sb=na(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Py(e,t),_f!==null&&_f(e,t)};var ai=Ha(null);function Hp(){var e=ai.current;return e!==null?e:$e.pooledCache}function $l(e,t){t===null?Pe(ai,ai.current):Pe(ai,t.pool)}function pg(){var e=Hp();return e===null?null:{parent:mt._currentValue,pool:e}}var yn=Error(L(460)),jp=Error(L(474)),Ds=Error(L(542)),cs={then:function(){}};function xf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dg(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(tr,tr),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sf(e),e;default:if(typeof t.status=="string")t.then(tr,tr);else{if(e=$e,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=r}},function(r){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sf(e),e}throw ri=t,yn}}function Ir(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ri=a,yn):a}}var ri=null;function kf(){if(ri===null)throw Error(L(459));var e=ri;return ri=null,e}function Sf(e){if(e===yn||e===Ds)throw Error(L(483))}var an=null,zo=0;function Tl(e){var t=zo;return zo+=1,an===null&&(an=[]),dg(an,e,t)}function to(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zl(e,t){throw t.$$typeof===O0?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function mg(e){function t(h,u){if(e){var g=h.deletions;g===null?(h.deletions=[u],h.flags|=16):g.push(u)}}function a(h,u){if(!e)return null;for(;u!==null;)t(h,u),u=u.sibling;return null}function r(h){for(var u=new Map;h!==null;)h.key!==null?u.set(h.key,h):u.set(h.index,h),h=h.sibling;return u}function i(h,u){return h=rr(h,u),h.index=0,h.sibling=null,h}function n(h,u,g){return h.index=g,e?(g=h.alternate,g!==null?(g=g.index,g<u?(h.flags|=67108866,u):g):(h.flags|=67108866,u)):(h.flags|=1048576,u)}function o(h){return e&&h.alternate===null&&(h.flags|=67108866),h}function l(h,u,g,v){return u===null||u.tag!==6?(u=iu(g,h.mode,v),u.return=h,u):(u=i(u,g),u.return=h,u)}function c(h,u,g,v){var N=g.type;return N===ji?m(h,u,g.props.children,v,g.key):u!==null&&(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===wr&&Ir(N)===u.type)?(u=i(u,g.props),to(u,g),u.return=h,u):(u=Yl(g.type,g.key,g.props,null,h.mode,v),to(u,g),u.return=h,u)}function p(h,u,g,v){return u===null||u.tag!==4||u.stateNode.containerInfo!==g.containerInfo||u.stateNode.implementation!==g.implementation?(u=nu(g,h.mode,v),u.return=h,u):(u=i(u,g.children||[]),u.return=h,u)}function m(h,u,g,v,N){return u===null||u.tag!==7?(u=ti(g,h.mode,v,N),u.return=h,u):(u=i(u,g),u.return=h,u)}function b(h,u,g){if(typeof u=="string"&&u!==""||typeof u=="number"||typeof u=="bigint")return u=iu(""+u,h.mode,g),u.return=h,u;if(typeof u=="object"&&u!==null){switch(u.$$typeof){case _l:return g=Yl(u.type,u.key,u.props,null,h.mode,g),to(g,u),g.return=h,g;case oo:return u=nu(u,h.mode,g),u.return=h,u;case wr:return u=Ir(u),b(h,u,g)}if(lo(u)||Wn(u))return u=ti(u,h.mode,g,null),u.return=h,u;if(typeof u.then=="function")return b(h,Tl(u),g);if(u.$$typeof===er)return b(h,Ml(h,u),g);zl(h,u)}return null}function f(h,u,g,v){var N=u!==null?u.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return N!==null?null:l(h,u,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case _l:return g.key===N?c(h,u,g,v):null;case oo:return g.key===N?p(h,u,g,v):null;case wr:return g=Ir(g),f(h,u,g,v)}if(lo(g)||Wn(g))return N!==null?null:m(h,u,g,v,null);if(typeof g.then=="function")return f(h,u,Tl(g),v);if(g.$$typeof===er)return f(h,u,Ml(h,g),v);zl(h,g)}return null}function w(h,u,g,v,N){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return h=h.get(g)||null,l(u,h,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case _l:return h=h.get(v.key===null?g:v.key)||null,c(u,h,v,N);case oo:return h=h.get(v.key===null?g:v.key)||null,p(u,h,v,N);case wr:return v=Ir(v),w(h,u,g,v,N)}if(lo(v)||Wn(v))return h=h.get(g)||null,m(u,h,v,N,null);if(typeof v.then=="function")return w(h,u,g,Tl(v),N);if(v.$$typeof===er)return w(h,u,g,Ml(u,v),N);zl(u,v)}return null}function _(h,u,g,v){for(var N=null,R=null,T=u,U=u=0,A=null;T!==null&&U<g.length;U++){T.index>U?(A=T,T=null):A=T.sibling;var B=f(h,T,g[U],v);if(B===null){T===null&&(T=A);break}e&&T&&B.alternate===null&&t(h,T),u=n(B,u,U),R===null?N=B:R.sibling=B,R=B,T=A}if(U===g.length)return a(h,T),Ce&&Ia(h,U),N;if(T===null){for(;U<g.length;U++)T=b(h,g[U],v),T!==null&&(u=n(T,u,U),R===null?N=T:R.sibling=T,R=T);return Ce&&Ia(h,U),N}for(T=r(T);U<g.length;U++)A=w(T,h,U,g[U],v),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?U:A.key),u=n(A,u,U),R===null?N=A:R.sibling=A,R=A);return e&&T.forEach(function(ie){return t(h,ie)}),Ce&&Ia(h,U),N}function E(h,u,g,v){if(g==null)throw Error(L(151));for(var N=null,R=null,T=u,U=u=0,A=null,B=g.next();T!==null&&!B.done;U++,B=g.next()){T.index>U?(A=T,T=null):A=T.sibling;var ie=f(h,T,B.value,v);if(ie===null){T===null&&(T=A);break}e&&T&&ie.alternate===null&&t(h,T),u=n(ie,u,U),R===null?N=ie:R.sibling=ie,R=ie,T=A}if(B.done)return a(h,T),Ce&&Ia(h,U),N;if(T===null){for(;!B.done;U++,B=g.next())B=b(h,B.value,v),B!==null&&(u=n(B,u,U),R===null?N=B:R.sibling=B,R=B);return Ce&&Ia(h,U),N}for(T=r(T);!B.done;U++,B=g.next())B=w(T,h,U,B.value,v),B!==null&&(e&&B.alternate!==null&&T.delete(B.key===null?U:B.key),u=n(B,u,U),R===null?N=B:R.sibling=B,R=B);return e&&T.forEach(function(ze){return t(h,ze)}),Ce&&Ia(h,U),N}function D(h,u,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 _l:e:{for(var N=g.key;u!==null;){if(u.key===N){if(N=g.type,N===ji){if(u.tag===7){a(h,u.sibling),v=i(u,g.props.children),v.return=h,h=v;break e}}else if(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===wr&&Ir(N)===u.type){a(h,u.sibling),v=i(u,g.props),to(v,g),v.return=h,h=v;break e}a(h,u);break}else t(h,u);u=u.sibling}g.type===ji?(v=ti(g.props.children,h.mode,v,g.key),v.return=h,h=v):(v=Yl(g.type,g.key,g.props,null,h.mode,v),to(v,g),v.return=h,h=v)}return o(h);case oo:e:{for(N=g.key;u!==null;){if(u.key===N)if(u.tag===4&&u.stateNode.containerInfo===g.containerInfo&&u.stateNode.implementation===g.implementation){a(h,u.sibling),v=i(u,g.children||[]),v.return=h,h=v;break e}else{a(h,u);break}else t(h,u);u=u.sibling}v=nu(g,h.mode,v),v.return=h,h=v}return o(h);case wr:return g=Ir(g),D(h,u,g,v)}if(lo(g))return _(h,u,g,v);if(Wn(g)){if(N=Wn(g),typeof N!="function")throw Error(L(150));return g=N.call(g),E(h,u,g,v)}if(typeof g.then=="function")return D(h,u,Tl(g),v);if(g.$$typeof===er)return D(h,u,Ml(h,g),v);zl(h,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,u!==null&&u.tag===6?(a(h,u.sibling),v=i(u,g),v.return=h,h=v):(a(h,u),v=iu(g,h.mode,v),v.return=h,h=v),o(h)):a(h,u)}return function(h,u,g,v){try{zo=0;var N=D(h,u,g,v);return an=null,N}catch(T){if(T===yn||T===Ds)throw T;var R=ra(29,T,null,h.mode);return R.lanes=v,R.return=h,R}}}var li=mg(!0),fg=mg(!1),vr=!1;function Qp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ku(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 zr(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 i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=os(e),ng(e,null,a),t}return Us(e,r,t,a),os(e)}function go(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,Rh(e,a)}}function lu(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var i=null,n=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};n===null?i=n=o:n=n.next=o,a=a.next}while(a!==null);n===null?i=n=t:n=n.next=t}else i=n=t;a={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:n,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Pu=!1;function bo(){if(Pu){var e=tn;if(e!==null)throw e}}function wo(e,t,a,r){Pu=!1;var i=e.updateQueue;vr=!1;var n=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,p=c.next;c.next=null,o===null?n=p:o.next=p,o=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==o&&(l===null?m.firstBaseUpdate=p:l.next=p,m.lastBaseUpdate=c))}if(n!==null){var b=i.baseState;o=0,m=p=c=null,l=n;do{var f=l.lane&-536870913,w=f!==l.lane;if(w?(Se&f)===f:(r&f)===f){f!==0&&f===cn&&(Pu=!0),m!==null&&(m=m.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var _=e,E=l;f=t;var D=a;switch(E.tag){case 1:if(_=E.payload,typeof _=="function"){b=_.call(D,b,f);break e}b=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=E.payload,f=typeof _=="function"?_.call(D,b,f):_,f==null)break e;b=et({},b,f);break e;case 2:vr=!0}}f=l.callback,f!==null&&(e.flags|=64,w&&(e.flags|=8192),w=i.callbacks,w===null?i.callbacks=[f]:w.push(f))}else w={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(p=m=w,c=b):m=m.next=w,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;w=l,l=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);m===null&&(c=b),i.baseState=c,i.firstBaseUpdate=p,i.lastBaseUpdate=m,n===null&&(i.shared.lanes=0),Qr|=o,e.lanes=o,e.memoizedState=b}}function hg(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function gg(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hg(a[e],t)}var un=Ha(null),us=Ha(0);function Nf(e,t){e=ur,Pe(us,e),Pe(un,t),ur=e|t.baseLanes}function Ju(){Pe(us,ur),Pe(un,un.current)}function Gp(){ur=us.current,xt(un),xt(us)}var ua=Ha(null),va=null;function _r(e){var t=e.alternate;Pe(st,st.current&1),Pe(ua,e),va===null&&(t===null||un.current!==null||t.memoizedState!==null)&&(va=e)}function Fu(e){Pe(st,st.current),Pe(ua,e),va===null&&(va=e)}function bg(e){e.tag===22?(Pe(st,st.current),Pe(ua,e),va===null&&(va=e)):xr(e)}function xr(){Pe(st,st.current),Pe(ua,ua.current)}function aa(e){xt(ua),va===e&&(va=null),xt(st)}var st=Ha(0);function ps(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||gp(a)||bp(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 lr=0,de=null,Ge=null,pt=null,ds=!1,rn=!1,si=!1,ms=0,Ro=0,nn=null,Fy=0;function nt(){throw Error(L(321))}function Yp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!ca(e[a],t[a]))return!1;return!0}function $p(e,t,a,r,i,n){return lr=n,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,se.H=e===null||e.memoizedState===null?Kg:td,si=!1,n=a(r,i),si=!1,rn&&(n=vg(t,a,r,i)),wg(e),n}function wg(e){se.H=Ao;var t=Ge!==null&&Ge.next!==null;if(lr=0,pt=Ge=de=null,ds=!1,Ro=0,nn=null,t)throw Error(L(300));e===null||ft||(e=e.dependencies,e!==null&&ss(e)&&(ft=!0))}function vg(e,t,a,r){de=e;var i=0;do{if(rn&&(nn=null),Ro=0,rn=!1,25<=i)throw Error(L(301));if(i+=1,pt=Ge=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}se.H=Pg,n=t(a,r)}while(rn);return n}function Iy(){var e=se.H,t=e.useState()[0];return t=typeof t.then=="function"?Xo(t):t,e=e.useState()[0],(Ge!==null?Ge.memoizedState:null)!==e&&(de.flags|=1024),t}function Vp(){var e=ms!==0;return ms=0,e}function Xp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Zp(e){if(ds){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ds=!1}lr=0,pt=Ge=de=null,rn=!1,Ro=ms=0,nn=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?de.memoizedState=pt=e:pt=pt.next=e,pt}function ct(){if(Ge===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=Ge.next;var t=pt===null?de.memoizedState:pt.next;if(t!==null)pt=t,Ge=e;else{if(e===null)throw de.alternate===null?Error(L(467)):Error(L(310));Ge=e,e={memoizedState:Ge.memoizedState,baseState:Ge.baseState,baseQueue:Ge.baseQueue,queue:Ge.queue,next:null},pt===null?de.memoizedState=pt=e:pt=pt.next=e}return pt}function Os(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(e){var t=Ro;return Ro+=1,nn===null&&(nn=[]),e=dg(nn,e,t),t=de,(pt===null?t.memoizedState:pt.next)===null&&(t=t.alternate,se.H=t===null||t.memoizedState===null?Kg:td),e}function Bs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xo(e);if(e.$$typeof===er)return Tt(e)}throw Error(L(438,String(e)))}function Kp(e){var t=null,a=de.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=de.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Os(),de.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=B0;return t.index++,a}function sr(e,t){return typeof t=="function"?t(e):t}function Vl(e){var t=ct();return Pp(t,Ge,e)}function Pp(e,t,a){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=a;var i=e.baseQueue,n=r.pending;if(n!==null){if(i!==null){var o=i.next;i.next=n.next,n.next=o}t.baseQueue=i=n,r.pending=null}if(n=e.baseState,i===null)e.memoizedState=n;else{t=i.next;var l=o=null,c=null,p=t,m=!1;do{var b=p.lane&-536870913;if(b!==p.lane?(Se&b)===b:(lr&b)===b){var f=p.revertLane;if(f===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),b===cn&&(m=!0);else if((lr&f)===f){p=p.next,f===cn&&(m=!0);continue}else b={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=b,o=n):c=c.next=b,de.lanes|=f,Qr|=f;b=p.action,si&&a(n,b),n=p.hasEagerState?p.eagerState:a(n,b)}else f={lane:b,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=f,o=n):c=c.next=f,de.lanes|=b,Qr|=b;p=p.next}while(p!==null&&p!==t);if(c===null?o=n:c.next=l,!ca(n,e.memoizedState)&&(ft=!0,m&&(a=tn,a!==null)))throw a;e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function su(e){var t=ct(),a=t.queue;if(a===null)throw Error(L(311));a.lastRenderedReducer=e;var r=a.dispatch,i=a.pending,n=t.memoizedState;if(i!==null){a.pending=null;var o=i=i.next;do n=e(n,o.action),o=o.next;while(o!==i);ca(n,t.memoizedState)||(ft=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),a.lastRenderedState=n}return[n,r]}function yg(e,t,a){var r=de,i=ct(),n=Ce;if(n){if(a===void 0)throw Error(L(407));a=a()}else a=t();var o=!ca((Ge||i).memoizedState,a);if(o&&(i.memoizedState=a,ft=!0),i=i.queue,Jp(kg.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||pt!==null&&pt.memoizedState.tag&1){if(r.flags|=2048,pn(9,{destroy:void 0},xg.bind(null,r,i,a,t),null),$e===null)throw Error(L(349));n||(lr&127)!==0||_g(r,t,a)}return a}function _g(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=de.updateQueue,t===null?(t=Os(),de.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function xg(e,t,a,r){t.value=a,t.getSnapshot=r,Sg(t)&&Ng(e)}function kg(e,t,a){return a(function(){Sg(t)&&Ng(e)})}function Sg(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!ca(e,a)}catch{return!0}}function Ng(e){var t=mi(e,2);t!==null&&Kt(t,e,2)}function Iu(e){var t=jt();if(typeof e=="function"){var a=e;if(e=a(),si){Sr(!0);try{a()}finally{Sr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:e},t}function Cg(e,t,a,r){return e.baseState=a,Pp(e,Ge,typeof r=="function"?r:sr)}function Wy(e,t,a,r,i){if(Hs(e))throw Error(L(485));if(e=t.action,e!==null){var n={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){n.listeners.push(o)}};se.T!==null?a(!0):n.isTransition=!1,r(n),a=t.pending,a===null?(n.next=t.pending=n,qg(t,n)):(n.next=a.next,t.pending=a.next=n)}}function qg(e,t){var a=t.action,r=t.payload,i=e.state;if(t.isTransition){var n=se.T,o={};se.T=o;try{var l=a(i,r),c=se.S;c!==null&&c(o,l),Cf(e,t,l)}catch(p){Wu(e,t,p)}finally{n!==null&&o.types!==null&&(n.types=o.types),se.T=n}}else try{n=a(i,r),Cf(e,t,n)}catch(p){Wu(e,t,p)}}function Cf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){qf(e,t,r)},function(r){return Wu(e,t,r)}):qf(e,t,a)}function qf(e,t,a){t.status="fulfilled",t.value=a,Eg(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,qg(e,a)))}function Wu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,Eg(t),t=t.next;while(t!==r)}e.action=null}function Eg(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mg(e,t){return t}function Ef(e,t){if(Ce){var a=$e.formState;if(a!==null){e:{var r=de;if(Ce){if(We){t:{for(var i=We,n=wa;i.nodeType!==8;){if(!n){i=null;break t}if(i=ya(i.nextSibling),i===null){i=null;break t}}n=i.data,i=n==="F!"||n==="F"?i:null}if(i){We=ya(i.nextSibling),r=i.data==="F!";break e}}Hr(r)}r=!1}r&&(t=a[0])}}return a=jt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mg,lastRenderedState:t},a.queue=r,a=Vg.bind(null,de,r),r.dispatch=a,r=Iu(!1),n=ed.bind(null,de,!1,r.queue),r=jt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,a=Wy.bind(null,de,i,n,a),i.dispatch=a,r.memoizedState=e,[t,a,!1]}function Mf(e){var t=ct();return Tg(t,Ge,e)}function Tg(e,t,a){if(t=Pp(e,t,Mg)[0],e=Vl(sr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Xo(t)}catch(o){throw o===yn?Ds:o}else r=t;t=ct();var i=t.queue,n=i.dispatch;return a!==t.memoizedState&&(de.flags|=2048,pn(9,{destroy:void 0},e1.bind(null,i,a),null)),[r,n,e]}function e1(e,t){e.action=t}function Tf(e){var t=ct(),a=Ge;if(a!==null)return Tg(t,a,e);ct(),t=t.memoizedState,a=ct();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=de.updateQueue,t===null&&(t=Os(),de.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 zg(){return ct().memoizedState}function Xl(e,t,a,r){var i=jt();de.flags|=e,i.memoizedState=pn(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ls(e,t,a,r){var i=ct();r=r===void 0?null:r;var n=i.memoizedState.inst;Ge!==null&&r!==null&&Yp(r,Ge.memoizedState.deps)?i.memoizedState=pn(t,n,a,r):(de.flags|=e,i.memoizedState=pn(1|t,n,a,r))}function zf(e,t){Xl(8390656,8,e,t)}function Jp(e,t){Ls(2048,8,e,t)}function t1(e){de.flags|=4;var t=de.updateQueue;if(t===null)t=Os(),de.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Rg(e){var t=ct().memoizedState;return t1({ref:t,nextImpl:e}),function(){if((Ae&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function Ag(e,t){return Ls(4,2,e,t)}function Ug(e,t){return Ls(4,4,e,t)}function Dg(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 Og(e,t,a){a=a!=null?a.concat([e]):null,Ls(4,4,Dg.bind(null,t,e),a)}function Fp(){}function Bg(e,t){var a=ct();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Yp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Lg(e,t){var a=ct();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Yp(t,r[1]))return r[0];if(r=e(),si){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r}function Ip(e,t,a){return a===void 0||(lr&1073741824)!==0&&(Se&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Cb(),de.lanes|=e,Qr|=e,a)}function Hg(e,t,a,r){return ca(a,t)?a:un.current!==null?(e=Ip(e,a,r),ca(e,t)||(ft=!0),e):(lr&42)===0||(lr&1073741824)!==0&&(Se&261930)===0?(ft=!0,e.memoizedState=a):(e=Cb(),de.lanes|=e,Qr|=e,t)}function jg(e,t,a,r,i){var n=Ue.p;Ue.p=n!==0&&8>n?n:8;var o=se.T,l={};se.T=l,ed(e,!1,t,a);try{var c=i(),p=se.S;if(p!==null&&p(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var m=Jy(c,r);vo(e,t,m,sa(e))}else vo(e,t,r,sa(e))}catch(b){vo(e,t,{then:function(){},status:"rejected",reason:b},sa())}finally{Ue.p=n,o!==null&&l.types!==null&&(o.types=l.types),se.T=o}}function a1(){}function ep(e,t,a,r){if(e.tag!==5)throw Error(L(476));var i=Qg(e).queue;jg(e,i,t,ei,a===null?a1:function(){return Gg(e),a(r)})}function Qg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ei,baseState:ei,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:ei},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gg(e){var t=Qg(e);t.next===null&&(t=e.alternate.memoizedState),vo(e,t.next.queue,{},sa())}function Wp(){return Tt(Oo)}function Yg(){return ct().memoizedState}function $g(){return ct().memoizedState}function r1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=sa();e=zr(a);var r=Rr(t,e,a);r!==null&&(Kt(r,t,a),go(r,t,a)),t={cache:Lp()},e.payload=t;return}t=t.return}}function i1(e,t,a){var r=sa();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Hs(e)?Xg(t,a):(a=Up(e,t,a,r),a!==null&&(Kt(a,e,r),Zg(a,t,r)))}function Vg(e,t,a){var r=sa();vo(e,t,a,r)}function vo(e,t,a,r){var i={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Hs(e))Xg(t,i);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,a);if(i.hasEagerState=!0,i.eagerState=l,ca(l,o))return Us(e,t,i,0),$e===null&&As(),!1}catch{}if(a=Up(e,t,i,r),a!==null)return Kt(a,e,r),Zg(a,t,r),!0}return!1}function ed(e,t,a,r){if(r={lane:2,revertLane:cd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Hs(e)){if(t)throw Error(L(479))}else t=Up(e,a,r,2),t!==null&&Kt(t,e,2)}function Hs(e){var t=e.alternate;return e===de||t!==null&&t===de}function Xg(e,t){rn=ds=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Zg(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Rh(e,a)}}var Ao={readContext:Tt,use:Bs,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useLayoutEffect:nt,useInsertionEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useSyncExternalStore:nt,useId:nt,useHostTransitionStatus:nt,useFormState:nt,useActionState:nt,useOptimistic:nt,useMemoCache:nt,useCacheRefresh:nt};Ao.useEffectEvent=nt;var Kg={readContext:Tt,use:Bs,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:zf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Xl(4194308,4,Dg.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Xl(4194308,4,e,t)},useInsertionEffect:function(e,t){Xl(4,2,e,t)},useMemo:function(e,t){var a=jt();t=t===void 0?null:t;var r=e();if(si){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=jt();if(a!==void 0){var i=a(t);if(si){Sr(!0);try{a(t)}finally{Sr(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=i1.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Iu(e);var t=e.queue,a=Vg.bind(null,de,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Fp,useDeferredValue:function(e,t){var a=jt();return Ip(a,e,t)},useTransition:function(){var e=Iu(!1);return e=jg.bind(null,de,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=de,i=jt();if(Ce){if(a===void 0)throw Error(L(407));a=a()}else{if(a=t(),$e===null)throw Error(L(349));(Se&127)!==0||_g(r,t,a)}i.memoizedState=a;var n={value:a,getSnapshot:t};return i.queue=n,zf(kg.bind(null,r,n,e),[e]),r.flags|=2048,pn(9,{destroy:void 0},xg.bind(null,r,n,a,t),null),a},useId:function(){var e=jt(),t=$e.identifierPrefix;if(Ce){var a=Oa,r=Da;a=(r&~(1<<32-la(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ms++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Fy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Wp,useFormState:Ef,useActionState:Ef,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=ed.bind(null,de,!0,a),a.dispatch=t,[e,t]},useMemoCache:Kp,useCacheRefresh:function(){return jt().memoizedState=r1.bind(null,de)},useEffectEvent:function(e){var t=jt(),a={impl:e};return t.memoizedState=a,function(){if((Ae&2)!==0)throw Error(L(440));return a.impl.apply(void 0,arguments)}}},td={readContext:Tt,use:Bs,useCallback:Bg,useContext:Tt,useEffect:Jp,useImperativeHandle:Og,useInsertionEffect:Ag,useLayoutEffect:Ug,useMemo:Lg,useReducer:Vl,useRef:zg,useState:function(){return Vl(sr)},useDebugValue:Fp,useDeferredValue:function(e,t){var a=ct();return Hg(a,Ge.memoizedState,e,t)},useTransition:function(){var e=Vl(sr)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:yg,useId:Yg,useHostTransitionStatus:Wp,useFormState:Mf,useActionState:Mf,useOptimistic:function(e,t){var a=ct();return Cg(a,Ge,e,t)},useMemoCache:Kp,useCacheRefresh:$g};td.useEffectEvent=Rg;var Pg={readContext:Tt,use:Bs,useCallback:Bg,useContext:Tt,useEffect:Jp,useImperativeHandle:Og,useInsertionEffect:Ag,useLayoutEffect:Ug,useMemo:Lg,useReducer:su,useRef:zg,useState:function(){return su(sr)},useDebugValue:Fp,useDeferredValue:function(e,t){var a=ct();return Ge===null?Ip(a,e,t):Hg(a,Ge.memoizedState,e,t)},useTransition:function(){var e=su(sr)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:yg,useId:Yg,useHostTransitionStatus:Wp,useFormState:Tf,useActionState:Tf,useOptimistic:function(e,t){var a=ct();return Ge!==null?Cg(a,Ge,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Kp,useCacheRefresh:$g};Pg.useEffectEvent=Rg;function cu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:et({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var tp={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=sa(),i=zr(r);i.payload=t,a!=null&&(i.callback=a),t=Rr(e,i,r),t!==null&&(Kt(t,e,r),go(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=sa(),i=zr(r);i.tag=1,i.payload=t,a!=null&&(i.callback=a),t=Rr(e,i,r),t!==null&&(Kt(t,e,r),go(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=sa(),r=zr(a);r.tag=2,t!=null&&(r.callback=t),t=Rr(e,r,a),t!==null&&(Kt(t,e,a),go(t,e,a))}};function Rf(e,t,a,r,i,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!Eo(a,r)||!Eo(i,n):!0}function Af(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&&tp.enqueueReplaceState(t,t.state,null)}function ci(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=et({},a));for(var i in e)a[i]===void 0&&(a[i]=e[i])}return a}function Jg(e){ns(e)}function Fg(e){console.error(e)}function Ig(e){ns(e)}function fs(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(i){setTimeout(function(){throw i})}}function ap(e,t,a){return a=zr(a),a.tag=3,a.payload={element:null},a.callback=function(){fs(e,t)},a}function Wg(e){return e=zr(e),e.tag=3,e}function eb(e,t,a,r){var i=a.type.getDerivedStateFromError;if(typeof i=="function"){var n=r.value;e.payload=function(){return i(n)},e.callback=function(){Uf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Uf(t,a,r),typeof i!="function"&&(Ar===null?Ar=new Set([this]):Ar.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function n1(e,t,a,r,i){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&vn(t,a,i,!0),a=ua.current,a!==null){switch(a.tag){case 31:case 13:return va===null?vs():a.alternate===null&&ot===0&&(ot=3),a.flags&=-257,a.flags|=65536,a.lanes=i,r===cs?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),yu(e,r,i)),!1;case 22:return a.flags|=65536,r===cs?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)),yu(e,r,i)),!1}throw Error(L(435,a.tag))}return yu(e,r,i),vs(),!1}if(Ce)return t=ua.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Yu&&(e=Error(L(422),{cause:r}),To(ba(e,a)))):(r!==Yu&&(t=Error(L(423),{cause:r}),To(ba(t,a))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ba(r,a),i=ap(e.stateNode,r,i),lu(e,i),ot!==4&&(ot=2)),!1;var n=Error(L(520),{cause:r});if(n=ba(n,a),xo===null?xo=[n]:xo.push(n),ot!==4&&(ot=2),t===null)return!0;r=ba(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=i&-i,a.lanes|=e,e=ap(a.stateNode,r,e),lu(a,e),!1;case 1:if(t=a.type,n=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(Ar===null||!Ar.has(n))))return a.flags|=65536,i&=-i,a.lanes|=i,i=Wg(i),eb(i,e,a,r),lu(a,i),!1}a=a.return}while(a!==null);return!1}var ad=Error(L(461)),ft=!1;function qt(e,t,a,r){t.child=e===null?fg(t,null,a,r):li(t,e.child,a,r)}function Df(e,t,a,r,i){a=a.render;var n=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return oi(t),r=$p(e,t,a,o,n,i),l=Vp(),e!==null&&!ft?(Xp(e,t,i),cr(e,t,i)):(Ce&&l&&Op(t),t.flags|=1,qt(e,t,r,i),t.child)}function Of(e,t,a,r,i){if(e===null){var n=a.type;return typeof n=="function"&&!Dp(n)&&n.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=n,tb(e,t,n,r,i)):(e=Yl(a.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!rd(e,i)){var o=n.memoizedProps;if(a=a.compare,a=a!==null?a:Eo,a(o,r)&&e.ref===t.ref)return cr(e,t,i)}return t.flags|=1,e=rr(n,r),e.ref=t.ref,e.return=t,t.child=e}function tb(e,t,a,r,i){if(e!==null){var n=e.memoizedProps;if(Eo(n,r)&&e.ref===t.ref)if(ft=!1,t.pendingProps=r=n,rd(e,i))(e.flags&131072)!==0&&(ft=!0);else return t.lanes=e.lanes,cr(e,t,i)}return rp(e,t,a,r,i)}function ab(e,t,a,r){var i=r.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(n=n!==null?n.baseLanes|a:a,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~n}else r=0,t.child=null;return Bf(e,t,n,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$l(t,n!==null?n.cachePool:null),n!==null?Nf(t,n):Ju(),bg(t);else return r=t.lanes=536870912,Bf(e,t,n!==null?n.baseLanes|a:a,a,r)}else n!==null?($l(t,n.cachePool),Nf(t,n),xr(t),t.memoizedState=null):(e!==null&&$l(t,null),Ju(),xr(t));return qt(e,t,i,a),t.child}function co(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bf(e,t,a,r,i){var n=Hp();return n=n===null?null:{parent:mt._currentValue,pool:n},t.memoizedState={baseLanes:a,cachePool:n},e!==null&&$l(t,null),Ju(),bg(t),e!==null&&vn(e,t,r,!0),t.childLanes=i,null}function Zl(e,t){return t=hs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lf(e,t,a){return li(t,e.child,null,a),e=Zl(t,t.pendingProps),e.flags|=2,aa(t),t.memoizedState=null,e}function o1(e,t,a){var r=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(r.mode==="hidden")return e=Zl(t,r),t.lanes=536870912,co(null,e);if(Fu(t),(e=We)?(e=Kb(e,wa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Lr!==null?{id:Da,overflow:Oa}:null,retryLane:536870912,hydrationErrors:null},a=lg(e),a.return=t,t.child=a,Mt=t,We=null)):e=null,e===null)throw Hr(t);return t.lanes=536870912,null}return Zl(t,r)}var n=e.memoizedState;if(n!==null){var o=n.dehydrated;if(Fu(t),i)if(t.flags&256)t.flags&=-257,t=Lf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(ft||vn(e,t,a,!1),i=(a&e.childLanes)!==0,ft||i){if(r=$e,r!==null&&(o=Ah(r,a),o!==0&&o!==n.retryLane))throw n.retryLane=o,mi(e,o),Kt(r,e,o),ad;vs(),t=Lf(e,t,a)}else e=n.treeContext,We=ya(o.nextSibling),Mt=t,Ce=!0,Tr=null,wa=!1,e!==null&&cg(t,e),t=Zl(t,r),t.flags|=4096;return t}return e=rr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(L(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function rp(e,t,a,r,i){return oi(t),a=$p(e,t,a,r,void 0,i),r=Vp(),e!==null&&!ft?(Xp(e,t,i),cr(e,t,i)):(Ce&&r&&Op(t),t.flags|=1,qt(e,t,a,i),t.child)}function Hf(e,t,a,r,i,n){return oi(t),t.updateQueue=null,a=vg(t,r,a,i),wg(e),r=Vp(),e!==null&&!ft?(Xp(e,t,n),cr(e,t,n)):(Ce&&r&&Op(t),t.flags|=1,qt(e,t,a,n),t.child)}function jf(e,t,a,r,i){if(oi(t),t.stateNode===null){var n=Ki,o=a.contextType;typeof o=="object"&&o!==null&&(n=Tt(o)),n=new a(r,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=tp,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=r,n.state=t.memoizedState,n.refs={},Qp(t),o=a.contextType,n.context=typeof o=="object"&&o!==null?Tt(o):Ki,n.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(cu(t,a,o,r),n.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(o=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),o!==n.state&&tp.enqueueReplaceState(n,n.state,null),wo(t,r,n,i),bo(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){n=t.stateNode;var l=t.memoizedProps,c=ci(a,l);n.props=c;var p=n.context,m=a.contextType;o=Ki,typeof m=="object"&&m!==null&&(o=Tt(m));var b=a.getDerivedStateFromProps;m=typeof b=="function"||typeof n.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,m||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l||p!==o)&&Af(t,n,r,o),vr=!1;var f=t.memoizedState;n.state=f,wo(t,r,n,i),bo(),p=t.memoizedState,l||f!==p||vr?(typeof b=="function"&&(cu(t,a,b,r),p=t.memoizedState),(c=vr||Rf(t,a,c,r,f,p,o))?(m||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),n.props=r,n.state=p,n.context=o,r=c):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{n=t.stateNode,Ku(e,t),o=t.memoizedProps,m=ci(a,o),n.props=m,b=t.pendingProps,f=n.context,p=a.contextType,c=Ki,typeof p=="object"&&p!==null&&(c=Tt(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(o!==b||f!==c)&&Af(t,n,r,c),vr=!1,f=t.memoizedState,n.state=f,wo(t,r,n,i),bo();var w=t.memoizedState;o!==b||f!==w||vr||e!==null&&e.dependencies!==null&&ss(e.dependencies)?(typeof l=="function"&&(cu(t,a,l,r),w=t.memoizedState),(m=vr||Rf(t,a,m,r,f,w,c)||e!==null&&e.dependencies!==null&&ss(e.dependencies))?(p||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(r,w,c),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(r,w,c)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),n.props=r,n.state=w,n.context=c,r=m):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return n=r,Kl(e,t),r=(t.flags&128)!==0,n||r?(n=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&r?(t.child=li(t,e.child,null,i),t.child=li(t,null,a,i)):qt(e,t,a,i),t.memoizedState=n.state,e=t.child):e=cr(e,t,i),e}function Qf(e,t,a,r){return ni(),t.flags|=256,qt(e,t,a,r),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pu(e){return{baseLanes:e,cachePool:pg()}}function du(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ia),e}function rb(e,t,a){var r=t.pendingProps,i=!1,n=(t.flags&128)!==0,o;if((o=n)||(o=e!==null&&e.memoizedState===null?!1:(st.current&2)!==0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ce){if(i?_r(t):xr(t),(e=We)?(e=Kb(e,wa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Lr!==null?{id:Da,overflow:Oa}:null,retryLane:536870912,hydrationErrors:null},a=lg(e),a.return=t,t.child=a,Mt=t,We=null)):e=null,e===null)throw Hr(t);return bp(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,i?(xr(t),i=t.mode,l=hs({mode:"hidden",children:l},i),r=ti(r,i,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=pu(a),r.childLanes=du(e,o,a),t.memoizedState=uu,co(null,r)):(_r(t),ip(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(n)t.flags&256?(_r(t),t.flags&=-257,t=mu(e,t,a)):t.memoizedState!==null?(xr(t),t.child=e.child,t.flags|=128,t=null):(xr(t),l=r.fallback,i=t.mode,r=hs({mode:"visible",children:r.children},i),l=ti(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,li(t,e.child,null,a),r=t.child,r.memoizedState=pu(a),r.childLanes=du(e,o,a),t.memoizedState=uu,t=co(null,r));else if(_r(t),bp(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(L(419)),r.stack="",r.digest=o,To({value:r,source:null,stack:null}),t=mu(e,t,a)}else if(ft||vn(e,t,a,!1),o=(a&e.childLanes)!==0,ft||o){if(o=$e,o!==null&&(r=Ah(o,a),r!==0&&r!==c.retryLane))throw c.retryLane=r,mi(e,r),Kt(o,e,r),ad;gp(l)||vs(),t=mu(e,t,a)}else gp(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,We=ya(l.nextSibling),Mt=t,Ce=!0,Tr=null,wa=!1,e!==null&&cg(t,e),t=ip(t,r.children),t.flags|=4096);return t}return i?(xr(t),l=r.fallback,i=t.mode,c=e.child,p=c.sibling,r=rr(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,p!==null?l=rr(p,l):(l=ti(l,i,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,co(null,r),r=t.child,l=e.child.memoizedState,l===null?l=pu(a):(i=l.cachePool,i!==null?(c=mt._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=pg(),l={baseLanes:l.baseLanes|a,cachePool:i}),r.memoizedState=l,r.childLanes=du(e,o,a),t.memoizedState=uu,co(e.child,r)):(_r(t),a=e.child,e=a.sibling,a=rr(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 ip(e,t){return t=hs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function hs(e,t){return e=ra(22,e,null,t),e.lanes=0,e}function mu(e,t,a){return li(t,e.child,null,a),e=ip(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vu(e.return,t,a)}function fu(e,t,a,r,i,n){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:i,treeForkCount:n}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=i,o.treeForkCount=n)}function ib(e,t,a){var r=t.pendingProps,i=r.revealOrder,n=r.tail;r=r.children;var o=st.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Pe(st,o),qt(e,t,r,a),r=Ce?Mo:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,a,t);else if(e.tag===19)Gf(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(a=t.child,i=null;a!==null;)e=a.alternate,e!==null&&ps(e)===null&&(i=a),a=a.sibling;a=i,a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null),fu(t,!1,i,a,n,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ps(e)===null){t.child=i;break}e=i.sibling,i.sibling=a,a=i,i=e}fu(t,!0,a,null,n,r);break;case"together":fu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function cr(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(L(153));if(t.child!==null){for(e=t.child,a=rr(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=rr(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function rd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ss(e)))}function l1(e,t,a){switch(t.tag){case 3:ts(t,t.stateNode.containerInfo),yr(t,mt,e.memoizedState.cache),ni();break;case 27:case 5:Ru(t);break;case 4:ts(t,t.stateNode.containerInfo);break;case 10:yr(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(_r(t),t.flags|=128,null):(a&t.child.childLanes)!==0?rb(e,t,a):(_r(t),e=cr(e,t,a),e!==null?e.sibling:null);_r(t);break;case 19:var i=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(vn(e,t,a,!1),r=(a&t.childLanes)!==0),i){if(r)return ib(e,t,a);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(st,st.current),r)break;return null;case 22:return t.lanes=0,ab(e,t,a,t.pendingProps);case 24:yr(t,mt,e.memoizedState.cache)}return cr(e,t,a)}function nb(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ft=!0;else{if(!rd(e,a)&&(t.flags&128)===0)return ft=!1,l1(e,t,a);ft=(e.flags&131072)!==0}else ft=!1,Ce&&(t.flags&1048576)!==0&&sg(t,Mo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Ir(t.elementType),t.type=e,typeof e=="function")Dp(e)?(r=ci(e,r),t.tag=1,t=jf(null,t,e,r,a)):(t.tag=0,t=rp(null,t,e,r,a));else{if(e!=null){var i=e.$$typeof;if(i===_p){t.tag=11,t=Df(null,t,e,r,a);break e}else if(i===xp){t.tag=14,t=Of(null,t,e,r,a);break e}}throw t=Tu(e)||e,Error(L(306,t,""))}}return t;case 0:return rp(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,i=ci(r,t.pendingProps),jf(e,t,r,i,a);case 3:e:{if(ts(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var n=t.memoizedState;i=n.element,Ku(e,t),wo(t,r,null,a);var o=t.memoizedState;if(r=o.cache,yr(t,mt,r),r!==n.cache&&Xu(t,[mt],a,!0),bo(),r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=Qf(e,t,r,a);break e}else if(r!==i){i=ba(Error(L(424)),t),To(i),t=Qf(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,We=ya(e.firstChild),Mt=t,Ce=!0,Tr=null,wa=!0,a=fg(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ni(),r===i){t=cr(e,t,a);break e}qt(e,t,r,a)}t=t.child}return t;case 26:return Kl(e,t),e===null?(a=uh(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ce||(a=t.type,e=t.pendingProps,r=ks(Mr.current).createElement(a),r[Et]=t,r[Pt]=e,zt(r,a,e),_t(r),t.stateNode=r):t.memoizedState=uh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ru(t),e===null&&Ce&&(r=t.stateNode=Pb(t.type,t.pendingProps,Mr.current),Mt=t,wa=!0,i=We,Yr(t.type)?(wp=i,We=ya(r.firstChild)):We=i),qt(e,t,t.pendingProps.children,a),Kl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((i=r=We)&&(r=D1(r,t.type,t.pendingProps,wa),r!==null?(t.stateNode=r,Mt=t,We=ya(r.firstChild),wa=!1,i=!0):i=!1),i||Hr(t)),Ru(t),i=t.type,n=t.pendingProps,o=e!==null?e.memoizedProps:null,r=n.children,fp(i,n)?r=null:o!==null&&fp(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=$p(e,t,Iy,null,null,a),Oo._currentValue=i),Kl(e,t),qt(e,t,r,a),t.child;case 6:return e===null&&Ce&&((e=a=We)&&(a=O1(a,t.pendingProps,wa),a!==null?(t.stateNode=a,Mt=t,We=null,e=!0):e=!1),e||Hr(t)),null;case 13:return rb(e,t,a);case 4:return ts(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=li(t,null,r,a):qt(e,t,r,a),t.child;case 11:return Df(e,t,t.type,t.pendingProps,a);case 7:return qt(e,t,t.pendingProps,a),t.child;case 8:return qt(e,t,t.pendingProps.children,a),t.child;case 12:return qt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,yr(t,t.type,r.value),qt(e,t,r.children,a),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,oi(t),i=Tt(i),r=r(i),t.flags|=1,qt(e,t,r,a),t.child;case 14:return Of(e,t,t.type,t.pendingProps,a);case 15:return tb(e,t,t.type,t.pendingProps,a);case 19:return ib(e,t,a);case 31:return o1(e,t,a);case 22:return ab(e,t,a,t.pendingProps);case 24:return oi(t),r=Tt(mt),e===null?(i=Hp(),i===null&&(i=$e,n=Lp(),i.pooledCache=n,n.refCount++,n!==null&&(i.pooledCacheLanes|=a),i=n),t.memoizedState={parent:r,cache:i},Qp(t),yr(t,mt,i)):((e.lanes&a)!==0&&(Ku(e,t),wo(t,null,null,a),bo()),i=e.memoizedState,n=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),yr(t,mt,r)):(r=n.cache,yr(t,mt,r),r!==i.cache&&Xu(t,[mt],a,!0))),qt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Ka(e){e.flags|=4}function hu(e,t,a,r,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Mb())e.flags|=8192;else throw ri=cs,jp}else e.flags&=-16777217}function Yf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ib(t))if(Mb())e.flags|=8192;else throw ri=cs,jp}function Rl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Th():536870912,e.lanes|=t,dn|=t)}function ao(e,t){if(!Ce)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 Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function s1(e,t,a){var r=t.pendingProps;switch(Bp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ie(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ir(mt),on(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?Ka(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ou())),Ie(t),null;case 26:var i=t.type,n=t.memoizedState;return e===null?(Ka(t),n!==null?(Ie(t),Yf(t,n)):(Ie(t),hu(t,i,null,r,a))):n?n!==e.memoizedState?(Ka(t),Ie(t),Yf(t,n)):(Ie(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ka(t),Ie(t),hu(t,i,e,r,a)),null;case 27:if(as(t),a=Mr.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}e=La.current,Oi(t)?wf(t,e):(e=Pb(i,r,a),t.stateNode=e,Ka(t))}return Ie(t),null;case 5:if(as(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}if(n=La.current,Oi(t))wf(t,n);else{var o=ks(Mr.current);switch(n){case 1:n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?n.multiple=!0:r.size&&(n.size=r.size);break;default:n=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}n[Et]=t,n[Pt]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)n.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=n;e:switch(zt(n,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ka(t)}}return Ie(t),hu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Mr.current,Oi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,i=Mt,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Et]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Vb(e.nodeValue,a)),e||Hr(t,!0)}else e=ks(e).createTextNode(r),e[Et]=t,t.stateNode=e}return Ie(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Oi(t),a!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Et]=t}else ni(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),e=!1}else a=ou(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(aa(t),t):(aa(t),null);if((t.flags&128)!==0)throw Error(L(558))}return Ie(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Oi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(L(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(L(317));i[Et]=t}else ni(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),i=!1}else i=ou(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(aa(t),t):(aa(t),null)}return aa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Rl(t,t.updateQueue),Ie(t),null);case 4:return on(),e===null&&ud(t.stateNode.containerInfo),Ie(t),null;case 10:return ir(t.type),Ie(t),null;case 19:if(xt(st),r=t.memoizedState,r===null)return Ie(t),null;if(i=(t.flags&128)!==0,n=r.rendering,n===null)if(i)ao(r,!1);else{if(ot!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(n=ps(e),n!==null){for(t.flags|=128,ao(r,!1),e=n.updateQueue,t.updateQueue=e,Rl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)og(a,e),a=a.sibling;return Pe(st,st.current&1|2),Ce&&Ia(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&na()>bs&&(t.flags|=128,i=!0,ao(r,!1),t.lanes=4194304)}else{if(!i)if(e=ps(n),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Rl(t,e),ao(r,!0),r.tail===null&&r.tailMode==="hidden"&&!n.alternate&&!Ce)return Ie(t),null}else 2*na()-r.renderingStartTime>bs&&a!==536870912&&(t.flags|=128,i=!0,ao(r,!1),t.lanes=4194304);r.isBackwards?(n.sibling=t.child,t.child=n):(e=r.last,e!==null?e.sibling=n:t.child=n,r.last=n)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=na(),e.sibling=null,a=st.current,Pe(st,i?a&1|2:a&1),Ce&&Ia(t,r.treeForkCount),e):(Ie(t),null);case 22:case 23:return aa(t),Gp(),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&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),a=t.updateQueue,a!==null&&Rl(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&&xt(ai),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ir(mt),Ie(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function c1(e,t){switch(Bp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(mt),on(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return as(t),null;case 31:if(t.memoizedState!==null){if(aa(t),t.alternate===null)throw Error(L(340));ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(aa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xt(st),null;case 4:return on(),null;case 10:return ir(t.type),null;case 22:case 23:return aa(t),Gp(),e!==null&&xt(ai),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ir(mt),null;case 25:return null;default:return null}}function ob(e,t){switch(Bp(t),t.tag){case 3:ir(mt),on();break;case 26:case 27:case 5:as(t);break;case 4:on();break;case 31:t.memoizedState!==null&&aa(t);break;case 13:aa(t);break;case 19:xt(st);break;case 10:ir(t.type);break;case 22:case 23:aa(t),Gp(),e!==null&&xt(ai);break;case 24:ir(mt)}}function Zo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var i=r.next;a=i;do{if((a.tag&e)===e){r=void 0;var n=a.create,o=a.inst;r=n(),o.destroy=r}a=a.next}while(a!==i)}}catch(l){Be(t,t.return,l)}}function jr(e,t,a){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var n=i.next;r=n;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,i=t;var c=a,p=l;try{p()}catch(m){Be(i,c,m)}}}r=r.next}while(r!==n)}}catch(m){Be(t,t.return,m)}}function lb(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{gg(t,a)}catch(r){Be(e,e.return,r)}}}function sb(e,t,a){a.props=ci(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Be(e,t,r)}}function yo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(i){Be(e,t,i)}}function Ba(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(i){Be(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Be(e,t,i)}else a.current=null}function cb(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(i){Be(e,e.return,i)}}function gu(e,t,a){try{var r=e.stateNode;M1(r,e.type,a,t),r[Pt]=t}catch(i){Be(e,e.return,i)}}function ub(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Yr(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ub(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&&Yr(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 np(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=tr));else if(r!==4&&(r===27&&Yr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(np(e,t,a),e=e.sibling;e!==null;)np(e,t,a),e=e.sibling}function gs(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&&Yr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gs(e,t,a),e=e.sibling;e!==null;)gs(e,t,a),e=e.sibling}function pb(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zt(t,r,a),t[Et]=e,t[Pt]=a}catch(n){Be(e,e.return,n)}}var Wa=!1,dt=!1,wu=!1,$f=typeof WeakSet=="function"?WeakSet:Set,yt=null;function u1(e,t){if(e=e.containerInfo,dp=qs,e=Ih(e),Rp(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var i=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{a.nodeType,n.nodeType}catch{a=null;break e}var o=0,l=-1,c=-1,p=0,m=0,b=e,f=null;t:for(;;){for(var w;b!==a||i!==0&&b.nodeType!==3||(l=o+i),b!==n||r!==0&&b.nodeType!==3||(c=o+r),b.nodeType===3&&(o+=b.nodeValue.length),(w=b.firstChild)!==null;)f=b,b=w;for(;;){if(b===e)break t;if(f===a&&++p===i&&(l=o),f===n&&++m===r&&(c=o),(w=b.nextSibling)!==null)break;b=f,f=b.parentNode}b=w}a=l===-1||c===-1?null:{start:l,end:c}}else a=null}a=a||{start:0,end:0}}else a=null;for(mp={focusedElem:e,selectionRange:a},qs=!1,yt=t;yt!==null;)if(t=yt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,yt=e;else for(;yt!==null;){switch(t=yt,n=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)i=e[a],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&n!==null){e=void 0,a=t,i=n.memoizedProps,n=n.memoizedState,r=a.stateNode;try{var _=ci(a.type,i);e=r.getSnapshotBeforeUpdate(_,n),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)hp(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,yt=e;break}yt=t.return}}function db(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ja(e,a),r&4&&Zo(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 i=ci(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Be(a,a.return,o)}}r&64&&lb(a),r&512&&yo(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{gg(e,t)}catch(o){Be(a,a.return,o)}}break;case 27:t===null&&r&4&&pb(a);case 26:case 5:Ja(e,a),t===null&&r&4&&cb(a),r&512&&yo(a,a.return);break;case 12:Ja(e,a);break;case 31:Ja(e,a),r&4&&hb(e,a);break;case 13:Ja(e,a),r&4&&gb(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=v1.bind(null,a),B1(e,a))));break;case 22:if(r=a.memoizedState!==null||Wa,!r){t=t!==null&&t.memoizedState!==null||dt,i=Wa;var n=dt;Wa=r,(dt=t)&&!n?Fa(e,a,(a.subtreeFlags&8772)!==0):Ja(e,a),Wa=i,dt=n}break;case 30:break;default:Ja(e,a)}}function mb(e){var t=e.alternate;t!==null&&(e.alternate=null,mb(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 at=null,Xt=!1;function Pa(e,t,a){for(a=a.child;a!==null;)fb(e,t,a),a=a.sibling}function fb(e,t,a){if(oa&&typeof oa.onCommitFiberUnmount=="function")try{oa.onCommitFiberUnmount(jo,a)}catch{}switch(a.tag){case 26:dt||Ba(a,t),Pa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dt||Ba(a,t);var r=at,i=Xt;Yr(a.type)&&(at=a.stateNode,Xt=!1),Pa(e,t,a),So(a.stateNode),at=r,Xt=i;break;case 5:dt||Ba(a,t);case 6:if(r=at,i=Xt,at=null,Pa(e,t,a),at=r,Xt=i,at!==null)if(Xt)try{(at.nodeType===9?at.body:at.nodeName==="HTML"?at.ownerDocument.body:at).removeChild(a.stateNode)}catch(n){Be(a,t,n)}else try{at.removeChild(a.stateNode)}catch(n){Be(a,t,n)}break;case 18:at!==null&&(Xt?(e=at,nh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),gn(e)):nh(at,a.stateNode));break;case 4:r=at,i=Xt,at=a.stateNode.containerInfo,Xt=!0,Pa(e,t,a),at=r,Xt=i;break;case 0:case 11:case 14:case 15:jr(2,a,t),dt||jr(4,a,t),Pa(e,t,a);break;case 1:dt||(Ba(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&sb(a,t,r)),Pa(e,t,a);break;case 21:Pa(e,t,a);break;case 22:dt=(r=dt)||a.memoizedState!==null,Pa(e,t,a),dt=r;break;default:Pa(e,t,a)}}function hb(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 gb(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 p1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $f),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $f),t;default:throw Error(L(435,e.tag))}}function Al(e,t){var a=p1(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var i=y1.bind(null,e,r);r.then(i,i)}})}function $t(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var i=a[r],n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Yr(l.type)){at=l.stateNode,Xt=!1;break e}break;case 5:at=l.stateNode,Xt=!1;break e;case 3:case 4:at=l.stateNode.containerInfo,Xt=!0;break e}l=l.return}if(at===null)throw Error(L(160));fb(n,o,i),at=null,Xt=!1,n=i.alternate,n!==null&&(n.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bb(t,e),t=t.sibling}var Ma=null;function bb(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$t(t,e),Vt(e),r&4&&(jr(3,e,e.return),Zo(3,e),jr(5,e,e.return));break;case 1:$t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),r&64&&Wa&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var i=Ma;if($t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),r&4){var n=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":n=i.getElementsByTagName("title")[0],(!n||n[Yo]||n[Et]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=i.createElement(r),i.head.insertBefore(n,i.querySelector("head > title"))),zt(n,r,a),n[Et]=e,_t(n),r=n;break e;case"link":var o=dh("link","href",i).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(n=o[l],n.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&n.getAttribute("rel")===(a.rel==null?null:a.rel)&&n.getAttribute("title")===(a.title==null?null:a.title)&&n.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;case"meta":if(o=dh("meta","content",i).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(n=o[l],n.getAttribute("content")===(a.content==null?null:""+a.content)&&n.getAttribute("name")===(a.name==null?null:a.name)&&n.getAttribute("property")===(a.property==null?null:a.property)&&n.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&n.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;default:throw Error(L(468,r))}n[Et]=e,_t(n),r=n}e.stateNode=r}else mh(i,e.type,e.stateNode);else e.stateNode=ph(i,r,e.memoizedProps);else n!==r?(n===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):n.count--,r===null?mh(i,e.type,e.stateNode):ph(i,r,e.memoizedProps)):r===null&&e.stateNode!==null&&gu(e,e.memoizedProps,a.memoizedProps)}break;case 27:$t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),a!==null&&r&4&&gu(e,e.memoizedProps,a.memoizedProps);break;case 5:if($t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),e.flags&32){i=e.stateNode;try{sn(i,"")}catch(_){Be(e,e.return,_)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,gu(e,i,a!==null?a.memoizedProps:i)),r&1024&&(wu=!0);break;case 6:if($t(t,e),Vt(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(_){Be(e,e.return,_)}}break;case 3:if(Fl=null,i=Ma,Ma=Ss(t.containerInfo),$t(t,e),Ma=i,Vt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{gn(t.containerInfo)}catch(_){Be(e,e.return,_)}wu&&(wu=!1,wb(e));break;case 4:r=Ma,Ma=Ss(e.stateNode.containerInfo),$t(t,e),Vt(e),Ma=r;break;case 12:$t(t,e),Vt(e);break;case 31:$t(t,e),Vt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 13:$t(t,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(js=na()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 22:i=e.memoizedState!==null;var c=a!==null&&a.memoizedState!==null,p=Wa,m=dt;if(Wa=p||i,dt=m||c,$t(t,e),dt=m,Wa=p,Vt(e),r&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(a===null||c||Wa||dt||Wr(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){c=a=t;try{if(n=c.stateNode,i)o=n.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var b=c.memoizedProps.style,f=b!=null&&b.hasOwnProperty("display")?b.display:null;l.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(_){Be(c,c.return,_)}}}else if(t.tag===6){if(a===null){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(_){Be(c,c.return,_)}}}else if(t.tag===18){if(a===null){c=t;try{var w=c.stateNode;i?oh(w,!0):oh(c.stateNode,!1)}catch(_){Be(c,c.return,_)}}}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,Al(e,a))));break;case 19:$t(t,e),Vt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 30:break;case 21:break;default:$t(t,e),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(ub(r)){a=r;break}r=r.return}if(a==null)throw Error(L(160));switch(a.tag){case 27:var i=a.stateNode,n=bu(e);gs(e,n,i);break;case 5:var o=a.stateNode;a.flags&32&&(sn(o,""),a.flags&=-33);var l=bu(e);gs(e,l,o);break;case 3:case 4:var c=a.stateNode.containerInfo,p=bu(e);np(e,p,c);break;default:throw Error(L(161))}}catch(m){Be(e,e.return,m)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wb(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;)db(e,t.alternate,t),t=t.sibling}function Wr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:jr(4,t,t.return),Wr(t);break;case 1:Ba(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&sb(t,t.return,a),Wr(t);break;case 27:So(t.stateNode);case 26:case 5:Ba(t,t.return),Wr(t);break;case 22:t.memoizedState===null&&Wr(t);break;case 30:Wr(t);break;default:Wr(t)}e=e.sibling}}function Fa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,i=e,n=t,o=n.flags;switch(n.tag){case 0:case 11:case 15:Fa(i,n,a),Zo(4,n);break;case 1:if(Fa(i,n,a),r=n,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(p){Be(r,r.return,p)}if(r=n,i=r.updateQueue,i!==null){var l=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)hg(c[i],l)}catch(p){Be(r,r.return,p)}}a&&o&64&&lb(n),yo(n,n.return);break;case 27:pb(n);case 26:case 5:Fa(i,n,a),a&&r===null&&o&4&&cb(n),yo(n,n.return);break;case 12:Fa(i,n,a);break;case 31:Fa(i,n,a),a&&o&4&&hb(i,n);break;case 13:Fa(i,n,a),a&&o&4&&gb(i,n);break;case 22:n.memoizedState===null&&Fa(i,n,a),yo(n,n.return);break;case 30:break;default:Fa(i,n,a)}t=t.sibling}}function id(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&&Vo(a))}function nd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vo(e))}function Ea(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vb(e,t,a,r),t=t.sibling}function vb(e,t,a,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ea(e,t,a,r),i&2048&&Zo(9,t);break;case 1:Ea(e,t,a,r);break;case 3:Ea(e,t,a,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vo(e)));break;case 12:if(i&2048){Ea(e,t,a,r),e=t.stateNode;try{var n=t.memoizedProps,o=n.id,l=n.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Be(t,t.return,c)}}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:n=t.stateNode,o=t.alternate,t.memoizedState!==null?n._visibility&2?Ea(e,t,a,r):_o(e,t):n._visibility&2?Ea(e,t,a,r):(n._visibility|=2,Li(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),i&2048&&id(o,t);break;case 24:Ea(e,t,a,r),i&2048&&nd(t.alternate,t);break;default:Ea(e,t,a,r)}}function Li(e,t,a,r,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,o=t,l=a,c=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Li(n,o,l,c,i),Zo(8,o);break;case 23:break;case 22:var m=o.stateNode;o.memoizedState!==null?m._visibility&2?Li(n,o,l,c,i):_o(n,o):(m._visibility|=2,Li(n,o,l,c,i)),i&&p&2048&&id(o.alternate,o);break;case 24:Li(n,o,l,c,i),i&&p&2048&&nd(o.alternate,o);break;default:Li(n,o,l,c,i)}t=t.sibling}}function _o(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,i=r.flags;switch(r.tag){case 22:_o(a,r),i&2048&&id(r.alternate,r);break;case 24:_o(a,r),i&2048&&nd(r.alternate,r);break;default:_o(a,r)}t=t.sibling}}var uo=8192;function Bi(e,t,a){if(e.subtreeFlags&uo)for(e=e.child;e!==null;)yb(e,t,a),e=e.sibling}function yb(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&uo&&e.memoizedState!==null&&P1(a,Ma,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var r=Ma;Ma=Ss(e.stateNode.containerInfo),Bi(e,t,a),Ma=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=uo,uo=16777216,Bi(e,t,a),uo=r):Bi(e,t,a));break;default:Bi(e,t,a)}}function _b(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 ro(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];yt=r,kb(r,e)}_b(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xb(e),e=e.sibling}function xb(e){switch(e.tag){case 0:case 11:case 15:ro(e),e.flags&2048&&jr(9,e,e.return);break;case 3:ro(e);break;case 12:ro(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):ro(e);break;default:ro(e)}}function Pl(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];yt=r,kb(r,e)}_b(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:jr(8,t,t.return),Pl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function kb(e,t){for(;yt!==null;){var a=yt;switch(a.tag){case 0:case 11:case 15:jr(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:Vo(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,yt=r;else e:for(a=e;yt!==null;){r=yt;var i=r.sibling,n=r.return;if(mb(r),r===a){yt=null;break e}if(i!==null){i.return=n,yt=i;break e}yt=n}}}var d1={getCacheForType:function(e){var t=Tt(mt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(mt).controller.signal}},m1=typeof WeakMap=="function"?WeakMap:Map,Ae=0,$e=null,xe=null,Se=0,Oe=0,ta=null,Cr=!1,_n=!1,od=!1,ur=0,ot=0,Qr=0,ii=0,ld=0,ia=0,dn=0,xo=null,Zt=null,op=!1,js=0,Sb=0,bs=1/0,ws=null,Ar=null,gt=0,Ur=null,mn=null,nr=0,lp=0,sp=null,Nb=null,ko=0,cp=null;function sa(){return(Ae&2)!==0&&Se!==0?Se&-Se:se.T!==null?cd():Uh()}function Cb(){if(ia===0)if((Se&536870912)===0||Ce){var e=kl;kl<<=1,(kl&3932160)===0&&(kl=262144),ia=e}else ia=536870912;return e=ua.current,e!==null&&(e.flags|=32),ia}function Kt(e,t,a){(e===$e&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(fn(e,0),qr(e,Se,ia,!1)),Go(e,a),((Ae&2)===0||e!==$e)&&(e===$e&&((Ae&2)===0&&(ii|=a),ot===4&&qr(e,Se,ia,!1)),ja(e))}function qb(e,t,a){if((Ae&6)!==0)throw Error(L(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Qo(e,t),i=r?g1(e,t):vu(e,t,!0),n=r;do{if(i===0){_n&&!r&&qr(e,t,0,!1);break}else{if(a=e.current.alternate,n&&!f1(a)){i=vu(e,t,!1),n=!1;continue}if(i===2){if(n=t,e.errorRecoveryDisabledLanes&n)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;i=xo;var c=l.current.memoizedState.isDehydrated;if(c&&(fn(l,o).flags|=256),o=vu(l,o,!1),o!==2){if(od&&!c){l.errorRecoveryDisabledLanes|=n,ii|=n,i=4;break e}n=Zt,Zt=i,n!==null&&(Zt===null?Zt=n:Zt.push.apply(Zt,n))}i=o}if(n=!1,i!==2)continue}}if(i===1){fn(e,0),qr(e,t,0,!0);break}e:{switch(r=e,n=i,n){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:qr(r,t,ia,!Cr);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(i=js+300-na(),10<i)){if(qr(r,t,ia,!Cr),Ms(r,0,!0)!==0)break e;nr=t,r.timeoutHandle=Zb(Vf.bind(null,r,a,Zt,ws,op,t,ia,ii,dn,Cr,n,"Throttled",-0,0),i);break e}Vf(r,a,Zt,ws,op,t,ia,ii,dn,Cr,n,null,-0,0)}}break}while(!0);ja(e)}function Vf(e,t,a,r,i,n,o,l,c,p,m,b,f,w){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:tr},yb(t,n,b);var _=(n&62914560)===n?js-na():(n&4194048)===n?Sb-na():0;if(_=J1(b,_),_!==null){nr=n,e.cancelPendingCommit=_(Zf.bind(null,e,t,n,a,r,i,o,l,c,m,b,null,f,w)),qr(e,n,o,!p);return}}Zf(e,t,n,a,r,i,o,l,c)}function f1(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var i=a[r],n=i.getSnapshot;i=i.value;try{if(!ca(n(),i))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qr(e,t,a,r){t&=~ld,t&=~ii,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var n=31-la(i),o=1<<n;r[n]=-1,i&=~o}a!==0&&zh(e,a,t)}function Qs(){return(Ae&6)===0?(Ko(0,!1),!1):!0}function sd(){if(xe!==null){if(Oe===0)var e=xe.return;else e=xe,ar=fi=null,Zp(e),an=null,zo=0,e=xe;for(;e!==null;)ob(e.alternate,e),e=e.return;xe=null}}function fn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,R1(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),nr=0,sd(),$e=e,xe=a=rr(e.current,null),Se=t,Oe=0,ta=null,Cr=!1,_n=Qo(e,t),od=!1,dn=ia=ld=ii=Qr=ot=0,Zt=xo=null,op=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-la(r),n=1<<i;t|=e[i],r&=~n}return ur=t,As(),a}function Eb(e,t){de=null,se.H=Ao,t===yn||t===Ds?(t=kf(),Oe=3):t===jp?(t=kf(),Oe=4):Oe=t===ad?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ta=t,xe===null&&(ot=1,fs(e,ba(t,e.current)))}function Mb(){var e=ua.current;return e===null?!0:(Se&4194048)===Se?va===null:(Se&62914560)===Se||(Se&536870912)!==0?e===va:!1}function Tb(){var e=se.H;return se.H=Ao,e===null?Ao:e}function zb(){var e=se.A;return se.A=d1,e}function vs(){ot=4,Cr||(Se&4194048)!==Se&&ua.current!==null||(_n=!0),(Qr&134217727)===0&&(ii&134217727)===0||$e===null||qr($e,Se,ia,!1)}function vu(e,t,a){var r=Ae;Ae|=2;var i=Tb(),n=zb();($e!==e||Se!==t)&&(ws=null,fn(e,t)),t=!1;var o=ot;e:do try{if(Oe!==0&&xe!==null){var l=xe,c=ta;switch(Oe){case 8:sd(),o=6;break e;case 3:case 2:case 9:case 6:ua.current===null&&(t=!0);var p=Oe;if(Oe=0,ta=null,Fi(e,l,c,p),a&&_n){o=0;break e}break;default:p=Oe,Oe=0,ta=null,Fi(e,l,c,p)}}h1(),o=ot;break}catch(m){Eb(e,m)}while(!0);return t&&e.shellSuspendCounter++,ar=fi=null,Ae=r,se.H=i,se.A=n,xe===null&&($e=null,Se=0,As()),o}function h1(){for(;xe!==null;)Rb(xe)}function g1(e,t){var a=Ae;Ae|=2;var r=Tb(),i=zb();$e!==e||Se!==t?(ws=null,bs=na()+500,fn(e,t)):_n=Qo(e,t);e:do try{if(Oe!==0&&xe!==null){t=xe;var n=ta;t:switch(Oe){case 1:Oe=0,ta=null,Fi(e,t,n,1);break;case 2:case 9:if(xf(n)){Oe=0,ta=null,Xf(t);break}t=function(){Oe!==2&&Oe!==9||$e!==e||(Oe=7),ja(e)},n.then(t,t);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:xf(n)?(Oe=0,ta=null,Xf(t)):(Oe=0,ta=null,Fi(e,t,n,7));break;case 5:var o=null;switch(xe.tag){case 26:o=xe.memoizedState;case 5:case 27:var l=xe;if(o?Ib(o):l.stateNode.complete){Oe=0,ta=null;var c=l.sibling;if(c!==null)xe=c;else{var p=l.return;p!==null?(xe=p,Gs(p)):xe=null}break t}}Oe=0,ta=null,Fi(e,t,n,5);break;case 6:Oe=0,ta=null,Fi(e,t,n,6);break;case 8:sd(),ot=6;break e;default:throw Error(L(462))}}b1();break}catch(m){Eb(e,m)}while(!0);return ar=fi=null,se.H=r,se.A=i,Ae=a,xe!==null?0:($e=null,Se=0,As(),ot)}function b1(){for(;xe!==null&&!j0();)Rb(xe)}function Rb(e){var t=nb(e.alternate,e,ur);e.memoizedProps=e.pendingProps,t===null?Gs(e):xe=t}function Xf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Hf(a,t,t.pendingProps,t.type,void 0,Se);break;case 11:t=Hf(a,t,t.pendingProps,t.type.render,t.ref,Se);break;case 5:Zp(t);default:ob(a,t),t=xe=og(t,ur),t=nb(a,t,ur)}e.memoizedProps=e.pendingProps,t===null?Gs(e):xe=t}function Fi(e,t,a,r){ar=fi=null,Zp(t),an=null,zo=0;var i=t.return;try{if(n1(e,i,t,a,Se)){ot=1,fs(e,ba(a,e.current)),xe=null;return}}catch(n){if(i!==null)throw xe=i,n;ot=1,fs(e,ba(a,e.current)),xe=null;return}t.flags&32768?(Ce||r===1?e=!0:_n||(Se&536870912)!==0?e=!1:(Cr=e=!0,(r===2||r===9||r===3||r===6)&&(r=ua.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ab(t,e)):Gs(t)}function Gs(e){var t=e;do{if((t.flags&32768)!==0){Ab(t,Cr);return}e=t.return;var a=s1(t.alternate,t,ur);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);ot===0&&(ot=5)}function Ab(e,t){do{var a=c1(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);ot=6,xe=null}function Zf(e,t,a,r,i,n,o,l,c){e.cancelPendingCommit=null;do Ys();while(gt!==0);if((Ae&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(n=t.lanes|t.childLanes,n|=Ap,J0(e,a,n,o,l,c),e===$e&&(xe=$e=null,Se=0),mn=t,Ur=e,nr=a,lp=n,sp=i,Nb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,_1(rs,function(){return Lb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=se.T,se.T=null,i=Ue.p,Ue.p=2,o=Ae,Ae|=4;try{u1(e,t,a)}finally{Ae=o,Ue.p=i,se.T=r}}gt=1,Ub(),Db(),Ob()}}function Ub(){if(gt===1){gt=0;var e=Ur,t=mn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=se.T,se.T=null;var r=Ue.p;Ue.p=2;var i=Ae;Ae|=4;try{bb(t,e);var n=mp,o=Ih(e.containerInfo),l=n.focusedElem,c=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&Fh(l.ownerDocument.documentElement,l)){if(c!==null&&Rp(l)){var p=c.start,m=c.end;if(m===void 0&&(m=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(m,l.value.length);else{var b=l.ownerDocument||document,f=b&&b.defaultView||window;if(f.getSelection){var w=f.getSelection(),_=l.textContent.length,E=Math.min(c.start,_),D=c.end===void 0?E:Math.min(c.end,_);!w.extend&&E>D&&(o=D,D=E,E=o);var h=hf(l,E),u=hf(l,D);if(h&&u&&(w.rangeCount!==1||w.anchorNode!==h.node||w.anchorOffset!==h.offset||w.focusNode!==u.node||w.focusOffset!==u.offset)){var g=b.createRange();g.setStart(h.node,h.offset),w.removeAllRanges(),E>D?(w.addRange(g),w.extend(u.node,u.offset)):(g.setEnd(u.node,u.offset),w.addRange(g))}}}}for(b=[],w=l;w=w.parentNode;)w.nodeType===1&&b.push({element:w,left:w.scrollLeft,top:w.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}}qs=!!dp,mp=dp=null}finally{Ae=i,Ue.p=r,se.T=a}}e.current=t,gt=2}}function Db(){if(gt===2){gt=0;var e=Ur,t=mn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=se.T,se.T=null;var r=Ue.p;Ue.p=2;var i=Ae;Ae|=4;try{db(e,t.alternate,t)}finally{Ae=i,Ue.p=r,se.T=a}}gt=3}}function Ob(){if(gt===4||gt===3){gt=0,Q0();var e=Ur,t=mn,a=nr,r=Nb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?gt=5:(gt=0,mn=Ur=null,Bb(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Ar=null),Np(a),t=t.stateNode,oa&&typeof oa.onCommitFiberRoot=="function")try{oa.onCommitFiberRoot(jo,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=se.T,i=Ue.p,Ue.p=2,se.T=null;try{for(var n=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];n(l.value,{componentStack:l.stack})}}finally{se.T=t,Ue.p=i}}(nr&3)!==0&&Ys(),ja(e),i=e.pendingLanes,(a&261930)!==0&&(i&42)!==0?e===cp?ko++:(ko=0,cp=e):ko=0,Ko(0,!1)}}function Bb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vo(t)))}function Ys(){return Ub(),Db(),Ob(),Lb()}function Lb(){if(gt!==5)return!1;var e=Ur,t=lp;lp=0;var a=Np(nr),r=se.T,i=Ue.p;try{Ue.p=32>a?32:a,se.T=null,a=sp,sp=null;var n=Ur,o=nr;if(gt=0,mn=Ur=null,nr=0,(Ae&6)!==0)throw Error(L(331));var l=Ae;if(Ae|=4,xb(n.current),vb(n,n.current,o,a),Ae=l,Ko(0,!1),oa&&typeof oa.onPostCommitFiberRoot=="function")try{oa.onPostCommitFiberRoot(jo,n)}catch{}return!0}finally{Ue.p=i,se.T=r,Bb(e,t)}}function Kf(e,t,a){t=ba(a,t),t=ap(e.stateNode,t,2),e=Rr(e,t,2),e!==null&&(Go(e,2),ja(e))}function Be(e,t,a){if(e.tag===3)Kf(e,e,a);else for(;t!==null;){if(t.tag===3){Kf(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ar===null||!Ar.has(r))){e=ba(a,e),a=Wg(2),r=Rr(t,a,2),r!==null&&(eb(a,r,t,e),Go(r,2),ja(r));break}}t=t.return}}function yu(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new m1;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(a)||(od=!0,i.add(a),e=w1.bind(null,e,t,a),t.then(e,e))}function w1(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,$e===e&&(Se&a)===a&&(ot===4||ot===3&&(Se&62914560)===Se&&300>na()-js?(Ae&2)===0&&fn(e,0):ld|=a,dn===Se&&(dn=0)),ja(e)}function Hb(e,t){t===0&&(t=Th()),e=mi(e,t),e!==null&&(Go(e,t),ja(e))}function v1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Hb(e,a)}function y1(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(L(314))}r!==null&&r.delete(t),Hb(e,a)}function _1(e,t){return kp(e,t)}var ys=null,Hi=null,up=!1,_s=!1,_u=!1,Er=0;function ja(e){e!==Hi&&e.next===null&&(Hi===null?ys=Hi=e:Hi=Hi.next=e),_s=!0,up||(up=!0,k1())}function Ko(e,t){if(!_u&&_s){_u=!0;do for(var a=!1,r=ys;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var n=0;else{var o=r.suspendedLanes,l=r.pingedLanes;n=(1<<31-la(42|e)+1)-1,n&=i&~(o&~l),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(a=!0,Pf(r,n))}else n=Se,n=Ms(r,r===$e?n:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(n&3)===0||Qo(r,n)||(a=!0,Pf(r,n));r=r.next}while(a);_u=!1}}function x1(){jb()}function jb(){_s=up=!1;var e=0;Er!==0&&z1()&&(e=Er);for(var t=na(),a=null,r=ys;r!==null;){var i=r.next,n=Qb(r,t);n===0?(r.next=null,a===null?ys=i:a.next=i,i===null&&(Hi=a)):(a=r,(e!==0||(n&3)!==0)&&(_s=!0)),r=i}gt!==0&>!==5||Ko(e,!1),Er!==0&&(Er=0)}function Qb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var o=31-la(n),l=1<<o,c=i[o];c===-1?((l&a)===0||(l&r)!==0)&&(i[o]=P0(l,t)):c<=t&&(e.expiredLanes|=l),n&=~l}if(t=$e,a=Se,a=Ms(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Jc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Qo(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Jc(r),Np(a)){case 2:case 8:a=Eh;break;case 32:a=rs;break;case 268435456:a=Mh;break;default:a=rs}return r=Gb.bind(null,e),a=kp(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Jc(r),e.callbackPriority=2,e.callbackNode=null,2}function Gb(e,t){if(gt!==0&>!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ys()&&e.callbackNode!==a)return null;var r=Se;return r=Ms(e,e===$e?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(qb(e,r,t),Qb(e,na()),e.callbackNode!=null&&e.callbackNode===a?Gb.bind(null,e):null)}function Pf(e,t){if(Ys())return null;qb(e,t,!0)}function k1(){A1(function(){(Ae&6)!==0?kp(qh,x1):jb()})}function cd(){if(Er===0){var e=cn;e===0&&(e=xl,xl<<=1,(xl&261888)===0&&(xl=256)),Er=e}return Er}function Jf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:jl(""+e)}function Ff(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 S1(e,t,a,r,i){if(t==="submit"&&a&&a.stateNode===i){var n=Jf((i[Pt]||null).action),o=r.submitter;o&&(t=(t=o[Pt]||null)?Jf(t.formAction):o.getAttribute("formAction"),t!==null&&(n=t,o=null));var l=new Ts("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Er!==0){var c=o?Ff(i,o):new FormData(i);ep(a,{pending:!0,data:c,method:i.method,action:n},null,c)}}else typeof n=="function"&&(l.preventDefault(),c=o?Ff(i,o):new FormData(i),ep(a,{pending:!0,data:c,method:i.method,action:n},n,c))},currentTarget:i}]})}}for(Ul=0;Ul<Gu.length;Ul++)Dl=Gu[Ul],If=Dl.toLowerCase(),Wf=Dl[0].toUpperCase()+Dl.slice(1),Ta(If,"on"+Wf);var Dl,If,Wf,Ul;Ta(eg,"onAnimationEnd");Ta(tg,"onAnimationIteration");Ta(ag,"onAnimationStart");Ta("dblclick","onDoubleClick");Ta("focusin","onFocus");Ta("focusout","onBlur");Ta(Gy,"onTransitionRun");Ta(Yy,"onTransitionStart");Ta($y,"onTransitionCancel");Ta(rg,"onTransitionEnd");ln("onMouseEnter",["mouseout","mouseover"]);ln("onMouseLeave",["mouseout","mouseover"]);ln("onPointerEnter",["pointerout","pointerover"]);ln("onPointerLeave",["pointerout","pointerover"]);ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ui("onBeforeInput",["compositionend","keypress","textInput","paste"]);ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),N1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uo));function Yb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],i=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,p=l.currentTarget;if(l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(m){ns(m)}i.currentTarget=null,n=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,p=l.currentTarget,l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(m){ns(m)}i.currentTarget=null,n=c}}}}function _e(e,t){var a=t[Uu];a===void 0&&(a=t[Uu]=new Set);var r=e+"__bubble";a.has(r)||($b(t,e,2,!1),a.add(r))}function xu(e,t,a){var r=0;t&&(r|=4),$b(a,e,r,t)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function ud(e){if(!e[Ol]){e[Ol]=!0,Dh.forEach(function(a){a!=="selectionchange"&&(N1.has(a)||xu(a,!1,e),xu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ol]||(t[Ol]=!0,xu("selectionchange",!1,t))}}function $b(e,t,a,r){switch(rw(t)){case 2:var i=W1;break;case 8:i=e_;break;default:i=fd}a=i.bind(null,t,a,e),i=void 0,!Hu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,a,{capture:!0,passive:i}):e.addEventListener(t,a,!0):i!==void 0?e.addEventListener(t,a,{passive:i}):e.addEventListener(t,a,!1)}function ku(e,t,a,r,i){var n=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;l!==null;){if(o=Gi(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=n=o;continue e}l=l.parentNode}}r=r.return}Yh(function(){var p=n,m=Ep(a),b=[];e:{var f=ig.get(e);if(f!==void 0){var w=Ts,_=e;switch(e){case"keypress":if(Gl(a)===0)break e;case"keydown":case"keyup":w=yy;break;case"focusin":_="focus",w=tu;break;case"focusout":_="blur",w=tu;break;case"beforeblur":case"afterblur":w=tu;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":w=of;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":w=sy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":w=ky;break;case eg:case tg:case ag:w=py;break;case rg:w=Ny;break;case"scroll":case"scrollend":w=oy;break;case"wheel":w=qy;break;case"copy":case"cut":case"paste":w=my;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":w=sf;break;case"toggle":case"beforetoggle":w=My}var E=(t&4)!==0,D=!E&&(e==="scroll"||e==="scrollend"),h=E?f!==null?f+"Capture":null:f;E=[];for(var u=p,g;u!==null;){var v=u;if(g=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||g===null||h===null||(v=Co(u,h),v!=null&&E.push(Do(u,v,g))),D)break;u=u.return}0<E.length&&(f=new w(f,_,null,a,m),b.push({event:f,listeners:E}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",w=e==="mouseout"||e==="pointerout",f&&a!==Lu&&(_=a.relatedTarget||a.fromElement)&&(Gi(_)||_[bn]))break e;if((w||f)&&(f=m.window===m?m:(f=m.ownerDocument)?f.defaultView||f.parentWindow:window,w?(_=a.relatedTarget||a.toElement,w=p,_=_?Gi(_):null,_!==null&&(D=Ho(_),E=_.tag,_!==D||E!==5&&E!==27&&E!==6)&&(_=null)):(w=null,_=p),w!==_)){if(E=of,v="onMouseLeave",h="onMouseEnter",u="mouse",(e==="pointerout"||e==="pointerover")&&(E=sf,v="onPointerLeave",h="onPointerEnter",u="pointer"),D=w==null?f:so(w),g=_==null?f:so(_),f=new E(v,u+"leave",w,a,m),f.target=D,f.relatedTarget=g,v=null,Gi(m)===p&&(E=new E(h,u+"enter",_,a,m),E.target=g,E.relatedTarget=D,v=E),D=v,w&&_)t:{for(E=C1,h=w,u=_,g=0,v=h;v;v=E(v))g++;v=0;for(var N=u;N;N=E(N))v++;for(;0<g-v;)h=E(h),g--;for(;0<v-g;)u=E(u),v--;for(;g--;){if(h===u||u!==null&&h===u.alternate){E=h;break t}h=E(h),u=E(u)}E=null}else E=null;w!==null&&eh(b,f,w,E,!1),_!==null&&D!==null&&eh(b,D,_,E,!0)}}e:{if(f=p?so(p):window,w=f.nodeName&&f.nodeName.toLowerCase(),w==="select"||w==="input"&&f.type==="file")var R=df;else if(pf(f))if(Ph)R=Hy;else{R=By;var T=Oy}else w=f.nodeName,!w||w.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?p&&qp(p.elementType)&&(R=df):R=Ly;if(R&&(R=R(e,p))){Kh(b,R,a,m);break e}T&&T(e,f,p),e==="focusout"&&p&&f.type==="number"&&p.memoizedProps.value!=null&&Bu(f,"number",f.value)}switch(T=p?so(p):window,e){case"focusin":(pf(T)||T.contentEditable==="true")&&(Vi=T,ju=p,fo=null);break;case"focusout":fo=ju=Vi=null;break;case"mousedown":Qu=!0;break;case"contextmenu":case"mouseup":case"dragend":Qu=!1,gf(b,a,m);break;case"selectionchange":if(Qy)break;case"keydown":case"keyup":gf(b,a,m)}var U;if(zp)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else $i?Xh(e,a)&&(A="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(A="onCompositionStart");A&&(Vh&&a.locale!=="ko"&&($i||A!=="onCompositionStart"?A==="onCompositionEnd"&&$i&&(U=$h()):(Nr=m,Mp="value"in Nr?Nr.value:Nr.textContent,$i=!0)),T=xs(p,A),0<T.length&&(A=new lf(A,e,null,a,m),b.push({event:A,listeners:T}),U?A.data=U:(U=Zh(a),U!==null&&(A.data=U)))),(U=zy?Ry(e,a):Ay(e,a))&&(A=xs(p,"onBeforeInput"),0<A.length&&(T=new lf("onBeforeInput","beforeinput",null,a,m),b.push({event:T,listeners:A}),T.data=U)),S1(b,e,p,a,m)}Yb(b,t)})}function Do(e,t,a){return{instance:e,listener:t,currentTarget:a}}function xs(e,t){for(var a=t+"Capture",r=[];e!==null;){var i=e,n=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||n===null||(i=Co(e,a),i!=null&&r.unshift(Do(e,i,n)),i=Co(e,t),i!=null&&r.push(Do(e,i,n))),e.tag===3)return r;e=e.return}return[]}function C1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function eh(e,t,a,r,i){for(var n=t._reactName,o=[];a!==null&&a!==r;){var l=a,c=l.alternate,p=l.stateNode;if(l=l.tag,c!==null&&c===r)break;l!==5&&l!==26&&l!==27||p===null||(c=p,i?(p=Co(a,n),p!=null&&o.unshift(Do(a,p,c))):i||(p=Co(a,n),p!=null&&o.push(Do(a,p,c)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var q1=/\r\n?/g,E1=/\u0000|\uFFFD/g;function th(e){return(typeof e=="string"?e:""+e).replace(q1,`
|
|
9
|
-
`).replace(E1,"")}function Vb(e,t){return t=th(t),th(e)===t}function Qe(e,t,a,r,i,n){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||sn(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&sn(e,""+r);break;case"className":Nl(e,"class",r);break;case"tabIndex":Nl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Nl(e,a,r);break;case"style":Gh(e,r,n);break;case"data":if(t!=="object"){Nl(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=jl(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof n=="function"&&(a==="formAction"?(t!=="input"&&Qe(e,t,"name",i.name,i,null),Qe(e,t,"formEncType",i.formEncType,i,null),Qe(e,t,"formMethod",i.formMethod,i,null),Qe(e,t,"formTarget",i.formTarget,i,null)):(Qe(e,t,"encType",i.encType,i,null),Qe(e,t,"method",i.method,i,null),Qe(e,t,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=jl(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=tr);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(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=jl(""+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),Hl(e,"popover",r);break;case"xlinkActuate":Za(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Za(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Za(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Za(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Za(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Za(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Za(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Za(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Za(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Hl(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=iy.get(a)||a,Hl(e,a,r))}}function pp(e,t,a,r,i,n){switch(a){case"style":Gh(e,r,n);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"children":typeof r=="string"?sn(e,r):(typeof r=="number"||typeof r=="bigint")&&sn(e,""+r);break;case"onScroll":r!=null&&_e("scroll",e);break;case"onScrollEnd":r!=null&&_e("scrollend",e);break;case"onClick":r!=null&&(e.onclick=tr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Oh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(i=a.endsWith("Capture"),t=a.slice(2,i?a.length-7:void 0),n=e[Pt]||null,n=n!=null?n[a]:null,typeof n=="function"&&e.removeEventListener(t,n,i),typeof r=="function")){typeof n!="function"&&n!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,i);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Hl(e,a,r)}}}function zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",e),_e("load",e);var r=!1,i=!1,n;for(n in a)if(a.hasOwnProperty(n)){var o=a[n];if(o!=null)switch(n){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Qe(e,t,n,o,a,null)}}i&&Qe(e,t,"srcSet",a.srcSet,a,null),r&&Qe(e,t,"src",a.src,a,null);return;case"input":_e("invalid",e);var l=n=o=i=null,c=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var m=a[r];if(m!=null)switch(r){case"name":i=m;break;case"type":o=m;break;case"checked":c=m;break;case"defaultChecked":p=m;break;case"value":n=m;break;case"defaultValue":l=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(L(137,t));break;default:Qe(e,t,r,m,a,null)}}Hh(e,n,l,c,p,o,i,!1);return;case"select":_e("invalid",e),r=o=n=null;for(i in a)if(a.hasOwnProperty(i)&&(l=a[i],l!=null))switch(i){case"value":n=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:Qe(e,t,i,l,a,null)}t=n,a=o,e.multiple=!!r,t!=null?Wi(e,!!r,t,!1):a!=null&&Wi(e,!!r,a,!0);return;case"textarea":_e("invalid",e),n=i=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":i=l;break;case"children":n=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(L(91));break;default:Qe(e,t,o,l,a,null)}Qh(e,r,i,n);return;case"option":for(c in a)a.hasOwnProperty(c)&&(r=a[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Qe(e,t,c,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<Uo.length;r++)_e(Uo[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(L(137,t));default:Qe(e,t,p,r,a,null)}return;default:if(qp(t)){for(m in a)a.hasOwnProperty(m)&&(r=a[m],r!==void 0&&pp(e,t,m,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&Qe(e,t,l,r,a,null))}function M1(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,n=null,o=null,l=null,c=null,p=null,m=null;for(w in a){var b=a[w];if(a.hasOwnProperty(w)&&b!=null)switch(w){case"checked":break;case"value":break;case"defaultValue":c=b;default:r.hasOwnProperty(w)||Qe(e,t,w,null,r,b)}}for(var f in r){var w=r[f];if(b=a[f],r.hasOwnProperty(f)&&(w!=null||b!=null))switch(f){case"type":n=w;break;case"name":i=w;break;case"checked":p=w;break;case"defaultChecked":m=w;break;case"value":o=w;break;case"defaultValue":l=w;break;case"children":case"dangerouslySetInnerHTML":if(w!=null)throw Error(L(137,t));break;default:w!==b&&Qe(e,t,f,w,r,b)}}Ou(e,o,l,c,p,m,n,i);return;case"select":w=o=l=f=null;for(n in a)if(c=a[n],a.hasOwnProperty(n)&&c!=null)switch(n){case"value":break;case"multiple":w=c;default:r.hasOwnProperty(n)||Qe(e,t,n,null,r,c)}for(i in r)if(n=r[i],c=a[i],r.hasOwnProperty(i)&&(n!=null||c!=null))switch(i){case"value":f=n;break;case"defaultValue":l=n;break;case"multiple":o=n;default:n!==c&&Qe(e,t,i,n,r,c)}t=l,a=o,r=w,f!=null?Wi(e,!!a,f,!1):!!r!=!!a&&(t!=null?Wi(e,!!a,t,!0):Wi(e,!!a,a?[]:"",!1));return;case"textarea":w=f=null;for(l in a)if(i=a[l],a.hasOwnProperty(l)&&i!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Qe(e,t,l,null,r,i)}for(o in r)if(i=r[o],n=a[o],r.hasOwnProperty(o)&&(i!=null||n!=null))switch(o){case"value":f=i;break;case"defaultValue":w=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(L(91));break;default:i!==n&&Qe(e,t,o,i,r,n)}jh(e,f,w);return;case"option":for(var _ in a)f=a[_],a.hasOwnProperty(_)&&f!=null&&!r.hasOwnProperty(_)&&(_==="selected"?e.selected=!1:Qe(e,t,_,null,r,f));for(c in r)f=r[c],w=a[c],r.hasOwnProperty(c)&&f!==w&&(f!=null||w!=null)&&(c==="selected"?e.selected=f&&typeof f!="function"&&typeof f!="symbol":Qe(e,t,c,f,r,w));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)f=a[E],a.hasOwnProperty(E)&&f!=null&&!r.hasOwnProperty(E)&&Qe(e,t,E,null,r,f);for(p in r)if(f=r[p],w=a[p],r.hasOwnProperty(p)&&f!==w&&(f!=null||w!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Qe(e,t,p,f,r,w)}return;default:if(qp(t)){for(var D in a)f=a[D],a.hasOwnProperty(D)&&f!==void 0&&!r.hasOwnProperty(D)&&pp(e,t,D,void 0,r,f);for(m in r)f=r[m],w=a[m],!r.hasOwnProperty(m)||f===w||f===void 0&&w===void 0||pp(e,t,m,f,r,w);return}}for(var h in a)f=a[h],a.hasOwnProperty(h)&&f!=null&&!r.hasOwnProperty(h)&&Qe(e,t,h,null,r,f);for(b in r)f=r[b],w=a[b],!r.hasOwnProperty(b)||f===w||f==null&&w==null||Qe(e,t,b,f,r,w)}function ah(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function T1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var i=a[r],n=i.transferSize,o=i.initiatorType,l=i.duration;if(n&&l&&ah(o)){for(o=0,l=i.responseEnd,r+=1;r<a.length;r++){var c=a[r],p=c.startTime;if(p>l)break;var m=c.transferSize,b=c.initiatorType;m&&ah(b)&&(c=c.responseEnd,o+=m*(c<l?1:(l-p)/(c-p)))}if(--r,t+=8*(n+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var dp=null,mp=null;function ks(e){return e.nodeType===9?e:e.ownerDocument}function rh(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 fp(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 Su=null;function z1(){var e=window.event;return e&&e.type==="popstate"?e===Su?!1:(Su=e,!0):(Su=null,!1)}var Zb=typeof setTimeout=="function"?setTimeout:void 0,R1=typeof clearTimeout=="function"?clearTimeout:void 0,ih=typeof Promise=="function"?Promise:void 0,A1=typeof queueMicrotask=="function"?queueMicrotask:typeof ih<"u"?function(e){return ih.resolve(null).then(e).catch(U1)}:Zb;function U1(e){setTimeout(function(){throw e})}function Yr(e){return e==="head"}function nh(e,t){var a=t,r=0;do{var i=a.nextSibling;if(e.removeChild(a),i&&i.nodeType===8)if(a=i.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(i),gn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")So(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,So(a);for(var n=a.firstChild;n;){var o=n.nextSibling,l=n.nodeName;n[Yo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&n.rel.toLowerCase()==="stylesheet"||a.removeChild(n),n=o}}else a==="body"&&So(e.ownerDocument.body);a=i}while(a);gn(t)}function oh(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 hp(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":hp(a),Cp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function D1(e,t,a,r){for(;e.nodeType===1;){var i=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Yo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=ya(e.nextSibling),e===null)break}return null}function O1(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 Kb(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 gp(e){return e.data==="$?"||e.data==="$~"}function bp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function B1(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function 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 wp=null;function lh(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 sh(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 Pb(e,t,a){switch(t=ks(a),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function So(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Cp(e)}var _a=new Map,ch=new Set;function Ss(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var pr=Ue.d;Ue.d={f:L1,r:H1,D:j1,C:Q1,L:G1,m:Y1,X:V1,S:$1,M:X1};function L1(){var e=pr.f(),t=Qs();return e||t}function H1(e){var t=wn(e);t!==null&&t.tag===5&&t.type==="form"?Gg(t):pr.r(e)}var xn=typeof document>"u"?null:document;function Jb(e,t,a){var r=xn;if(r&&typeof t=="string"&&t){var i=ga(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),ch.has(i)||(ch.add(i),e={rel:e,crossOrigin:a,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),zt(t,"link",e),_t(t),r.head.appendChild(t)))}}function j1(e){pr.D(e),Jb("dns-prefetch",e,null)}function Q1(e,t){pr.C(e,t),Jb("preconnect",e,t)}function G1(e,t,a){pr.L(e,t,a);var r=xn;if(r&&e&&t){var i='link[rel="preload"][as="'+ga(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+ga(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+ga(a.imageSizes)+'"]')):i+='[href="'+ga(e)+'"]';var n=i;switch(t){case"style":n=hn(e);break;case"script":n=kn(e)}_a.has(n)||(e=et({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),_a.set(n,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(Po(n))||t==="script"&&r.querySelector(Jo(n))||(t=r.createElement("link"),zt(t,"link",e),_t(t),r.head.appendChild(t)))}}function Y1(e,t){pr.m(e,t);var a=xn;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ga(r)+'"][href="'+ga(e)+'"]',n=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=kn(e)}if(!_a.has(n)&&(e=et({rel:"modulepreload",href:e},t),_a.set(n,e),a.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Jo(n)))return}r=a.createElement("link"),zt(r,"link",e),_t(r),a.head.appendChild(r)}}}function $1(e,t,a){pr.S(e,t,a);var r=xn;if(r&&e){var i=Ii(r).hoistableStyles,n=hn(e);t=t||"default";var o=i.get(n);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Po(n)))l.loading=5;else{e=et({rel:"stylesheet",href:e,"data-precedence":t},a),(a=_a.get(n))&&pd(e,a);var c=o=r.createElement("link");_t(c),zt(c,"link",e),c._p=new Promise(function(p,m){c.onload=p,c.onerror=m}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Jl(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},i.set(n,o)}}}function V1(e,t){pr.X(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Jo(i)),n||(e=et({src:e,async:!0},t),(t=_a.get(i))&&dd(e,t),n=a.createElement("script"),_t(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function X1(e,t){pr.M(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Jo(i)),n||(e=et({src:e,async:!0,type:"module"},t),(t=_a.get(i))&&dd(e,t),n=a.createElement("script"),_t(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function uh(e,t,a,r){var i=(i=Mr.current)?Ss(i):null;if(!i)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=hn(a.href),a=Ii(i).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=hn(a.href);var n=Ii(i).hoistableStyles,o=n.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,o),(n=i.querySelector(Po(e)))&&!n._p&&(o.instance=n,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),n||Z1(i,e,a,o.state))),t&&r===null)throw Error(L(528,""));return o}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=kn(a),a=Ii(i).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(L(444,e))}}function hn(e){return'href="'+ga(e)+'"'}function Po(e){return'link[rel="stylesheet"]['+e+"]"}function Fb(e){return et({},e,{"data-precedence":e.precedence,precedence:null})}function Z1(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),zt(t,"link",a),_t(t),e.head.appendChild(t))}function kn(e){return'[src="'+ga(e)+'"]'}function Jo(e){return"script[async]"+e}function ph(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ga(a.href)+'"]');if(r)return t.instance=r,_t(r),r;var i=et({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),_t(r),zt(r,"style",i),Jl(r,a.precedence,e),t.instance=r;case"stylesheet":i=hn(a.href);var n=e.querySelector(Po(i));if(n)return t.state.loading|=4,t.instance=n,_t(n),n;r=Fb(a),(i=_a.get(i))&&pd(r,i),n=(e.ownerDocument||e).createElement("link"),_t(n);var o=n;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),t.state.loading|=4,Jl(n,a.precedence,e),t.instance=n;case"script":return n=kn(a.src),(i=e.querySelector(Jo(n)))?(t.instance=i,_t(i),i):(r=a,(i=_a.get(n))&&(r=et({},a),dd(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),_t(i),zt(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Jl(r,a.precedence,e));return t.instance}function Jl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,n=i,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)n=l;else if(n!==i)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function pd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function dd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Fl=null;function dh(e,t,a){if(Fl===null){var r=new Map,i=Fl=new Map;i.set(a,r)}else i=Fl,r=i.get(a),r||(r=new Map,i.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),i=0;i<a.length;i++){var n=a[i];if(!(n[Yo]||n[Et]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var o=n.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(n):r.set(o,[n])}}return r}function mh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function K1(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 Ib(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function P1(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=hn(r.href),n=t.querySelector(Po(i));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ns.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=n,_t(n);return}n=t.ownerDocument||t,r=Fb(r),(i=_a.get(i))&&pd(r,i),n=n.createElement("link"),_t(n);var o=n;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),a.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Ns.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Nu=0;function J1(e,t){return e.stylesheets&&e.count===0&&Il(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&Nu===0&&(Nu=62500*T1());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>Nu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Ns(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Il(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Cs=null;function Il(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Cs=new Map,t.forEach(F1,e),Cs=null,Ns.call(e))}function F1(e,t){if(!(t.state.loading&4)){var a=Cs.get(e);if(a)var r=a.get(null);else{a=new Map,Cs.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<i.length;n++){var o=i[n];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}i=t.instance,o=i.getAttribute("data-precedence"),n=a.get(o)||r,n===r&&a.set(null,i),a.set(o,i),this.count++,r=Ns.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),n?n.parentNode.insertBefore(i,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Oo={$$typeof:er,Provider:null,Consumer:null,_currentValue:ei,_currentValue2:ei,_threadCount:0};function I1(e,t,a,r,i,n,o,l,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Fc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.hiddenUpdates=Fc(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=n,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Wb(e,t,a,r,i,n,o,l,c,p,m,b){return e=new I1(e,t,a,o,c,p,m,b,l),t=1,n===!0&&(t|=24),n=ra(3,null,null,t),e.current=n,n.stateNode=e,t=Lp(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:r,isDehydrated:a,cache:t},Qp(n),e}function ew(e){return e?(e=Ki,e):Ki}function tw(e,t,a,r,i,n){i=ew(i),r.context===null?r.context=i:r.pendingContext=i,r=zr(t),r.payload={element:a},n=n===void 0?null:n,n!==null&&(r.callback=n),a=Rr(e,r,t),a!==null&&(Kt(a,e,t),go(a,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function md(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function aw(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&Kt(t,e,67108864),md(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=sa();t=Sp(t);var a=mi(e,t);a!==null&&Kt(a,e,t),md(e,t)}}var qs=!0;function W1(e,t,a,r){var i=se.T;se.T=null;var n=Ue.p;try{Ue.p=2,fd(e,t,a,r)}finally{Ue.p=n,se.T=i}}function e_(e,t,a,r){var i=se.T;se.T=null;var n=Ue.p;try{Ue.p=8,fd(e,t,a,r)}finally{Ue.p=n,se.T=i}}function fd(e,t,a,r){if(qs){var i=vp(r);if(i===null)ku(e,t,r,Es,a),gh(e,r);else if(a_(i,e,t,a,r))r.stopPropagation();else if(gh(e,r),t&4&&-1<t_.indexOf(e)){for(;i!==null;){var n=wn(i);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var o=Fr(n.pendingLanes);if(o!==0){var l=n;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-la(o);l.entanglements[1]|=c,o&=~c}ja(n),(Ae&6)===0&&(bs=na()+500,Ko(0,!1))}}break;case 31:case 13:l=mi(n,2),l!==null&&Kt(l,n,2),Qs(),md(n,2)}if(n=vp(r),n===null&&ku(e,t,r,Es,a),n===i)break;i=n}i!==null&&r.stopPropagation()}else ku(e,t,r,null,a)}}function vp(e){return e=Ep(e),hd(e)}var Es=null;function hd(e){if(Es=null,e=Gi(e),e!==null){var t=Ho(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=xh(t),e!==null)return e;e=null}else if(a===31){if(e=kh(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 Es=e,null}function rw(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(G0()){case qh:return 2;case Eh:return 8;case rs:case Y0:return 32;case Mh:return 268435456;default:return 32}default:return 32}}var yp=!1,Dr=null,Or=null,Br=null,Bo=new Map,Lo=new Map,kr=[],t_="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 gh(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":Bo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lo.delete(t.pointerId)}}function io(e,t,a,r,i,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:n,targetContainers:[i]},t!==null&&(t=wn(t),t!==null&&aw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function a_(e,t,a,r,i){switch(t){case"focusin":return Dr=io(Dr,e,t,a,r,i),!0;case"dragenter":return Or=io(Or,e,t,a,r,i),!0;case"mouseover":return Br=io(Br,e,t,a,r,i),!0;case"pointerover":var n=i.pointerId;return Bo.set(n,io(Bo.get(n)||null,e,t,a,r,i)),!0;case"gotpointercapture":return n=i.pointerId,Lo.set(n,io(Lo.get(n)||null,e,t,a,r,i)),!0}return!1}function iw(e){var t=Gi(e.target);if(t!==null){var a=Ho(t);if(a!==null){if(t=a.tag,t===13){if(t=xh(a),t!==null){e.blockedOn=t,Im(e.priority,function(){hh(a)});return}}else if(t===31){if(t=kh(a),t!==null){e.blockedOn=t,Im(e.priority,function(){hh(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 Wl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=vp(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Lu=r,a.target.dispatchEvent(r),Lu=null}else return t=wn(a),t!==null&&aw(t),e.blockedOn=a,!1;t.shift()}return!0}function bh(e,t,a){Wl(e)&&a.delete(t)}function r_(){yp=!1,Dr!==null&&Wl(Dr)&&(Dr=null),Or!==null&&Wl(Or)&&(Or=null),Br!==null&&Wl(Br)&&(Br=null),Bo.forEach(bh),Lo.forEach(bh)}function Bl(e,t){e.blockedOn===t&&(e.blockedOn=null,yp||(yp=!0,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,r_)))}var Ll=null;function wh(e){Ll!==e&&(Ll=e,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,function(){Ll===e&&(Ll=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],i=e[t+2];if(typeof r!="function"){if(hd(r||a)===null)continue;break}var n=wn(a);n!==null&&(e.splice(t,3),t-=3,ep(n,{pending:!0,data:i,method:a.method,action:r},r,i))}}))}function gn(e){function t(c){return Bl(c,e)}Dr!==null&&Bl(Dr,e),Or!==null&&Bl(Or,e),Br!==null&&Bl(Br,e),Bo.forEach(t),Lo.forEach(t);for(var a=0;a<kr.length;a++){var r=kr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kr.length&&(a=kr[0],a.blockedOn===null);)iw(a),a.blockedOn===null&&kr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var i=a[r],n=a[r+1],o=i[Pt]||null;if(typeof n=="function")o||wh(a);else if(o){var l=null;if(n&&n.hasAttribute("formAction")){if(i=n,o=n[Pt]||null)l=o.formAction;else if(hd(i)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),wh(a)}}}function nw(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function gd(e){this._internalRoot=e}$s.prototype.render=gd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var a=t.current,r=sa();tw(a,r,e,t,null,null)};$s.prototype.unmount=gd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;tw(e.current,2,null,e,null,null),Qs(),t[bn]=null}};function $s(e){this._internalRoot=e}$s.prototype.unstable_scheduleHydration=function(e){if(e){var t=Uh();e={blockedOn:null,target:e,priority:t};for(var a=0;a<kr.length&&t!==0&&t<kr[a].priority;a++);kr.splice(a,0,e),a===0&&iw(e)}};var vh=yh.version;if(vh!=="19.2.3")throw Error(L(527,vh,"19.2.3"));Ue.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=D0(t),e=e!==null?Sh(e):null,e=e===null?null:e.stateNode,e};var i_={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:se,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(no=__REACT_DEVTOOLS_GLOBAL_HOOK__,!no.isDisabled&&no.supportsFiber))try{jo=no.inject(i_),oa=no}catch{}var no;Vs.createRoot=function(e,t){if(!_h(e))throw Error(L(299));var a=!1,r="",i=Jg,n=Fg,o=Ig;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Wb(e,1,!1,null,null,a,r,null,i,n,o,nw),e[bn]=t.current,ud(e),new gd(t)};Vs.hydrateRoot=function(e,t,a){if(!_h(e))throw Error(L(299));var r=!1,i="",n=Jg,o=Fg,l=Ig,c=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(n=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(c=a.formState)),t=Wb(e,1,!0,t,a??null,r,i,c,n,o,l,nw),t.context=ew(null),a=t.current,r=sa(),r=Sp(r),i=zr(r),i.callback=null,Rr(a,i,r),a=r,t.current.lanes=a,Go(t,a),ja(t),e[bn]=t.current,ud(e),new $s(t)};Vs.version="19.2.3"});var cw=Aa(($x,sw)=>{"use strict";function lw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lw)}catch(e){console.error(e)}}lw(),sw.exports=ow()});var ev=Aa(Ps=>{"use strict";var d_=Symbol.for("react.transitional.element"),m_=Symbol.for("react.fragment");function Ww(e,t,a){var r=null;if(a!==void 0&&(r=""+a),t.key!==void 0&&(r=""+t.key),"key"in t){a={};for(var i in t)i!=="key"&&(a[i]=t[i])}else a=t;return t=a.ref,{$$typeof:d_,type:e,key:r,ref:t!==void 0?t:null,props:a}}Ps.Fragment=m_;Ps.jsx=Ww;Ps.jsxs=Ww});var ee=Aa((b2,tv)=>{"use strict";tv.exports=ev()});var r0=Y(cw());var uw=`/* Every rule is scoped to .app-wrapper, the root of each widget, so nothing here styles
|
|
8
|
+
`+r.stack}}var Au=Object.prototype.hasOwnProperty,kp=bt.unstable_scheduleCallback,Jc=bt.unstable_cancelCallback,j0=bt.unstable_shouldYield,Q0=bt.unstable_requestPaint,na=bt.unstable_now,G0=bt.unstable_getCurrentPriorityLevel,qh=bt.unstable_ImmediatePriority,Eh=bt.unstable_UserBlockingPriority,rs=bt.unstable_NormalPriority,Y0=bt.unstable_LowPriority,Mh=bt.unstable_IdlePriority,$0=bt.log,V0=bt.unstable_setDisableYieldValue,jo=null,oa=null;function Sr(e){if(typeof $0=="function"&&V0(e),oa&&typeof oa.setStrictMode=="function")try{oa.setStrictMode(jo,e)}catch{}}var la=Math.clz32?Math.clz32:K0,X0=Math.log,Z0=Math.LN2;function K0(e){return e>>>=0,e===0?32:31-(X0(e)/Z0|0)|0}var xl=256,kl=262144,Sl=4194304;function Fr(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 Ms(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~n,r!==0?i=Fr(r):(o&=l,o!==0?i=Fr(o):a||(a=l&~e,a!==0&&(i=Fr(a))))):(l=r&~n,l!==0?i=Fr(l):o!==0?i=Fr(o):a||(a=r&~e,a!==0&&(i=Fr(a)))),i===0?0:t!==0&&t!==i&&(t&n)===0&&(n=i&-i,a=t&-t,n>=a||n===32&&(a&4194048)!==0)?t:i}function Qo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function P0(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 Th(){var e=Sl;return Sl<<=1,(Sl&62914560)===0&&(Sl=4194304),e}function Fc(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Go(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function J0(e,t,a,r,i,n){var o=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,p=e.hiddenUpdates;for(a=o&~a;0<a;){var m=31-la(a),b=1<<m;l[m]=0,c[m]=-1;var f=p[m];if(f!==null)for(p[m]=null,m=0;m<f.length;m++){var w=f[m];w!==null&&(w.lane&=-536870913)}a&=~b}r!==0&&zh(e,r,0),n!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=n&~(o&~t))}function zh(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-la(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function Rh(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-la(a),i=1<<r;i&t|e[r]&t&&(e[r]|=t),a&=~i}}function Ah(e,t){var a=t&-t;return a=(a&42)!==0?1:Sp(a),(a&(e.suspendedLanes|t))!==0?0:a}function Sp(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 Np(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Uh(){var e=Ue.p;return e!==0?e:(e=window.event,e===void 0?32:rw(e.type))}function Im(e,t){var a=Ue.p;try{return Ue.p=e,t()}finally{Ue.p=a}}var Gr=Math.random().toString(36).slice(2),Et="__reactFiber$"+Gr,Pt="__reactProps$"+Gr,bn="__reactContainer$"+Gr,Uu="__reactEvents$"+Gr,F0="__reactListeners$"+Gr,I0="__reactHandles$"+Gr,Wm="__reactResources$"+Gr,Yo="__reactMarker$"+Gr;function Cp(e){delete e[Et],delete e[Pt],delete e[Uu],delete e[F0],delete e[I0]}function Gi(e){var t=e[Et];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[Et]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=sh(e);e!==null;){if(a=e[Et])return a;e=sh(e)}return t}e=a,a=e.parentNode}return null}function wn(e){if(e=e[Et]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function so(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(L(33))}function Ii(e){var t=e[Wm];return t||(t=e[Wm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function _t(e){e[Yo]=!0}var Dh=new Set,Oh={};function ui(e,t){ln(e,t),ln(e+"Capture",t)}function ln(e,t){for(Oh[e]=t,e=0;e<t.length;e++)Dh.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]*$"),ef={},tf={};function ey(e){return Au.call(tf,e)?!0:Au.call(ef,e)?!1:W0.test(e)?tf[e]=!0:(ef[e]=!0,!1)}function Hl(e,t,a){if(ey(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 Nl(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 Za(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 Bh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ty(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){a=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(o){a=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Du(e){if(!e._valueTracker){var t=Bh(e)?"checked":"value";e._valueTracker=ty(e,t,""+e[t])}}function Lh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Bh(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function is(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 ay=/[\n"\\]/g;function ga(e){return e.replace(ay,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ou(e,t,a,r,i,n,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ma(t)):e.value!==""+ma(t)&&(e.value=""+ma(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Bu(e,o,ma(t)):a!=null?Bu(e,o,ma(a)):r!=null&&e.removeAttribute("value"),i==null&&n!=null&&(e.defaultChecked=!!n),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+ma(l):e.removeAttribute("name")}function Hh(e,t,a,r,i,n,o,l){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||a!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){Du(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??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Du(e)}function Bu(e,t,a){t==="number"&&is(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Wi(e,t,a,r){if(e=e.options,t){t={};for(var i=0;i<a.length;i++)t["$"+a[i]]=!0;for(a=0;a<e.length;a++)i=t.hasOwnProperty("$"+e[a].value),e[a].selected!==i&&(e[a].selected=i),i&&r&&(e[a].defaultSelected=!0)}else{for(a=""+ma(a),t=null,i=0;i<e.length;i++){if(e[i].value===a){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function jh(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 Qh(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(L(92));if(lo(r)){if(1<r.length)throw Error(L(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),Du(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 ry=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 af(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||ry.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Gh(e,t,a){if(t!=null&&typeof t!="object")throw Error(L(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&a[i]!==r&&af(e,i,r)}else for(var n in t)t.hasOwnProperty(n)&&af(e,n,t[n])}function qp(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 iy=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"]]),ny=/^[\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 jl(e){return ny.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function tr(){}var Lu=null;function Ep(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 rf(e){var t=wn(e);if(t&&(e=t.stateNode)){var a=e[Pt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ou(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="'+ga(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var i=r[Pt]||null;if(!i)throw Error(L(90));Ou(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Lh(r)}break e;case"textarea":jh(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Wi(e,!!a.multiple,t,!1)}}}var Ic=!1;function Yh(e,t,a){if(Ic)return e(t,a);Ic=!0;try{var r=e(t);return r}finally{if(Ic=!1,(Yi!==null||en!==null)&&(Qs(),Yi&&(t=Yi,e=en,en=Yi=null,rf(t),e)))for(t=0;t<e.length;t++)rf(e[t])}}function Co(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Pt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(L(231,t,typeof a));return a}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hu=!1;if(or)try{Di={},Object.defineProperty(Di,"passive",{get:function(){Hu=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{Hu=!1}var Di,Nr=null,Mp=null,Ql=null;function $h(){if(Ql)return Ql;var e,t=Mp,a=t.length,r,i="value"in Nr?Nr.value:Nr.textContent,n=i.length;for(e=0;e<a&&t[e]===i[e];e++);var o=a-e;for(r=1;r<=o&&t[a-r]===i[n-r];r++);return Ql=i.slice(e,1<r?1-r:void 0)}function Gl(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 Cl(){return!0}function nf(){return!1}function Jt(e){function t(a,r,i,n,o){this._reactName=a,this._targetInst=i,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(a=e[l],this[l]=a?a(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?Cl:nf,this.isPropagationStopped=nf,this}return et(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=Cl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),t}var pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ts=Jt(pi),$o=et({},pi,{view:0,detail:0}),oy=Jt($o),Wc,eu,eo,zs=et({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tp,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!==eo&&(eo&&e.type==="mousemove"?(Wc=e.screenX-eo.screenX,eu=e.screenY-eo.screenY):eu=Wc=0,eo=e),Wc)},movementY:function(e){return"movementY"in e?e.movementY:eu}}),of=Jt(zs),ly=et({},zs,{dataTransfer:0}),sy=Jt(ly),cy=et({},$o,{relatedTarget:0}),tu=Jt(cy),uy=et({},pi,{animationName:0,elapsedTime:0,pseudoElement:0}),py=Jt(uy),dy=et({},pi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),my=Jt(dy),fy=et({},pi,{data:0}),lf=Jt(fy),hy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gy={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"},by={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=by[e])?!!t[e]:!1}function Tp(){return wy}var vy=et({},$o,{key:function(e){if(e.key){var t=hy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tp,charCode:function(e){return e.type==="keypress"?Gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yy=Jt(vy),_y=et({},zs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sf=Jt(_y),xy=et({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tp}),ky=Jt(xy),Sy=et({},pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ny=Jt(Sy),Cy=et({},zs,{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}),qy=Jt(Cy),Ey=et({},pi,{newState:0,oldState:0}),My=Jt(Ey),Ty=[9,13,27,32],zp=or&&"CompositionEvent"in window,po=null;or&&"documentMode"in document&&(po=document.documentMode);var zy=or&&"TextEvent"in window&&!po,Vh=or&&(!zp||po&&8<po&&11>=po),cf=" ",uf=!1;function Xh(e,t){switch(e){case"keyup":return Ty.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $i=!1;function Ry(e,t){switch(e){case"compositionend":return Zh(t);case"keypress":return t.which!==32?null:(uf=!0,cf);case"textInput":return e=t.data,e===cf&&uf?null:e;default:return null}}function Ay(e,t){if($i)return e==="compositionend"||!zp&&Xh(e,t)?(e=$h(),Ql=Mp=Nr=null,$i=!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 Vh&&t.locale!=="ko"?null:t.data;default:return null}}var Uy={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 pf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Uy[e.type]:t==="textarea"}function Kh(e,t,a,r){Yi?en?en.push(r):en=[r]:Yi=r,t=xs(t,"onChange"),0<t.length&&(a=new Ts("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var mo=null,qo=null;function Dy(e){Yb(e,0)}function Rs(e){var t=so(e);if(Lh(t))return e}function df(e,t){if(e==="change")return t}var Ph=!1;or&&(or?(El="oninput"in document,El||(au=document.createElement("div"),au.setAttribute("oninput","return;"),El=typeof au.oninput=="function"),ql=El):ql=!1,Ph=ql&&(!document.documentMode||9<document.documentMode));var ql,El,au;function mf(){mo&&(mo.detachEvent("onpropertychange",Jh),qo=mo=null)}function Jh(e){if(e.propertyName==="value"&&Rs(qo)){var t=[];Kh(t,qo,e,Ep(e)),Yh(Dy,t)}}function Oy(e,t,a){e==="focusin"?(mf(),mo=t,qo=a,mo.attachEvent("onpropertychange",Jh)):e==="focusout"&&mf()}function By(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rs(qo)}function Ly(e,t){if(e==="click")return Rs(t)}function Hy(e,t){if(e==="input"||e==="change")return Rs(t)}function jy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ca=typeof Object.is=="function"?Object.is:jy;function Eo(e,t){if(ca(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var i=a[r];if(!Au.call(t,i)||!ca(e[i],t[i]))return!1}return!0}function ff(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hf(e,t){var a=ff(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=ff(a)}}function Fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ih(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=is(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=is(e.document)}return t}function Rp(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 Qy=or&&"documentMode"in document&&11>=document.documentMode,Vi=null,ju=null,fo=null,Qu=!1;function gf(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Qu||Vi==null||Vi!==is(r)||(r=Vi,"selectionStart"in r&&Rp(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}),fo&&Eo(fo,r)||(fo=r,r=xs(ju,"onSelect"),0<r.length&&(t=new Ts("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Vi)))}function Pr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Xi={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")},ru={},Wh={};or&&(Wh=document.createElement("div").style,"AnimationEvent"in window||(delete Xi.animationend.animation,delete Xi.animationiteration.animation,delete Xi.animationstart.animation),"TransitionEvent"in window||delete Xi.transitionend.transition);function di(e){if(ru[e])return ru[e];if(!Xi[e])return e;var t=Xi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Wh)return ru[e]=t[a];return e}var eg=di("animationend"),tg=di("animationiteration"),ag=di("animationstart"),Gy=di("transitionrun"),Yy=di("transitionstart"),$y=di("transitioncancel"),rg=di("transitionend"),ig=new Map,Gu="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(" ");Gu.push("scrollEnd");function Ta(e,t){ig.set(e,t),ui(t,[e])}var ns=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,Ap=0;function As(){for(var e=Zi,t=Ap=Zi=0;t<e;){var a=da[t];da[t++]=null;var r=da[t];da[t++]=null;var i=da[t];da[t++]=null;var n=da[t];if(da[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}n!==0&&ng(a,i,n)}}function Us(e,t,a,r){da[Zi++]=e,da[Zi++]=t,da[Zi++]=a,da[Zi++]=r,Ap|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Up(e,t,a,r){return Us(e,t,a,r),os(e)}function mi(e,t){return Us(e,null,null,t),os(e)}function ng(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var i=!1,n=e.return;n!==null;)n.childLanes|=a,r=n.alternate,r!==null&&(r.childLanes|=a),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(i=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,i&&t!==null&&(i=31-la(a),e=n.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=a|536870912),n):null}function os(e){if(50<ko)throw ko=0,cp=null,Error(L(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ki={};function Vy(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(e,t,a,r){return new Vy(e,t,a,r)}function Dp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rr(e,t){var a=e.alternate;return a===null?(a=ra(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function og(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 Yl(e,t,a,r,i,n){var o=0;if(r=e,typeof e=="function")Dp(e)&&(o=1);else if(typeof e=="string")o=K1(e,a,La.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Mu:return e=ra(31,a,t,i),e.elementType=Mu,e.lanes=n,e;case ji:return ti(a.children,i,n,t);case Nh:o=8,i|=24;break;case Cu:return e=ra(12,a,t,i|2),e.elementType=Cu,e.lanes=n,e;case qu:return e=ra(13,a,t,i),e.elementType=qu,e.lanes=n,e;case Eu:return e=ra(19,a,t,i),e.elementType=Eu,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case er:o=10;break e;case Ch:o=9;break e;case _p:o=11;break e;case xp:o=14;break e;case wr:o=16,r=null;break e}o=29,a=Error(L(130,e===null?"null":typeof e,"")),r=null}return t=ra(o,a,t,i),t.elementType=e,t.type=r,t.lanes=n,t}function ti(e,t,a,r){return e=ra(7,e,r,t),e.lanes=a,e}function iu(e,t,a){return e=ra(6,e,null,t),e.lanes=a,e}function lg(e){var t=ra(18,null,null,0);return t.stateNode=e,t}function nu(e,t,a){return t=ra(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var bf=new WeakMap;function ba(e,t){if(typeof e=="object"&&e!==null){var a=bf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Fm(t)},bf.set(e,t),t)}return{value:e,source:t,stack:Fm(t)}}var Pi=[],Ji=0,ls=null,Mo=0,fa=[],ha=0,Lr=null,Da=1,Oa="";function Ia(e,t){Pi[Ji++]=Mo,Pi[Ji++]=ls,ls=e,Mo=t}function sg(e,t,a){fa[ha++]=Da,fa[ha++]=Oa,fa[ha++]=Lr,Lr=e;var r=Da;e=Oa;var i=32-la(r)-1;r&=~(1<<i),a+=1;var n=32-la(t)+i;if(30<n){var o=i-i%5;n=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Da=1<<32-la(t)+i|a<<i|r,Oa=n+e}else Da=1<<n|a<<i|r,Oa=e}function Op(e){e.return!==null&&(Ia(e,1),sg(e,1,0))}function Bp(e){for(;e===ls;)ls=Pi[--Ji],Pi[Ji]=null,Mo=Pi[--Ji],Pi[Ji]=null;for(;e===Lr;)Lr=fa[--ha],fa[ha]=null,Oa=fa[--ha],fa[ha]=null,Da=fa[--ha],fa[ha]=null}function cg(e,t){fa[ha++]=Da,fa[ha++]=Oa,fa[ha++]=Lr,Da=t.id,Oa=t.overflow,Lr=e}var Mt=null,We=null,Ce=!1,Tr=null,wa=!1,Yu=Error(L(519));function Hr(e){var t=Error(L(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw To(ba(t,e)),Yu}function wf(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Et]=e,t[Pt]=r,a){case"dialog":ye("cancel",t),ye("close",t);break;case"iframe":case"object":case"embed":ye("load",t);break;case"video":case"audio":for(a=0;a<Uo.length;a++)ye(Uo[a],t);break;case"source":ye("error",t);break;case"img":case"image":case"link":ye("error",t),ye("load",t);break;case"details":ye("toggle",t);break;case"input":ye("invalid",t),Hh(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":ye("invalid",t);break;case"textarea":ye("invalid",t),Qh(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||Vb(t.textContent,a)?(r.popover!=null&&(ye("beforetoggle",t),ye("toggle",t)),r.onScroll!=null&&ye("scroll",t),r.onScrollEnd!=null&&ye("scrollend",t),r.onClick!=null&&(t.onclick=tr),t=!0):t=!1,t||Hr(e,!0)}function vf(e){for(Mt=e.return;Mt;)switch(Mt.tag){case 5:case 31:case 13:wa=!1;return;case 27:case 3:wa=!0;return;default:Mt=Mt.return}}function Oi(e){if(e!==Mt)return!1;if(!Ce)return vf(e),Ce=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||fp(e.type,e.memoizedProps)),a=!a),a&&We&&Hr(e),vf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));We=lh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));We=lh(e)}else t===27?(t=We,Yr(e.type)?(e=wp,wp=null,We=e):We=t):We=Mt?ya(e.stateNode.nextSibling):null;return!0}function ni(){We=Mt=null,Ce=!1}function ou(){var e=Tr;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Tr=null),e}function To(e){Tr===null?Tr=[e]:Tr.push(e)}var $u=Ha(null),fi=null,ar=null;function yr(e,t,a){Pe($u,t._currentValue),t._currentValue=a}function ir(e){e._currentValue=$u.current,xt($u)}function Vu(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 Xu(e,t,a,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var n=i.dependencies;if(n!==null){var o=i.child;n=n.firstContext;e:for(;n!==null;){var l=n;n=i;for(var c=0;c<t.length;c++)if(l.context===t[c]){n.lanes|=a,l=n.alternate,l!==null&&(l.lanes|=a),Vu(n.return,a,e),r||(o=null);break e}n=l.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=a,n=o.alternate,n!==null&&(n.lanes|=a),Vu(o,a,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function vn(e,t,a,r){e=null;for(var i=t,n=!1;i!==null;){if(!n){if((i.flags&524288)!==0)n=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(L(387));if(o=o.memoizedProps,o!==null){var l=i.type;ca(i.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(i===es.current){if(o=i.alternate,o===null)throw Error(L(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Oo):e=[Oo])}i=i.return}e!==null&&Xu(t,e,a,r),t.flags|=262144}function ss(e){for(e=e.firstContext;e!==null;){if(!ca(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oi(e){fi=e,ar=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return ug(fi,e)}function Ml(e,t){return fi===null&&oi(e),ug(e,t)}function ug(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ar===null){if(e===null)throw Error(L(308));ar=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ar=ar.next=t;return a}var Xy=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()})}},Zy=bt.unstable_scheduleCallback,Ky=bt.unstable_NormalPriority,mt={$$typeof:er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lp(){return{controller:new Xy,data:new Map,refCount:0}}function Vo(e){e.refCount--,e.refCount===0&&Zy(Ky,function(){e.controller.abort()})}var ho=null,Zu=0,cn=0,tn=null;function Py(e,t){if(ho===null){var a=ho=[];Zu=0,cn=cd(),tn={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Zu++,t.then(yf,yf),t}function yf(){if(--Zu===0&&ho!==null){tn!==null&&(tn.status="fulfilled");var e=ho;ho=null,cn=0,tn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Jy(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(i){a.push(i)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var i=0;i<a.length;i++)(0,a[i])(t)},function(i){for(r.status="rejected",r.reason=i,i=0;i<a.length;i++)(0,a[i])(void 0)}),r}var _f=se.S;se.S=function(e,t){Sb=na(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Py(e,t),_f!==null&&_f(e,t)};var ai=Ha(null);function Hp(){var e=ai.current;return e!==null?e:$e.pooledCache}function $l(e,t){t===null?Pe(ai,ai.current):Pe(ai,t.pool)}function pg(){var e=Hp();return e===null?null:{parent:mt._currentValue,pool:e}}var yn=Error(L(460)),jp=Error(L(474)),Ds=Error(L(542)),cs={then:function(){}};function xf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dg(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(tr,tr),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sf(e),e;default:if(typeof t.status=="string")t.then(tr,tr);else{if(e=$e,e!==null&&100<e.shellSuspendCounter)throw Error(L(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=r}},function(r){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sf(e),e}throw ri=t,yn}}function Ir(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ri=a,yn):a}}var ri=null;function kf(){if(ri===null)throw Error(L(459));var e=ri;return ri=null,e}function Sf(e){if(e===yn||e===Ds)throw Error(L(483))}var an=null,zo=0;function Tl(e){var t=zo;return zo+=1,an===null&&(an=[]),dg(an,e,t)}function to(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zl(e,t){throw t.$$typeof===O0?Error(L(525)):(e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function mg(e){function t(h,u){if(e){var g=h.deletions;g===null?(h.deletions=[u],h.flags|=16):g.push(u)}}function a(h,u){if(!e)return null;for(;u!==null;)t(h,u),u=u.sibling;return null}function r(h){for(var u=new Map;h!==null;)h.key!==null?u.set(h.key,h):u.set(h.index,h),h=h.sibling;return u}function i(h,u){return h=rr(h,u),h.index=0,h.sibling=null,h}function n(h,u,g){return h.index=g,e?(g=h.alternate,g!==null?(g=g.index,g<u?(h.flags|=67108866,u):g):(h.flags|=67108866,u)):(h.flags|=1048576,u)}function o(h){return e&&h.alternate===null&&(h.flags|=67108866),h}function l(h,u,g,v){return u===null||u.tag!==6?(u=iu(g,h.mode,v),u.return=h,u):(u=i(u,g),u.return=h,u)}function c(h,u,g,v){var N=g.type;return N===ji?m(h,u,g.props.children,v,g.key):u!==null&&(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===wr&&Ir(N)===u.type)?(u=i(u,g.props),to(u,g),u.return=h,u):(u=Yl(g.type,g.key,g.props,null,h.mode,v),to(u,g),u.return=h,u)}function p(h,u,g,v){return u===null||u.tag!==4||u.stateNode.containerInfo!==g.containerInfo||u.stateNode.implementation!==g.implementation?(u=nu(g,h.mode,v),u.return=h,u):(u=i(u,g.children||[]),u.return=h,u)}function m(h,u,g,v,N){return u===null||u.tag!==7?(u=ti(g,h.mode,v,N),u.return=h,u):(u=i(u,g),u.return=h,u)}function b(h,u,g){if(typeof u=="string"&&u!==""||typeof u=="number"||typeof u=="bigint")return u=iu(""+u,h.mode,g),u.return=h,u;if(typeof u=="object"&&u!==null){switch(u.$$typeof){case _l:return g=Yl(u.type,u.key,u.props,null,h.mode,g),to(g,u),g.return=h,g;case oo:return u=nu(u,h.mode,g),u.return=h,u;case wr:return u=Ir(u),b(h,u,g)}if(lo(u)||Wn(u))return u=ti(u,h.mode,g,null),u.return=h,u;if(typeof u.then=="function")return b(h,Tl(u),g);if(u.$$typeof===er)return b(h,Ml(h,u),g);zl(h,u)}return null}function f(h,u,g,v){var N=u!==null?u.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return N!==null?null:l(h,u,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case _l:return g.key===N?c(h,u,g,v):null;case oo:return g.key===N?p(h,u,g,v):null;case wr:return g=Ir(g),f(h,u,g,v)}if(lo(g)||Wn(g))return N!==null?null:m(h,u,g,v,null);if(typeof g.then=="function")return f(h,u,Tl(g),v);if(g.$$typeof===er)return f(h,u,Ml(h,g),v);zl(h,g)}return null}function w(h,u,g,v,N){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return h=h.get(g)||null,l(u,h,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case _l:return h=h.get(v.key===null?g:v.key)||null,c(u,h,v,N);case oo:return h=h.get(v.key===null?g:v.key)||null,p(u,h,v,N);case wr:return v=Ir(v),w(h,u,g,v,N)}if(lo(v)||Wn(v))return h=h.get(g)||null,m(u,h,v,N,null);if(typeof v.then=="function")return w(h,u,g,Tl(v),N);if(v.$$typeof===er)return w(h,u,g,Ml(u,v),N);zl(u,v)}return null}function _(h,u,g,v){for(var N=null,R=null,T=u,U=u=0,A=null;T!==null&&U<g.length;U++){T.index>U?(A=T,T=null):A=T.sibling;var B=f(h,T,g[U],v);if(B===null){T===null&&(T=A);break}e&&T&&B.alternate===null&&t(h,T),u=n(B,u,U),R===null?N=B:R.sibling=B,R=B,T=A}if(U===g.length)return a(h,T),Ce&&Ia(h,U),N;if(T===null){for(;U<g.length;U++)T=b(h,g[U],v),T!==null&&(u=n(T,u,U),R===null?N=T:R.sibling=T,R=T);return Ce&&Ia(h,U),N}for(T=r(T);U<g.length;U++)A=w(T,h,U,g[U],v),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?U:A.key),u=n(A,u,U),R===null?N=A:R.sibling=A,R=A);return e&&T.forEach(function(ie){return t(h,ie)}),Ce&&Ia(h,U),N}function E(h,u,g,v){if(g==null)throw Error(L(151));for(var N=null,R=null,T=u,U=u=0,A=null,B=g.next();T!==null&&!B.done;U++,B=g.next()){T.index>U?(A=T,T=null):A=T.sibling;var ie=f(h,T,B.value,v);if(ie===null){T===null&&(T=A);break}e&&T&&ie.alternate===null&&t(h,T),u=n(ie,u,U),R===null?N=ie:R.sibling=ie,R=ie,T=A}if(B.done)return a(h,T),Ce&&Ia(h,U),N;if(T===null){for(;!B.done;U++,B=g.next())B=b(h,B.value,v),B!==null&&(u=n(B,u,U),R===null?N=B:R.sibling=B,R=B);return Ce&&Ia(h,U),N}for(T=r(T);!B.done;U++,B=g.next())B=w(T,h,U,B.value,v),B!==null&&(e&&B.alternate!==null&&T.delete(B.key===null?U:B.key),u=n(B,u,U),R===null?N=B:R.sibling=B,R=B);return e&&T.forEach(function(ze){return t(h,ze)}),Ce&&Ia(h,U),N}function D(h,u,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 _l:e:{for(var N=g.key;u!==null;){if(u.key===N){if(N=g.type,N===ji){if(u.tag===7){a(h,u.sibling),v=i(u,g.props.children),v.return=h,h=v;break e}}else if(u.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===wr&&Ir(N)===u.type){a(h,u.sibling),v=i(u,g.props),to(v,g),v.return=h,h=v;break e}a(h,u);break}else t(h,u);u=u.sibling}g.type===ji?(v=ti(g.props.children,h.mode,v,g.key),v.return=h,h=v):(v=Yl(g.type,g.key,g.props,null,h.mode,v),to(v,g),v.return=h,h=v)}return o(h);case oo:e:{for(N=g.key;u!==null;){if(u.key===N)if(u.tag===4&&u.stateNode.containerInfo===g.containerInfo&&u.stateNode.implementation===g.implementation){a(h,u.sibling),v=i(u,g.children||[]),v.return=h,h=v;break e}else{a(h,u);break}else t(h,u);u=u.sibling}v=nu(g,h.mode,v),v.return=h,h=v}return o(h);case wr:return g=Ir(g),D(h,u,g,v)}if(lo(g))return _(h,u,g,v);if(Wn(g)){if(N=Wn(g),typeof N!="function")throw Error(L(150));return g=N.call(g),E(h,u,g,v)}if(typeof g.then=="function")return D(h,u,Tl(g),v);if(g.$$typeof===er)return D(h,u,Ml(h,g),v);zl(h,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,u!==null&&u.tag===6?(a(h,u.sibling),v=i(u,g),v.return=h,h=v):(a(h,u),v=iu(g,h.mode,v),v.return=h,h=v),o(h)):a(h,u)}return function(h,u,g,v){try{zo=0;var N=D(h,u,g,v);return an=null,N}catch(T){if(T===yn||T===Ds)throw T;var R=ra(29,T,null,h.mode);return R.lanes=v,R.return=h,R}}}var li=mg(!0),fg=mg(!1),vr=!1;function Qp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ku(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 zr(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 i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=os(e),ng(e,null,a),t}return Us(e,r,t,a),os(e)}function go(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,Rh(e,a)}}function lu(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var i=null,n=null;if(a=a.firstBaseUpdate,a!==null){do{var o={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};n===null?i=n=o:n=n.next=o,a=a.next}while(a!==null);n===null?i=n=t:n=n.next=t}else i=n=t;a={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:n,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Pu=!1;function bo(){if(Pu){var e=tn;if(e!==null)throw e}}function wo(e,t,a,r){Pu=!1;var i=e.updateQueue;vr=!1;var n=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,p=c.next;c.next=null,o===null?n=p:o.next=p,o=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==o&&(l===null?m.firstBaseUpdate=p:l.next=p,m.lastBaseUpdate=c))}if(n!==null){var b=i.baseState;o=0,m=p=c=null,l=n;do{var f=l.lane&-536870913,w=f!==l.lane;if(w?(Se&f)===f:(r&f)===f){f!==0&&f===cn&&(Pu=!0),m!==null&&(m=m.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var _=e,E=l;f=t;var D=a;switch(E.tag){case 1:if(_=E.payload,typeof _=="function"){b=_.call(D,b,f);break e}b=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=E.payload,f=typeof _=="function"?_.call(D,b,f):_,f==null)break e;b=et({},b,f);break e;case 2:vr=!0}}f=l.callback,f!==null&&(e.flags|=64,w&&(e.flags|=8192),w=i.callbacks,w===null?i.callbacks=[f]:w.push(f))}else w={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(p=m=w,c=b):m=m.next=w,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;w=l,l=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);m===null&&(c=b),i.baseState=c,i.firstBaseUpdate=p,i.lastBaseUpdate=m,n===null&&(i.shared.lanes=0),Qr|=o,e.lanes=o,e.memoizedState=b}}function hg(e,t){if(typeof e!="function")throw Error(L(191,e));e.call(t)}function gg(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hg(a[e],t)}var un=Ha(null),us=Ha(0);function Nf(e,t){e=ur,Pe(us,e),Pe(un,t),ur=e|t.baseLanes}function Ju(){Pe(us,ur),Pe(un,un.current)}function Gp(){ur=us.current,xt(un),xt(us)}var ua=Ha(null),va=null;function _r(e){var t=e.alternate;Pe(st,st.current&1),Pe(ua,e),va===null&&(t===null||un.current!==null||t.memoizedState!==null)&&(va=e)}function Fu(e){Pe(st,st.current),Pe(ua,e),va===null&&(va=e)}function bg(e){e.tag===22?(Pe(st,st.current),Pe(ua,e),va===null&&(va=e)):xr(e)}function xr(){Pe(st,st.current),Pe(ua,ua.current)}function aa(e){xt(ua),va===e&&(va=null),xt(st)}var st=Ha(0);function ps(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||gp(a)||bp(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 lr=0,de=null,Ge=null,pt=null,ds=!1,rn=!1,si=!1,ms=0,Ro=0,nn=null,Fy=0;function nt(){throw Error(L(321))}function Yp(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!ca(e[a],t[a]))return!1;return!0}function $p(e,t,a,r,i,n){return lr=n,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,se.H=e===null||e.memoizedState===null?Kg:td,si=!1,n=a(r,i),si=!1,rn&&(n=vg(t,a,r,i)),wg(e),n}function wg(e){se.H=Ao;var t=Ge!==null&&Ge.next!==null;if(lr=0,pt=Ge=de=null,ds=!1,Ro=0,nn=null,t)throw Error(L(300));e===null||ft||(e=e.dependencies,e!==null&&ss(e)&&(ft=!0))}function vg(e,t,a,r){de=e;var i=0;do{if(rn&&(nn=null),Ro=0,rn=!1,25<=i)throw Error(L(301));if(i+=1,pt=Ge=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}se.H=Pg,n=t(a,r)}while(rn);return n}function Iy(){var e=se.H,t=e.useState()[0];return t=typeof t.then=="function"?Xo(t):t,e=e.useState()[0],(Ge!==null?Ge.memoizedState:null)!==e&&(de.flags|=1024),t}function Vp(){var e=ms!==0;return ms=0,e}function Xp(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Zp(e){if(ds){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ds=!1}lr=0,pt=Ge=de=null,rn=!1,Ro=ms=0,nn=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?de.memoizedState=pt=e:pt=pt.next=e,pt}function ct(){if(Ge===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=Ge.next;var t=pt===null?de.memoizedState:pt.next;if(t!==null)pt=t,Ge=e;else{if(e===null)throw de.alternate===null?Error(L(467)):Error(L(310));Ge=e,e={memoizedState:Ge.memoizedState,baseState:Ge.baseState,baseQueue:Ge.baseQueue,queue:Ge.queue,next:null},pt===null?de.memoizedState=pt=e:pt=pt.next=e}return pt}function Os(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(e){var t=Ro;return Ro+=1,nn===null&&(nn=[]),e=dg(nn,e,t),t=de,(pt===null?t.memoizedState:pt.next)===null&&(t=t.alternate,se.H=t===null||t.memoizedState===null?Kg:td),e}function Bs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xo(e);if(e.$$typeof===er)return Tt(e)}throw Error(L(438,String(e)))}function Kp(e){var t=null,a=de.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=de.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Os(),de.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=B0;return t.index++,a}function sr(e,t){return typeof t=="function"?t(e):t}function Vl(e){var t=ct();return Pp(t,Ge,e)}function Pp(e,t,a){var r=e.queue;if(r===null)throw Error(L(311));r.lastRenderedReducer=a;var i=e.baseQueue,n=r.pending;if(n!==null){if(i!==null){var o=i.next;i.next=n.next,n.next=o}t.baseQueue=i=n,r.pending=null}if(n=e.baseState,i===null)e.memoizedState=n;else{t=i.next;var l=o=null,c=null,p=t,m=!1;do{var b=p.lane&-536870913;if(b!==p.lane?(Se&b)===b:(lr&b)===b){var f=p.revertLane;if(f===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),b===cn&&(m=!0);else if((lr&f)===f){p=p.next,f===cn&&(m=!0);continue}else b={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=b,o=n):c=c.next=b,de.lanes|=f,Qr|=f;b=p.action,si&&a(n,b),n=p.hasEagerState?p.eagerState:a(n,b)}else f={lane:b,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},c===null?(l=c=f,o=n):c=c.next=f,de.lanes|=b,Qr|=b;p=p.next}while(p!==null&&p!==t);if(c===null?o=n:c.next=l,!ca(n,e.memoizedState)&&(ft=!0,m&&(a=tn,a!==null)))throw a;e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function su(e){var t=ct(),a=t.queue;if(a===null)throw Error(L(311));a.lastRenderedReducer=e;var r=a.dispatch,i=a.pending,n=t.memoizedState;if(i!==null){a.pending=null;var o=i=i.next;do n=e(n,o.action),o=o.next;while(o!==i);ca(n,t.memoizedState)||(ft=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),a.lastRenderedState=n}return[n,r]}function yg(e,t,a){var r=de,i=ct(),n=Ce;if(n){if(a===void 0)throw Error(L(407));a=a()}else a=t();var o=!ca((Ge||i).memoizedState,a);if(o&&(i.memoizedState=a,ft=!0),i=i.queue,Jp(kg.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||pt!==null&&pt.memoizedState.tag&1){if(r.flags|=2048,pn(9,{destroy:void 0},xg.bind(null,r,i,a,t),null),$e===null)throw Error(L(349));n||(lr&127)!==0||_g(r,t,a)}return a}function _g(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=de.updateQueue,t===null?(t=Os(),de.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function xg(e,t,a,r){t.value=a,t.getSnapshot=r,Sg(t)&&Ng(e)}function kg(e,t,a){return a(function(){Sg(t)&&Ng(e)})}function Sg(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!ca(e,a)}catch{return!0}}function Ng(e){var t=mi(e,2);t!==null&&Kt(t,e,2)}function Iu(e){var t=jt();if(typeof e=="function"){var a=e;if(e=a(),si){Sr(!0);try{a()}finally{Sr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:e},t}function Cg(e,t,a,r){return e.baseState=a,Pp(e,Ge,typeof r=="function"?r:sr)}function Wy(e,t,a,r,i){if(Hs(e))throw Error(L(485));if(e=t.action,e!==null){var n={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){n.listeners.push(o)}};se.T!==null?a(!0):n.isTransition=!1,r(n),a=t.pending,a===null?(n.next=t.pending=n,qg(t,n)):(n.next=a.next,t.pending=a.next=n)}}function qg(e,t){var a=t.action,r=t.payload,i=e.state;if(t.isTransition){var n=se.T,o={};se.T=o;try{var l=a(i,r),c=se.S;c!==null&&c(o,l),Cf(e,t,l)}catch(p){Wu(e,t,p)}finally{n!==null&&o.types!==null&&(n.types=o.types),se.T=n}}else try{n=a(i,r),Cf(e,t,n)}catch(p){Wu(e,t,p)}}function Cf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){qf(e,t,r)},function(r){return Wu(e,t,r)}):qf(e,t,a)}function qf(e,t,a){t.status="fulfilled",t.value=a,Eg(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,qg(e,a)))}function Wu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,Eg(t),t=t.next;while(t!==r)}e.action=null}function Eg(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mg(e,t){return t}function Ef(e,t){if(Ce){var a=$e.formState;if(a!==null){e:{var r=de;if(Ce){if(We){t:{for(var i=We,n=wa;i.nodeType!==8;){if(!n){i=null;break t}if(i=ya(i.nextSibling),i===null){i=null;break t}}n=i.data,i=n==="F!"||n==="F"?i:null}if(i){We=ya(i.nextSibling),r=i.data==="F!";break e}}Hr(r)}r=!1}r&&(t=a[0])}}return a=jt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mg,lastRenderedState:t},a.queue=r,a=Vg.bind(null,de,r),r.dispatch=a,r=Iu(!1),n=ed.bind(null,de,!1,r.queue),r=jt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,a=Wy.bind(null,de,i,n,a),i.dispatch=a,r.memoizedState=e,[t,a,!1]}function Mf(e){var t=ct();return Tg(t,Ge,e)}function Tg(e,t,a){if(t=Pp(e,t,Mg)[0],e=Vl(sr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Xo(t)}catch(o){throw o===yn?Ds:o}else r=t;t=ct();var i=t.queue,n=i.dispatch;return a!==t.memoizedState&&(de.flags|=2048,pn(9,{destroy:void 0},e1.bind(null,i,a),null)),[r,n,e]}function e1(e,t){e.action=t}function Tf(e){var t=ct(),a=Ge;if(a!==null)return Tg(t,a,e);ct(),t=t.memoizedState,a=ct();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=de.updateQueue,t===null&&(t=Os(),de.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 zg(){return ct().memoizedState}function Xl(e,t,a,r){var i=jt();de.flags|=e,i.memoizedState=pn(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ls(e,t,a,r){var i=ct();r=r===void 0?null:r;var n=i.memoizedState.inst;Ge!==null&&r!==null&&Yp(r,Ge.memoizedState.deps)?i.memoizedState=pn(t,n,a,r):(de.flags|=e,i.memoizedState=pn(1|t,n,a,r))}function zf(e,t){Xl(8390656,8,e,t)}function Jp(e,t){Ls(2048,8,e,t)}function t1(e){de.flags|=4;var t=de.updateQueue;if(t===null)t=Os(),de.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Rg(e){var t=ct().memoizedState;return t1({ref:t,nextImpl:e}),function(){if((Ae&2)!==0)throw Error(L(440));return t.impl.apply(void 0,arguments)}}function Ag(e,t){return Ls(4,2,e,t)}function Ug(e,t){return Ls(4,4,e,t)}function Dg(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 Og(e,t,a){a=a!=null?a.concat([e]):null,Ls(4,4,Dg.bind(null,t,e),a)}function Fp(){}function Bg(e,t){var a=ct();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Yp(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Lg(e,t){var a=ct();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Yp(t,r[1]))return r[0];if(r=e(),si){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r}function Ip(e,t,a){return a===void 0||(lr&1073741824)!==0&&(Se&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Cb(),de.lanes|=e,Qr|=e,a)}function Hg(e,t,a,r){return ca(a,t)?a:un.current!==null?(e=Ip(e,a,r),ca(e,t)||(ft=!0),e):(lr&42)===0||(lr&1073741824)!==0&&(Se&261930)===0?(ft=!0,e.memoizedState=a):(e=Cb(),de.lanes|=e,Qr|=e,t)}function jg(e,t,a,r,i){var n=Ue.p;Ue.p=n!==0&&8>n?n:8;var o=se.T,l={};se.T=l,ed(e,!1,t,a);try{var c=i(),p=se.S;if(p!==null&&p(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var m=Jy(c,r);vo(e,t,m,sa(e))}else vo(e,t,r,sa(e))}catch(b){vo(e,t,{then:function(){},status:"rejected",reason:b},sa())}finally{Ue.p=n,o!==null&&l.types!==null&&(o.types=l.types),se.T=o}}function a1(){}function ep(e,t,a,r){if(e.tag!==5)throw Error(L(476));var i=Qg(e).queue;jg(e,i,t,ei,a===null?a1:function(){return Gg(e),a(r)})}function Qg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ei,baseState:ei,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:ei},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gg(e){var t=Qg(e);t.next===null&&(t=e.alternate.memoizedState),vo(e,t.next.queue,{},sa())}function Wp(){return Tt(Oo)}function Yg(){return ct().memoizedState}function $g(){return ct().memoizedState}function r1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=sa();e=zr(a);var r=Rr(t,e,a);r!==null&&(Kt(r,t,a),go(r,t,a)),t={cache:Lp()},e.payload=t;return}t=t.return}}function i1(e,t,a){var r=sa();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Hs(e)?Xg(t,a):(a=Up(e,t,a,r),a!==null&&(Kt(a,e,r),Zg(a,t,r)))}function Vg(e,t,a){var r=sa();vo(e,t,a,r)}function vo(e,t,a,r){var i={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Hs(e))Xg(t,i);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,a);if(i.hasEagerState=!0,i.eagerState=l,ca(l,o))return Us(e,t,i,0),$e===null&&As(),!1}catch{}if(a=Up(e,t,i,r),a!==null)return Kt(a,e,r),Zg(a,t,r),!0}return!1}function ed(e,t,a,r){if(r={lane:2,revertLane:cd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Hs(e)){if(t)throw Error(L(479))}else t=Up(e,a,r,2),t!==null&&Kt(t,e,2)}function Hs(e){var t=e.alternate;return e===de||t!==null&&t===de}function Xg(e,t){rn=ds=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Zg(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Rh(e,a)}}var Ao={readContext:Tt,use:Bs,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useLayoutEffect:nt,useInsertionEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useSyncExternalStore:nt,useId:nt,useHostTransitionStatus:nt,useFormState:nt,useActionState:nt,useOptimistic:nt,useMemoCache:nt,useCacheRefresh:nt};Ao.useEffectEvent=nt;var Kg={readContext:Tt,use:Bs,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:zf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Xl(4194308,4,Dg.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Xl(4194308,4,e,t)},useInsertionEffect:function(e,t){Xl(4,2,e,t)},useMemo:function(e,t){var a=jt();t=t===void 0?null:t;var r=e();if(si){Sr(!0);try{e()}finally{Sr(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=jt();if(a!==void 0){var i=a(t);if(si){Sr(!0);try{a(t)}finally{Sr(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=i1.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Iu(e);var t=e.queue,a=Vg.bind(null,de,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Fp,useDeferredValue:function(e,t){var a=jt();return Ip(a,e,t)},useTransition:function(){var e=Iu(!1);return e=jg.bind(null,de,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=de,i=jt();if(Ce){if(a===void 0)throw Error(L(407));a=a()}else{if(a=t(),$e===null)throw Error(L(349));(Se&127)!==0||_g(r,t,a)}i.memoizedState=a;var n={value:a,getSnapshot:t};return i.queue=n,zf(kg.bind(null,r,n,e),[e]),r.flags|=2048,pn(9,{destroy:void 0},xg.bind(null,r,n,a,t),null),a},useId:function(){var e=jt(),t=$e.identifierPrefix;if(Ce){var a=Oa,r=Da;a=(r&~(1<<32-la(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ms++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Fy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Wp,useFormState:Ef,useActionState:Ef,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=ed.bind(null,de,!0,a),a.dispatch=t,[e,t]},useMemoCache:Kp,useCacheRefresh:function(){return jt().memoizedState=r1.bind(null,de)},useEffectEvent:function(e){var t=jt(),a={impl:e};return t.memoizedState=a,function(){if((Ae&2)!==0)throw Error(L(440));return a.impl.apply(void 0,arguments)}}},td={readContext:Tt,use:Bs,useCallback:Bg,useContext:Tt,useEffect:Jp,useImperativeHandle:Og,useInsertionEffect:Ag,useLayoutEffect:Ug,useMemo:Lg,useReducer:Vl,useRef:zg,useState:function(){return Vl(sr)},useDebugValue:Fp,useDeferredValue:function(e,t){var a=ct();return Hg(a,Ge.memoizedState,e,t)},useTransition:function(){var e=Vl(sr)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:yg,useId:Yg,useHostTransitionStatus:Wp,useFormState:Mf,useActionState:Mf,useOptimistic:function(e,t){var a=ct();return Cg(a,Ge,e,t)},useMemoCache:Kp,useCacheRefresh:$g};td.useEffectEvent=Rg;var Pg={readContext:Tt,use:Bs,useCallback:Bg,useContext:Tt,useEffect:Jp,useImperativeHandle:Og,useInsertionEffect:Ag,useLayoutEffect:Ug,useMemo:Lg,useReducer:su,useRef:zg,useState:function(){return su(sr)},useDebugValue:Fp,useDeferredValue:function(e,t){var a=ct();return Ge===null?Ip(a,e,t):Hg(a,Ge.memoizedState,e,t)},useTransition:function(){var e=su(sr)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Xo(e),t]},useSyncExternalStore:yg,useId:Yg,useHostTransitionStatus:Wp,useFormState:Tf,useActionState:Tf,useOptimistic:function(e,t){var a=ct();return Ge!==null?Cg(a,Ge,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Kp,useCacheRefresh:$g};Pg.useEffectEvent=Rg;function cu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:et({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var tp={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=sa(),i=zr(r);i.payload=t,a!=null&&(i.callback=a),t=Rr(e,i,r),t!==null&&(Kt(t,e,r),go(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=sa(),i=zr(r);i.tag=1,i.payload=t,a!=null&&(i.callback=a),t=Rr(e,i,r),t!==null&&(Kt(t,e,r),go(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=sa(),r=zr(a);r.tag=2,t!=null&&(r.callback=t),t=Rr(e,r,a),t!==null&&(Kt(t,e,a),go(t,e,a))}};function Rf(e,t,a,r,i,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!Eo(a,r)||!Eo(i,n):!0}function Af(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&&tp.enqueueReplaceState(t,t.state,null)}function ci(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=et({},a));for(var i in e)a[i]===void 0&&(a[i]=e[i])}return a}function Jg(e){ns(e)}function Fg(e){console.error(e)}function Ig(e){ns(e)}function fs(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(i){setTimeout(function(){throw i})}}function ap(e,t,a){return a=zr(a),a.tag=3,a.payload={element:null},a.callback=function(){fs(e,t)},a}function Wg(e){return e=zr(e),e.tag=3,e}function eb(e,t,a,r){var i=a.type.getDerivedStateFromError;if(typeof i=="function"){var n=r.value;e.payload=function(){return i(n)},e.callback=function(){Uf(t,a,r)}}var o=a.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Uf(t,a,r),typeof i!="function"&&(Ar===null?Ar=new Set([this]):Ar.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function n1(e,t,a,r,i){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&vn(t,a,i,!0),a=ua.current,a!==null){switch(a.tag){case 31:case 13:return va===null?vs():a.alternate===null&&ot===0&&(ot=3),a.flags&=-257,a.flags|=65536,a.lanes=i,r===cs?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),yu(e,r,i)),!1;case 22:return a.flags|=65536,r===cs?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)),yu(e,r,i)),!1}throw Error(L(435,a.tag))}return yu(e,r,i),vs(),!1}if(Ce)return t=ua.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Yu&&(e=Error(L(422),{cause:r}),To(ba(e,a)))):(r!==Yu&&(t=Error(L(423),{cause:r}),To(ba(t,a))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ba(r,a),i=ap(e.stateNode,r,i),lu(e,i),ot!==4&&(ot=2)),!1;var n=Error(L(520),{cause:r});if(n=ba(n,a),xo===null?xo=[n]:xo.push(n),ot!==4&&(ot=2),t===null)return!0;r=ba(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=i&-i,a.lanes|=e,e=ap(a.stateNode,r,e),lu(a,e),!1;case 1:if(t=a.type,n=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(Ar===null||!Ar.has(n))))return a.flags|=65536,i&=-i,a.lanes|=i,i=Wg(i),eb(i,e,a,r),lu(a,i),!1}a=a.return}while(a!==null);return!1}var ad=Error(L(461)),ft=!1;function qt(e,t,a,r){t.child=e===null?fg(t,null,a,r):li(t,e.child,a,r)}function Df(e,t,a,r,i){a=a.render;var n=t.ref;if("ref"in r){var o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}else o=r;return oi(t),r=$p(e,t,a,o,n,i),l=Vp(),e!==null&&!ft?(Xp(e,t,i),cr(e,t,i)):(Ce&&l&&Op(t),t.flags|=1,qt(e,t,r,i),t.child)}function Of(e,t,a,r,i){if(e===null){var n=a.type;return typeof n=="function"&&!Dp(n)&&n.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=n,tb(e,t,n,r,i)):(e=Yl(a.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!rd(e,i)){var o=n.memoizedProps;if(a=a.compare,a=a!==null?a:Eo,a(o,r)&&e.ref===t.ref)return cr(e,t,i)}return t.flags|=1,e=rr(n,r),e.ref=t.ref,e.return=t,t.child=e}function tb(e,t,a,r,i){if(e!==null){var n=e.memoizedProps;if(Eo(n,r)&&e.ref===t.ref)if(ft=!1,t.pendingProps=r=n,rd(e,i))(e.flags&131072)!==0&&(ft=!0);else return t.lanes=e.lanes,cr(e,t,i)}return rp(e,t,a,r,i)}function ab(e,t,a,r){var i=r.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(n=n!==null?n.baseLanes|a:a,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~n}else r=0,t.child=null;return Bf(e,t,n,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$l(t,n!==null?n.cachePool:null),n!==null?Nf(t,n):Ju(),bg(t);else return r=t.lanes=536870912,Bf(e,t,n!==null?n.baseLanes|a:a,a,r)}else n!==null?($l(t,n.cachePool),Nf(t,n),xr(t),t.memoizedState=null):(e!==null&&$l(t,null),Ju(),xr(t));return qt(e,t,i,a),t.child}function co(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bf(e,t,a,r,i){var n=Hp();return n=n===null?null:{parent:mt._currentValue,pool:n},t.memoizedState={baseLanes:a,cachePool:n},e!==null&&$l(t,null),Ju(),bg(t),e!==null&&vn(e,t,r,!0),t.childLanes=i,null}function Zl(e,t){return t=hs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lf(e,t,a){return li(t,e.child,null,a),e=Zl(t,t.pendingProps),e.flags|=2,aa(t),t.memoizedState=null,e}function o1(e,t,a){var r=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ce){if(r.mode==="hidden")return e=Zl(t,r),t.lanes=536870912,co(null,e);if(Fu(t),(e=We)?(e=Kb(e,wa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Lr!==null?{id:Da,overflow:Oa}:null,retryLane:536870912,hydrationErrors:null},a=lg(e),a.return=t,t.child=a,Mt=t,We=null)):e=null,e===null)throw Hr(t);return t.lanes=536870912,null}return Zl(t,r)}var n=e.memoizedState;if(n!==null){var o=n.dehydrated;if(Fu(t),i)if(t.flags&256)t.flags&=-257,t=Lf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(L(558));else if(ft||vn(e,t,a,!1),i=(a&e.childLanes)!==0,ft||i){if(r=$e,r!==null&&(o=Ah(r,a),o!==0&&o!==n.retryLane))throw n.retryLane=o,mi(e,o),Kt(r,e,o),ad;vs(),t=Lf(e,t,a)}else e=n.treeContext,We=ya(o.nextSibling),Mt=t,Ce=!0,Tr=null,wa=!1,e!==null&&cg(t,e),t=Zl(t,r),t.flags|=4096;return t}return e=rr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(L(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function rp(e,t,a,r,i){return oi(t),a=$p(e,t,a,r,void 0,i),r=Vp(),e!==null&&!ft?(Xp(e,t,i),cr(e,t,i)):(Ce&&r&&Op(t),t.flags|=1,qt(e,t,a,i),t.child)}function Hf(e,t,a,r,i,n){return oi(t),t.updateQueue=null,a=vg(t,r,a,i),wg(e),r=Vp(),e!==null&&!ft?(Xp(e,t,n),cr(e,t,n)):(Ce&&r&&Op(t),t.flags|=1,qt(e,t,a,n),t.child)}function jf(e,t,a,r,i){if(oi(t),t.stateNode===null){var n=Ki,o=a.contextType;typeof o=="object"&&o!==null&&(n=Tt(o)),n=new a(r,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=tp,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=r,n.state=t.memoizedState,n.refs={},Qp(t),o=a.contextType,n.context=typeof o=="object"&&o!==null?Tt(o):Ki,n.state=t.memoizedState,o=a.getDerivedStateFromProps,typeof o=="function"&&(cu(t,a,o,r),n.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(o=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),o!==n.state&&tp.enqueueReplaceState(n,n.state,null),wo(t,r,n,i),bo(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){n=t.stateNode;var l=t.memoizedProps,c=ci(a,l);n.props=c;var p=n.context,m=a.contextType;o=Ki,typeof m=="object"&&m!==null&&(o=Tt(m));var b=a.getDerivedStateFromProps;m=typeof b=="function"||typeof n.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,m||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l||p!==o)&&Af(t,n,r,o),vr=!1;var f=t.memoizedState;n.state=f,wo(t,r,n,i),bo(),p=t.memoizedState,l||f!==p||vr?(typeof b=="function"&&(cu(t,a,b,r),p=t.memoizedState),(c=vr||Rf(t,a,c,r,f,p,o))?(m||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=p),n.props=r,n.state=p,n.context=o,r=c):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{n=t.stateNode,Ku(e,t),o=t.memoizedProps,m=ci(a,o),n.props=m,b=t.pendingProps,f=n.context,p=a.contextType,c=Ki,typeof p=="object"&&p!==null&&(c=Tt(p)),l=a.getDerivedStateFromProps,(p=typeof l=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(o!==b||f!==c)&&Af(t,n,r,c),vr=!1,f=t.memoizedState,n.state=f,wo(t,r,n,i),bo();var w=t.memoizedState;o!==b||f!==w||vr||e!==null&&e.dependencies!==null&&ss(e.dependencies)?(typeof l=="function"&&(cu(t,a,l,r),w=t.memoizedState),(m=vr||Rf(t,a,m,r,f,w,c)||e!==null&&e.dependencies!==null&&ss(e.dependencies))?(p||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(r,w,c),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(r,w,c)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),n.props=r,n.state=w,n.context=c,r=m):(typeof n.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return n=r,Kl(e,t),r=(t.flags&128)!==0,n||r?(n=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&r?(t.child=li(t,e.child,null,i),t.child=li(t,null,a,i)):qt(e,t,a,i),t.memoizedState=n.state,e=t.child):e=cr(e,t,i),e}function Qf(e,t,a,r){return ni(),t.flags|=256,qt(e,t,a,r),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pu(e){return{baseLanes:e,cachePool:pg()}}function du(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ia),e}function rb(e,t,a){var r=t.pendingProps,i=!1,n=(t.flags&128)!==0,o;if((o=n)||(o=e!==null&&e.memoizedState===null?!1:(st.current&2)!==0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ce){if(i?_r(t):xr(t),(e=We)?(e=Kb(e,wa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Lr!==null?{id:Da,overflow:Oa}:null,retryLane:536870912,hydrationErrors:null},a=lg(e),a.return=t,t.child=a,Mt=t,We=null)):e=null,e===null)throw Hr(t);return bp(e)?t.lanes=32:t.lanes=536870912,null}var l=r.children;return r=r.fallback,i?(xr(t),i=t.mode,l=hs({mode:"hidden",children:l},i),r=ti(r,i,a,null),l.return=t,r.return=t,l.sibling=r,t.child=l,r=t.child,r.memoizedState=pu(a),r.childLanes=du(e,o,a),t.memoizedState=uu,co(null,r)):(_r(t),ip(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(n)t.flags&256?(_r(t),t.flags&=-257,t=mu(e,t,a)):t.memoizedState!==null?(xr(t),t.child=e.child,t.flags|=128,t=null):(xr(t),l=r.fallback,i=t.mode,r=hs({mode:"visible",children:r.children},i),l=ti(l,i,a,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,li(t,e.child,null,a),r=t.child,r.memoizedState=pu(a),r.childLanes=du(e,o,a),t.memoizedState=uu,t=co(null,r));else if(_r(t),bp(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var p=o.dgst;o=p,r=Error(L(419)),r.stack="",r.digest=o,To({value:r,source:null,stack:null}),t=mu(e,t,a)}else if(ft||vn(e,t,a,!1),o=(a&e.childLanes)!==0,ft||o){if(o=$e,o!==null&&(r=Ah(o,a),r!==0&&r!==c.retryLane))throw c.retryLane=r,mi(e,r),Kt(o,e,r),ad;gp(l)||vs(),t=mu(e,t,a)}else gp(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,We=ya(l.nextSibling),Mt=t,Ce=!0,Tr=null,wa=!1,e!==null&&cg(t,e),t=ip(t,r.children),t.flags|=4096);return t}return i?(xr(t),l=r.fallback,i=t.mode,c=e.child,p=c.sibling,r=rr(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,p!==null?l=rr(p,l):(l=ti(l,i,a,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,co(null,r),r=t.child,l=e.child.memoizedState,l===null?l=pu(a):(i=l.cachePool,i!==null?(c=mt._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=pg(),l={baseLanes:l.baseLanes|a,cachePool:i}),r.memoizedState=l,r.childLanes=du(e,o,a),t.memoizedState=uu,co(e.child,r)):(_r(t),a=e.child,e=a.sibling,a=rr(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 ip(e,t){return t=hs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function hs(e,t){return e=ra(22,e,null,t),e.lanes=0,e}function mu(e,t,a){return li(t,e.child,null,a),e=ip(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vu(e.return,t,a)}function fu(e,t,a,r,i,n){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:i,treeForkCount:n}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=a,o.tailMode=i,o.treeForkCount=n)}function ib(e,t,a){var r=t.pendingProps,i=r.revealOrder,n=r.tail;r=r.children;var o=st.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,Pe(st,o),qt(e,t,r,a),r=Ce?Mo:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,a,t);else if(e.tag===19)Gf(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(a=t.child,i=null;a!==null;)e=a.alternate,e!==null&&ps(e)===null&&(i=a),a=a.sibling;a=i,a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null),fu(t,!1,i,a,n,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ps(e)===null){t.child=i;break}e=i.sibling,i.sibling=a,a=i,i=e}fu(t,!0,a,null,n,r);break;case"together":fu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function cr(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(L(153));if(t.child!==null){for(e=t.child,a=rr(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=rr(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function rd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ss(e)))}function l1(e,t,a){switch(t.tag){case 3:ts(t,t.stateNode.containerInfo),yr(t,mt,e.memoizedState.cache),ni();break;case 27:case 5:Ru(t);break;case 4:ts(t,t.stateNode.containerInfo);break;case 10:yr(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(_r(t),t.flags|=128,null):(a&t.child.childLanes)!==0?rb(e,t,a):(_r(t),e=cr(e,t,a),e!==null?e.sibling:null);_r(t);break;case 19:var i=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(vn(e,t,a,!1),r=(a&t.childLanes)!==0),i){if(r)return ib(e,t,a);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(st,st.current),r)break;return null;case 22:return t.lanes=0,ab(e,t,a,t.pendingProps);case 24:yr(t,mt,e.memoizedState.cache)}return cr(e,t,a)}function nb(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ft=!0;else{if(!rd(e,a)&&(t.flags&128)===0)return ft=!1,l1(e,t,a);ft=(e.flags&131072)!==0}else ft=!1,Ce&&(t.flags&1048576)!==0&&sg(t,Mo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Ir(t.elementType),t.type=e,typeof e=="function")Dp(e)?(r=ci(e,r),t.tag=1,t=jf(null,t,e,r,a)):(t.tag=0,t=rp(null,t,e,r,a));else{if(e!=null){var i=e.$$typeof;if(i===_p){t.tag=11,t=Df(null,t,e,r,a);break e}else if(i===xp){t.tag=14,t=Of(null,t,e,r,a);break e}}throw t=Tu(e)||e,Error(L(306,t,""))}}return t;case 0:return rp(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,i=ci(r,t.pendingProps),jf(e,t,r,i,a);case 3:e:{if(ts(t,t.stateNode.containerInfo),e===null)throw Error(L(387));r=t.pendingProps;var n=t.memoizedState;i=n.element,Ku(e,t),wo(t,r,null,a);var o=t.memoizedState;if(r=o.cache,yr(t,mt,r),r!==n.cache&&Xu(t,[mt],a,!0),bo(),r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=Qf(e,t,r,a);break e}else if(r!==i){i=ba(Error(L(424)),t),To(i),t=Qf(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,We=ya(e.firstChild),Mt=t,Ce=!0,Tr=null,wa=!0,a=fg(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ni(),r===i){t=cr(e,t,a);break e}qt(e,t,r,a)}t=t.child}return t;case 26:return Kl(e,t),e===null?(a=uh(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ce||(a=t.type,e=t.pendingProps,r=ks(Mr.current).createElement(a),r[Et]=t,r[Pt]=e,zt(r,a,e),_t(r),t.stateNode=r):t.memoizedState=uh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ru(t),e===null&&Ce&&(r=t.stateNode=Pb(t.type,t.pendingProps,Mr.current),Mt=t,wa=!0,i=We,Yr(t.type)?(wp=i,We=ya(r.firstChild)):We=i),qt(e,t,t.pendingProps.children,a),Kl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ce&&((i=r=We)&&(r=D1(r,t.type,t.pendingProps,wa),r!==null?(t.stateNode=r,Mt=t,We=ya(r.firstChild),wa=!1,i=!0):i=!1),i||Hr(t)),Ru(t),i=t.type,n=t.pendingProps,o=e!==null?e.memoizedProps:null,r=n.children,fp(i,n)?r=null:o!==null&&fp(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=$p(e,t,Iy,null,null,a),Oo._currentValue=i),Kl(e,t),qt(e,t,r,a),t.child;case 6:return e===null&&Ce&&((e=a=We)&&(a=O1(a,t.pendingProps,wa),a!==null?(t.stateNode=a,Mt=t,We=null,e=!0):e=!1),e||Hr(t)),null;case 13:return rb(e,t,a);case 4:return ts(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=li(t,null,r,a):qt(e,t,r,a),t.child;case 11:return Df(e,t,t.type,t.pendingProps,a);case 7:return qt(e,t,t.pendingProps,a),t.child;case 8:return qt(e,t,t.pendingProps.children,a),t.child;case 12:return qt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,yr(t,t.type,r.value),qt(e,t,r.children,a),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,oi(t),i=Tt(i),r=r(i),t.flags|=1,qt(e,t,r,a),t.child;case 14:return Of(e,t,t.type,t.pendingProps,a);case 15:return tb(e,t,t.type,t.pendingProps,a);case 19:return ib(e,t,a);case 31:return o1(e,t,a);case 22:return ab(e,t,a,t.pendingProps);case 24:return oi(t),r=Tt(mt),e===null?(i=Hp(),i===null&&(i=$e,n=Lp(),i.pooledCache=n,n.refCount++,n!==null&&(i.pooledCacheLanes|=a),i=n),t.memoizedState={parent:r,cache:i},Qp(t),yr(t,mt,i)):((e.lanes&a)!==0&&(Ku(e,t),wo(t,null,null,a),bo()),i=e.memoizedState,n=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),yr(t,mt,r)):(r=n.cache,yr(t,mt,r),r!==i.cache&&Xu(t,[mt],a,!0))),qt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(L(156,t.tag))}function Ka(e){e.flags|=4}function hu(e,t,a,r,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Mb())e.flags|=8192;else throw ri=cs,jp}else e.flags&=-16777217}function Yf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ib(t))if(Mb())e.flags|=8192;else throw ri=cs,jp}function Rl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Th():536870912,e.lanes|=t,dn|=t)}function ao(e,t){if(!Ce)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 Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)a|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function s1(e,t,a){var r=t.pendingProps;switch(Bp(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ie(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ir(mt),on(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?Ka(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ou())),Ie(t),null;case 26:var i=t.type,n=t.memoizedState;return e===null?(Ka(t),n!==null?(Ie(t),Yf(t,n)):(Ie(t),hu(t,i,null,r,a))):n?n!==e.memoizedState?(Ka(t),Ie(t),Yf(t,n)):(Ie(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ka(t),Ie(t),hu(t,i,e,r,a)),null;case 27:if(as(t),a=Mr.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}e=La.current,Oi(t)?wf(t,e):(e=Pb(i,r,a),t.stateNode=e,Ka(t))}return Ie(t),null;case 5:if(as(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}if(n=La.current,Oi(t))wf(t,n);else{var o=ks(Mr.current);switch(n){case 1:n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":n=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":n=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?n.multiple=!0:r.size&&(n.size=r.size);break;default:n=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}n[Et]=t,n[Pt]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)n.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=n;e:switch(zt(n,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ka(t)}}return Ie(t),hu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ka(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(e=Mr.current,Oi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,i=Mt,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Et]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Vb(e.nodeValue,a)),e||Hr(t,!0)}else e=ks(e).createTextNode(r),e[Et]=t,t.stateNode=e}return Ie(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Oi(t),a!==null){if(e===null){if(!r)throw Error(L(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(557));e[Et]=t}else ni(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),e=!1}else a=ou(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(aa(t),t):(aa(t),null);if((t.flags&128)!==0)throw Error(L(558))}return Ie(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Oi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(L(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(L(317));i[Et]=t}else ni(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),i=!1}else i=ou(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(aa(t),t):(aa(t),null)}return aa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Rl(t,t.updateQueue),Ie(t),null);case 4:return on(),e===null&&ud(t.stateNode.containerInfo),Ie(t),null;case 10:return ir(t.type),Ie(t),null;case 19:if(xt(st),r=t.memoizedState,r===null)return Ie(t),null;if(i=(t.flags&128)!==0,n=r.rendering,n===null)if(i)ao(r,!1);else{if(ot!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(n=ps(e),n!==null){for(t.flags|=128,ao(r,!1),e=n.updateQueue,t.updateQueue=e,Rl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)og(a,e),a=a.sibling;return Pe(st,st.current&1|2),Ce&&Ia(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&na()>bs&&(t.flags|=128,i=!0,ao(r,!1),t.lanes=4194304)}else{if(!i)if(e=ps(n),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Rl(t,e),ao(r,!0),r.tail===null&&r.tailMode==="hidden"&&!n.alternate&&!Ce)return Ie(t),null}else 2*na()-r.renderingStartTime>bs&&a!==536870912&&(t.flags|=128,i=!0,ao(r,!1),t.lanes=4194304);r.isBackwards?(n.sibling=t.child,t.child=n):(e=r.last,e!==null?e.sibling=n:t.child=n,r.last=n)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=na(),e.sibling=null,a=st.current,Pe(st,i?a&1|2:a&1),Ce&&Ia(t,r.treeForkCount),e):(Ie(t),null);case 22:case 23:return aa(t),Gp(),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&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),a=t.updateQueue,a!==null&&Rl(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&&xt(ai),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ir(mt),Ie(t),null;case 25:return null;case 30:return null}throw Error(L(156,t.tag))}function c1(e,t){switch(Bp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(mt),on(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return as(t),null;case 31:if(t.memoizedState!==null){if(aa(t),t.alternate===null)throw Error(L(340));ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(aa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xt(st),null;case 4:return on(),null;case 10:return ir(t.type),null;case 22:case 23:return aa(t),Gp(),e!==null&&xt(ai),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ir(mt),null;case 25:return null;default:return null}}function ob(e,t){switch(Bp(t),t.tag){case 3:ir(mt),on();break;case 26:case 27:case 5:as(t);break;case 4:on();break;case 31:t.memoizedState!==null&&aa(t);break;case 13:aa(t);break;case 19:xt(st);break;case 10:ir(t.type);break;case 22:case 23:aa(t),Gp(),e!==null&&xt(ai);break;case 24:ir(mt)}}function Zo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var i=r.next;a=i;do{if((a.tag&e)===e){r=void 0;var n=a.create,o=a.inst;r=n(),o.destroy=r}a=a.next}while(a!==i)}}catch(l){Be(t,t.return,l)}}function jr(e,t,a){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var n=i.next;r=n;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,i=t;var c=a,p=l;try{p()}catch(m){Be(i,c,m)}}}r=r.next}while(r!==n)}}catch(m){Be(t,t.return,m)}}function lb(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{gg(t,a)}catch(r){Be(e,e.return,r)}}}function sb(e,t,a){a.props=ci(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Be(e,t,r)}}function yo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(i){Be(e,t,i)}}function Ba(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(i){Be(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Be(e,t,i)}else a.current=null}function cb(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(i){Be(e,e.return,i)}}function gu(e,t,a){try{var r=e.stateNode;M1(r,e.type,a,t),r[Pt]=t}catch(i){Be(e,e.return,i)}}function ub(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Yr(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ub(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&&Yr(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 np(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=tr));else if(r!==4&&(r===27&&Yr(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(np(e,t,a),e=e.sibling;e!==null;)np(e,t,a),e=e.sibling}function gs(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&&Yr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(gs(e,t,a),e=e.sibling;e!==null;)gs(e,t,a),e=e.sibling}function pb(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zt(t,r,a),t[Et]=e,t[Pt]=a}catch(n){Be(e,e.return,n)}}var Wa=!1,dt=!1,wu=!1,$f=typeof WeakSet=="function"?WeakSet:Set,yt=null;function u1(e,t){if(e=e.containerInfo,dp=qs,e=Ih(e),Rp(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var i=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{a.nodeType,n.nodeType}catch{a=null;break e}var o=0,l=-1,c=-1,p=0,m=0,b=e,f=null;t:for(;;){for(var w;b!==a||i!==0&&b.nodeType!==3||(l=o+i),b!==n||r!==0&&b.nodeType!==3||(c=o+r),b.nodeType===3&&(o+=b.nodeValue.length),(w=b.firstChild)!==null;)f=b,b=w;for(;;){if(b===e)break t;if(f===a&&++p===i&&(l=o),f===n&&++m===r&&(c=o),(w=b.nextSibling)!==null)break;b=f,f=b.parentNode}b=w}a=l===-1||c===-1?null:{start:l,end:c}}else a=null}a=a||{start:0,end:0}}else a=null;for(mp={focusedElem:e,selectionRange:a},qs=!1,yt=t;yt!==null;)if(t=yt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,yt=e;else for(;yt!==null;){switch(t=yt,n=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)i=e[a],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&n!==null){e=void 0,a=t,i=n.memoizedProps,n=n.memoizedState,r=a.stateNode;try{var _=ci(a.type,i);e=r.getSnapshotBeforeUpdate(_,n),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)hp(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(L(163))}if(e=t.sibling,e!==null){e.return=t.return,yt=e;break}yt=t.return}}function db(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ja(e,a),r&4&&Zo(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 i=ci(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Be(a,a.return,o)}}r&64&&lb(a),r&512&&yo(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{gg(e,t)}catch(o){Be(a,a.return,o)}}break;case 27:t===null&&r&4&&pb(a);case 26:case 5:Ja(e,a),t===null&&r&4&&cb(a),r&512&&yo(a,a.return);break;case 12:Ja(e,a);break;case 31:Ja(e,a),r&4&&hb(e,a);break;case 13:Ja(e,a),r&4&&gb(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=v1.bind(null,a),B1(e,a))));break;case 22:if(r=a.memoizedState!==null||Wa,!r){t=t!==null&&t.memoizedState!==null||dt,i=Wa;var n=dt;Wa=r,(dt=t)&&!n?Fa(e,a,(a.subtreeFlags&8772)!==0):Ja(e,a),Wa=i,dt=n}break;case 30:break;default:Ja(e,a)}}function mb(e){var t=e.alternate;t!==null&&(e.alternate=null,mb(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 at=null,Xt=!1;function Pa(e,t,a){for(a=a.child;a!==null;)fb(e,t,a),a=a.sibling}function fb(e,t,a){if(oa&&typeof oa.onCommitFiberUnmount=="function")try{oa.onCommitFiberUnmount(jo,a)}catch{}switch(a.tag){case 26:dt||Ba(a,t),Pa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dt||Ba(a,t);var r=at,i=Xt;Yr(a.type)&&(at=a.stateNode,Xt=!1),Pa(e,t,a),So(a.stateNode),at=r,Xt=i;break;case 5:dt||Ba(a,t);case 6:if(r=at,i=Xt,at=null,Pa(e,t,a),at=r,Xt=i,at!==null)if(Xt)try{(at.nodeType===9?at.body:at.nodeName==="HTML"?at.ownerDocument.body:at).removeChild(a.stateNode)}catch(n){Be(a,t,n)}else try{at.removeChild(a.stateNode)}catch(n){Be(a,t,n)}break;case 18:at!==null&&(Xt?(e=at,nh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),gn(e)):nh(at,a.stateNode));break;case 4:r=at,i=Xt,at=a.stateNode.containerInfo,Xt=!0,Pa(e,t,a),at=r,Xt=i;break;case 0:case 11:case 14:case 15:jr(2,a,t),dt||jr(4,a,t),Pa(e,t,a);break;case 1:dt||(Ba(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&sb(a,t,r)),Pa(e,t,a);break;case 21:Pa(e,t,a);break;case 22:dt=(r=dt)||a.memoizedState!==null,Pa(e,t,a),dt=r;break;default:Pa(e,t,a)}}function hb(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 gb(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 p1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $f),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $f),t;default:throw Error(L(435,e.tag))}}function Al(e,t){var a=p1(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var i=y1.bind(null,e,r);r.then(i,i)}})}function $t(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var i=a[r],n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Yr(l.type)){at=l.stateNode,Xt=!1;break e}break;case 5:at=l.stateNode,Xt=!1;break e;case 3:case 4:at=l.stateNode.containerInfo,Xt=!0;break e}l=l.return}if(at===null)throw Error(L(160));fb(n,o,i),at=null,Xt=!1,n=i.alternate,n!==null&&(n.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bb(t,e),t=t.sibling}var Ma=null;function bb(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$t(t,e),Vt(e),r&4&&(jr(3,e,e.return),Zo(3,e),jr(5,e,e.return));break;case 1:$t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),r&64&&Wa&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var i=Ma;if($t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),r&4){var n=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":n=i.getElementsByTagName("title")[0],(!n||n[Yo]||n[Et]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=i.createElement(r),i.head.insertBefore(n,i.querySelector("head > title"))),zt(n,r,a),n[Et]=e,_t(n),r=n;break e;case"link":var o=dh("link","href",i).get(r+(a.href||""));if(o){for(var l=0;l<o.length;l++)if(n=o[l],n.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&n.getAttribute("rel")===(a.rel==null?null:a.rel)&&n.getAttribute("title")===(a.title==null?null:a.title)&&n.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;case"meta":if(o=dh("meta","content",i).get(r+(a.content||""))){for(l=0;l<o.length;l++)if(n=o[l],n.getAttribute("content")===(a.content==null?null:""+a.content)&&n.getAttribute("name")===(a.name==null?null:a.name)&&n.getAttribute("property")===(a.property==null?null:a.property)&&n.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&n.getAttribute("charset")===(a.charSet==null?null:a.charSet)){o.splice(l,1);break t}}n=i.createElement(r),zt(n,r,a),i.head.appendChild(n);break;default:throw Error(L(468,r))}n[Et]=e,_t(n),r=n}e.stateNode=r}else mh(i,e.type,e.stateNode);else e.stateNode=ph(i,r,e.memoizedProps);else n!==r?(n===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):n.count--,r===null?mh(i,e.type,e.stateNode):ph(i,r,e.memoizedProps)):r===null&&e.stateNode!==null&&gu(e,e.memoizedProps,a.memoizedProps)}break;case 27:$t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),a!==null&&r&4&&gu(e,e.memoizedProps,a.memoizedProps);break;case 5:if($t(t,e),Vt(e),r&512&&(dt||a===null||Ba(a,a.return)),e.flags&32){i=e.stateNode;try{sn(i,"")}catch(_){Be(e,e.return,_)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,gu(e,i,a!==null?a.memoizedProps:i)),r&1024&&(wu=!0);break;case 6:if($t(t,e),Vt(e),r&4){if(e.stateNode===null)throw Error(L(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(_){Be(e,e.return,_)}}break;case 3:if(Fl=null,i=Ma,Ma=Ss(t.containerInfo),$t(t,e),Ma=i,Vt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{gn(t.containerInfo)}catch(_){Be(e,e.return,_)}wu&&(wu=!1,wb(e));break;case 4:r=Ma,Ma=Ss(e.stateNode.containerInfo),$t(t,e),Vt(e),Ma=r;break;case 12:$t(t,e),Vt(e);break;case 31:$t(t,e),Vt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 13:$t(t,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(js=na()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 22:i=e.memoizedState!==null;var c=a!==null&&a.memoizedState!==null,p=Wa,m=dt;if(Wa=p||i,dt=m||c,$t(t,e),dt=m,Wa=p,Vt(e),r&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(a===null||c||Wa||dt||Wr(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){c=a=t;try{if(n=c.stateNode,i)o=n.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var b=c.memoizedProps.style,f=b!=null&&b.hasOwnProperty("display")?b.display:null;l.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(_){Be(c,c.return,_)}}}else if(t.tag===6){if(a===null){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(_){Be(c,c.return,_)}}}else if(t.tag===18){if(a===null){c=t;try{var w=c.stateNode;i?oh(w,!0):oh(c.stateNode,!1)}catch(_){Be(c,c.return,_)}}}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,Al(e,a))));break;case 19:$t(t,e),Vt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Al(e,r)));break;case 30:break;case 21:break;default:$t(t,e),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(ub(r)){a=r;break}r=r.return}if(a==null)throw Error(L(160));switch(a.tag){case 27:var i=a.stateNode,n=bu(e);gs(e,n,i);break;case 5:var o=a.stateNode;a.flags&32&&(sn(o,""),a.flags&=-33);var l=bu(e);gs(e,l,o);break;case 3:case 4:var c=a.stateNode.containerInfo,p=bu(e);np(e,p,c);break;default:throw Error(L(161))}}catch(m){Be(e,e.return,m)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wb(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;)db(e,t.alternate,t),t=t.sibling}function Wr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:jr(4,t,t.return),Wr(t);break;case 1:Ba(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&sb(t,t.return,a),Wr(t);break;case 27:So(t.stateNode);case 26:case 5:Ba(t,t.return),Wr(t);break;case 22:t.memoizedState===null&&Wr(t);break;case 30:Wr(t);break;default:Wr(t)}e=e.sibling}}function Fa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,i=e,n=t,o=n.flags;switch(n.tag){case 0:case 11:case 15:Fa(i,n,a),Zo(4,n);break;case 1:if(Fa(i,n,a),r=n,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(p){Be(r,r.return,p)}if(r=n,i=r.updateQueue,i!==null){var l=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)hg(c[i],l)}catch(p){Be(r,r.return,p)}}a&&o&64&&lb(n),yo(n,n.return);break;case 27:pb(n);case 26:case 5:Fa(i,n,a),a&&r===null&&o&4&&cb(n),yo(n,n.return);break;case 12:Fa(i,n,a);break;case 31:Fa(i,n,a),a&&o&4&&hb(i,n);break;case 13:Fa(i,n,a),a&&o&4&&gb(i,n);break;case 22:n.memoizedState===null&&Fa(i,n,a),yo(n,n.return);break;case 30:break;default:Fa(i,n,a)}t=t.sibling}}function id(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&&Vo(a))}function nd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vo(e))}function Ea(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vb(e,t,a,r),t=t.sibling}function vb(e,t,a,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ea(e,t,a,r),i&2048&&Zo(9,t);break;case 1:Ea(e,t,a,r);break;case 3:Ea(e,t,a,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vo(e)));break;case 12:if(i&2048){Ea(e,t,a,r),e=t.stateNode;try{var n=t.memoizedProps,o=n.id,l=n.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Be(t,t.return,c)}}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:n=t.stateNode,o=t.alternate,t.memoizedState!==null?n._visibility&2?Ea(e,t,a,r):_o(e,t):n._visibility&2?Ea(e,t,a,r):(n._visibility|=2,Li(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),i&2048&&id(o,t);break;case 24:Ea(e,t,a,r),i&2048&&nd(t.alternate,t);break;default:Ea(e,t,a,r)}}function Li(e,t,a,r,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,o=t,l=a,c=r,p=o.flags;switch(o.tag){case 0:case 11:case 15:Li(n,o,l,c,i),Zo(8,o);break;case 23:break;case 22:var m=o.stateNode;o.memoizedState!==null?m._visibility&2?Li(n,o,l,c,i):_o(n,o):(m._visibility|=2,Li(n,o,l,c,i)),i&&p&2048&&id(o.alternate,o);break;case 24:Li(n,o,l,c,i),i&&p&2048&&nd(o.alternate,o);break;default:Li(n,o,l,c,i)}t=t.sibling}}function _o(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,i=r.flags;switch(r.tag){case 22:_o(a,r),i&2048&&id(r.alternate,r);break;case 24:_o(a,r),i&2048&&nd(r.alternate,r);break;default:_o(a,r)}t=t.sibling}}var uo=8192;function Bi(e,t,a){if(e.subtreeFlags&uo)for(e=e.child;e!==null;)yb(e,t,a),e=e.sibling}function yb(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&uo&&e.memoizedState!==null&&P1(a,Ma,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var r=Ma;Ma=Ss(e.stateNode.containerInfo),Bi(e,t,a),Ma=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=uo,uo=16777216,Bi(e,t,a),uo=r):Bi(e,t,a));break;default:Bi(e,t,a)}}function _b(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 ro(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];yt=r,kb(r,e)}_b(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xb(e),e=e.sibling}function xb(e){switch(e.tag){case 0:case 11:case 15:ro(e),e.flags&2048&&jr(9,e,e.return);break;case 3:ro(e);break;case 12:ro(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):ro(e);break;default:ro(e)}}function Pl(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];yt=r,kb(r,e)}_b(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:jr(8,t,t.return),Pl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function kb(e,t){for(;yt!==null;){var a=yt;switch(a.tag){case 0:case 11:case 15:jr(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:Vo(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,yt=r;else e:for(a=e;yt!==null;){r=yt;var i=r.sibling,n=r.return;if(mb(r),r===a){yt=null;break e}if(i!==null){i.return=n,yt=i;break e}yt=n}}}var d1={getCacheForType:function(e){var t=Tt(mt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(mt).controller.signal}},m1=typeof WeakMap=="function"?WeakMap:Map,Ae=0,$e=null,_e=null,Se=0,Oe=0,ta=null,Cr=!1,_n=!1,od=!1,ur=0,ot=0,Qr=0,ii=0,ld=0,ia=0,dn=0,xo=null,Zt=null,op=!1,js=0,Sb=0,bs=1/0,ws=null,Ar=null,gt=0,Ur=null,mn=null,nr=0,lp=0,sp=null,Nb=null,ko=0,cp=null;function sa(){return(Ae&2)!==0&&Se!==0?Se&-Se:se.T!==null?cd():Uh()}function Cb(){if(ia===0)if((Se&536870912)===0||Ce){var e=kl;kl<<=1,(kl&3932160)===0&&(kl=262144),ia=e}else ia=536870912;return e=ua.current,e!==null&&(e.flags|=32),ia}function Kt(e,t,a){(e===$e&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(fn(e,0),qr(e,Se,ia,!1)),Go(e,a),((Ae&2)===0||e!==$e)&&(e===$e&&((Ae&2)===0&&(ii|=a),ot===4&&qr(e,Se,ia,!1)),ja(e))}function qb(e,t,a){if((Ae&6)!==0)throw Error(L(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Qo(e,t),i=r?g1(e,t):vu(e,t,!0),n=r;do{if(i===0){_n&&!r&&qr(e,t,0,!1);break}else{if(a=e.current.alternate,n&&!f1(a)){i=vu(e,t,!1),n=!1;continue}if(i===2){if(n=t,e.errorRecoveryDisabledLanes&n)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;i=xo;var c=l.current.memoizedState.isDehydrated;if(c&&(fn(l,o).flags|=256),o=vu(l,o,!1),o!==2){if(od&&!c){l.errorRecoveryDisabledLanes|=n,ii|=n,i=4;break e}n=Zt,Zt=i,n!==null&&(Zt===null?Zt=n:Zt.push.apply(Zt,n))}i=o}if(n=!1,i!==2)continue}}if(i===1){fn(e,0),qr(e,t,0,!0);break}e:{switch(r=e,n=i,n){case 0:case 1:throw Error(L(345));case 4:if((t&4194048)!==t)break;case 6:qr(r,t,ia,!Cr);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(L(329))}if((t&62914560)===t&&(i=js+300-na(),10<i)){if(qr(r,t,ia,!Cr),Ms(r,0,!0)!==0)break e;nr=t,r.timeoutHandle=Zb(Vf.bind(null,r,a,Zt,ws,op,t,ia,ii,dn,Cr,n,"Throttled",-0,0),i);break e}Vf(r,a,Zt,ws,op,t,ia,ii,dn,Cr,n,null,-0,0)}}break}while(!0);ja(e)}function Vf(e,t,a,r,i,n,o,l,c,p,m,b,f,w){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:tr},yb(t,n,b);var _=(n&62914560)===n?js-na():(n&4194048)===n?Sb-na():0;if(_=J1(b,_),_!==null){nr=n,e.cancelPendingCommit=_(Zf.bind(null,e,t,n,a,r,i,o,l,c,m,b,null,f,w)),qr(e,n,o,!p);return}}Zf(e,t,n,a,r,i,o,l,c)}function f1(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var i=a[r],n=i.getSnapshot;i=i.value;try{if(!ca(n(),i))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qr(e,t,a,r){t&=~ld,t&=~ii,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var n=31-la(i),o=1<<n;r[n]=-1,i&=~o}a!==0&&zh(e,a,t)}function Qs(){return(Ae&6)===0?(Ko(0,!1),!1):!0}function sd(){if(_e!==null){if(Oe===0)var e=_e.return;else e=_e,ar=fi=null,Zp(e),an=null,zo=0,e=_e;for(;e!==null;)ob(e.alternate,e),e=e.return;_e=null}}function fn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,R1(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),nr=0,sd(),$e=e,_e=a=rr(e.current,null),Se=t,Oe=0,ta=null,Cr=!1,_n=Qo(e,t),od=!1,dn=ia=ld=ii=Qr=ot=0,Zt=xo=null,op=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-la(r),n=1<<i;t|=e[i],r&=~n}return ur=t,As(),a}function Eb(e,t){de=null,se.H=Ao,t===yn||t===Ds?(t=kf(),Oe=3):t===jp?(t=kf(),Oe=4):Oe=t===ad?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ta=t,_e===null&&(ot=1,fs(e,ba(t,e.current)))}function Mb(){var e=ua.current;return e===null?!0:(Se&4194048)===Se?va===null:(Se&62914560)===Se||(Se&536870912)!==0?e===va:!1}function Tb(){var e=se.H;return se.H=Ao,e===null?Ao:e}function zb(){var e=se.A;return se.A=d1,e}function vs(){ot=4,Cr||(Se&4194048)!==Se&&ua.current!==null||(_n=!0),(Qr&134217727)===0&&(ii&134217727)===0||$e===null||qr($e,Se,ia,!1)}function vu(e,t,a){var r=Ae;Ae|=2;var i=Tb(),n=zb();($e!==e||Se!==t)&&(ws=null,fn(e,t)),t=!1;var o=ot;e:do try{if(Oe!==0&&_e!==null){var l=_e,c=ta;switch(Oe){case 8:sd(),o=6;break e;case 3:case 2:case 9:case 6:ua.current===null&&(t=!0);var p=Oe;if(Oe=0,ta=null,Fi(e,l,c,p),a&&_n){o=0;break e}break;default:p=Oe,Oe=0,ta=null,Fi(e,l,c,p)}}h1(),o=ot;break}catch(m){Eb(e,m)}while(!0);return t&&e.shellSuspendCounter++,ar=fi=null,Ae=r,se.H=i,se.A=n,_e===null&&($e=null,Se=0,As()),o}function h1(){for(;_e!==null;)Rb(_e)}function g1(e,t){var a=Ae;Ae|=2;var r=Tb(),i=zb();$e!==e||Se!==t?(ws=null,bs=na()+500,fn(e,t)):_n=Qo(e,t);e:do try{if(Oe!==0&&_e!==null){t=_e;var n=ta;t:switch(Oe){case 1:Oe=0,ta=null,Fi(e,t,n,1);break;case 2:case 9:if(xf(n)){Oe=0,ta=null,Xf(t);break}t=function(){Oe!==2&&Oe!==9||$e!==e||(Oe=7),ja(e)},n.then(t,t);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:xf(n)?(Oe=0,ta=null,Xf(t)):(Oe=0,ta=null,Fi(e,t,n,7));break;case 5:var o=null;switch(_e.tag){case 26:o=_e.memoizedState;case 5:case 27:var l=_e;if(o?Ib(o):l.stateNode.complete){Oe=0,ta=null;var c=l.sibling;if(c!==null)_e=c;else{var p=l.return;p!==null?(_e=p,Gs(p)):_e=null}break t}}Oe=0,ta=null,Fi(e,t,n,5);break;case 6:Oe=0,ta=null,Fi(e,t,n,6);break;case 8:sd(),ot=6;break e;default:throw Error(L(462))}}b1();break}catch(m){Eb(e,m)}while(!0);return ar=fi=null,se.H=r,se.A=i,Ae=a,_e!==null?0:($e=null,Se=0,As(),ot)}function b1(){for(;_e!==null&&!j0();)Rb(_e)}function Rb(e){var t=nb(e.alternate,e,ur);e.memoizedProps=e.pendingProps,t===null?Gs(e):_e=t}function Xf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Hf(a,t,t.pendingProps,t.type,void 0,Se);break;case 11:t=Hf(a,t,t.pendingProps,t.type.render,t.ref,Se);break;case 5:Zp(t);default:ob(a,t),t=_e=og(t,ur),t=nb(a,t,ur)}e.memoizedProps=e.pendingProps,t===null?Gs(e):_e=t}function Fi(e,t,a,r){ar=fi=null,Zp(t),an=null,zo=0;var i=t.return;try{if(n1(e,i,t,a,Se)){ot=1,fs(e,ba(a,e.current)),_e=null;return}}catch(n){if(i!==null)throw _e=i,n;ot=1,fs(e,ba(a,e.current)),_e=null;return}t.flags&32768?(Ce||r===1?e=!0:_n||(Se&536870912)!==0?e=!1:(Cr=e=!0,(r===2||r===9||r===3||r===6)&&(r=ua.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ab(t,e)):Gs(t)}function Gs(e){var t=e;do{if((t.flags&32768)!==0){Ab(t,Cr);return}e=t.return;var a=s1(t.alternate,t,ur);if(a!==null){_e=a;return}if(t=t.sibling,t!==null){_e=t;return}_e=t=e}while(t!==null);ot===0&&(ot=5)}function Ab(e,t){do{var a=c1(e.alternate,e);if(a!==null){a.flags&=32767,_e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){_e=e;return}_e=e=a}while(e!==null);ot=6,_e=null}function Zf(e,t,a,r,i,n,o,l,c){e.cancelPendingCommit=null;do Ys();while(gt!==0);if((Ae&6)!==0)throw Error(L(327));if(t!==null){if(t===e.current)throw Error(L(177));if(n=t.lanes|t.childLanes,n|=Ap,J0(e,a,n,o,l,c),e===$e&&(_e=$e=null,Se=0),mn=t,Ur=e,nr=a,lp=n,sp=i,Nb=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,_1(rs,function(){return Lb(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=se.T,se.T=null,i=Ue.p,Ue.p=2,o=Ae,Ae|=4;try{u1(e,t,a)}finally{Ae=o,Ue.p=i,se.T=r}}gt=1,Ub(),Db(),Ob()}}function Ub(){if(gt===1){gt=0;var e=Ur,t=mn,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=se.T,se.T=null;var r=Ue.p;Ue.p=2;var i=Ae;Ae|=4;try{bb(t,e);var n=mp,o=Ih(e.containerInfo),l=n.focusedElem,c=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&Fh(l.ownerDocument.documentElement,l)){if(c!==null&&Rp(l)){var p=c.start,m=c.end;if(m===void 0&&(m=p),"selectionStart"in l)l.selectionStart=p,l.selectionEnd=Math.min(m,l.value.length);else{var b=l.ownerDocument||document,f=b&&b.defaultView||window;if(f.getSelection){var w=f.getSelection(),_=l.textContent.length,E=Math.min(c.start,_),D=c.end===void 0?E:Math.min(c.end,_);!w.extend&&E>D&&(o=D,D=E,E=o);var h=hf(l,E),u=hf(l,D);if(h&&u&&(w.rangeCount!==1||w.anchorNode!==h.node||w.anchorOffset!==h.offset||w.focusNode!==u.node||w.focusOffset!==u.offset)){var g=b.createRange();g.setStart(h.node,h.offset),w.removeAllRanges(),E>D?(w.addRange(g),w.extend(u.node,u.offset)):(g.setEnd(u.node,u.offset),w.addRange(g))}}}}for(b=[],w=l;w=w.parentNode;)w.nodeType===1&&b.push({element:w,left:w.scrollLeft,top:w.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}}qs=!!dp,mp=dp=null}finally{Ae=i,Ue.p=r,se.T=a}}e.current=t,gt=2}}function Db(){if(gt===2){gt=0;var e=Ur,t=mn,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=se.T,se.T=null;var r=Ue.p;Ue.p=2;var i=Ae;Ae|=4;try{db(e,t.alternate,t)}finally{Ae=i,Ue.p=r,se.T=a}}gt=3}}function Ob(){if(gt===4||gt===3){gt=0,Q0();var e=Ur,t=mn,a=nr,r=Nb;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?gt=5:(gt=0,mn=Ur=null,Bb(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Ar=null),Np(a),t=t.stateNode,oa&&typeof oa.onCommitFiberRoot=="function")try{oa.onCommitFiberRoot(jo,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=se.T,i=Ue.p,Ue.p=2,se.T=null;try{for(var n=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];n(l.value,{componentStack:l.stack})}}finally{se.T=t,Ue.p=i}}(nr&3)!==0&&Ys(),ja(e),i=e.pendingLanes,(a&261930)!==0&&(i&42)!==0?e===cp?ko++:(ko=0,cp=e):ko=0,Ko(0,!1)}}function Bb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vo(t)))}function Ys(){return Ub(),Db(),Ob(),Lb()}function Lb(){if(gt!==5)return!1;var e=Ur,t=lp;lp=0;var a=Np(nr),r=se.T,i=Ue.p;try{Ue.p=32>a?32:a,se.T=null,a=sp,sp=null;var n=Ur,o=nr;if(gt=0,mn=Ur=null,nr=0,(Ae&6)!==0)throw Error(L(331));var l=Ae;if(Ae|=4,xb(n.current),vb(n,n.current,o,a),Ae=l,Ko(0,!1),oa&&typeof oa.onPostCommitFiberRoot=="function")try{oa.onPostCommitFiberRoot(jo,n)}catch{}return!0}finally{Ue.p=i,se.T=r,Bb(e,t)}}function Kf(e,t,a){t=ba(a,t),t=ap(e.stateNode,t,2),e=Rr(e,t,2),e!==null&&(Go(e,2),ja(e))}function Be(e,t,a){if(e.tag===3)Kf(e,e,a);else for(;t!==null;){if(t.tag===3){Kf(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ar===null||!Ar.has(r))){e=ba(a,e),a=Wg(2),r=Rr(t,a,2),r!==null&&(eb(a,r,t,e),Go(r,2),ja(r));break}}t=t.return}}function yu(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new m1;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(a)||(od=!0,i.add(a),e=w1.bind(null,e,t,a),t.then(e,e))}function w1(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,$e===e&&(Se&a)===a&&(ot===4||ot===3&&(Se&62914560)===Se&&300>na()-js?(Ae&2)===0&&fn(e,0):ld|=a,dn===Se&&(dn=0)),ja(e)}function Hb(e,t){t===0&&(t=Th()),e=mi(e,t),e!==null&&(Go(e,t),ja(e))}function v1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Hb(e,a)}function y1(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(L(314))}r!==null&&r.delete(t),Hb(e,a)}function _1(e,t){return kp(e,t)}var ys=null,Hi=null,up=!1,_s=!1,_u=!1,Er=0;function ja(e){e!==Hi&&e.next===null&&(Hi===null?ys=Hi=e:Hi=Hi.next=e),_s=!0,up||(up=!0,k1())}function Ko(e,t){if(!_u&&_s){_u=!0;do for(var a=!1,r=ys;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var n=0;else{var o=r.suspendedLanes,l=r.pingedLanes;n=(1<<31-la(42|e)+1)-1,n&=i&~(o&~l),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(a=!0,Pf(r,n))}else n=Se,n=Ms(r,r===$e?n:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(n&3)===0||Qo(r,n)||(a=!0,Pf(r,n));r=r.next}while(a);_u=!1}}function x1(){jb()}function jb(){_s=up=!1;var e=0;Er!==0&&z1()&&(e=Er);for(var t=na(),a=null,r=ys;r!==null;){var i=r.next,n=Qb(r,t);n===0?(r.next=null,a===null?ys=i:a.next=i,i===null&&(Hi=a)):(a=r,(e!==0||(n&3)!==0)&&(_s=!0)),r=i}gt!==0&>!==5||Ko(e,!1),Er!==0&&(Er=0)}function Qb(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var o=31-la(n),l=1<<o,c=i[o];c===-1?((l&a)===0||(l&r)!==0)&&(i[o]=P0(l,t)):c<=t&&(e.expiredLanes|=l),n&=~l}if(t=$e,a=Se,a=Ms(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Jc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Qo(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Jc(r),Np(a)){case 2:case 8:a=Eh;break;case 32:a=rs;break;case 268435456:a=Mh;break;default:a=rs}return r=Gb.bind(null,e),a=kp(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Jc(r),e.callbackPriority=2,e.callbackNode=null,2}function Gb(e,t){if(gt!==0&>!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ys()&&e.callbackNode!==a)return null;var r=Se;return r=Ms(e,e===$e?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(qb(e,r,t),Qb(e,na()),e.callbackNode!=null&&e.callbackNode===a?Gb.bind(null,e):null)}function Pf(e,t){if(Ys())return null;qb(e,t,!0)}function k1(){A1(function(){(Ae&6)!==0?kp(qh,x1):jb()})}function cd(){if(Er===0){var e=cn;e===0&&(e=xl,xl<<=1,(xl&261888)===0&&(xl=256)),Er=e}return Er}function Jf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:jl(""+e)}function Ff(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 S1(e,t,a,r,i){if(t==="submit"&&a&&a.stateNode===i){var n=Jf((i[Pt]||null).action),o=r.submitter;o&&(t=(t=o[Pt]||null)?Jf(t.formAction):o.getAttribute("formAction"),t!==null&&(n=t,o=null));var l=new Ts("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Er!==0){var c=o?Ff(i,o):new FormData(i);ep(a,{pending:!0,data:c,method:i.method,action:n},null,c)}}else typeof n=="function"&&(l.preventDefault(),c=o?Ff(i,o):new FormData(i),ep(a,{pending:!0,data:c,method:i.method,action:n},n,c))},currentTarget:i}]})}}for(Ul=0;Ul<Gu.length;Ul++)Dl=Gu[Ul],If=Dl.toLowerCase(),Wf=Dl[0].toUpperCase()+Dl.slice(1),Ta(If,"on"+Wf);var Dl,If,Wf,Ul;Ta(eg,"onAnimationEnd");Ta(tg,"onAnimationIteration");Ta(ag,"onAnimationStart");Ta("dblclick","onDoubleClick");Ta("focusin","onFocus");Ta("focusout","onBlur");Ta(Gy,"onTransitionRun");Ta(Yy,"onTransitionStart");Ta($y,"onTransitionCancel");Ta(rg,"onTransitionEnd");ln("onMouseEnter",["mouseout","mouseover"]);ln("onMouseLeave",["mouseout","mouseover"]);ln("onPointerEnter",["pointerout","pointerover"]);ln("onPointerLeave",["pointerout","pointerover"]);ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ui("onBeforeInput",["compositionend","keypress","textInput","paste"]);ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),N1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uo));function Yb(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],i=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,p=l.currentTarget;if(l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(m){ns(m)}i.currentTarget=null,n=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,p=l.currentTarget,l=l.listener,c!==n&&i.isPropagationStopped())break e;n=l,i.currentTarget=p;try{n(i)}catch(m){ns(m)}i.currentTarget=null,n=c}}}}function ye(e,t){var a=t[Uu];a===void 0&&(a=t[Uu]=new Set);var r=e+"__bubble";a.has(r)||($b(t,e,2,!1),a.add(r))}function xu(e,t,a){var r=0;t&&(r|=4),$b(a,e,r,t)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function ud(e){if(!e[Ol]){e[Ol]=!0,Dh.forEach(function(a){a!=="selectionchange"&&(N1.has(a)||xu(a,!1,e),xu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ol]||(t[Ol]=!0,xu("selectionchange",!1,t))}}function $b(e,t,a,r){switch(rw(t)){case 2:var i=W1;break;case 8:i=e_;break;default:i=fd}a=i.bind(null,t,a,e),i=void 0,!Hu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,a,{capture:!0,passive:i}):e.addEventListener(t,a,!0):i!==void 0?e.addEventListener(t,a,{passive:i}):e.addEventListener(t,a,!1)}function ku(e,t,a,r,i){var n=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;l!==null;){if(o=Gi(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=n=o;continue e}l=l.parentNode}}r=r.return}Yh(function(){var p=n,m=Ep(a),b=[];e:{var f=ig.get(e);if(f!==void 0){var w=Ts,_=e;switch(e){case"keypress":if(Gl(a)===0)break e;case"keydown":case"keyup":w=yy;break;case"focusin":_="focus",w=tu;break;case"focusout":_="blur",w=tu;break;case"beforeblur":case"afterblur":w=tu;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":w=of;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":w=sy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":w=ky;break;case eg:case tg:case ag:w=py;break;case rg:w=Ny;break;case"scroll":case"scrollend":w=oy;break;case"wheel":w=qy;break;case"copy":case"cut":case"paste":w=my;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":w=sf;break;case"toggle":case"beforetoggle":w=My}var E=(t&4)!==0,D=!E&&(e==="scroll"||e==="scrollend"),h=E?f!==null?f+"Capture":null:f;E=[];for(var u=p,g;u!==null;){var v=u;if(g=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||g===null||h===null||(v=Co(u,h),v!=null&&E.push(Do(u,v,g))),D)break;u=u.return}0<E.length&&(f=new w(f,_,null,a,m),b.push({event:f,listeners:E}))}}if((t&7)===0){e:{if(f=e==="mouseover"||e==="pointerover",w=e==="mouseout"||e==="pointerout",f&&a!==Lu&&(_=a.relatedTarget||a.fromElement)&&(Gi(_)||_[bn]))break e;if((w||f)&&(f=m.window===m?m:(f=m.ownerDocument)?f.defaultView||f.parentWindow:window,w?(_=a.relatedTarget||a.toElement,w=p,_=_?Gi(_):null,_!==null&&(D=Ho(_),E=_.tag,_!==D||E!==5&&E!==27&&E!==6)&&(_=null)):(w=null,_=p),w!==_)){if(E=of,v="onMouseLeave",h="onMouseEnter",u="mouse",(e==="pointerout"||e==="pointerover")&&(E=sf,v="onPointerLeave",h="onPointerEnter",u="pointer"),D=w==null?f:so(w),g=_==null?f:so(_),f=new E(v,u+"leave",w,a,m),f.target=D,f.relatedTarget=g,v=null,Gi(m)===p&&(E=new E(h,u+"enter",_,a,m),E.target=g,E.relatedTarget=D,v=E),D=v,w&&_)t:{for(E=C1,h=w,u=_,g=0,v=h;v;v=E(v))g++;v=0;for(var N=u;N;N=E(N))v++;for(;0<g-v;)h=E(h),g--;for(;0<v-g;)u=E(u),v--;for(;g--;){if(h===u||u!==null&&h===u.alternate){E=h;break t}h=E(h),u=E(u)}E=null}else E=null;w!==null&&eh(b,f,w,E,!1),_!==null&&D!==null&&eh(b,D,_,E,!0)}}e:{if(f=p?so(p):window,w=f.nodeName&&f.nodeName.toLowerCase(),w==="select"||w==="input"&&f.type==="file")var R=df;else if(pf(f))if(Ph)R=Hy;else{R=By;var T=Oy}else w=f.nodeName,!w||w.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?p&&qp(p.elementType)&&(R=df):R=Ly;if(R&&(R=R(e,p))){Kh(b,R,a,m);break e}T&&T(e,f,p),e==="focusout"&&p&&f.type==="number"&&p.memoizedProps.value!=null&&Bu(f,"number",f.value)}switch(T=p?so(p):window,e){case"focusin":(pf(T)||T.contentEditable==="true")&&(Vi=T,ju=p,fo=null);break;case"focusout":fo=ju=Vi=null;break;case"mousedown":Qu=!0;break;case"contextmenu":case"mouseup":case"dragend":Qu=!1,gf(b,a,m);break;case"selectionchange":if(Qy)break;case"keydown":case"keyup":gf(b,a,m)}var U;if(zp)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else $i?Xh(e,a)&&(A="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(A="onCompositionStart");A&&(Vh&&a.locale!=="ko"&&($i||A!=="onCompositionStart"?A==="onCompositionEnd"&&$i&&(U=$h()):(Nr=m,Mp="value"in Nr?Nr.value:Nr.textContent,$i=!0)),T=xs(p,A),0<T.length&&(A=new lf(A,e,null,a,m),b.push({event:A,listeners:T}),U?A.data=U:(U=Zh(a),U!==null&&(A.data=U)))),(U=zy?Ry(e,a):Ay(e,a))&&(A=xs(p,"onBeforeInput"),0<A.length&&(T=new lf("onBeforeInput","beforeinput",null,a,m),b.push({event:T,listeners:A}),T.data=U)),S1(b,e,p,a,m)}Yb(b,t)})}function Do(e,t,a){return{instance:e,listener:t,currentTarget:a}}function xs(e,t){for(var a=t+"Capture",r=[];e!==null;){var i=e,n=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||n===null||(i=Co(e,a),i!=null&&r.unshift(Do(e,i,n)),i=Co(e,t),i!=null&&r.push(Do(e,i,n))),e.tag===3)return r;e=e.return}return[]}function C1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function eh(e,t,a,r,i){for(var n=t._reactName,o=[];a!==null&&a!==r;){var l=a,c=l.alternate,p=l.stateNode;if(l=l.tag,c!==null&&c===r)break;l!==5&&l!==26&&l!==27||p===null||(c=p,i?(p=Co(a,n),p!=null&&o.unshift(Do(a,p,c))):i||(p=Co(a,n),p!=null&&o.push(Do(a,p,c)))),a=a.return}o.length!==0&&e.push({event:t,listeners:o})}var q1=/\r\n?/g,E1=/\u0000|\uFFFD/g;function th(e){return(typeof e=="string"?e:""+e).replace(q1,`
|
|
9
|
+
`).replace(E1,"")}function Vb(e,t){return t=th(t),th(e)===t}function Qe(e,t,a,r,i,n){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||sn(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&sn(e,""+r);break;case"className":Nl(e,"class",r);break;case"tabIndex":Nl(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Nl(e,a,r);break;case"style":Gh(e,r,n);break;case"data":if(t!=="object"){Nl(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=jl(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof n=="function"&&(a==="formAction"?(t!=="input"&&Qe(e,t,"name",i.name,i,null),Qe(e,t,"formEncType",i.formEncType,i,null),Qe(e,t,"formMethod",i.formMethod,i,null),Qe(e,t,"formTarget",i.formTarget,i,null)):(Qe(e,t,"encType",i.encType,i,null),Qe(e,t,"method",i.method,i,null),Qe(e,t,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=jl(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=tr);break;case"onScroll":r!=null&&ye("scroll",e);break;case"onScrollEnd":r!=null&&ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=jl(""+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":ye("beforetoggle",e),ye("toggle",e),Hl(e,"popover",r);break;case"xlinkActuate":Za(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Za(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Za(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Za(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Za(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Za(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Za(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Za(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Za(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Hl(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=iy.get(a)||a,Hl(e,a,r))}}function pp(e,t,a,r,i,n){switch(a){case"style":Gh(e,r,n);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(L(61));if(a=r.__html,a!=null){if(i.children!=null)throw Error(L(60));e.innerHTML=a}}break;case"children":typeof r=="string"?sn(e,r):(typeof r=="number"||typeof r=="bigint")&&sn(e,""+r);break;case"onScroll":r!=null&&ye("scroll",e);break;case"onScrollEnd":r!=null&&ye("scrollend",e);break;case"onClick":r!=null&&(e.onclick=tr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Oh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(i=a.endsWith("Capture"),t=a.slice(2,i?a.length-7:void 0),n=e[Pt]||null,n=n!=null?n[a]:null,typeof n=="function"&&e.removeEventListener(t,n,i),typeof r=="function")){typeof n!="function"&&n!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,i);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Hl(e,a,r)}}}function zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ye("error",e),ye("load",e);var r=!1,i=!1,n;for(n in a)if(a.hasOwnProperty(n)){var o=a[n];if(o!=null)switch(n){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Qe(e,t,n,o,a,null)}}i&&Qe(e,t,"srcSet",a.srcSet,a,null),r&&Qe(e,t,"src",a.src,a,null);return;case"input":ye("invalid",e);var l=n=o=i=null,c=null,p=null;for(r in a)if(a.hasOwnProperty(r)){var m=a[r];if(m!=null)switch(r){case"name":i=m;break;case"type":o=m;break;case"checked":c=m;break;case"defaultChecked":p=m;break;case"value":n=m;break;case"defaultValue":l=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(L(137,t));break;default:Qe(e,t,r,m,a,null)}}Hh(e,n,l,c,p,o,i,!1);return;case"select":ye("invalid",e),r=o=n=null;for(i in a)if(a.hasOwnProperty(i)&&(l=a[i],l!=null))switch(i){case"value":n=l;break;case"defaultValue":o=l;break;case"multiple":r=l;default:Qe(e,t,i,l,a,null)}t=n,a=o,e.multiple=!!r,t!=null?Wi(e,!!r,t,!1):a!=null&&Wi(e,!!r,a,!0);return;case"textarea":ye("invalid",e),n=i=r=null;for(o in a)if(a.hasOwnProperty(o)&&(l=a[o],l!=null))switch(o){case"value":r=l;break;case"defaultValue":i=l;break;case"children":n=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(L(91));break;default:Qe(e,t,o,l,a,null)}Qh(e,r,i,n);return;case"option":for(c in a)a.hasOwnProperty(c)&&(r=a[c],r!=null)&&(c==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":Qe(e,t,c,r,a,null));return;case"dialog":ye("beforetoggle",e),ye("toggle",e),ye("cancel",e),ye("close",e);break;case"iframe":case"object":ye("load",e);break;case"video":case"audio":for(r=0;r<Uo.length;r++)ye(Uo[r],e);break;case"image":ye("error",e),ye("load",e);break;case"details":ye("toggle",e);break;case"embed":case"source":case"link":ye("error",e),ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(p in a)if(a.hasOwnProperty(p)&&(r=a[p],r!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(L(137,t));default:Qe(e,t,p,r,a,null)}return;default:if(qp(t)){for(m in a)a.hasOwnProperty(m)&&(r=a[m],r!==void 0&&pp(e,t,m,r,a,void 0));return}}for(l in a)a.hasOwnProperty(l)&&(r=a[l],r!=null&&Qe(e,t,l,r,a,null))}function M1(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,n=null,o=null,l=null,c=null,p=null,m=null;for(w in a){var b=a[w];if(a.hasOwnProperty(w)&&b!=null)switch(w){case"checked":break;case"value":break;case"defaultValue":c=b;default:r.hasOwnProperty(w)||Qe(e,t,w,null,r,b)}}for(var f in r){var w=r[f];if(b=a[f],r.hasOwnProperty(f)&&(w!=null||b!=null))switch(f){case"type":n=w;break;case"name":i=w;break;case"checked":p=w;break;case"defaultChecked":m=w;break;case"value":o=w;break;case"defaultValue":l=w;break;case"children":case"dangerouslySetInnerHTML":if(w!=null)throw Error(L(137,t));break;default:w!==b&&Qe(e,t,f,w,r,b)}}Ou(e,o,l,c,p,m,n,i);return;case"select":w=o=l=f=null;for(n in a)if(c=a[n],a.hasOwnProperty(n)&&c!=null)switch(n){case"value":break;case"multiple":w=c;default:r.hasOwnProperty(n)||Qe(e,t,n,null,r,c)}for(i in r)if(n=r[i],c=a[i],r.hasOwnProperty(i)&&(n!=null||c!=null))switch(i){case"value":f=n;break;case"defaultValue":l=n;break;case"multiple":o=n;default:n!==c&&Qe(e,t,i,n,r,c)}t=l,a=o,r=w,f!=null?Wi(e,!!a,f,!1):!!r!=!!a&&(t!=null?Wi(e,!!a,t,!0):Wi(e,!!a,a?[]:"",!1));return;case"textarea":w=f=null;for(l in a)if(i=a[l],a.hasOwnProperty(l)&&i!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Qe(e,t,l,null,r,i)}for(o in r)if(i=r[o],n=a[o],r.hasOwnProperty(o)&&(i!=null||n!=null))switch(o){case"value":f=i;break;case"defaultValue":w=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(L(91));break;default:i!==n&&Qe(e,t,o,i,r,n)}jh(e,f,w);return;case"option":for(var _ in a)f=a[_],a.hasOwnProperty(_)&&f!=null&&!r.hasOwnProperty(_)&&(_==="selected"?e.selected=!1:Qe(e,t,_,null,r,f));for(c in r)f=r[c],w=a[c],r.hasOwnProperty(c)&&f!==w&&(f!=null||w!=null)&&(c==="selected"?e.selected=f&&typeof f!="function"&&typeof f!="symbol":Qe(e,t,c,f,r,w));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)f=a[E],a.hasOwnProperty(E)&&f!=null&&!r.hasOwnProperty(E)&&Qe(e,t,E,null,r,f);for(p in r)if(f=r[p],w=a[p],r.hasOwnProperty(p)&&f!==w&&(f!=null||w!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(L(137,t));break;default:Qe(e,t,p,f,r,w)}return;default:if(qp(t)){for(var D in a)f=a[D],a.hasOwnProperty(D)&&f!==void 0&&!r.hasOwnProperty(D)&&pp(e,t,D,void 0,r,f);for(m in r)f=r[m],w=a[m],!r.hasOwnProperty(m)||f===w||f===void 0&&w===void 0||pp(e,t,m,f,r,w);return}}for(var h in a)f=a[h],a.hasOwnProperty(h)&&f!=null&&!r.hasOwnProperty(h)&&Qe(e,t,h,null,r,f);for(b in r)f=r[b],w=a[b],!r.hasOwnProperty(b)||f===w||f==null&&w==null||Qe(e,t,b,f,r,w)}function ah(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function T1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var i=a[r],n=i.transferSize,o=i.initiatorType,l=i.duration;if(n&&l&&ah(o)){for(o=0,l=i.responseEnd,r+=1;r<a.length;r++){var c=a[r],p=c.startTime;if(p>l)break;var m=c.transferSize,b=c.initiatorType;m&&ah(b)&&(c=c.responseEnd,o+=m*(c<l?1:(l-p)/(c-p)))}if(--r,t+=8*(n+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var dp=null,mp=null;function ks(e){return e.nodeType===9?e:e.ownerDocument}function rh(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 fp(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 Su=null;function z1(){var e=window.event;return e&&e.type==="popstate"?e===Su?!1:(Su=e,!0):(Su=null,!1)}var Zb=typeof setTimeout=="function"?setTimeout:void 0,R1=typeof clearTimeout=="function"?clearTimeout:void 0,ih=typeof Promise=="function"?Promise:void 0,A1=typeof queueMicrotask=="function"?queueMicrotask:typeof ih<"u"?function(e){return ih.resolve(null).then(e).catch(U1)}:Zb;function U1(e){setTimeout(function(){throw e})}function Yr(e){return e==="head"}function nh(e,t){var a=t,r=0;do{var i=a.nextSibling;if(e.removeChild(a),i&&i.nodeType===8)if(a=i.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(i),gn(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")So(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,So(a);for(var n=a.firstChild;n;){var o=n.nextSibling,l=n.nodeName;n[Yo]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&n.rel.toLowerCase()==="stylesheet"||a.removeChild(n),n=o}}else a==="body"&&So(e.ownerDocument.body);a=i}while(a);gn(t)}function oh(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 hp(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":hp(a),Cp(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function D1(e,t,a,r){for(;e.nodeType===1;){var i=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Yo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=ya(e.nextSibling),e===null)break}return null}function O1(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 Kb(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 gp(e){return e.data==="$?"||e.data==="$~"}function bp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function B1(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function 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 wp=null;function lh(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 sh(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 Pb(e,t,a){switch(t=ks(a),e){case"html":if(e=t.documentElement,!e)throw Error(L(452));return e;case"head":if(e=t.head,!e)throw Error(L(453));return e;case"body":if(e=t.body,!e)throw Error(L(454));return e;default:throw Error(L(451))}}function So(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Cp(e)}var _a=new Map,ch=new Set;function Ss(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var pr=Ue.d;Ue.d={f:L1,r:H1,D:j1,C:Q1,L:G1,m:Y1,X:V1,S:$1,M:X1};function L1(){var e=pr.f(),t=Qs();return e||t}function H1(e){var t=wn(e);t!==null&&t.tag===5&&t.type==="form"?Gg(t):pr.r(e)}var xn=typeof document>"u"?null:document;function Jb(e,t,a){var r=xn;if(r&&typeof t=="string"&&t){var i=ga(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),ch.has(i)||(ch.add(i),e={rel:e,crossOrigin:a,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),zt(t,"link",e),_t(t),r.head.appendChild(t)))}}function j1(e){pr.D(e),Jb("dns-prefetch",e,null)}function Q1(e,t){pr.C(e,t),Jb("preconnect",e,t)}function G1(e,t,a){pr.L(e,t,a);var r=xn;if(r&&e&&t){var i='link[rel="preload"][as="'+ga(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+ga(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+ga(a.imageSizes)+'"]')):i+='[href="'+ga(e)+'"]';var n=i;switch(t){case"style":n=hn(e);break;case"script":n=kn(e)}_a.has(n)||(e=et({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),_a.set(n,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(Po(n))||t==="script"&&r.querySelector(Jo(n))||(t=r.createElement("link"),zt(t,"link",e),_t(t),r.head.appendChild(t)))}}function Y1(e,t){pr.m(e,t);var a=xn;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ga(r)+'"][href="'+ga(e)+'"]',n=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=kn(e)}if(!_a.has(n)&&(e=et({rel:"modulepreload",href:e},t),_a.set(n,e),a.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Jo(n)))return}r=a.createElement("link"),zt(r,"link",e),_t(r),a.head.appendChild(r)}}}function $1(e,t,a){pr.S(e,t,a);var r=xn;if(r&&e){var i=Ii(r).hoistableStyles,n=hn(e);t=t||"default";var o=i.get(n);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Po(n)))l.loading=5;else{e=et({rel:"stylesheet",href:e,"data-precedence":t},a),(a=_a.get(n))&&pd(e,a);var c=o=r.createElement("link");_t(c),zt(c,"link",e),c._p=new Promise(function(p,m){c.onload=p,c.onerror=m}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Jl(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},i.set(n,o)}}}function V1(e,t){pr.X(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Jo(i)),n||(e=et({src:e,async:!0},t),(t=_a.get(i))&&dd(e,t),n=a.createElement("script"),_t(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function X1(e,t){pr.M(e,t);var a=xn;if(a&&e){var r=Ii(a).hoistableScripts,i=kn(e),n=r.get(i);n||(n=a.querySelector(Jo(i)),n||(e=et({src:e,async:!0,type:"module"},t),(t=_a.get(i))&&dd(e,t),n=a.createElement("script"),_t(n),zt(n,"link",e),a.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},r.set(i,n))}}function uh(e,t,a,r){var i=(i=Mr.current)?Ss(i):null;if(!i)throw Error(L(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=hn(a.href),a=Ii(i).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=hn(a.href);var n=Ii(i).hoistableStyles,o=n.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,o),(n=i.querySelector(Po(e)))&&!n._p&&(o.instance=n,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),n||Z1(i,e,a,o.state))),t&&r===null)throw Error(L(528,""));return o}if(t&&r!==null)throw Error(L(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=kn(a),a=Ii(i).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(L(444,e))}}function hn(e){return'href="'+ga(e)+'"'}function Po(e){return'link[rel="stylesheet"]['+e+"]"}function Fb(e){return et({},e,{"data-precedence":e.precedence,precedence:null})}function Z1(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),zt(t,"link",a),_t(t),e.head.appendChild(t))}function kn(e){return'[src="'+ga(e)+'"]'}function Jo(e){return"script[async]"+e}function ph(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ga(a.href)+'"]');if(r)return t.instance=r,_t(r),r;var i=et({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),_t(r),zt(r,"style",i),Jl(r,a.precedence,e),t.instance=r;case"stylesheet":i=hn(a.href);var n=e.querySelector(Po(i));if(n)return t.state.loading|=4,t.instance=n,_t(n),n;r=Fb(a),(i=_a.get(i))&&pd(r,i),n=(e.ownerDocument||e).createElement("link"),_t(n);var o=n;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),t.state.loading|=4,Jl(n,a.precedence,e),t.instance=n;case"script":return n=kn(a.src),(i=e.querySelector(Jo(n)))?(t.instance=i,_t(i),i):(r=a,(i=_a.get(n))&&(r=et({},a),dd(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),_t(i),zt(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(L(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Jl(r,a.precedence,e));return t.instance}function Jl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,n=i,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)n=l;else if(n!==i)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function pd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function dd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Fl=null;function dh(e,t,a){if(Fl===null){var r=new Map,i=Fl=new Map;i.set(a,r)}else i=Fl,r=i.get(a),r||(r=new Map,i.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),i=0;i<a.length;i++){var n=a[i];if(!(n[Yo]||n[Et]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var o=n.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(n):r.set(o,[n])}}return r}function mh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function K1(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 Ib(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function P1(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=hn(r.href),n=t.querySelector(Po(i));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ns.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=n,_t(n);return}n=t.ownerDocument||t,r=Fb(r),(i=_a.get(i))&&pd(r,i),n=n.createElement("link"),_t(n);var o=n;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),zt(n,"link",r),a.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Ns.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Nu=0;function J1(e,t){return e.stylesheets&&e.count===0&&Il(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&Nu===0&&(Nu=62500*T1());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>Nu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Ns(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Il(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Cs=null;function Il(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Cs=new Map,t.forEach(F1,e),Cs=null,Ns.call(e))}function F1(e,t){if(!(t.state.loading&4)){var a=Cs.get(e);if(a)var r=a.get(null);else{a=new Map,Cs.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<i.length;n++){var o=i[n];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(a.set(o.dataset.precedence,o),r=o)}r&&a.set(null,r)}i=t.instance,o=i.getAttribute("data-precedence"),n=a.get(o)||r,n===r&&a.set(null,i),a.set(o,i),this.count++,r=Ns.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),n?n.parentNode.insertBefore(i,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Oo={$$typeof:er,Provider:null,Consumer:null,_currentValue:ei,_currentValue2:ei,_threadCount:0};function I1(e,t,a,r,i,n,o,l,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Fc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.hiddenUpdates=Fc(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=n,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Wb(e,t,a,r,i,n,o,l,c,p,m,b){return e=new I1(e,t,a,o,c,p,m,b,l),t=1,n===!0&&(t|=24),n=ra(3,null,null,t),e.current=n,n.stateNode=e,t=Lp(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:r,isDehydrated:a,cache:t},Qp(n),e}function ew(e){return e?(e=Ki,e):Ki}function tw(e,t,a,r,i,n){i=ew(i),r.context===null?r.context=i:r.pendingContext=i,r=zr(t),r.payload={element:a},n=n===void 0?null:n,n!==null&&(r.callback=n),a=Rr(e,r,t),a!==null&&(Kt(a,e,t),go(a,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function md(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function aw(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&Kt(t,e,67108864),md(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=sa();t=Sp(t);var a=mi(e,t);a!==null&&Kt(a,e,t),md(e,t)}}var qs=!0;function W1(e,t,a,r){var i=se.T;se.T=null;var n=Ue.p;try{Ue.p=2,fd(e,t,a,r)}finally{Ue.p=n,se.T=i}}function e_(e,t,a,r){var i=se.T;se.T=null;var n=Ue.p;try{Ue.p=8,fd(e,t,a,r)}finally{Ue.p=n,se.T=i}}function fd(e,t,a,r){if(qs){var i=vp(r);if(i===null)ku(e,t,r,Es,a),gh(e,r);else if(a_(i,e,t,a,r))r.stopPropagation();else if(gh(e,r),t&4&&-1<t_.indexOf(e)){for(;i!==null;){var n=wn(i);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var o=Fr(n.pendingLanes);if(o!==0){var l=n;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-la(o);l.entanglements[1]|=c,o&=~c}ja(n),(Ae&6)===0&&(bs=na()+500,Ko(0,!1))}}break;case 31:case 13:l=mi(n,2),l!==null&&Kt(l,n,2),Qs(),md(n,2)}if(n=vp(r),n===null&&ku(e,t,r,Es,a),n===i)break;i=n}i!==null&&r.stopPropagation()}else ku(e,t,r,null,a)}}function vp(e){return e=Ep(e),hd(e)}var Es=null;function hd(e){if(Es=null,e=Gi(e),e!==null){var t=Ho(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=xh(t),e!==null)return e;e=null}else if(a===31){if(e=kh(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 Es=e,null}function rw(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(G0()){case qh:return 2;case Eh:return 8;case rs:case Y0:return 32;case Mh:return 268435456;default:return 32}default:return 32}}var yp=!1,Dr=null,Or=null,Br=null,Bo=new Map,Lo=new Map,kr=[],t_="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 gh(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":Bo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lo.delete(t.pointerId)}}function io(e,t,a,r,i,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:n,targetContainers:[i]},t!==null&&(t=wn(t),t!==null&&aw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function a_(e,t,a,r,i){switch(t){case"focusin":return Dr=io(Dr,e,t,a,r,i),!0;case"dragenter":return Or=io(Or,e,t,a,r,i),!0;case"mouseover":return Br=io(Br,e,t,a,r,i),!0;case"pointerover":var n=i.pointerId;return Bo.set(n,io(Bo.get(n)||null,e,t,a,r,i)),!0;case"gotpointercapture":return n=i.pointerId,Lo.set(n,io(Lo.get(n)||null,e,t,a,r,i)),!0}return!1}function iw(e){var t=Gi(e.target);if(t!==null){var a=Ho(t);if(a!==null){if(t=a.tag,t===13){if(t=xh(a),t!==null){e.blockedOn=t,Im(e.priority,function(){hh(a)});return}}else if(t===31){if(t=kh(a),t!==null){e.blockedOn=t,Im(e.priority,function(){hh(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 Wl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=vp(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Lu=r,a.target.dispatchEvent(r),Lu=null}else return t=wn(a),t!==null&&aw(t),e.blockedOn=a,!1;t.shift()}return!0}function bh(e,t,a){Wl(e)&&a.delete(t)}function r_(){yp=!1,Dr!==null&&Wl(Dr)&&(Dr=null),Or!==null&&Wl(Or)&&(Or=null),Br!==null&&Wl(Br)&&(Br=null),Bo.forEach(bh),Lo.forEach(bh)}function Bl(e,t){e.blockedOn===t&&(e.blockedOn=null,yp||(yp=!0,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,r_)))}var Ll=null;function wh(e){Ll!==e&&(Ll=e,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,function(){Ll===e&&(Ll=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],i=e[t+2];if(typeof r!="function"){if(hd(r||a)===null)continue;break}var n=wn(a);n!==null&&(e.splice(t,3),t-=3,ep(n,{pending:!0,data:i,method:a.method,action:r},r,i))}}))}function gn(e){function t(c){return Bl(c,e)}Dr!==null&&Bl(Dr,e),Or!==null&&Bl(Or,e),Br!==null&&Bl(Br,e),Bo.forEach(t),Lo.forEach(t);for(var a=0;a<kr.length;a++){var r=kr[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kr.length&&(a=kr[0],a.blockedOn===null);)iw(a),a.blockedOn===null&&kr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var i=a[r],n=a[r+1],o=i[Pt]||null;if(typeof n=="function")o||wh(a);else if(o){var l=null;if(n&&n.hasAttribute("formAction")){if(i=n,o=n[Pt]||null)l=o.formAction;else if(hd(i)!==null)continue}else l=o.action;typeof l=="function"?a[r+1]=l:(a.splice(r,3),r-=3),wh(a)}}}function nw(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function gd(e){this._internalRoot=e}$s.prototype.render=gd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));var a=t.current,r=sa();tw(a,r,e,t,null,null)};$s.prototype.unmount=gd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;tw(e.current,2,null,e,null,null),Qs(),t[bn]=null}};function $s(e){this._internalRoot=e}$s.prototype.unstable_scheduleHydration=function(e){if(e){var t=Uh();e={blockedOn:null,target:e,priority:t};for(var a=0;a<kr.length&&t!==0&&t<kr[a].priority;a++);kr.splice(a,0,e),a===0&&iw(e)}};var vh=yh.version;if(vh!=="19.2.3")throw Error(L(527,vh,"19.2.3"));Ue.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=D0(t),e=e!==null?Sh(e):null,e=e===null?null:e.stateNode,e};var i_={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:se,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(no=__REACT_DEVTOOLS_GLOBAL_HOOK__,!no.isDisabled&&no.supportsFiber))try{jo=no.inject(i_),oa=no}catch{}var no;Vs.createRoot=function(e,t){if(!_h(e))throw Error(L(299));var a=!1,r="",i=Jg,n=Fg,o=Ig;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Wb(e,1,!1,null,null,a,r,null,i,n,o,nw),e[bn]=t.current,ud(e),new gd(t)};Vs.hydrateRoot=function(e,t,a){if(!_h(e))throw Error(L(299));var r=!1,i="",n=Jg,o=Fg,l=Ig,c=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(n=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(l=a.onRecoverableError),a.formState!==void 0&&(c=a.formState)),t=Wb(e,1,!0,t,a??null,r,i,c,n,o,l,nw),t.context=ew(null),a=t.current,r=sa(),r=Sp(r),i=zr(r),i.callback=null,Rr(a,i,r),a=r,t.current.lanes=a,Go(t,a),ja(t),e[bn]=t.current,ud(e),new $s(t)};Vs.version="19.2.3"});var cw=Aa(($x,sw)=>{"use strict";function lw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lw)}catch(e){console.error(e)}}lw(),sw.exports=ow()});var ev=Aa(Ps=>{"use strict";var d_=Symbol.for("react.transitional.element"),m_=Symbol.for("react.fragment");function Ww(e,t,a){var r=null;if(a!==void 0&&(r=""+a),t.key!==void 0&&(r=""+t.key),"key"in t){a={};for(var i in t)i!=="key"&&(a[i]=t[i])}else a=t;return t=a.ref,{$$typeof:d_,type:e,key:r,ref:t!==void 0?t:null,props:a}}Ps.Fragment=m_;Ps.jsx=Ww;Ps.jsxs=Ww});var ee=Aa((b2,tv)=>{"use strict";tv.exports=ev()});var r0=Y(cw());var uw=`/* 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
|
|
|
@@ -6969,9 +6969,9 @@ Error generating stack: `+r.message+`
|
|
|
6969
6969
|
}
|
|
6970
6970
|
`;var De=Y(je());var Xs={};function pw(e){Xs={...e,client:e.client?.trim().toUpperCase()||void 0}}function Ot(){return Xs}function bd(){return!!Xs.apiBaseUrl}var o_=e=>e.replace(/\/$/,"");function za(e){let t=Xs.apiBaseUrl;return t?`${o_(t)}${e.replace(/^\/api\//,"/v1/")}`:e}var Sn=Y(je());var l_="metron:step",s_="metron_step",Fo=(0,Sn.createContext)(()=>{}),Nn=()=>(0,Sn.useContext)(Fo);function Zs(e,t){return(0,Sn.useCallback)((a,r={})=>{let i=Ot(),n=i.analytics??"all";if(n==="none")return;let o={...r,widget:e,step:a};t.current?.dispatchEvent(new CustomEvent(l_,{detail:o,bubbles:!0,composed:!0})),i.onEvent?.(o);let l=window.dataLayer;n==="all"&&Array.isArray(l)&&l.push({event:s_,...o})},[e,t])}var dw="boq-session-id",mw="x-boq-session";function fw(){if(typeof window>"u")return"server";try{let e=window.localStorage.getItem(dw);return e||(e=crypto.randomUUID(),window.localStorage.setItem(dw,e)),e}catch{return crypto.randomUUID()}}var c_="x-boq-client";function Ks(){return Ot().client}function Cn(){let{client:e,apiKey:t}=Ot();return bd()?t?{Authorization:`Bearer ${t}`}:{}:e?{[c_]:e}:{}}function hi(){return{...bd()?{}:{[mw]:fw()},...Cn()}}function u_(e){return e&&typeof e=="object"&&e.success===!0&&"data"in e?e.data:e}async function Qa(e){return u_(await e.json().catch(()=>({})))}var hw=9e4;async function gw(e,t){let a=new AbortController,r=setTimeout(()=>a.abort(),hw),i;try{i=await fetch(e,{...t,signal:a.signal})}catch(o){throw o?.name==="AbortError"?new Error(`Request to ${e} timed out after ${hw/1e3}s. Please try again.`):o}finally{clearTimeout(r)}let n=await Qa(i);if(!i.ok||n?.error){let o=n;throw new Error(o.detail??o.message??o.error??`Server error ${i.status}`)}return n}function bw(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"),gw(za("/api/schedule"),{method:"POST",body:r,headers:hi()})}function ww(e,t){let a=t?`?account=${encodeURIComponent(t)}`:"";return gw(za(`/api/schedule/${e}${a}`),{headers:Cn()})}function vw(e,t,a,r){let i=!1,n=null,o=performance.now();return{promise:new Promise((p,m)=>{let b=async()=>{if(!i)try{let f=await e();if(i)return;if(f.status==="completed"||f.status==="failed"){console.log(`[pollJob:${r??"job"}] ${f.status} (${Math.round(performance.now()-o)}ms)`),p(f);return}a?.(),n=setTimeout(b,t)}catch(f){i||m(f)}};n=setTimeout(b,t)}),cancel:()=>{i=!0,n&&(clearTimeout(n),n=null)}}}var kt=Y(je());var yw=new URL("../assets/decking/boards/diagonal.webp",import.meta.url).href;var _w=new URL("../assets/decking/boards/no-border.webp",import.meta.url).href;var xw=new URL("../assets/decking/boards/picture-frame.webp",import.meta.url).href;var kw=new URL("../assets/decking/boards/straight.webp",import.meta.url).href;var Sw=new URL("../assets/fencing/gates/no-gate.webp",import.meta.url).href;var Nw=new URL("../assets/fencing/gates/single-gate.webp",import.meta.url).href;var Cw=new URL("../assets/fencing/gravel-board.webp",import.meta.url).href;var qw=new URL("../assets/fencing/height/0.9.webp",import.meta.url).href;var Ew=new URL("../assets/fencing/height/1.2.webp",import.meta.url).href;var Mw=new URL("../assets/fencing/height/1.5.webp",import.meta.url).href;var Tw=new URL("../assets/fencing/height/1.8.webp",import.meta.url).href;var zw=new URL("../assets/fencing/no-gravel-board.webp",import.meta.url).href;var Rw=new URL("../assets/quick-order/paste-list.webp",import.meta.url).href;var Aw=new URL("../assets/quick-order/photo-list.webp",import.meta.url).href;var Uw=new URL("../assets/quick-order/upload-file.webp",import.meta.url).href;var Dw=new URL("../assets/schedule-products/building-sand.webp",import.meta.url).href;var Ow=new URL("../assets/schedule-products/drywall-screws.webp",import.meta.url).href;var Bw=new URL("../assets/schedule-products/loft-insulation-roll.webp",import.meta.url).href;var Lw=new URL("../assets/schedule-products/red-multi-stock-bricks.webp",import.meta.url).href;var Hw=new URL("../assets/schedule-products/scrim-tape.webp",import.meta.url).href;var jw=new URL("../assets/schedule-products/wall-ties.webp",import.meta.url).href;var Qw=new URL("../assets/tool-images/architrave.webp",import.meta.url).href;var Gw=new URL("../assets/tool-images/brick-block.webp",import.meta.url).href;var Yw=new URL("../assets/tool-images/concrete-aggregate.webp",import.meta.url).href;var $w=new URL("../assets/tool-images/decking.webp",import.meta.url).href;var Vw=new URL("../assets/tool-images/fencing.webp",import.meta.url).href;var Xw=new URL("../assets/tool-images/insulation.webp",import.meta.url).href;var Zw=new URL("../assets/tool-images/paint.webp",import.meta.url).href;var Kw=new URL("../assets/tool-images/paving.webp",import.meta.url).href;var Pw=new URL("../assets/tool-images/plasterboard.webp",import.meta.url).href;var Jw=new URL("../assets/tool-images/skirting.webp",import.meta.url).href;var Fw=new URL("../assets/tool-images/timber.webp",import.meta.url).href;var Iw=new URL("../assets/tool-images/truss.webp",import.meta.url).href;var Ee=e=>typeof e=="string"?e:e.src,p_={"/decking/boards/diagonal.webp":Ee(yw),"/decking/boards/no-border.webp":Ee(_w),"/decking/boards/picture-frame.webp":Ee(xw),"/decking/boards/straight.webp":Ee(kw),"/fencing/gates/no-gate.webp":Ee(Sw),"/fencing/gates/single-gate.webp":Ee(Nw),"/fencing/gravel-board.webp":Ee(Cw),"/fencing/height/0.9.webp":Ee(qw),"/fencing/height/1.2.webp":Ee(Ew),"/fencing/height/1.5.webp":Ee(Mw),"/fencing/height/1.8.webp":Ee(Tw),"/fencing/no-gravel-board.webp":Ee(zw),"/quick-order/paste-list.webp":Ee(Rw),"/quick-order/photo-list.webp":Ee(Aw),"/quick-order/upload-file.webp":Ee(Uw),"/schedule-products/building-sand.webp":Ee(Dw),"/schedule-products/drywall-screws.webp":Ee(Ow),"/schedule-products/loft-insulation-roll.webp":Ee(Bw),"/schedule-products/red-multi-stock-bricks.webp":Ee(Lw),"/schedule-products/scrim-tape.webp":Ee(Hw),"/schedule-products/wall-ties.webp":Ee(jw),"/tool-images/architrave.webp":Ee(Qw),"/tool-images/brick-block.webp":Ee(Gw),"/tool-images/concrete-aggregate.webp":Ee(Yw),"/tool-images/decking.webp":Ee($w),"/tool-images/fencing.webp":Ee(Vw),"/tool-images/insulation.webp":Ee(Xw),"/tool-images/paint.webp":Ee(Zw),"/tool-images/paving.webp":Ee(Kw),"/tool-images/plasterboard.webp":Ee(Pw),"/tool-images/skirting.webp":Ee(Jw),"/tool-images/timber.webp":Ee(Fw),"/tool-images/truss.webp":Ee(Iw)};function Ft(e){return p_[e]??e}var wd=Y(ee());function Qt(){return(0,wd.jsx)("svg",{className:"forward-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,wd.jsx)("path",{d:"M3 8H13M13 8L9 4M13 8L9 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var vd=Y(ee());function Io(){return(0,vd.jsx)("svg",{className:"close-icon",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,vd.jsx)("path",{d:"M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}var qn={schedule:[".xlsx",".xls",".csv",".pdf",".docx"],photo:[".png",".jpg",".jpeg",".webp",".gif",".bmp",".heic",".heif"],email:[".eml",".msg"]};var rv=(e,t)=>qn[t].some(a=>e.toLowerCase().endsWith(a)),En=e=>e.type.startsWith("image/")||rv(e.name,"photo"),f_=e=>En(e)||rv(e.name,"schedule"),av=e=>`${Math.max(.1,Math.round(e/1048576*10)/10)} MB`;function yd(e,t=5242880){return f_(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 (${[...qn.schedule,...qn.photo].join(", ")}).`}var h_=e=>e.split(`
|
|
6971
6971
|
`).map(t=>t.trim()).filter(Boolean);function iv(e){let t=h_(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 nv(e){if(e.size<=5242880)return e;let t;try{t=await createImageBitmap(e)}catch{return e}let a=Math.min(1,2e3/Math.max(t.width,t.height)),r=document.createElement("canvas");r.width=Math.round(t.width*a),r.height=Math.round(t.height*a);let i=r.getContext("2d");if(!i)return e;i.fillStyle="#fff",i.fillRect(0,0,r.width,r.height),i.drawImage(t,0,0,r.width,r.height),t.close();let n=await new Promise(o=>r.toBlob(o,"image/jpeg",.85));return!n||n.size>=e.size?e:new File([n],`${e.name.replace(/\.[^.]+$/,"")}.jpg`,{type:"image/jpeg"})}var $r=Y(je());var Fs=Y(je()),Js=Y(ee()),g_=[4,5,4],_d=4e3;function gi(){let[e,t]=(0,Fs.useState)(0);(0,Fs.useEffect)(()=>{let r=setInterval(()=>t(i=>i+1),_d);return()=>clearInterval(r)},[]);let a=0;return(0,Js.jsx)("div",{className:"brick-wall","aria-hidden":!0,children:g_.map((r,i)=>(0,Js.jsx)("div",{className:"brick-wall__course",children:Array.from({length:r},(n,o)=>(0,Js.jsx)("span",{className:`brick-wall__brick${r===5&&(o===0||o===4)?" brick-wall__brick--half":""}`,style:{"--i":a++}},o))},i))},e)}var Wo=Y(ee()),Is=["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 ov(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 lv(){let e=(0,$r.useRef)(ov(Is.map((o,l)=>l))),t=(0,$r.useRef)(0),[a,r]=(0,$r.useState)(Is[e.current[0]]),[i,n]=(0,$r.useState)(!0);return(0,$r.useEffect)(()=>{let o=setInterval(()=>{n(!1),window.setTimeout(()=>{t.current++,t.current>=e.current.length&&(e.current=ov(Is.map((l,c)=>c)),t.current=0),r(Is[e.current[t.current]]),n(!0)},600)},_d);return()=>clearInterval(o)},[]),(0,Wo.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",children:[(0,Wo.jsx)(gi,{}),(0,Wo.jsx)("p",{className:`banter-message${i?" is-visible":""}`,children:a})]})}var Ws=Y(je());function el(e,t){let a=(0,Ws.useRef)(t);a.current=t,(0,Ws.useEffect)(()=>{if(!e)return;let r=i=>{i.key!=="Escape"||i.defaultPrevented||i.isComposing||(i.preventDefault(),a.current())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e])}var xd={"#quote-entry":"entry","#matched-products":"results","#quote-request":"basket"},sv=!1,tc="",kd=!1,cv=()=>window.navigation,ec=-1;function b_(){if(kd)return-1;let e=cv()?.currentEntry?.index;return e==null||ec<0||e===ec?0:e<ec?-1:1}function w_(e){let t=new URL(tc||window.location.href),a=new URL(window.location.href);if(tc=a.href,t.pathname!==a.pathname||t.search!==a.search||!(t.hash in xd)&&!(a.hash in xd))return;let r=t.href===a.href?b_():0;if(r){e.stopImmediatePropagation(),window.history.go(r);return}kd=!1;let i=e.state;Object.defineProperty(e,"state",{value:null}),setTimeout(()=>{if(window.location.href!==a.href)return;let n=xd[a.hash],o=n&&i?.turbo?{boqQuoteStage:n}:i;JSON.stringify(window.history.state)!==JSON.stringify(o)&&window.history.replaceState(o,"",a.href)})}function uv(){sv||typeof window>"u"||(sv=!0,tc=window.location.href,window.addEventListener("popstate",w_,{capture:!0}),cv()?.addEventListener("currententrychange",e=>{ec=e.from?.index??-1}))}function Mn(e,t,a){window.history[e](t,"",a),tc=window.location.href}function ac(){kd=!0,window.history.back()}var J=Y(ee()),v_=[...qn.schedule,...qn.photo].join(","),y_={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."}]},Tn="#quote-entry",rc="metron-quick-quote-entry";function Sd({onPasteSchedule:e,onUploadSchedule:t,onEntryModeChange:a,draft:r,onSubmitDraft:i,onCancelMatch:n}){let[o,l]=(0,kt.useState)(()=>r&&typeof window<"u"&&window.location.hash===Tn?r.tab:null),c=Nn(),[p,m]=(0,kt.useState)(r?.text??""),[b,f]=(0,kt.useState)(r?.file??null),[w,_]=(0,kt.useState)(""),[E,D]=(0,kt.useState)(!1),[h,u]=(0,kt.useState)(!1),[g,v]=(0,kt.useState)(null),N=(0,kt.useRef)(0),R=(0,kt.useRef)(0),T=(0,kt.useRef)(null),U=p.split(`
|
|
6972
|
-
`).filter(X=>X.trim()).length,A=iv(p),B=o==="paste"?!!p:!!b;(0,kt.useEffect)(()=>{if(!b||!En(b)){v(null);return}let X=URL.createObjectURL(b);return v(X),()=>URL.revokeObjectURL(X)},[b]);let ie=(0,kt.useRef)(o??r?.tab??null);o&&(ie.current=o),(0,kt.useEffect)(()=>{if(r||window.location.hash!==Tn)return;let X=null;try{X=JSON.parse(window.sessionStorage.getItem(rc)??"null")}catch{}if(!X?.tab){let me=new URL(window.location.href);me.hash="",Mn("replaceState",window.history.state,me);return}ie.current=X.tab,l(X.tab),m(X.text??"")},[]),(0,kt.useEffect)(()=>{if(o)try{window.sessionStorage.setItem(rc,JSON.stringify({tab:o,text:p}))}catch{}},[o,p]),(0,kt.useEffect)(()=>{let X=()=>{if(window.location.hash===Tn)return l(ie.current);l(null),R.current++,D(!1),n?.()};return window.addEventListener("popstate",X),()=>window.removeEventListener("popstate",X)},[]);let ze=X=>{c("method_selected",{method:X}),l(X),a(null);let me=window.location.hash;if(me===Tn)return;let Re=new URL(window.location.href);Re.hash=Tn,Mn(me==="#matched-products"||me==="#quote-request"?"replaceState":"pushState",{boqQuoteStage:"entry"},Re)},He=()=>{l(null),a(null),window.location.hash===Tn&&ac()};el(!!o&&!E,He);let Ve=X=>{if(!X?.length)return;if(X.length>1)return _("Please choose one file at a time.");let me=X[0],Re=yd(me,En(me)?1/0:void 0);if(Re)return _(Re);_(""),f(me)},qe=async X=>{o==="paste"&&f(null),o==="upload"&&m(""),o&&i?.({tab:o,text:o==="paste"?p:"",file:o==="upload"?b:null});let me=++R.current;D(!0);try{await X()}finally{me===R.current&&D(!1)}},
|
|
6972
|
+
`).filter(X=>X.trim()).length,A=iv(p),B=o==="paste"?!!p:!!b;(0,kt.useEffect)(()=>{if(!b||!En(b)){v(null);return}let X=URL.createObjectURL(b);return v(X),()=>URL.revokeObjectURL(X)},[b]);let ie=(0,kt.useRef)(o??r?.tab??null);o&&(ie.current=o),(0,kt.useEffect)(()=>{if(r||window.location.hash!==Tn)return;let X=null;try{X=JSON.parse(window.sessionStorage.getItem(rc)??"null")}catch{}if(!X?.tab){let me=new URL(window.location.href);me.hash="",Mn("replaceState",window.history.state,me);return}ie.current=X.tab,l(X.tab),m(X.text??"")},[]),(0,kt.useEffect)(()=>{if(o)try{window.sessionStorage.setItem(rc,JSON.stringify({tab:o,text:p}))}catch{}},[o,p]),(0,kt.useEffect)(()=>{let X=()=>{if(window.location.hash===Tn)return l(ie.current);l(null),R.current++,D(!1),n?.()};return window.addEventListener("popstate",X),()=>window.removeEventListener("popstate",X)},[]);let ze=X=>{c("method_selected",{method:X}),l(X),a(null);let me=window.location.hash;if(me===Tn)return;let Re=new URL(window.location.href);Re.hash=Tn,Mn(me==="#matched-products"||me==="#quote-request"?"replaceState":"pushState",{boqQuoteStage:"entry"},Re)},He=()=>{l(null),a(null),window.location.hash===Tn&&ac()};el(!!o&&!E,He);let Ve=X=>{if(!X?.length)return;if(X.length>1)return _("Please choose one file at a time.");let me=X[0],Re=yd(me,En(me)?1/0:void 0);if(Re)return _(Re);_(""),f(me)},qe=async X=>{o==="paste"&&f(null),o==="upload"&&m(""),o&&i?.({tab:o,text:o==="paste"?p:"",file:o==="upload"?b:null});let me=++R.current;D(!0);try{await X()}finally{me===R.current&&D(!1)}},be=()=>{if(b)return c("list_submitted",{method:En(b)?"photo":"upload"}),qe(async()=>{if(!En(b))return t(b);try{let X=await nv(b),me=yd(X);if(me)throw new Error(me);await t(X)}catch(X){c("error",{stage:"photo"}),_(X?.message||"Failed to process image upload")}})},le=X=>X.dataTransfer.types.includes("Files"),Je=X=>{le(X)&&(X.preventDefault(),N.current+=1,u(!0))},Ne=X=>{le(X)&&(N.current-=1,N.current<=0&&(N.current=0,u(!1)))},St=X=>{le(X)&&(X.preventDefault(),N.current=0,u(!1),Ve(X.dataTransfer.files),ze("upload"))};return(0,J.jsxs)("div",{className:"wizard-step entry-stage",onDragEnter:Je,onDragOver:X=>le(X)&&X.preventDefault(),onDragLeave:Ne,onDrop:St,children:[h&&(0,J.jsx)("div",{className:"entry-drop-overlay","aria-hidden":"true",children:"Drop your file to upload"}),(0,J.jsxs)("div",{className:"quick-order-card",children:[(0,J.jsxs)("div",{className:"quick-order-alt",children:[(0,J.jsxs)("div",{className:"quick-order-entry-copy",children:[(0,J.jsx)("div",{className:"quick-order-alt-title",children:"How would you like to get started?"}),(0,J.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,J.jsxs)("div",{className:"entry-options entry-options--workflow entry-options--two",children:[(0,J.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--paste${o==="paste"?" entry-option-card--active":""}`,onClick:()=>ze("paste"),children:[(0,J.jsxs)("span",{className:"entry-option-content",children:[(0,J.jsx)("span",{className:"entry-option-title",children:"Type or paste a list"}),(0,J.jsx)("span",{className:"entry-option-desc",children:"Enter your materials and quantities"})]}),(0,J.jsx)("span",{className:"entry-option-media entry-option-media--paste","aria-hidden":"true",children:(0,J.jsx)("img",{className:"fill-img",src:Ft("/quick-order/paste-list.webp"),alt:""})})]}),(0,J.jsxs)("button",{type:"button",className:`entry-option-card entry-option-card--upload${o==="upload"?" entry-option-card--active":""}`,onClick:()=>ze("upload"),children:[(0,J.jsxs)("span",{className:"entry-option-content",children:[(0,J.jsx)("span",{className:"entry-option-title",children:"Upload a file"}),(0,J.jsx)("span",{className:"entry-option-desc",children:"A photo, spreadsheet, Word document or PDF"})]}),(0,J.jsx)("span",{className:"entry-option-media entry-option-media--upload","aria-hidden":"true",children:(0,J.jsx)("img",{className:"fill-img",src:Ft("/quick-order/photo-list.webp"),alt:""})})]})]})]}),o&&(0,J.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"quick-order-workflow-title",onClick:()=>!B&&He(),children:(0,J.jsxs)("section",{className:`quick-order-workflow-modal${E?" quick-order-workflow-modal--matching":""}`,onClick:X=>X.stopPropagation(),children:[(0,J.jsxs)("header",{className:"quick-order-workflow-modal-header",children:[(0,J.jsx)("h2",{id:"quick-order-workflow-title",children:o==="paste"?"Type or paste a list":"Upload a file"}),(0,J.jsx)("button",{type:"button",className:"quick-order-workflow-close",onClick:He,"aria-label":"Close",children:(0,J.jsx)(Io,{})})]}),(0,J.jsxs)("div",{className:"quick-order-panel",children:[(0,J.jsxs)("div",{className:"quick-order-body","aria-hidden":E,children:[(0,J.jsx)("div",{className:"quick-order-body-main",children:o==="paste"?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("textarea",{className:"paste-textarea",placeholder:`Paste your line items here, one per line, e.g.
|
|
6973
6973
|
insulated plasterboard 50mm
|
|
6974
|
-
C24 timber 4.8m`,value:p,onChange:X=>m(X.target.value),"aria-label":"Paste schedule line items"}),A&&(0,J.jsxs)("div",{className:"error-box",role:"alert",children:[(0,J.jsx)("strong",{children:"Error:"})," ",A]}),(0,J.jsxs)("div",{className:"quick-order-hint",children:[(0,J.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,J.jsx)("div",{className:"quick-order-actions",children:(0,J.jsxs)("button",{type:"button",className:"cta-btn",disabled:!U||!!A,onClick:()=>{c("list_submitted",{method:"paste",lines:U}),qe(()=>e(p))},"aria-label":"Match pasted lines",children:[(0,J.jsx)("span",{children:"Match line items"}),(0,J.jsx)("span",{className:"arrow",children:(0,J.jsx)(Qt,{})})]})})]}):(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsxs)("div",{className:"error-box",role:"alert",children:[(0,J.jsx)("strong",{children:"Error:"})," ",w]}),(0,J.jsxs)("div",{className:`upload-zone${b?" has-file":""}`,onClick:()=>T.current?.click(),onDragOver:X=>X.preventDefault(),onDrop:St,role:"button",tabIndex:0,onKeyDown:X=>(X.key==="Enter"||X.key===" ")&&T.current?.click(),"aria-label":"Upload zone: click or drag a list or image file here",children:[g?(0,J.jsx)("img",{src:g,alt:b?.name??"Selected photo",className:"upload-zone-photo-preview"}):(0,J.jsx)("div",{className:"upload-zone-icon",children:(0,J.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,J.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,J.jsx)("polyline",{points:"14,2 14,8 20,8"}),(0,J.jsx)("polyline",{points:"9,15 11,17 15,13"})]})}),b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"upload-zone-subtext",children:b.name}),(0,J.jsx)("button",{type:"button",className:"link-btn link-btn--underline",onClick:X=>{X.stopPropagation(),f(null),_(""),T.current&&(T.current.value="")},children:"Remove"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"upload-zone-text",children:"Drop a photo, spreadsheet, Word document or PDF"}),(0,J.jsx)("div",{className:"upload-zone-subtext",children:"or click to choose a file"})]}),(0,J.jsx)("input",{ref:T,type:"file",accept:v_,className:"visually-hidden",onChange:X=>Ve(X.target.files),tabIndex:-1,"aria-hidden":"true"})]}),(0,J.jsx)("div",{className:"quick-order-actions",children:(0,J.jsxs)("button",{type:"button",className:"cta-btn",disabled:!b,onClick:()=>{
|
|
6974
|
+
C24 timber 4.8m`,value:p,onChange:X=>m(X.target.value),"aria-label":"Paste schedule line items"}),A&&(0,J.jsxs)("div",{className:"error-box",role:"alert",children:[(0,J.jsx)("strong",{children:"Error:"})," ",A]}),(0,J.jsxs)("div",{className:"quick-order-hint",children:[(0,J.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,J.jsx)("div",{className:"quick-order-actions",children:(0,J.jsxs)("button",{type:"button",className:"cta-btn",disabled:!U||!!A,onClick:()=>{c("list_submitted",{method:"paste",lines:U}),qe(()=>e(p))},"aria-label":"Match pasted lines",children:[(0,J.jsx)("span",{children:"Match line items"}),(0,J.jsx)("span",{className:"arrow",children:(0,J.jsx)(Qt,{})})]})})]}):(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsxs)("div",{className:"error-box",role:"alert",children:[(0,J.jsx)("strong",{children:"Error:"})," ",w]}),(0,J.jsxs)("div",{className:`upload-zone${b?" has-file":""}`,onClick:()=>T.current?.click(),onDragOver:X=>X.preventDefault(),onDrop:St,role:"button",tabIndex:0,onKeyDown:X=>(X.key==="Enter"||X.key===" ")&&T.current?.click(),"aria-label":"Upload zone: click or drag a list or image file here",children:[g?(0,J.jsx)("img",{src:g,alt:b?.name??"Selected photo",className:"upload-zone-photo-preview"}):(0,J.jsx)("div",{className:"upload-zone-icon",children:(0,J.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,J.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,J.jsx)("polyline",{points:"14,2 14,8 20,8"}),(0,J.jsx)("polyline",{points:"9,15 11,17 15,13"})]})}),b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"upload-zone-subtext",children:b.name}),(0,J.jsx)("button",{type:"button",className:"link-btn link-btn--underline",onClick:X=>{X.stopPropagation(),f(null),_(""),T.current&&(T.current.value="")},children:"Remove"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"upload-zone-text",children:"Drop a photo, spreadsheet, Word document or PDF"}),(0,J.jsx)("div",{className:"upload-zone-subtext",children:"or click to choose a file"})]}),(0,J.jsx)("input",{ref:T,type:"file",accept:v_,className:"visually-hidden",onChange:X=>Ve(X.target.files),tabIndex:-1,"aria-hidden":"true"})]}),(0,J.jsx)("div",{className:"quick-order-actions",children:(0,J.jsxs)("button",{type:"button",className:"cta-btn",disabled:!b,onClick:()=>{be()},"aria-label":"Match uploaded items",children:[(0,J.jsx)("span",{children:"Match items"}),(0,J.jsx)("span",{className:"arrow",children:(0,J.jsx)(Qt,{})})]})})]})}),(0,J.jsx)("aside",{className:"quick-order-sidebar",children:y_[o].map((X,me)=>(0,J.jsxs)("div",{className:"quick-order-step quick-order-step--rail",children:[(0,J.jsx)("span",{className:"quick-order-step-dot",children:me+1}),(0,J.jsxs)("div",{children:[(0,J.jsx)("div",{className:"quick-order-step-title",children:X.title}),(0,J.jsx)("div",{className:"quick-order-step-desc",children:X.desc})]})]},X.title))})]}),E&&(0,J.jsx)("div",{className:"quick-order-matching-overlay",children:(0,J.jsx)(lv,{})})]})]})})]})]})}var xe=Y(je());var Nd=Y(ee());function Vr(){return(0,Nd.jsx)("svg",{className:"back-arrow",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Nd.jsx)("path",{d:"M13 8H3M3 8L7 4M3 8L7 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var bi=Y(ee());function Cd(){return(0,bi.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,bi.jsx)("path",{d:"M3 12a9 9 0 0 1 15.36-6.36L21 8"}),(0,bi.jsx)("path",{d:"M21 3v5h-5"}),(0,bi.jsx)("path",{d:"M21 12a9 9 0 0 1-15.36 6.36L3 16"}),(0,bi.jsx)("path",{d:"M3 21v-5h5"})]})}var tl=Y(ee());function qd({unit:e}){return(0,tl.jsx)(tl.Fragment,{children:e.split(/([²³])/).map((t,a)=>t==="\xB2"||t==="\xB3"?(0,tl.jsx)("span",{className:"unit-sup",children:t},a):t)})}var pv=Y(ee());function __(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?__(r,t):r}function ka(e,t){let a=xa(e,t);return a?(0,pv.jsx)(qd,{unit:a}):null}function al(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 lt(e){return`\xA3${e.toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function dv(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}var x_=[{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"}],k_=[{match:["mortar"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Blue+Circle+Quality+Assured+Mortar+Mix+-+Photo.jpg"},{match:["mot type 1"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/MOT+-+Photo+1.jpg"},{match:["soft sand","building sand"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Soft+Building+Sand+-+Photo+1.jpg"},{match:["cement"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/blue+circle+general+cement+bagged.jpg"},{match:["brick"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/class+B+engineering+brick+smooth+red+perforated+65mm+-+Photo+1+comp.jpg"},{match:["dense block","concrete block"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/100mm+solid+dense+concrete+block+-+Photo+1+-+1920+comp.jpg"},{match:["metal c stud","c stud"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/70mm+c+stud+angle.jpg"},{match:["timber","carcassing","sawn","c24","c16"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/47mm+x+100mm+sawn+treated+c16+-+Photo+1+1920.jpg"},{match:["osb"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/18mm+structural+OSB+-+Photo+1+comp.jpg"},{match:["dpc"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/225mm+damp+proof+course.jpg"},{match:["soil pipe","soil bend","underground","drainage"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/110mm+Soil+Pipe+Single+Socket+Black+3m+-+High+Res.jpg"},{match:["nail"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/galvanised+round+wire+nail+vertical.jpg"},{match:["retaining clip","retaining clips","insulation disc","insulation disks"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/multiple+zinc+insulation+discs.jpg"},{match:["wall tie"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Type+4+Wall+Ties+-+Photo.jpg"},{match:["loft insulation","loft roll","insulation roll"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/200mm+knauf+loft+roll+44+unwrapping.jpg"},{match:["pir insulation","insulation board","celotex","unilin","indiboard"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/100mm+celotex+sheet+logo.jpg"},{match:["plasterboard","wallboard"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/12.5mm+wallboard+tapered+edge+corner.jpg"},{match:["drywall screw"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/close+up+drywall+course+thread.jpg"},{match:["scrim","jointing tape","paper tape"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/50mm+scrim+tape.jpg"},{match:["adhesive","high grab","evostik","stixall","gripfill","sealant","ct1"],url:"https://res.cloudinary.com/materials-market/image/upload/c_fill,w_750/assets/product-images-final/Instant+Nails+Solvent+Free+Grab+Adhesive+White+290ml+-+Photo.jpg"}];function Ga(e,t,a){if(a)return a;let r=(e||"").toLowerCase(),i=k_.find(o=>o.match.some(l=>r.includes(l)));if(i)return i.url;let n=x_.find(o=>o.match.some(l=>r.includes(l)));return n?Ft(n.path):r.includes("insulation")?dv(`
|
|
6975
6975
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
|
|
6976
6976
|
<rect width="640" height="420" fill="#fbf1cf"/>
|
|
6977
6977
|
<rect x="88" y="78" width="432" height="264" rx="16" fill="#f0c43f"/>
|
|
@@ -6990,7 +6990,7 @@ C24 timber 4.8m`,value:p,onChange:X=>m(X.target.value),"aria-label":"Paste sched
|
|
|
6990
6990
|
<rect x="168" y="188" width="250" height="24" rx="12" fill="#aab5c0"/>
|
|
6991
6991
|
<rect x="168" y="232" width="220" height="24" rx="12" fill="#aab5c0"/>
|
|
6992
6992
|
</svg>
|
|
6993
|
-
`)}function zn(e,t){return{lineId:t.lineId,description:e?.description||t.description||"(no description)",requestedDescription:t.description,productId:e?.product_id??"-",price:e?.price??null,priceBasis:e?.price_basis??null,unit:t.unit,uoi:e?.uoi??t.unit,uoiCount:e?.uoi_count??null,saleUnit:e?.conversion?.sale_unit??null,saleUnitQuantity:e?.conversion?.sale_unit_quantity??null,unitConversions:e?.conversion?.unit_conversions?.map(a=>({requestUom:a.request_uom,quantityPerSaleUnit:a.quantity_per_sale_unit,evidence:a.evidence,confidence:a.confidence})),pdpPhotoUrl:e?.pdp_photo_url??null,measurementsMm:e?.measurements_mm??[],conversionType:e?.conversion?.conversion_type??null,requestUomsSupported:e?.conversion?.request_uoms_supported??null,salesUomNormalised:e?.conversion?.sales_uom_normalised??null,salesUnitSize:e?.conversion?.sales_unit_size??null,salesUnitSizeUom:e?.conversion?.sales_unit_size_uom??null,coverageQty:e?.conversion?.coverage_qty??null,coverageUom:e?.conversion?.coverage_uom??null,itemsPerPallet:e?.conversion?.items_per_pallet??null,itemsPerPack:e?.conversion?.items_per_pack??null,itemsPerBox:e?.conversion?.items_per_box??null,itemsPerM2:e?.conversion?.items_per_m2??null,wasteFactorDefault:e?.conversion?.waste_factor_default??null,roundingRule:e?.conversion?.rounding_rule??null,derivedCoverageM2:e?.conversion?.derived_coverage_m2??null,derivedLengthM:e?.conversion?.derived_length_m??null,quoteQtyFormulaType:e?.conversion?.quote_qty_formula_type??null,conversionConfidence:e?.conversion?.conversion_confidence??null,conversionNotes:e?.conversion?.conversion_notes??null,calculatorWasteIncluded:t.calculatorWasteIncluded,qty:t.qty,linkedContext:t.linkedContext}}var bv=e=>(e??"").trim().toLowerCase(),S_={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",piece:"each",pieces:"each",board:"sheet",bags:"bag",length:"length",lengths:"length",pallet:"pallet",pallets:"pallet"},Ed=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),mv=new Set(["box","bag","pack","pallet","roll","set","tub"]),Md=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,Td=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,dr=e=>{let t=bv(e);return S_[t]??t},it=(e,t)=>{let a=dr(e),r=dr(t);return a.length>0&&a===r},fv=(e,t)=>{let a=bv(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},N_=e=>(e??"").split(",").map(t=>dr(t)).filter(Boolean),C_=(e,t)=>{let a=N_(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||it(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||it(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||it(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},hv=(e,t)=>it(t,"pallet")?e.itemsPerPallet??null:it(t,"pack")?e.itemsPerPack??null:it(t,"box")?e.itemsPerBox??null:null,gv=(e,t)=>{let a=t==="volume"?/(\d+(?:[.,]\d+)?)\s*(ml|l|ltr|ltrs|litres?|liters?)\b/i:/(\d+(?:[.,]\d+)?)\s*(kg|kgs|tonnes?)\b/i,r=e.description.match(a);if(!r)return null;let i=Number.parseFloat(r[1].replace(",","."));if(!Number.isFinite(i)||i<=0)return null;let n=r[2].toLowerCase();return t==="volume"?{ml:n==="ml"?i:i*1e3}:{g:n.startsWith("tonne")?i*1e6:i*1e3}},q_=["volume_from_description","same_unit_volume"],E_=["weight_from_description","mass_from_pack","same_unit_mass"],M_=(e,t,a)=>{if(!it(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||!it(r[3],a))return null;let i=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(i)&&i>0?i:null};function ic(e,t){let a=e.map(r=>It(r,t).lineTotal);return a.some(r=>r==null)?null:a.reduce((r,i)=>r+(i??0),0)}function It(e,t){let a=e.qty,r=dr(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=dr(e.unit)||(a>0&&Ed.has(r)?r:"-"),n=e.saleUnitQuantity??e.salesUnitSize??e.uoiCount??1,o=t?.wasteFactorEnabled===!1?0:t?.wasteFactorOverride??e.wasteFactorOverride??e.wasteFactorDefault??0,l=e.sellUnitsOverride!=null&&Number.isFinite(e.sellUnitsOverride)&&e.sellUnitsOverride>0,c=l?Ed.has(r)?Math.ceil(e.sellUnitsOverride):e.sellUnitsOverride:null,p=A=>({requestedAmount:a,requestedUnit:i,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:r,calculatedSellUnits:null,requiredSellUnits:c,unitPrice:e.price,lineTotal:e.price!=null&&c!=null?e.price*c:null,calculation:c!=null?`${A} Manually set to ${c} ${r}.`:A,costingMode:"review"});if(!Number.isFinite(a)||a<=0)return p("Quantity needs confirmation.");let m=Md(a,i),b=Td(a,i),f=it(i,r)?null:m!=null&&!q_.includes(e.conversionType??"")?gv(e,"volume"):b!=null&&!E_.includes(e.conversionType??"")?gv(e,"weight"):null,w=f?.ml!=null?m:b,_=f?.ml??f?.g??null;if(w!=null&&_!=null){let A=dr(e.uoi)||r,B=f?.ml!=null?`${_/1e3} l`:`${_/1e3} kg`,ie=l?c:Math.ceil(w*(1+o)/_-1e-9);return{requestedAmount:a,requestedUnit:i,salesUnitSize:1,sellUnit:A,calculatedSellUnits:ie,requiredSellUnits:ie,unitPrice:e.price,lineTotal:e.price!=null?e.price*ie:null,calculation:`${a} ${i}${o>0?` x ${1+o}`:""} / ${B} per ${A} (from product description) = ${ie} ${A}`,costingMode:"derived"}}if(i==="sales_unit"){let A=dr(e.uoi)||r,B=l?c:fv(a*(1+o),e.roundingRule??"round_up_each");return{requestedAmount:a,requestedUnit:A,salesUnitSize:1,sellUnit:A,calculatedSellUnits:B,requiredSellUnits:B,unitPrice:e.price,lineTotal:e.price!=null?e.price*B:null,calculation:`${a} ${A}${o>0?` x ${1+o}`:""} = ${B} ${A}`,costingMode:"direct"}}if(!C_(e,i))return p("Requested unit is not supported by this catalogue conversion.");let E=null,D="review",h=e.roundingRule,u=`Quantity review required, initial request needed ${a} ${i}.`,g=1+o,v=M_(e,i,r),N=e.unitConversions?.find(A=>it(A.requestUom,i));if(!!e.saleUnit&&(it(i,r)||!!N||it(i,"each")&&!mv.has(r)))if(it(i,r))E=a*g/n,D="direct",u=`${a} ${i}${o>0?` x ${g}`:""}`;else if(N){E=a*g/N.quantityPerSaleUnit,D="derived";let A=1/N.quantityPerSaleUnit,B=Math.round(A);u=it(r,"each")&&N.quantityPerSaleUnit<1&&Math.abs(A-B)<1e-9?`${a} ${i}${o>0?` x ${g}`:""} x ${B} per ${i}`:`${a} ${i}${o>0?` x ${g}`:""} / ${N.quantityPerSaleUnit} ${i} per ${r}`}else it(i,"each")&&!mv.has(r)&&(E=a*g/n,D="derived",u=`${a} ${r}${o>0?` x ${g}`:""}`);else if(it(i,r)&&n>0)E=a*g/n,D="direct",u=o>0?`${a} ${i} x ${g} / ${n} ${r} per sell unit`:`${a} ${i} / ${n} ${r} per sell unit`;else if(it(i,"each")&&n>0&&Ed.has(r))E=a*g/n,D="derived",u=o>0?`${a} each x ${g} / ${n} each per ${r}`:`${a} each / ${n} each per ${r}`;else if(hv(e,i)!=null&&n>0){let A=hv(e,i)??0;E=a*A*g/n,D="derived";let B=`${a} ${i} x ${A} each${o>0?` x ${g}`:""}`;u=n===1&&it(r,"each")?B:`${B} / ${n} each per ${r}`}else if(v!=null)E=a*g/v,D="derived",h??(h="round_up_each"),u=`${a} m2 x ${g} / ${v} m2 per ${r} (from product description)`;else if(e.conversionType==="basket_line_unit")n>0&&(E=a*g/n,D="derived",u=`${a} ${i}${o>0?` x ${g}`:""} / ${n} ${i} per ${r}`);else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${i}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let A=e.coverageQty??e.derivedCoverageM2??null;it(i,"m2")&&A!=null&&A>0&&(E=a*g/A,D="derived",u=`${a} m2 x ${g} / ${A} m2 per ${r}`)}else if(e.conversionType==="count_per_area"){let A=e.coverageQty??null;it(i,"m2")&&A!=null&&A>0?(E=a/A,D="derived",u=`${a} m2 / ${A} m2 per sell unit`):it(i,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&n>0&&(E=a*e.itemsPerM2*g/n,D="derived",u=`${a} m2 x ${e.itemsPerM2} ${r}/m2 x ${g} / ${n}`)}else if(e.conversionType==="length_from_dims"){let A=e.coverageQty??e.derivedLengthM??null;it(i,"m")&&A!=null&&A>0&&(E=a*g/A,D="derived",u=`${a} m x ${g} / ${A} m per ${r}`)}else if(e.conversionType==="volume_from_description"){let A=Md(a,i),B=Md(e.coverageQty??0,dr(e.coverageUom));A!=null&&B!=null&&B>0&&(E=A*g/B,D="derived",u=`${a} ${i} x ${g} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="weight_from_description"||e.conversionType==="mass_from_pack"){let A=dr((e.coverageUom??"").split(" ")[0]),B=Td(a,i),ie=Td(e.coverageQty??0,A);B!=null&&ie!=null&&ie>0&&(E=B*g/ie,D="derived",u=`${a} ${i} x ${g} / ${e.coverageQty} ${A} per ${r}`)}else if(e.conversionType==="same_unit_volume"){let A=e.coverageQty??null;it(i,"m3")&&A!=null&&A>0&&(E=a/A,D="derived",u=`${a} m3 / ${A} m3 per ${r}`)}}if(E==null||!Number.isFinite(E)||E<0)return p(`Quantity review required, initial request needed ${a} ${i}.`);let T=fv(E,h),U=l?c:T;return{requestedAmount:a,requestedUnit:i,salesUnitSize:n,sellUnit:r,calculatedSellUnits:T,requiredSellUnits:U,unitPrice:e.price,lineTotal:e.price!=null&&U!=null?e.price*U:null,calculation:l?`${u} = ${T} ${r} (manually set to ${U})`:`${u} = ${U} ${r}`,costingMode:D}}var wv=()=>import("./xlsx-K4MOA2QM.js"),il=["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"],T_=il.indexOf("Line total");function z_(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 wv(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),i=[il],n=0;for(let c of e){let{item:p,best:m,qty:b,band:f,unmatchable:w,decision:_}=c,E=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),D=!w&&m?.price!=null?m.price*b:null;D!=null&&(n+=D),i.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(", "),_?.technical_classification??"",_?.include_in_quote==null?"":_.include_in_quote?"yes":"no",_?.approval_required==null?"":_.approval_required?"yes":"no",_?.approval_type??"",_?.missing_information.join(", ")??"",_?.confidence??"",_?.reason??"",w?"-":m?.product_id??_?.selected_candidate_id??"-",w?"-":m?.description??"-",w?"-":m?.price_basis??"-",w?null:m?.price??null,D,w?"-":f,z_(c)])}i.push(Array(il.length).fill(null));let o=Array(il.length).fill(null);o[0]="Estimated total",o[T_]=n,i.push(o),i.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(il.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(i);l["!cols"]=[{wch:12},{wch:12},{wch:44},{wch:24},{wch:8},{wch:8},{wch:28},{wch:28},{wch:16},{wch:10},{wch:12},{wch:24},{wch:24},{wch:24},{wch:22},{wch:14},{wch:14},{wch:18},{wch:24},{wch:16},{wch:48},{wch:16},{wch:40},{wch:10},{wch:10},{wch:12},{wch:11},{wch:26}],t.utils.book_append_sheet(a,l,"Schedule match"),t.writeFile(a,`schedule-quote-${r}.xlsx`)}var rl=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function yv(e,t){let a=await wv(),r=a.utils.book_new(),i=new Date().toISOString().slice(0,10),n=t?[["Account",t.name+" ("+t.id+")"],[],rl]:[rl],o=0;for(let p of e){let m=It(p),b=m.lineTotal;b!=null&&(o+=b),n.push([p.productId,p.description,m.costingMode,m.requestedAmount,xa(m.requestedUnit),m.salesUnitSize,xa(m.sellUnit),m.requiredSellUnits,m.unitPrice,b])}n.push(Array(rl.length).fill(null));let l=Array(rl.length).fill(null);l[0]="Estimated total",l[rl.length-1]=o,n.push(l);let c=a.utils.aoa_to_sheet(n);c["!cols"]=[{wch:14},{wch:48},{wch:12},{wch:14},{wch:10},{wch:14},{wch:10},{wch:16},{wch:12},{wch:14}],a.utils.book_append_sheet(r,c,"Basket"),a.writeFile(r,t?`basket-${t.id}-${i}.xlsx`:`basket-${i}.xlsx`)}var s=Y(ee()),Rd="__none__",nl=24,R_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function Sv(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var A_=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function U_(e,t){if(t!==Rd){if(t)return e?.candidates.find(a=>a.product_id===t);if(e?.decision?.selected_candidate_id!=null)return e.candidates.find(a=>a.product_id===e.decision.selected_candidate_id)}}function _v(e){return{product_id:e.productId,description:e.description,source_list:null,price:e.price,price_basis:e.priceBasis,uoi_count:e.uoiCount??null,uoi:e.uoi,pdp_photo_url:e.pdpPhotoUrl??null,measurements_mm:e.measurementsMm??[],conversion:{sale_unit:e.saleUnit,sale_unit_quantity:e.saleUnitQuantity,unit_conversions:e.unitConversions?.map(t=>({request_uom:t.requestUom,quantity_per_sale_unit:t.quantityPerSaleUnit,evidence:t.evidence,confidence:t.confidence})),sales_uom_normalised:e.salesUomNormalised,conversion_type:e.conversionType,request_uoms_supported:e.requestUomsSupported,sales_unit_size:e.salesUnitSize,sales_unit_size_uom:e.salesUnitSizeUom,coverage_qty:e.coverageQty,coverage_uom:e.coverageUom,items_per_pallet:e.itemsPerPallet,items_per_pack:e.itemsPerPack,items_per_box:e.itemsPerBox,items_per_m2:e.itemsPerM2,waste_factor_default:e.wasteFactorDefault,rounding_rule:e.roundingRule,derived_coverage_m2:e.derivedCoverageM2,derived_length_m:e.derivedLengthM,quote_qty_formula_type:e.quoteQtyFormulaType,conversion_confidence:e.conversionConfidence,conversion_notes:e.conversionNotes},scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"manual_cart_selection"}}function D_(e){return e?e.replace(/_/g," "):"not stated"}function O_({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 An(e,t){if(e==null)return"-";let a=al(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function Ad(e){return e&&e.length>0?e.join(" x "):"-"}function B_(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Rn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Xr(e,t){let a=typeof e.description_original=="string"?e.description_original.trim():"";return(typeof e.customer_display_label=="string"?e.customer_display_label.trim():"")||a||"(no description)"}function L_(e,t){return t>0||e==null?null:lt(e)}var xv=[{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 H_(e){let t=new Map;return[...new Set(e.filter(mr).map(r=>r.linked_group_id))].forEach((r,i)=>{let n=i%26;t.set(r,{token:String.fromCharCode(65+n),bubbleStyle:xv[i%xv.length]})}),t}function mr(e){return!1}function Un(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 zd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function j_(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,6),l=o.some(c=>c.product_id===a)?void 0:e.find(c=>c.product_id===a);return l?[...o,l]:o}let i=new Map(e.map(o=>[o.product_id,o])),n=r.map(o=>i.get(o)).filter(o=>o!=null);if(a&&!n.some(o=>o.product_id===a)){let o=i.get(a);o&&n.unshift(o)}return[...new Map(n.map(o=>[o.product_id,o])).values()].slice(0,6)}function nc(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 oc(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 Q_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:i}){let n=[...t].sort((l,c)=>c.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-n.length);return(0,s.jsxs)("div",{className:"results-detail-block",style:{marginBottom:18},children:[(0,s.jsx)("h3",{style:{margin:"0 0 12px"},children:"Pipeline timings"}),(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:12},children:[(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:oc(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:i})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:oc(r)})," LLM time"]})]}),(0,s.jsxs)("table",{className:"score-breakdown-table",style:{marginBottom:14},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Process stage"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:e.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:oc(l.durationMs)})]},`${l.key}-${c}`))})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{style:{margin:"0 0 10px"},children:"LLM calls"}),(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Call"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:n.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:oc(l.durationMs)})]},`${l.key}-${c}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",n.length," of ",t.length," LLM calls."]})]})]})}function G_({queries:e}){return e.length===0?null:(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Retrieval by procurement query"}),e.map((t,a)=>(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsxs)("div",{className:"results-row-meta",style:{marginBottom:6},children:["Query: ",(0,s.jsx)("strong",{children:t.query})]}),t.candidates.length===0?(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates returned for this query."}):(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Unit"}),(0,s.jsx)("th",{children:"bm25"})]})}),(0,s.jsx)("tbody",{children:t.candidates.slice(0,5).map((r,i)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:r.description}),(0,s.jsx)("div",{className:"results-row-meta",children:r.product_id})]}),(0,s.jsx)("td",{children:Ad(r.measurements_mm)}),(0,s.jsx)("td",{children:al(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${i}`))})]})]},`${t.query}-${a}`))]})}function kv({item:e,result:t}){let a=t?.retrieval_debug.map(i=>i.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Rn(e.procurement_aliases)],["Retrieval queries",Rn(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)",Ad(e.attrs.measurements_mm)],["Stock length",B_(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",Rn(e.installation_clues)],["System clues",Rn(e.system_clues)],["Component requirements",Rn(e.component_requirements)],["Linked group",Un(e)||"-"],["Flags",Rn(e.flags)]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Search context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:r.map(([i,n])=>(0,s.jsxs)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:i}),(0,s.jsx)("dd",{children:n})]},i))})]})}function Y_({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)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(ke.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 $_({result:e}){let t=e?.adjudication_debug;if(!t)return null;let a=[["Dependent rerank applied",t.dependent_rerank_applied?"yes":"no"],["Linked parent selected product",t.linked_parent_selected_candidate_description||t.linked_parent_selected_candidate_id||"-"],["Dimension reason overridden",t.dimension_reason_overridden?"yes":"no"]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Adjudication context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:a.map(([r,i])=>(0,s.jsxs)(ke.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:i})]},r))}),t.rerank_line_item_input?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h5",{style:{margin:"12px 0 8px"},children:"Rerank input"}),(0,s.jsx)("pre",{className:"results-pre",children:JSON.stringify(t.rerank_line_item_input,null,2)})]}):null]})}function V_({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:i=!1,linkedGroupMeta:n}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"No automatic match:":`AI review (${t.confidence??"confidence not stated"}):`;return i?t.reason?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),mr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",Un(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(kv,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(kv,{item:e,result:a}),r&&(0,s.jsx)(Y_,{item:e}),r&&(0,s.jsx)($_,{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]}),mr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",Un(e)]}):null]}),r&&(0,s.jsx)(G_,{queries:a?.retrieval_debug??[]})]})}function X_({item:e,candidates:t,result:a,decision:r,unmatchable:i,selectedProductId:n,detailMode:o,onPick:l,onClear:c,showAll:p=!1,internal:m=!1,debugEnabled:b=!1,forceReviewNote:f=!1,linkedGroupMeta:w}){let _=m||o==="detailed",E=b&&o==="detailed",D=_||f?(0,s.jsx)(V_,{item:e,decision:r,result:a,showRetrievalDebug:E,reviewOnly:f&&!_,linkedGroupMeta:w}):null;if(i)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"Classified as labour/plant or referencing another line item - skipped by design."})]});if(t.length===0)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let h=p||m||o==="detailed"?t:j_(t,a,n);return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Price"}),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:h.map((u,g)=>{let v=u.product_id===n;return(0,s.jsxs)("tr",{className:v?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:u.description}),(0,s.jsx)("div",{className:"results-row-meta",children:u.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:Ad(u.measurements_mm??u.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:An(u.price,u.price_basis)}),E&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(u.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.bm25??0).toFixed(2)}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(O_,{band:Sv(u.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(u.scores?.overall??0).toFixed(2)})]})})]}),(0,s.jsx)("td",{children:(0,s.jsxs)("label",{className:"switch-toggle",title:v?"Currently selected":"Use this candidate",children:[(0,s.jsx)("input",{type:"checkbox",checked:v,onChange:()=>{v?c?.():l(u)},"aria-label":v?`${u.description} selected`:`Use ${u.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${u.product_id}-${g}`)})})]})]})}function Ud({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:i,onGoToBasket:n,cartSeeded:o,onCartSeeded:l,reviewGateComplete:c,onReviewGateComplete:p,internal:m=!1}){let b=!m&&Ks()==="QZA6-MRA4",f=b?"quote":"basket",{results:w,lineItems:_,parseReport:E,timings:D}=e,[h,u]=(0,ke.useState)({}),g=Nn(),[v,N]=(0,ke.useState)({}),[R,T]=(0,ke.useState)({}),[U,A]=(0,ke.useState)(""),[B,ie]=(0,ke.useState)(null),[ze,He]=(0,ke.useState)(1),Ve=Ot().debug===!0,[qe,we]=(0,ke.useState)("simple"),[le,Je]=(0,ke.useState)(m?"list":"tile"),[Ne,St]=(0,ke.useState)(!1),[X,me]=(0,ke.useState)(null),[Re,Nt]=(0,ke.useState)(""),[Bt,Ut]=(0,ke.useState)([]),[Xe,ye]=(0,ke.useState)(!1),[be,Ye]=(0,ke.useState)(null),[z,H]=(0,ke.useState)(!1),[ne,ce]=(0,ke.useState)(null),fe=(0,ke.useRef)(null),[Me,Ze]=(0,ke.useState)(new Set),[d,M]=(0,ke.useState)(new Set),[S,$]=(0,ke.useState)(!1);(0,ke.useEffect)(()=>{He(1)},[U,B,le]);let Z=new Map(w.map(k=>[k.line_id,k])),x=H_(_),j=_.map(k=>{let Q=Z.get(k.line_id),he=Q?.decision,ut=A_(k),Ke=h[k.line_id],ea=U_(Q,Ke),Ti=a[k.line_id],d0=Ke===Rd?void 0:v[k.line_id]??(Ti&&Ti.productId!==ea?.product_id?_v(Ti):ea),wm=ut?void 0:d0,m0=k.qty??0;return{item:k,result:Q,decision:he,unmatchable:ut,best:wm,qty:m0,band:Sv(wm?.scores?.overall)}}),ue=j.some(k=>!k.unmatchable&&!k.best&&!d.has(k.item.line_id))?null:ic(Object.values(a),{wasteFactorEnabled:!1,wasteFactorOverride:0}),ve=0;for(let k of j){if(k.unmatchable||k.decision?.include_in_quote!==!0||!k.best)continue;let Q=a[k.item.line_id];(!Q||It(Q).lineTotal==null)&&(ve+=1)}ve>0&&(ue=null);let wt=L_(ue,ve),rt=k=>!k.unmatchable&&!k.best&&k.decision?.technical_classification!=="no_suitable_candidate"&&nc(k.result).length>0,Ct=k=>k.best??nc(k.result)[0],Kr=j.filter(k=>!k.unmatchable&&!k.best).filter(k=>!d.has(k.item.line_id)),Cc=j.filter(k=>d.has(k.item.line_id)),Yt=j;if(U.trim()){let k=U.trim().toLowerCase();Yt=Yt.filter(Q=>Q.item.description_original?.toLowerCase().includes(k)||Ct(Q)?.description?.toLowerCase().includes(k))}if(B){let k=B==="asc"?1:-1;Yt=[...Yt].sort((Q,he)=>k*(Q.item.description_original||"").localeCompare(he.item.description_original||""))}let hr=Math.max(1,Math.ceil(Yt.length/nl)),vt=Math.min(ze,hr),qi=Yt.slice((vt-1)*nl,vt*nl),um=qi.filter(k=>!k.unmatchable&&k.best),Dx=qi.filter(k=>rt(k)),qc=qi.filter(k=>!k.unmatchable&&(k.best||rt(k))),pm=qi.filter(k=>k.unmatchable||!k.best&&!rt(k)),P=X?j.find(k=>k.item.line_id===X)??null:null,n0=!m&&!c&&!P&&Kr.length>0,$n=(0,ke.useRef)(null),Vn=()=>{let k=fe.current;if(!k)return;let{top:Q,left:he,width:ut,height:Ke}=k.getBoundingClientRect(),Ti=k.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;ce({top:Q,left:he,width:Ti?Ti-he:ut,height:Ke})};(0,ke.useEffect)(()=>(window.addEventListener("scroll",Vn,!0),window.addEventListener("resize",Vn),()=>{window.removeEventListener("scroll",Vn,!0),window.removeEventListener("resize",Vn)})),(0,ke.useEffect)(()=>{let k=Q=>{$n.current&&!Q.composedPath().includes($n.current)&&$n.current.removeAttribute("open")};return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[]);let Ei=k=>{me(k),Nt("")},o0=()=>{if(!X)return;let k=a[X];if(k){u(Q=>({...Q,[X]:k.productId})),N(Q=>({...Q,[X]:_v(k)}));return}u(Q=>{let he={...Q};return delete he[X],he}),N(Q=>{let he={...Q};return delete he[X],he})},Va=(k=!1)=>{let Q=X?a[X]:void 0;!k&&Q&&P?.best&&Q.productId!==P.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(k||o0(),me(null),$(!1))};el(z,()=>H(!1)),el(!!P&&!z,()=>Va());let l0=k=>{if(Ze(Q=>new Set(Q).add(k)),Kr.some(Q=>Q.item.line_id!==k)){Va(!0);return}p(),Va(!0)},s0=k=>{if(Ec(k),M(Q=>new Set(Q).add(k)),Kr.some(Q=>Q.item.line_id!==k)){Va(!0);return}p(),Va(!0)},c0=()=>{M(k=>new Set([...k,...Kr.map(Q=>Q.item.line_id)])),p()},dm=()=>{P?.best&&(fm(P.item.line_id,P.best),r(Xn(P)),S?l0(P.item.line_id):Va(!0))},mm=pm.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:pm.map(k=>{let{item:Q,qty:he}=k;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>Ei(Q.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Xr(Q,_)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},Q.line_id)})})]}):null,Ec=k=>{u(Q=>({...Q,[k]:Rd})),N(Q=>({...Q,[k]:void 0})),T(Q=>({...Q,[k]:void 0})),i(k)},Mc=(k,Q)=>{u(he=>({...he,[k]:Q.product_id})),N(he=>({...he,[k]:Q}))},fm=(k,Q)=>{Q.method==="catalogue_search"&&T(he=>({...he,[k]:Q}))};function Ox(){g("downloaded",{type:"schedule",lines:j.length}),vv(j.map(({item:k,best:Q,qty:he,band:ut,unmatchable:Ke,decision:ea})=>({item:k,best:Q,qty:he,band:ut,unmatchable:Ke,decision:ea})))}function Xn(k){let Q=k.best??nc(k.result)[0];return zn(Q,{lineId:k.item.line_id,description:k.item.description_original,unit:k.item.unit,qty:k.qty,linkedContext:k.item.linked_group_role==="dependent"&&k.item.linked_group_id?_.filter(he=>he.linked_group_id===k.item.linked_group_id&&he.linked_group_role==="anchor").slice(0,1).map(he=>{let ut=a[he.line_id];return{line_id:he.line_id,product_id:ut?.productId??null,measurements_mm:ut?.measurementsMm??he.attrs.measurements_mm,description:ut?.description??he.description_original,qty:he.qty,unit:he.unit,role:"anchor"}}):void 0})}(0,ke.useEffect)(()=>{if(!o){for(let k of j)!k.unmatchable&&k.best&&r(Xn(k));l()}},[o]),(0,ke.useEffect)(()=>{if(!X){Ut([]),Ye(null),ye(!1);return}let k=Re.trim();if(!k){Ut([]),Ye(null),ye(!1);return}let Q=!1,he=window.setTimeout(async()=>{try{ye(!0),Ye(null);let ut=await fetch(za(`/api/catalogue/search?q=${encodeURIComponent(k)}`),{headers:hi()}),Ke=await Qa(ut);if(!ut.ok)throw new Error(Ke?.error||Ke?.message||"Failed to search catalogue");Q||Ut(Array.isArray(Ke?.items)?Ke.items:[])}catch(ut){Q||(Ut([]),Ye(ut?.message||"Failed to search catalogue"))}finally{Q||ye(!1)}},250);return()=>{Q=!0,window.clearTimeout(he)}},[Re,X]);let Tc=Object.keys(a).length,qa=Re.trim(),zc=nc(P?.result),fl=P?.decision?.technical_classification==="no_suitable_candidate"||!!P&&!P.best,hm=P?.decision?.technical_classification!=null,gm=P?.decision?.reason??(fl?"No catalogue candidate found. Refine the request or search the catalogue.":null),u0=Bt.map(k=>({product_id:k.product_id,description:k.description,source_list:k.source_list,price:k.price,price_basis:k.price_basis,uoi_count:k.uoi_count??null,uoi:k.uoi,pdp_photo_url:k.pdp_photo_url??null,conversion:k.conversion,measurements_mm:k.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"catalogue_search"})),Zn=qa?u0:zc,Mi=P?R[P.item.line_id]:void 0,Kn=!qa&&Mi&&!Zn.some(k=>k.product_id===Mi.product_id)?[...Zn,Mi]:Zn,bm=(()=>{let k=Kn.slice(0,qa?12:6);return qa||!Mi||k.some(Q=>Q.product_id===Mi.product_id)?k:[...k,Mi]})(),hl=!!P?.best&&a[P.item.line_id]?.productId===P.best.product_id,p0=!!P?.best&&!!a[P.item.line_id]&&!hl;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${m?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${m?"":" quick-order-hero--customer"}`,children:m?(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:wt??"Review quantities"})," 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:n,disabled:Tc===0,"aria-label":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:b?"View Quote":"View Basket"}),wt!=null&&(0,s.jsx)("strong",{children:wt})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[Ve&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":Ne,onClick:()=>St(k=>!k),children:Ne?"Hide timings":"Show timings"})}),Ve&&Ne&&(0,s.jsx)(Q_,{...D}),!b&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!P&&(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:0},children:[ve>0&&(0,s.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,s.jsx)("strong",{children:ve})," 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:U,onChange:k=>A(k.target.value),"aria-label":"Search line items"}),!m&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${le==="tile"?" is-active":""}`,"aria-pressed":le==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>Je("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${le==="list"?" is-active":""}`,"aria-pressed":le==="list","aria-label":"List view",title:"List view",onClick:()=>Je("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"})]})})]}),Ve&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>we(k=>k==="simple"?"detailed":"simple"),children:qe==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:$n,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:R_.map(k=>{let Q=B===k.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${Q?" is-active":""}`,onClick:()=>{ie(Q?null:k.dir),$n.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:Q?"\u2713":""}),k.label]},k.dir)})})]})]})]})}),le==="tile"||P?(0,s.jsxs)(s.Fragment,{children:[P?(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Product options",onClick:()=>Va(),children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal results-review-modal",onClick:k=>k.stopPropagation(),children:[(0,s.jsx)("button",{type:"button",className:"quick-order-workflow-close results-review-modal__close",onClick:()=>Va(),"aria-label":"Close product options",children:(0,s.jsx)(Io,{})}),(0,s.jsx)("div",{className:"results-review-page",children:m?(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:()=>Va(),children:[(0,s.jsx)(Vr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[Ve&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>we(k=>k==="simple"?"detailed":"simple"),children:qe==="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:Re,onChange:k=>Nt(k.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:()=>Ec(P.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:Ga(Ct(P)?.description||P.item.description_original,Ct(P)?.product_id,Ct(P)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Xr(P.item,_)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[wi(P.qty)," ",ka(P.item.unit,P.qty)]}),P.best?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:P.best.description}),P.best.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:An(P.best.price,P.best.price_basis)}):null]}):Ct(P)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:Ct(P)?.description}),Ct(P)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:An(Ct(P)?.price??null,Ct(P)?.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."}),mr(P.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(zd,{meta:x.get(P.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Un(P.item)})]}):null,(0,s.jsx)("div",{className:"results-review-page__actions",children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[P.item.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[P.item.line_id]?i(P.item.line_id):(P.best&&fm(P.item.line_id,P.best),r(Xn(P)))},disabled:!P.best,"aria-label":a[P.item.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[P.item.line_id]?"\u2713 Added":m?"+ Add to selection":`Add to ${f}`})})]})]}),Xe?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!Xe&&be?(0,s.jsx)("div",{className:"results-empty-card",children:be}):null,!Xe&&!be&&qa&&Zn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!Xe&&!be?(0,s.jsx)(X_,{item:P.item,candidates:Zn,result:P.result,decision:P.decision,unmatchable:P.unmatchable,selectedProductId:P.best?.product_id??null,detailMode:qe,linkedGroupMeta:mr(P.item)?x.get(P.item.linked_group_id):void 0,onPick:k=>Mc(P.item.line_id,k),onClear:()=>Ec(P.item.line_id),showAll:m||Ve||qa.length>0,internal:m,debugEnabled:Ve,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:Xr(P.item,_)||"Original request"})]}),gm?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:fl?"No automatic match:":"AI review:"})," ",gm]}):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:fl?zc.length>0?"Choose a product":"No suitable product found":hm?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:fl?zc.length>0?"No product was selected automatically. Review these related options before adding one.":"Search the catalogue to choose an alternative.":hm?`Select the option you want to add to your ${f}.`:"Search the catalogue to choose a product."})]})}),!qa&&Kn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:bm.map(k=>{let Q=k.product_id===P.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${Q?" is-selected":""}`,onClick:()=>Mc(P.item.line_id,k),"aria-pressed":Q,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ga(k.description,k.product_id,k.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:k.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:k.price!=null?`\xA3${An(k.price,k.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:Q?"Selected":"Choose"})]},k.product_id)})}):null,Kn.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:Re,onChange:k=>Nt(k.target.value),"aria-label":"Search catalogue"})]}),qa&&Xe?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,qa&&!Xe&&be?(0,s.jsx)("div",{className:"results-empty-card",children:be}):null,qa&&!Xe&&!be&&Kn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,qa&&!Xe&&!be&&Kn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:bm.map(k=>{let Q=k.product_id===P.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${Q?" is-selected":""}`,onClick:()=>Mc(P.item.line_id,k),"aria-pressed":Q,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ga(k.description,k.product_id,k.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:k.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:k.price!=null?`\xA3${An(k.price,k.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:Q?"Selected":"Choose"})]},k.product_id)})}):null]}),P.best?p0?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{dm()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>i(P.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${f}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${hl?" cta-btn-secondary":""}`,onClick:()=>{hl?i(P.item.line_id):dm()},children:(0,s.jsx)("span",{children:hl?`Remove from ${f}`:`Add selected product to ${f}`})}):null,S?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>s0(P.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[Yt.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,qc.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:qc.map(k=>{let{item:Q,best:he,qty:ut}=k,Ke=Ct(k),ea=!he&&rt(k);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>Ei(Q.line_id),"aria-label":`Review match for ${Xr(Q,_)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[ea||mr(Q)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[mr(Q)?(0,s.jsx)(zd,{meta:x.get(Q.linked_group_id)}):(0,s.jsx)("span",{}),ea?(0,s.jsx)("span",{style:{padding:"6px 10px",borderRadius:999,background:"#fef3c7",color:"#92400e",fontSize:12,fontWeight:700,lineHeight:1},children:"Partially matched"}):null]}):null,(0,s.jsx)("img",{className:"fill-img results-tile-card__image",src:Ga(Ke?.description||Q.description_original,Ke?.product_id,Ke?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Ke?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"results-tile-card__heading",children:(0,s.jsx)("div",{className:"results-tile-card__title",children:Ke.description})})}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),(0,s.jsx)("div",{className:"results-tile-card__match",children:Ke?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:ea?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Xr(Q,_)}),mr(Q)?(0,s.jsx)("div",{className:"results-row-meta",children:Un(Q)}):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:[m&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ei(Q.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[Q.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[Q.line_id]?i(Q.line_id):r(Xn(k))},disabled:!Ke,"aria-label":a[Q.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[Q.line_id]?"\u2713 Added":m?"+ Add":`Add to ${f}`})]})]},Q.line_id)})})}):null,mm]})]}):(0,s.jsxs)(s.Fragment,{children:[ne&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:ne,"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"}}),qe==="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"}),qe==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:m?"Selection":b?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[Yt.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:qe==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),qc.map(k=>{let{item:Q,result:he,decision:ut,best:Ke}=k;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>Ei(Q.line_id),onMouseEnter:ea=>{fe.current=ea.currentTarget,Vn()},onMouseLeave:()=>{fe.current=null,ce(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Xr(Q,_)}),mr(Q)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(zd,{meta:x.get(Q.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Un(Q)})]}):null]}),(0,s.jsx)("td",{children:Ke?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Ke.description,children:Ke.description}),qe==="detailed"&&ut?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[D_(ut.technical_classification),ut.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Ke?.price!=null?An(Ke.price,Ke.price_basis):"-"}),qe==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[Q.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:ea=>{ea.stopPropagation(),a[Q.line_id]?i(Q.line_id):r(Xn(k))},"aria-label":a[Q.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[Q.line_id]?"\u2713 Added":m?"+ Add":`Add to ${f}`})})]},Q.line_id)})]})]})}),mm]}),!P&&hr>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(vt-1)*nl+1,"\u2013",Math.min(vt*nl,Yt.length)," of ",Yt.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>He(vt-1),disabled:vt===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",vt," of ",hr]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>He(vt+1),disabled:vt===hr,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."})]}),!P&&(0,s.jsxs)("div",{className:"btn-row results-actions",children:[(0,s.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:()=>H(!0),"aria-label":"Start over",children:[(0,s.jsx)(Cd,{}),(0,s.jsx)("span",{children:"Start Over"})]}),(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:n,disabled:Tc===0,"aria-label":m?"View selection":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[m?"View Selection":b?"View Quote":"View Basket"," (",Tc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})]})]}),n0&&(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:Kr.map(k=>{let Q=Me.has(k.item.line_id),he=rt(k);return(0,s.jsx)("div",{className:`review-gate-item${Q?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{$(!0),Ei(k.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Xr(k.item,_)}),(0,s.jsx)("span",{children:k.decision?.reason||(he?"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:Q?"Choice made":"Choose a product"})]})},k.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:c0,children:"Skip all"}),Cc.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),Cc.map(k=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{M(Q=>{let he=new Set(Q);return he.delete(k.item.line_id),he}),$(!0),Ei(k.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Xr(k.item,_)}),(0,s.jsx)("span",{children:`Not added to your ${f}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},k.item.line_id))]}):null]})}),z&&(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:()=>H(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{H(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var ht=Y(je());var Rt=Y(je()),Cv=Y(ee());function Dn(e){return JSON.stringify([e.productId,e.qty,e.unit,e.linkedContext??[]])}function Z_(e,t){let a={...e,[t.lineId]:t};for(let[r,i]of Object.entries(a)){if(!i.linkedContext)continue;let n=i.linkedContext.find(l=>l.role==="anchor"&&l.line_id&&a[l.line_id]),o=n?.line_id?a[n.line_id]:void 0;if(!(!n||!o||n.product_id===o.productId&&n.description===o.description)){if(i.conversionType!=="basket_line_unit"){a[r]={...i,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l)};continue}a[r]={...i,qty:0,sellUnitsOverride:null,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l),conversionType:null,requestUomsSupported:null,salesUomNormalised:null,salesUnitSize:null,salesUnitSizeUom:null,coverageQty:null,coverageUom:null,roundingRule:null,conversionConfidence:null,conversionNotes:null}}}return a}var Dd=(0,Rt.createContext)(null);function lc({children:e,onOpenBasket:t}){let[a,r]=(0,Rt.useState)({}),i=(0,Rt.useCallback)(f=>{r(w=>Z_(w,f))},[]),n=(0,Rt.useCallback)(f=>{r(w=>{let _={...w};for(let E of f)_[E.lineId]=E;return _})},[]),o=(0,Rt.useCallback)(f=>{r(w=>{let _={...w};return delete _[f],_})},[]),l=(0,Rt.useCallback)((f,w)=>{r(_=>_[f]?{..._,[f]:{..._[f],qty:w,sellUnitsOverride:null}}:_)},[]),c=(0,Rt.useCallback)((f,w)=>{r(_=>_[f]?{..._,[f]:{..._[f],sellUnitsOverride:w}}:_)},[]),p=(0,Rt.useCallback)(f=>{r(w=>{let _=!1,E={...w};for(let[D,h]of Object.entries(f))E[D]&&(E[D]={...E[D],...h},_=!0);return _?E:w})},[]),m=(0,Rt.useCallback)(()=>r({}),[]),b=(0,Rt.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:i,addManyToCart:n,removeFromCart:o,updateCartQty:l,updateCartSellUnits:c,updateCartConversions:p,clearCart:m,openBasket:t??(()=>{})}),[a,i,n,o,l,c,p,m,t]);return(0,Cv.jsx)(Dd.Provider,{value:b,children:e})}function On(){let e=(0,Rt.useContext)(Dd);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function Nv(){return(0,Rt.useContext)(Dd)}var q=Y(ee()),qv=.2,ol=10,Ev="Enter a valid email address so we can send your quote.",K_=(e,t)=>{let a=`${t.requestedAmount} ${xa(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${xa(t.sellUnit,t.requiredSellUnits??0)}`,i=e.unitConversions?.find(n=>n.requestUom===t.requestedUnit);return i&&i.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/i.quantityPerSaleUnit)} ${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}`},P_=e=>["box","pack"].includes(e.requestedUnit)?"Pack size needed to calculate the order quantity.":`This product is sold by ${xa(e.sellUnit,1)}.`;function J_(){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 ll(){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 sl({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:i,onBack:n,onStartNewQuote:o,onQuoteRequested:l,internal:c=!1}){let p=(0,ht.useId)(),m=!c&&Ks()==="QZA6-MRA4",b=Object.values(e),[f,w]=(0,ht.useState)(""),[_,E]=(0,ht.useState)(!1),[D,h]=(0,ht.useState)(!1),u=Nn(),[g,v]=(0,ht.useState)(""),[N,R]=(0,ht.useState)({}),[T,U]=(0,ht.useState)({}),[A,B]=(0,ht.useState)(1),[ie,ze]=(0,ht.useState)({}),[He,Ve]=(0,ht.useState)(!1),[qe,we]=(0,ht.useState)("0"),[le,Je]=(0,ht.useState)({}),Ne=(0,ht.useRef)(new Map);(0,ht.useEffect)(()=>{if(!r)return;for(let S of Object.values(e))It(S).requiredSellUnits!=null&&Ne.current.delete(S.lineId);let d=Object.values(e).filter(S=>{if(S.productId==="-"||It(S).requiredSellUnits!=null)return!1;let $=Dn(S);return Ne.current.get(S.lineId)===$?!1:(Ne.current.set(S.lineId,$),!0)});if(d.length===0)return;let M=new Map(d.map(S=>[S.lineId,Dn(S)]));Je(S=>({...S,...Object.fromEntries(M)})),fetch(za("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Cn()},body:JSON.stringify({lines:d.map(S=>({line_id:S.lineId,product_id:S.productId,requested_description:S.requestedDescription??S.description,requested_qty:S.qty,requested_uom:S.unit||null,linked_context:S.linkedContext??[],selected_description:S.description,selected_uoi:S.uoi,selected_uoi_count:S.uoiCount,selected_conversion:{sales_uom_normalised:S.salesUomNormalised,conversion_type:S.conversionType,sales_unit_size:S.salesUnitSize,sales_unit_size_uom:S.salesUnitSizeUom,coverage_qty:S.coverageQty,coverage_uom:S.coverageUom}}))})}).then(S=>S.ok?Qa(S):null).then(S=>{let $={},Z=new Map(d.map(x=>[x.lineId,Dn(x)]));for(let x of S?.data?.items??S?.items??[]){let j=x?.conversion;if(!j||typeof x?.line_id!="string"||Ne.current.get(x.line_id)!==Z.get(x.line_id))continue;let K=e[x.line_id];$[x.line_id]={conversionType:j.conversion_type,requestUomsSupported:j.request_uoms_supported,salesUomNormalised:j.sales_uom_normalised,salesUnitSize:j.sales_unit_size,salesUnitSizeUom:j.sales_unit_size_uom,coverageQty:j.coverage_qty,coverageUom:j.coverage_uom,roundingRule:j.rounding_rule,conversionConfidence:j.conversion_confidence,conversionNotes:j.conversion_notes,...K?.qty===0&&Number.isFinite(j.suggested_order_qty)&&j.suggested_order_qty>0?{qty:j.suggested_order_qty,unit:j.suggested_order_uom||K.unit}:{}}}Object.keys($).length>0&&r($)}).catch(S=>console.error("Catalogue conversion resolution failed",S)).finally(()=>{Je(S=>{let $={...S};for(let[Z,x]of M)$[Z]===x&&delete $[Z];return $})})},[e,r]);function St(d){R(M=>{let S={...M};return delete S[d],S})}function X(d,M){let S=parseFloat(M);!isNaN(S)&&S>=0&&t(d,Math.min(S,1e5)),St(d)}function me(d,M,S){t(d,Math.min(1e5,Math.max(0,M+S))),St(d)}function Re(d){U(M=>{let S={...M};return delete S[d],S})}function Nt(d,M){let S=parseFloat(M);!isNaN(S)&&S>=0&&a(d,Math.min(S,1e5)),Re(d)}function Bt(d,M,S){a(d,Math.min(1e5,Math.max(0,M+S))),Re(d)}async function Ut(){if(Xe.some(({pricing:M})=>M.lineTotal==null)){v("Confirm the highlighted quantities before requesting a quote.");return}let d=f.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){v(Ev);return}v(""),h(!0);try{let M=await fetch(za("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Cn()},body:JSON.stringify({email:d,items:Xe.map(({item:S,pricing:$})=>{let Z=$.requiredSellUnits??$.requestedAmount,x=$.requiredSellUnits!=null?$.sellUnit:$.requestedUnit;return{product_id:S.productId,description:S.description,quantity:Z,unit:xa(x,Z),unit_price:$.requiredSellUnits!=null?$.unitPrice:null,line_total:$.lineTotal}})})});if(!M.ok){let S=await Qa(M);console.error("Quote request failed",M.status,S?.message),v(M.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}Ye!=null&&u("quote_requested",{items:Xe.length,total:Math.round(Ye*100)/100}),E(!0),l?.(),window.scrollTo(0,0)}catch{v("Your request couldn't be sent. Check your connection and try again.")}finally{h(!1)}}let Xe=b.map(d=>({item:d,pricing:It(d,{wasteFactorEnabled:He,wasteFactorOverride:Math.max(0,Number.parseFloat(qe)||0)/100})})),ye=ic(b,{wasteFactorEnabled:He,wasteFactorOverride:Math.max(0,Number.parseFloat(qe)||0)/100}),be=ye==null?null:ye*qv,Ye=ye==null?null:ye*(1+qv),z=Xe.filter(({pricing:d})=>d.lineTotal==null).length,H=Object.keys(le).length,ne=!!r&&b.some(d=>{if(d.productId==="-"||It(d).requiredSellUnits!=null)return!1;let M=Dn(d);return Ne.current.get(d.lineId)!==M||le[d.lineId]===M}),ce=(0,ht.useRef)({items:Xe.length,...Ye==null?{}:{total:Math.round(Ye*100)/100}});(0,ht.useEffect)(()=>{u("basket_viewed",ce.current)},[u]);let fe=Math.max(1,Math.ceil(Xe.length/ol)),Me=Math.min(A,fe),Ze=Xe.slice((Me-1)*ol,Me*ol);return _?(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:f.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."})]})}):!c&&b.length===0?(0,q.jsx)("div",{className:"wizard-step entry-stage",children:(0,q.jsxs)("div",{className:"quote-request-sent",children:[(0,q.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,q.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,q.jsx)("path",{d:"M3 9h18l-2 11H5z"}),(0,q.jsx)("path",{d:"M8 9l4-6 4 6"})]})}),(0,q.jsx)("h1",{children:m?"Your quote request is empty":"Your basket is empty"}),(0,q.jsx)("p",{children:m?"Start again with your list to build your quote.":"Start again with your list to fill your basket."}),(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,q.jsx)("span",{children:"Back to start"})})]})}):(0,q.jsx)("div",{className:`wizard-step entry-stage${m?" basket-layout--qza6-mra4":""}`,children:(0,q.jsxs)("div",{className:`quick-order-card${c?"":" quick-order-card--customer"}`,children:[(0,q.jsxs)("div",{className:`quick-order-hero${c?"":" quick-order-hero--customer"}`,children:[c&&(0,q.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,q.jsxs)("div",{className:"basket-hero-copy",children:[m&&(0,q.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:n,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:c?"Your Selection":m?"Request a quote":"Your Basket"}),c&&(0,q.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,q.jsx)("strong",{children:b.length})," ",b.length===1?"item":"items"]})]}),(0,q.jsx)("p",{children:c?"Review the items you've added before exporting them for review.":m?"Check your items and quantities below, and we'll do our best to beat list prices.":"Review your quantities and order summary before you buy."})]})]}),(0,q.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:ne?(0,q.jsxs)("div",{className:"basket-resolving",role:"status","aria-label":"Calculating order quantities",children:[(0,q.jsx)("span",{className:"basket-resolving-wheel","aria-hidden":"true"}),(0,q.jsx)("span",{children:"Calculating your quantities\u2026"})]}):b.length===0?(0,q.jsxs)("div",{className:"quick-order-history-empty",children:[(0,q.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:"\u{1F4CB}"}),(0,q.jsx)("p",{children:"Your selection is empty."}),(0,q.jsx)("p",{className:"basket-empty-hint",children:"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:n,"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":c?"Selection items":m?"Quote request items":"Basket items",children:Ze.map(({item:d,pricing:M})=>{let S=N[d.lineId]??String(M.requestedAmount),$=M.requestedUnit===M.sellUnit||M.costingMode==="review",Z=M.requiredSellUnits==null||M.requestedAmount!==M.requiredSellUnits||M.requestedUnit!==M.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:Ga(d.description,d.productId,d.pdpPhotoUrl),alt:"",width:48,height:48}),(0,q.jsxs)("div",{className:"basket-card-info",children:[(0,q.jsx)("div",{className:"bom-component-name",children:d.description}),Z&&M.costingMode!=="review"&&(0,q.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>ze(x=>({...x,[d.lineId]:!x[d.lineId]})),"aria-expanded":!!ie[d.lineId],children:["How we calculated this",(0,q.jsx)("span",{className:`basket-calc-toggle-chevron${ie[d.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("div",{className:"basket-card-actions",children:(0,q.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>i(d.lineId),"aria-label":`Remove ${d.description}`,children:(0,q.jsx)(J_,{})})})]}),c&&(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:d.conversionType??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion confidence"}),(0,q.jsx)("dd",{children:d.conversionConfidence??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Sales unit"}),(0,q.jsx)("dd",{children:d.salesUnitSize!=null?(0,q.jsxs)(q.Fragment,{children:[d.salesUnitSize," ",ka(d.salesUnitSizeUom,d.salesUnitSize)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Coverage"}),(0,q.jsx)("dd",{children:d.coverageQty!=null?(0,q.jsxs)(q.Fragment,{children:[d.coverageQty," ",ka(d.coverageUom,d.coverageQty)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Waste factor"}),(0,q.jsx)("dd",{children:d.wasteFactorDefault??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Rounding rule"}),(0,q.jsx)("dd",{children:d.roundingRule??"-"})]})]}),d.conversionNotes&&(0,q.jsx)("p",{className:"results-rerank-note",children:d.conversionNotes})]}),M.costingMode==="review"?(0,q.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,q.jsx)("strong",{children:le[d.lineId]===Dn(d)?"Calculating order quantity\u2026":"Quantity needs confirmation."})," ",P_(M)]}):Z&&ie[d.lineId]?(0,q.jsx)("p",{className:"basket-calc-text",children:K_(d,M)}):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:S,disabled:$,onChange:x=>R(j=>({...j,[d.lineId]:x.target.value})),onBlur:x=>X(d.lineId,x.target.value),onKeyDown:x=>{x.key==="Enter"&&x.target.blur()},"aria-label":`${d.description} requested quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:$,onClick:()=>me(d.lineId,parseFloat(S)||0,1),"aria-label":`Increase ${d.description} quantity`,children:(0,q.jsx)(ll,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:$,onClick:()=>me(d.lineId,parseFloat(S)||0,-1),"aria-label":`Decrease ${d.description} quantity`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(M.requestedUnit,parseFloat(S)||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:T[d.lineId]??String(M.requiredSellUnits??""),onChange:x=>U(j=>({...j,[d.lineId]:x.target.value})),onBlur:x=>Nt(d.lineId,x.target.value),onKeyDown:x=>{x.key==="Enter"&&x.target.blur()},"aria-label":`${d.description} order quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>Bt(d.lineId,parseFloat(T[d.lineId]??String(M.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${d.description} order quantity`,children:(0,q.jsx)(ll,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>Bt(d.lineId,parseFloat(T[d.lineId]??String(M.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${d.description} order quantity`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(M.sellUnit,parseFloat(T[d.lineId]??String(M.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:M.lineTotal!=null?lt(M.lineTotal):"-"}),M.lineTotal!=null&&(0,q.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},d.lineId)})}),fe>1&&(0,q.jsxs)("div",{className:"results-pagination",children:[(0,q.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(Me-1)*ol+1,"\u2013",Math.min(Me*ol,Xe.length)," of ",Xe.length]}),(0,q.jsxs)("div",{className:"results-pagination-controls",children:[(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>B(Me-1),disabled:Me===1,children:"Previous"}),(0,q.jsxs)("span",{className:"results-pagination-page",children:["Page ",Me," of ",fe]}),(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>B(Me+1),disabled:Me===fe,children:"Next"})]})]})]}),(0,q.jsxs)("aside",{className:"basket-sidebar",children:[(0,q.jsx)("div",{className:"basket-sidebar-title",children:m?"Quote request summary":"Order summary"}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:m?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,q.jsx)("span",{children:ye==null?"To confirm":lt(ye)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:"VAT (20%)"}),(0,q.jsx)("span",{children:be==null?"To confirm":lt(be)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,q.jsx)("span",{children:m?"List price (inc.\xA0VAT)":"Total"}),(0,q.jsx)("span",{children:Ye==null?"To confirm":lt(Ye)})]}),!m&&(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:He,onChange:d=>Ve(d.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:qe,onChange:d=>we(d.target.value),disabled:!He,"aria-label":"Waste factor percent"}),(0,q.jsx)("span",{children:"%"})]})]})}),(0,q.jsx)("label",{htmlFor:`${p}-basket-reference`,className:"basket-sidebar-label",children:m?"Enter email for your sharper quote":"Your reference (optional)"}),(0,q.jsx)("input",{id:`${p}-basket-reference`,type:m?"email":"text",className:"basket-sidebar-input",value:f,onChange:d=>{w(d.target.value),m&&v("")},placeholder:m?"you@example.com":"PO number or job reference","aria-invalid":m&&g===Ev,"aria-describedby":m&&g?`${p}-basket-reference-error`:void 0}),m&&g&&(0,q.jsx)("p",{id:`${p}-basket-reference-error`,className:"basket-quote-request-error",role:"alert",children:g}),m?(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{Ut()},disabled:D||z>0||H>0,"aria-busy":D,children:(0,q.jsx)("span",{children:D?"Sending\u2026":"Request our best quote"})}):(0,q.jsx)("button",{className:"cta-btn",onClick:()=>{u("downloaded",{type:"basket",items:b.length}),yv(b)},"aria-label":c?"Download selection":"Download basket",children:(0,q.jsx)("span",{children:c?"Download Quote":"Buy Now"})}),(0,q.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,q.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),m?"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:n,"aria-label":"Back to results",children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]})})]})})]})})}var Sa=Y(ee()),Bd="metron-quick-quote",F_=1440*60*1e3;function sc(e){return(0,Sa.jsx)(lc,{children:(0,Sa.jsx)(I_,{...e})})}function I_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,i]=(0,De.useState)("entry"),[n,o]=(0,De.useState)(null),[l,c]=(0,De.useState)(""),p=(0,De.useRef)(null),m=(0,De.useRef)(0),[b,f]=(0,De.useState)(0),[w,_]=(0,De.useState)(null),[E,D]=(0,De.useState)(!1),{cart:h,addToCart:u,addManyToCart:g,removeFromCart:v,updateCartQty:N,updateCartSellUnits:R,updateCartConversions:T,clearCart:U}=On(),[A,B]=(0,De.useState)(!1),[ie,ze]=(0,De.useState)(null),He=()=>{ze(null);try{window.sessionStorage.removeItem(rc)}catch{}},Ve=(0,De.useRef)(null),qe=Zs("quick-quote",Ve);(0,De.useEffect)(()=>{qe("viewed")},[qe]);let[we,le]=(0,De.useState)(!1);(0,De.useEffect)(()=>{uv();let ye=window.location.hash,be=null;try{be=JSON.parse(window.sessionStorage.getItem(Bd)??"null")}catch{}if(be&&!(Date.now()-(be.savedAt??0)<F_)&&(be=null),be?.scheduleResult)o("schedule"),_(be.scheduleResult),D(be.reviewGateComplete),B(be.cartSeeded),g(Object.values(be.cart)),ye==="#quote-request"?i("basket"):ye==="#matched-products"&&i("results");else if(ye==="#matched-products"||ye==="#quote-request"){let Ye=new URL(window.location.href);Ye.hash="",Mn("replaceState",window.history.state,Ye)}le(!0)},[]),(0,De.useEffect)(()=>{if(we)try{w?window.sessionStorage.setItem(Bd,JSON.stringify({savedAt:Date.now(),scheduleResult:w,reviewGateComplete:E,cartSeeded:A,cart:h})):window.sessionStorage.removeItem(Bd)}catch{}},[we,w,E,A,h]);let Je=(0,De.useCallback)(ye=>{if(typeof window>"u")return;let be=new URL(window.location.href);be.hash=ye==="basket"?"quote-request":"matched-products";let Ye=ye==="results"&&(window.location.hash==="#matched-products"||window.location.hash==="#quote-request");Mn(Ye?"replaceState":"pushState",{boqQuoteStage:ye},be)},[]),Ne=(0,De.useRef)(!1);(0,De.useEffect)(()=>{let ye=()=>{Ne.current=!1;let be=window.location.hash;be==="#quote-request"?i("basket"):be==="#matched-products"&&w?(o("schedule"),i("results")):i("entry")};return window.addEventListener("popstate",ye),()=>window.removeEventListener("popstate",ye)},[w]);let St=(0,De.useCallback)(()=>{Je("basket"),i("basket")},[Je]),X=(0,De.useCallback)(()=>{if(window.location.hash==="#quote-request"){if(Ne.current)return;Ne.current=!0,ac();return}i(w?"results":"entry")},[w]),me=(0,De.useRef)(r);(0,De.useEffect)(()=>{me.current!==r&&(me.current=r,window.scrollTo(0,0))},[r]);let Re=()=>{i("entry"),o(null),c(""),f(0),_(null),D(!1),U(),B(!1),He()},Nt=(0,De.useCallback)(async(ye,be,Ye=!0)=>{let z=++m.current;c(""),f(0);let H=0,ne=()=>{H=Math.min(H+1,3),f(H)};try{let{jobId:ce}=await bw(ye,be,Ye);if(z!==m.current)return;let{promise:fe,cancel:Me}=vw(()=>ww(ce),5e3,ne,"schedule");p.current=Me;let Ze=await fe;if(Ze.status==="failed"||!Ze.result)throw new Error(Ze.error||"Failed to process schedule");let d=Ze.result.lineItems.length,M=Ze.result.results.filter(S=>S.candidates.length>0).length;qe("results_shown",{lines:d,matched:M,unmatched:d-M}),U(),B(!1),D(!1),_(Ze.result),Je("results"),i("results")}catch(ce){if(z!==m.current)return;qe("error",{stage:"matching"}),c(ce?.message||"Failed to process schedule"),i("entry")}finally{z===m.current&&(p.current?.(),p.current=null)}},[Je,qe,U]),Bt=(0,De.useCallback)(()=>{m.current++,p.current?.(),p.current=null},[]),Ut=(0,De.useCallback)(async(ye,be,Ye=!0)=>{if(!ye.trim())return;o("schedule");let z=new File([ye],"pasted-schedule.txt",{type:"text/plain"});await Nt(z,be,Ye)},[Nt]),Xe=(0,De.useCallback)(async ye=>{o("schedule"),await Nt(ye)},[Nt]);return(0,Sa.jsx)(Fo.Provider,{value:qe,children:(0,Sa.jsx)("div",{ref:Ve,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:Ot().theme,children:(0,Sa.jsxs)("main",{className:"main-content",children:[l&&(0,Sa.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Sa.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Sa.jsx)(Sd,{onPasteSchedule:Ut,onUploadSchedule:Xe,onEntryModeChange:o,draft:ie,onSubmitDraft:ze,onCancelMatch:Bt}),r==="results"&&n==="schedule"&&w&&(0,Sa.jsx)(Ud,{scheduleResult:w,onStartOver:Re,cart:h,onAddToCart:u,onRemoveFromCart:v,onGoToBasket:St,cartSeeded:A,onCartSeeded:()=>B(!0),reviewGateComplete:E,onReviewGateComplete:()=>D(!0),internal:a}),r==="basket"&&(0,Sa.jsx)(sl,{cart:h,onUpdateQty:N,onUpdateSellUnits:R,onResolveConversions:T,onRemove:v,onBack:X,onStartNewQuote:Re,onQuoteRequested:()=>{_(null),D(!1),B(!1),U(),He()},internal:a})]})})})}var $a=Y(je());var yi=Y(je());var Mv={"NZ4Y-ZMSQ":{"brick-block":{"brick-common":"105499","brick-engineering-red":"1654","brick-engineering-blue":"1723",block:"501","mortar-cement":"1762 cement","mortar-sand":"564 building sand"},skirting:{"skirting-chamfered":"1525","skirting-ogee":"135 primed mdf ogee","skirting-pencil-round":"892","skirting-torus":"1941"},architrave:{"architrave-ogee":"134 primed mdf ogee","architrave-pencil-round":"1896","architrave-square-edge":"118 primed mdf square","architrave-torus":"1531"},plasterboard:{standard:"1647",moisture:"11 moisture plasterboard",fire:"14 fire plasterboard",sound:"1769",screws:"131160",tape:"1766",adhesive:"108439"},paint:{"paint-emulsion":"157217"},"concrete-aggregate":{cement:"1762 cement","sharp-sand":"563",gravel:"571",mot:"569"},insulation:{"insulation-floor":"152187","insulation-ground":"442","insulation-wall":"147","insulation-roof":"442","insulation-loft":"152180"},timber:{studs:"1213",joists:"208",battens:"1729"},fencing:{"panels-boundary-0.9":"66 lap fence panel","panels-boundary-1.2":"1450","panels-boundary-1.5":"1449","panels-boundary-1.8":"1448","panels-skyline-1.8":"1475","concrete-intermediate-8":"40197","concrete-end-8":"40198","timber-post-6":"141411","timber-post-8":"1709",postcrete:"12142","gate-boundary":"1984","gate-skyline":"40002","gravel-boards":"40200"},decking:{"boards-summit":"24322",joists:"208",screws:"131079"},paving:{"surface-council":"1669","surface-raj":"12363","surface-brindle":"304","surface-charcoal":"296","surface-pea":"431","sub-base":"569",bedding:"563"}}};function cl(e,t){let a=Mv[Ot().client??""]?.[e];if(!a)return null;let r=e==="plasterboard"&&t.key==="board"?t.label.split(" ")[0].toLowerCase():t.key;return a[r]??null}function vi(e,t){let a=Mv[Ot().client??""]?.[e];return!a||t in a}function Tv(e,t){let a=t.map(r=>{let i=cl(e,r);return i?{key:r.key,productId:i.split(" ")[0],search:i,qty:r.qty,unit:r.unit}:null});return a.length>0&&a.every(Boolean)?a:null}var W=Y(ee()),zv=[{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"}],cc=e=>Number.parseFloat(e)||0,Rv=(e,t)=>cc(e)*(t==="m"?1:.3048),Ld=(e,t)=>cc(e.quantity)*(2*Rv(e.height,t)+Rv(e.width,t)),W_=()=>({quantity:"1",width:"",height:""});function ex({profile:e}){return(0,W.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,W.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,W.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function Hd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,yi.useState)("m"),[n,o]=(0,yi.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,c]=(0,yi.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,m]=(0,yi.useState)([]),[b,f]=(0,yi.useState)("ogee"),[w,_]=(0,yi.useState)("2.4"),E=(N,R,T)=>{N(U=>({...U,[R]:T}))},D=Ld(n,r)+Ld(l,r)+p.reduce((N,R)=>N+Ld(R,r),0),h=cc(w)>0?Math.ceil(D/cc(w)):0,u=zv.find(N=>N.id===b)?.label??"",g=[{key:`architrave-${b}`,label:`Architrave (${u})`,qty:D,unit:"m",query:`${u} architrave`,category:"architrave"}],v=(N,R,T,U)=>(0,W.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,W.jsx)("span",{children:N}),(0,W.jsx)("input",{"aria-label":`${N} quantity`,type:"number",min:"0",step:"1",value:R.quantity,onChange:A=>T("quantity",A.target.value)}),(0,W.jsx)("input",{"aria-label":`${N} width`,type:"number",min:"0",step:"0.01",value:R.width,onChange:A=>T("width",A.target.value)}),(0,W.jsx)("input",{"aria-label":`${N} height`,type:"number",min:"0",step:"0.01",value:R.height,onChange:A=>T("height",A.target.value)}),U?(0,W.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:U,children:"Remove"}):null]});return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)("div",{className:"truss-estimator",children:[(0,W.jsxs)("div",{className:"quick-order-hero",children:[(0,W.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,W.jsx)("h1",{children:"Architrave Calculator"}),(0,W.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,W.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,W.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,W.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,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,W.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,W.jsx)("span",{children:"Units"}),(0,W.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,W.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metres"}),(0,W.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Feet"})]})]}),(0,W.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,W.jsx)("span",{children:"Opening"}),(0,W.jsx)("span",{children:"Qty"}),(0,W.jsxs)("span",{children:["Width (",r,")"]}),(0,W.jsxs)("span",{children:["Height (",r,")"]}),(0,W.jsx)("span",{})]}),v("Single doors",n,(N,R)=>E(o,N,R)),v("Double doors",l,(N,R)=>E(c,N,R)),p.map((N,R)=>v(`Alternative door ${R+1}`,N,(T,U)=>m(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B)),()=>m(T=>T.filter((U,A)=>A!==R)))),(0,W.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>m(N=>[...N,W_()]),children:"+ Add alternative-sized door"})]}),(0,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,W.jsx)("div",{className:"architrave-calculator__profiles",children:zv.filter(N=>vi("architrave",`architrave-${N.id}`)).map(N=>(0,W.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b===N.id?" is-selected":""}`,onClick:()=>f(N.id),children:[(0,W.jsx)(ex,{profile:N.id}),(0,W.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,W.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,W.jsx)("div",{className:"architrave-calculator__options",children:(0,W.jsxs)("label",{className:"truss-estimator__field",children:[(0,W.jsx)("span",{children:"Board length (m)"}),(0,W.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,W.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,W.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("span",{children:"Architrave needed"}),(0,W.jsxs)("strong",{children:[D.toFixed(2)," m"]})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("span",{children:"Board lengths"}),(0,W.jsx)("strong",{children:h})]})]})]}),(0,W.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,W.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,W.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:D<=0,children:a})]})]})]})})}var _i=Y(je()),ae=Y(ee()),Av=60,Uv=10,tx=.02,ax=.012,Dv=1,Ov=4,rx=1.33,ix=1440,nx=1600,Bn=e=>Number.parseFloat(e)||0,ox=(e,t=2)=>e.toFixed(t);function jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,_i.useState)("brick"),[n,o]=(0,_i.useState)("engineering-red"),[l,c]=(0,_i.useState)("metric"),[p,m]=(0,_i.useState)(""),[b,f]=(0,_i.useState)(""),[w,_]=(0,_i.useState)(!0),E=l==="metric"?Bn(p)*Bn(b):Bn(p)*Bn(b)*.092903,h=E*(r==="brick"?Av:Uv),u=Math.ceil(h),v=E*(r==="brick"?tx:ax)*rx/(Dv+Ov),N=Math.ceil(v*Dv*ix),R=Math.ceil(v*Ov*nx),T=l==="metric"?E:E*10.7639,U=[{key:r==="brick"?`brick-${n}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[n]:"Blocks",qty:u,unit:"each",query:r==="brick"?"facing brick":"concrete block",category:"masonry"},...w?[{key:"mortar-cement",label:"General purpose cement",qty:N,unit:"kg",query:"general purpose cement",category:"cement"},{key:"mortar-sand",label:"Building sand",qty:R,unit:"kg",query:"building sand",category:"aggregate"}]:[]],A=B=>{if(B===l)return;let ie=B==="imperial"?3.28084:.3048;m((Bn(p)*ie).toFixed(2)),f((Bn(b)*ie).toFixed(2)),c(B)};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:"Brick and Block Calculator"}),(0,ae.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,ae.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,ae.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,ae.jsx)("p",{className:"truss-estimator__step-sub",children:"Pick brick or block and enter the wall dimensions for unit counts plus the cement and sand for the mortar."}),(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,ae.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([B,ie])=>(0,ae.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===B?" is-selected":""}`,onClick:()=>i(B),children:[(0,ae.jsx)("div",{className:"truss-estimator__option-title",children:ie}),(0,ae.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",B==="brick"?Av:Uv," per m\xB2"]})]},B))})]}),r==="brick"&&(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,ae.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(([B,ie,ze])=>(0,ae.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n===B?" is-selected":""}`,onClick:()=>o(B),children:[(0,ae.jsx)("div",{className:"truss-estimator__option-title",children:ie}),(0,ae.jsx)("div",{className:"truss-estimator__option-copy",children:ze})]},B))})]}),(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,ae.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,ae.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>A("metric"),children:"Metric"}),(0,ae.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>A("imperial"),children:"Imperial"})]}),(0,ae.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ae.jsxs)("label",{className:"truss-estimator__field",children:[(0,ae.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,ae.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:B=>m(B.target.value)})]}),(0,ae.jsxs)("label",{className:"truss-estimator__field",children:[(0,ae.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,ae.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:B=>f(B.target.value)})]})]})]}),(0,ae.jsx)("div",{className:"brick-calculator__options",children:(0,ae.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,ae.jsx)("input",{type:"checkbox",checked:w,onChange:B=>_(B.target.checked)}),(0,ae.jsx)("span",{children:"Include mortar (cement and building sand, mixed 1:4)"})]})}),(0,ae.jsxs)("div",{className:"brick-calculator__totals",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ae.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Wall area"}),(0,ae.jsxs)("strong",{children:[ox(T)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,ae.jsx)("strong",{children:u.toLocaleString("en-GB")})]}),w?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Cement"}),(0,ae.jsxs)("strong",{children:[N," kg"]})]}),(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Building sand"}),(0,ae.jsxs)("strong",{children:[R," kg"]})]})]}):null]}),(0,ae.jsx)("p",{className:"brick-calculator__note",children:"Estimate based on standard nominal sizes and 10mm joints. Mortar is a general purpose 1:4 cement and sand mix; quantities are approximate, so confirm the specification before ordering."})]}),(0,ae.jsxs)("div",{className:"brick-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?.(U),disabled:E<=0,children:a})]})]})]})})}var xi=Y(je()),I=Y(ee()),lx=1.54,sx=1440,Qd=e=>Number.parseFloat(e)||0,Zr={mot:{label:"MOT Type 1",blurb:"Sub-base for patios and driveways",density:1.7,query:"MOT type 1"},"sharp-sand":{label:"Sharp sand",blurb:"Bedding and general groundwork",density:1.6,query:"sharp sand"},gravel:{label:"20mm gravel",blurb:"Drainage and landscaping",density:1.6,query:"20mm gravel"}};function Gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,xi.useState)("m"),[n,o]=(0,xi.useState)(""),[l,c]=(0,xi.useState)(""),[p,m]=(0,xi.useState)(""),[b,f]=(0,xi.useState)("concrete"),[w,_]=(0,xi.useState)("mot"),E=r==="m"?1:.3048,D=Qd(n)*E*Qd(l)*E*Qd(p)*(r==="m"?.01:.0254),h=Zr[w],u=D*lx/7,g=u*sx,v=u*2,N=u*4,R=(U,A)=>Math.ceil(U*A*1e3),T=b==="concrete"?[{key:"cement",label:"General purpose cement",qty:Math.ceil(g),unit:"kg",query:"general purpose cement"},{key:"sharp-sand",label:"Sharp sand",qty:R(v,Zr["sharp-sand"].density),unit:"kg",query:Zr["sharp-sand"].query},{key:"gravel",label:"20mm gravel",qty:R(N,Zr.gravel.density),unit:"kg",query:Zr.gravel.query}]:[{key:w,label:h.label,qty:R(D,h.density),unit:"kg",query:h.query}];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:"Concrete and Aggregate Calculator"}),(0,I.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,I.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,I.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,I.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the area and depth. The calculator works out the materials and adds them to your basket."}),(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,I.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b==="concrete"?" is-selected":""}`,onClick:()=>f("concrete"),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b==="aggregate"?" is-selected":""}`,onClick:()=>f("aggregate"),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),b==="aggregate"&&(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,I.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Zr).map(U=>(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===U?" is-selected":""}`,onClick:()=>_(U),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:Zr[U].label}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:Zr[U].blurb})]},U))})]}),(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,I.jsxs)("div",{className:"materials-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:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metric"}),(0,I.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Imperial"})]})]}),(0,I.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,I.jsxs)("label",{className:"truss-estimator__field",children:[(0,I.jsxs)("span",{children:["Length (",r,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:U=>o(U.target.value)})]}),(0,I.jsxs)("label",{className:"truss-estimator__field",children:[(0,I.jsxs)("span",{children:["Width (",r,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:U=>c(U.target.value)})]})]}),(0,I.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,I.jsxs)("span",{children:["Depth (",r==="m"?"cm":"inches",")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.1",value:p,onChange:U=>m(U.target.value)})]})]}),(0,I.jsxs)("div",{className:"materials-calculator__totals",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,I.jsx)("div",{className:"materials-calculator__result-grid",children:b==="concrete"?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Cement"}),(0,I.jsxs)("strong",{children:[g.toFixed(0)," kg"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Sharp sand"}),(0,I.jsxs)("strong",{children:[v.toFixed(2)," m\xB3"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"20mm aggregate"}),(0,I.jsxs)("strong",{children:[N.toFixed(2)," m\xB3"]})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:h.label}),(0,I.jsxs)("strong",{children:[D.toFixed(2)," m\xB3"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Approx. weight"}),(0,I.jsxs)("strong",{children:[(D*h.density).toFixed(2)," t"]})]}),(0,I.jsx)("div",{})]})}),(0,I.jsx)("p",{className:"materials-calculator__note",children:b==="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."})]}),(0,I.jsxs)("div",{className:"materials-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?.(T),disabled:D<=0,children:a})]})]})]})})}var Ya=Y(je());var O=Y(ee()),Ln=12,Hn=8,uc=.56,Bv=.21,Ra={ranges:{meridian:{label:"Standard grooved timber",blurb:"32 \xD7 125mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.125},summit:{label:"Wide grooved timber",blurb:"32 \xD7 150mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.15}},boardGapM:.006,wastage:{straight:.05,diagonal:.15},pictureFrame:{extraWastage:.08},joist:{spacingOptions:[{id:"300",label:"300mm centres (heavy duty)",spacingM:.3},{id:"400",label:"400mm centres (standard)",spacingM:.4},{id:"450",label:"450mm centres (light use)",spacingM:.45}]}},ki=["range","grid","pictureFrame","substructure"],cx={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:""}},pc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),dc=(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),ux=(e,t,a,r)=>{let i=pc(e,t,a),n=pc(e,t,r),o=pc(a,r,e),l=pc(a,r,t);return i===0&&dc(e,t,a)||n===0&&dc(e,t,r)||o===0&&dc(a,r,e)||l===0&&dc(a,r,t)?!0:i>0!=n>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 i=e[(r+1)%e.length];for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&ux(e[r],i,e[n],e[(n+1)%e.length]))return!0}return!1};function $d({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ya.useState)(0),[n,o]=(0,Ya.useState)(cx),[l,c]=(0,Ya.useState)(1),[p,m]=(0,Ya.useState)({x:0,y:0}),[b,f]=(0,Ya.useState)(null),w=(0,Ya.useRef)(null),_=(0,Ya.useRef)(null),E=(0,Ya.useRef)(null),D=ki[r],h=n.range?Ra.ranges[n.range]:null,u=Ln/l,g=Hn/l,v=(Ln-u)/2,N=(Hn-g)/2,R=Math.max(-Ln,Math.min(Ln*2-u,v+p.x)),T=Math.max(-Hn,Math.min(Hn*2-g,N+p.y)),U=Number.parseFloat(n.quickLengthM),A=Number.parseFloat(n.quickWidthM),B=U>0&&A>0,ie=z=>Math.abs(z.reduce((H,ne,ce)=>{let fe=z[(ce+1)%z.length];return H+ne.x*fe.y-fe.x*ne.y},0))/2,ze=(z,H)=>Math.hypot(H.x-z.x,H.y-z.y),He=n.isOutlineClosed?ie(n.points):0,Ve=n.isOutlineClosed?n.points.reduce((z,H,ne)=>z+ze(H,n.points[(ne+1)%n.points.length]),0):0,qe=n.isOutlineClosed?n.points.reduce((z,H,ne)=>z+(n.wallSegments.has(ne)?0:ze(H,n.points[(ne+1)%n.points.length])),0):0,we=n.points.reduce((z,H)=>({x:z.x+H.x/n.points.length,y:z.y+H.y/n.points.length}),{x:0,y:0}),le=n.points.length>1?(()=>{let z=n.points[0],H=n.points[1],ne=ze(z,H),ce=ne?-(H.y-z.y)/ne:0,fe=ne?(H.x-z.x)/ne:0,Me=(z.x+H.x)/2,Ze=(z.y+H.y)/2,d=ce*(Me-we.x)+fe*(Ze-we.y)>=0?1:-1;return{x:Me+ce*uc*d,y:Ze+fe*uc*d}})():null,Ne=(()=>{let z=n.range?Ra.ranges[n.range]:Ra.ranges.meridian,H=n.deckSizeMode==="quick"?U*A:He,ne=n.deckSizeMode==="quick"?2*(U+A):qe,ce=n.direction==="diagonal"?Ra.wastage.diagonal:Ra.wastage.straight,fe=n.pictureFrame==="yes"?Ra.pictureFrame.extraWastage:0,Ze=H/(z.boardWidthM+Ra.boardGapM)/z.boardLengthM,d=Math.ceil(Ze*(1+ce+fe)),M=Math.ceil(H*30*(1+ce+fe)/200),S=Ra.joist.spacingOptions.find(x=>x.id===n.joistSpacing)??Ra.joist.spacingOptions[1],$=H/S.spacingM,Z=Math.ceil($);return{range:z,area:H,boardCount:d,screwBoxes:M,joistMetres:Z,spacing:S}})(),St=Ne?[{key:`boards-${n.range??"meridian"}`,label:`Deck boards (${Ne.range.label})`,qty:Math.round(Ne.boardCount*Ne.range.boardLengthM*100)/100,unit:"m",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:Ne.joistMetres,unit:"m",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:Ne.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],X=()=>D==="range"?!!n.range:D==="grid"?n.deckSizeMode==="quick"?B:n.isOutlineClosed&&He>0:D==="pictureFrame"?!!n.pictureFrame&&!!n.direction:D==="substructure"?!!n.joistSpacing:!0,me=r===ki.length-1?a:"Next",Re=(z,H,ne=!1)=>{let ce=E.current?.getBoundingClientRect();if(!ce)return null;let fe=ne?1:.25;return{x:Math.round(Math.max(R,Math.min(R+u,R+(z-ce.left)/ce.width*u))/fe)*fe,y:Math.round(Math.max(T,Math.min(T+g,T+(H-ce.top)/ce.height*g))/fe)*fe}},Nt=z=>{if(n.isOutlineClosed){let ne=z.target;if(ne!==z.currentTarget&&!ne.classList.contains("deck-outline__grid"))return;_.current={startX:z.clientX,startY:z.clientY,startViewX:R,startViewY:T},z.currentTarget.setPointerCapture(z.pointerId);return}if(n.drawMode!=="outline")return;let H=Re(z.clientX,z.clientY,!0);H&&(f(null),o(ne=>{let ce=[...ne.points,H];return Yd(ce,!1)?{...ne,drawError:"Edges cannot cross. Choose another corner."}:{...ne,points:ce,drawError:""}}))},Bt=(z,H)=>{if(!n.isOutlineClosed){z.stopPropagation(),H===0&&n.points.length>=3&&o(ne=>({...ne,isOutlineClosed:!0,drawMode:"edges"}));return}z.stopPropagation(),w.current=H,z.currentTarget.setPointerCapture(z.pointerId)},Ut=z=>{if(_.current){let ce=E.current?.getBoundingClientRect();if(!ce)return;let fe=_.current,Me=fe.startViewX-(z.clientX-fe.startX)/ce.width*u,Ze=fe.startViewY-(z.clientY-fe.startY)/ce.height*g;m({x:Me-v,y:Ze-N});return}!n.isOutlineClosed&&n.drawMode==="outline"&&f(Re(z.clientX,z.clientY,!0));let H=w.current;if(H===null)return;let ne=Re(z.clientX,z.clientY);ne&&o(ce=>{let fe=ce.points.map((Me,Ze)=>Ze===H?ne:Me);return Yd(fe,!0)?{...ce,drawError:"Edges cannot cross. Move the corner to a different position."}:{...ce,points:fe,drawError:""}})},Xe=z=>{_.current=null,w.current=null,z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId)},ye=z=>{o(H=>{let ne=new Set(H.wallSegments);return ne.has(z)?ne.delete(z):ne.add(z),{...H,wallSegments:ne}})},be=()=>{r===0?e():i(z=>z-1)},Ye=()=>{X()&&(r===ki.length-1?t?.(St):i(z=>z+1))};return(0,O.jsx)(O.Fragment,{children:(0,O.jsxs)("div",{className:"truss-estimator",children:[(0,O.jsxs)("div",{className:"quick-order-hero",children:[(0,O.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,O.jsx)("h1",{children:"Decking Calculator"}),(0,O.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,O.jsxs)("div",{className:"truss-estimator__card",children:[(0,O.jsxs)("div",{className:"truss-estimator__body",children:[D==="range"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,O.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,O.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Ra.ranges).filter(([z])=>vi("decking",`boards-${z}`)).map(([z,H])=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===z?" is-selected":""}`,onClick:()=>o(ne=>({...ne,range:z})),children:[(0,O.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,O.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb}),(0,O.jsxs)("div",{className:"truss-estimator__option-copy",children:[H.boardLengthM,"m boards"]})]},z))})]}):null,D==="grid"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,O.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,O.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,O.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(z=>({...z,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,O.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(z=>({...z,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),n.deckSizeMode==="quick"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,O.jsxs)("label",{className:"truss-estimator__field",children:[(0,O.jsx)("span",{children:"Length (m)"}),(0,O.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickLengthM,onChange:z=>o(H=>({...H,quickLengthM:z.target.value}))})]}),(0,O.jsxs)("label",{className:"truss-estimator__field",children:[(0,O.jsx)("span",{children:"Width (m)"}),(0,O.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickWidthM,onChange:z=>o(H=>({...H,quickWidthM:z.target.value}))})]})]}),(0,O.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),B?(0,O.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,O.jsxs)("div",{children:[(U*A).toFixed(2)," m\xB2 deck"]}),(0,O.jsxs)("div",{children:[(2*(U+A)).toFixed(2)," m perimeter"]})]}):null]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,O.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,O.jsxs)("div",{className:"deck-outline__toolbar",children:[n.isOutlineClosed?(0,O.jsxs)("div",{className:"deck-outline__summary",children:[(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Deck area"}),(0,O.jsxs)("strong",{children:[He.toFixed(2)," m\xB2"]})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Perimeter"}),(0,O.jsxs)("strong",{children:[Ve.toFixed(2)," m"]})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Wall edges"}),(0,O.jsx)("strong",{children:n.wallSegments.size>0?n.wallSegments.size:"None"})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Visible edge"}),(0,O.jsxs)("strong",{children:[qe.toFixed(2)," m"]})]})]}):null,(0,O.jsxs)("div",{className:"deck-outline__actions",children:[(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(z=>({...z,points:z.points.slice(0,-1)})),disabled:n.points.length===0||n.isOutlineClosed,children:"Undo"}),(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f(null),o(z=>({...z,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:n.points.length===0,children:"Clear"}),(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(z=>({...z,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,O.jsx)("div",{className:"deck-editor-layout",children:(0,O.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,O.jsxs)("div",{className:"deck-outline",children:[(0,O.jsxs)("svg",{ref:E,className:`deck-outline__canvas${n.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${R} ${T} ${u} ${g}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:Nt,onPointerMove:Ut,onPointerUp:Xe,onPointerLeave:()=>{f(null),_.current||(w.current=null)},children:[(0,O.jsx)("defs",{children:(0,O.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,O.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,O.jsx)("rect",{x:-Ln,y:-Hn,width:Ln*3,height:Hn*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),n.points.length>1?(0,O.jsx)("polyline",{className:"deck-outline__preview",points:n.points.map(z=>`${z.x},${z.y}`).join(" ")}):null,n.isOutlineClosed?(0,O.jsx)("polygon",{className:"deck-outline__shape",points:n.points.map(z=>`${z.x},${z.y}`).join(" "),stroke:"none"}):null,n.points.length>1?n.points.slice(0,n.isOutlineClosed?void 0:-1).map((z,H)=>{let ne=n.points[n.isOutlineClosed?(H+1)%n.points.length:H+1],ce=ze(z,ne),fe=ce?-(ne.y-z.y)/ce:0,Me=ce?(ne.x-z.x)/ce:0,Ze=(z.x+ne.x)/2,d=(z.y+ne.y)/2,M=fe*(Ze-we.x)+Me*(d-we.y)>=0?1:-1,S=Ze+fe*uc*M,$=d+Me*uc*M;return(0,O.jsxs)("g",{children:[(0,O.jsx)("line",{className:"deck-outline__edge-hit",x1:z.x,y1:z.y,x2:ne.x,y2:ne.y,onClick:n.isOutlineClosed?()=>ye(H):void 0}),(0,O.jsx)("line",{className:`deck-outline__edge${n.wallSegments.has(H)?" is-wall":""}`,x1:z.x,y1:z.y,x2:ne.x,y2:ne.y,pointerEvents:"none"}),(0,O.jsxs)("text",{className:`deck-outline__edge-label${n.wallSegments.has(H)?" is-wall":""}`,x:S,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:Bv/l,children:[ce.toFixed(2)," m"]})]},`segment-${H}`)}):null,!n.isOutlineClosed&&n.points.length>0&&b?(()=>{let z=n.points[n.points.length-1],H=ze(z,b);if(!H)return null;let ne=-(b.y-z.y)/H,ce=(b.x-z.x)/H,fe=(z.x+b.x)/2,Me=(z.y+b.y)/2;return(0,O.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,O.jsx)("line",{x1:z.x,y1:z.y,x2:b.x,y2:b.y}),(0,O.jsxs)("text",{x:fe+ne*.34,y:Me+ce*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:Bv/l,children:[H.toFixed(2)," m"]})]})})():null,n.points.map((z,H)=>(0,O.jsx)("circle",{className:"deck-outline__point",cx:z.x,cy:z.y,r:"0.13",onPointerDown:ne=>Bt(ne,H)},`point-${H}`))]}),(0,O.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,O.jsx)("button",{type:"button",onClick:()=>c(z=>Math.max(.5,z-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,O.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,O.jsx)("button",{type:"button",onClick:()=>c(z=>Math.min(1,z+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),n.isOutlineClosed&&n.wallSegments.size===0&&le?(0,O.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(le.x-R)/u*100}%`,top:`${(le.y-T)/g*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!n.isOutlineClosed&&n.points.length>=3?(0,O.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(z=>Yd(z.points,!0)?{...z,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...z,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,O.jsxs)("div",{className:"deck-outline__supporting",children:[(0,O.jsx)("div",{className:"truss-estimator__grid-hint",children:n.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),n.drawError?(0,O.jsx)("div",{className:"deck-outline__error",role:"alert",children:n.drawError}):null]})]})})]})]}):null,D==="pictureFrame"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,O.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,O.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(z=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.pictureFrame===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,pictureFrame:z.id})),children:[(0,O.jsx)("img",{className:"truss-estimator__visual-card-img",src:Ft(z.img),alt:""}),(0,O.jsx)("span",{children:z.label})]},z.id))}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,O.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(z=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.direction===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,direction:z.id})),children:[(0,O.jsx)("img",{className:"truss-estimator__visual-card-img",src:Ft(z.img),alt:""}),(0,O.jsx)("span",{children:z.label})]},z.id))})]})]}):null,D==="substructure"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,O.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,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,O.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Ra.joist.spacingOptions.map(z=>(0,O.jsx)("button",{type:"button",className:`truss-estimator__option-card${n.joistSpacing===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,joistSpacing:z.id})),children:(0,O.jsx)("div",{className:"truss-estimator__option-title",children:z.label})},z.id))})]}):null]}),(0,O.jsxs)("div",{className:"truss-estimator__nav",children:[(0,O.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:be,children:"Back"}),(0,O.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Ye,disabled:!X(),children:[(0,O.jsx)("span",{children:me}),(0,O.jsx)("span",{className:"arrow",children:(0,O.jsx)(Qt,{})})]})]})]})]})})}var Ca=Y(je());var G=Y(ee()),Lv=12,Hv=30,jn=12,Qn=8,jv=.56,Na={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 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"],Vd=e=>Number(e)<=1.2?"6":"8",Qv=(e,t)=>vi("fencing",`panels-${e??"boundary"}-${t}`),Gv=(e,t)=>!t||vi("fencing",e==="concrete"?`concrete-intermediate-${Vd(t)}`:`timber-post-${Vd(t)}`),px={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:""}},mc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),fc=(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),dx=(e,t,a,r)=>{let i=mc(e,t,a),n=mc(e,t,r),o=mc(a,r,e),l=mc(a,r,t);return i===0&&fc(e,t,a)||n===0&&fc(e,t,r)||o===0&&fc(a,r,e)||l===0&&fc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},hc=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&dx(e[r],e[(r+1)%e.length],e[i],e[(i+1)%e.length]))return!0;return!1};function Xd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ca.useState)(0),[n,o]=(0,Ca.useState)(px),l=(0,Ca.useRef)(null),c=(0,Ca.useRef)(null),[p,m]=(0,Ca.useState)(1),[b,f]=(0,Ca.useState)({x:0,y:0}),[w,_]=(0,Ca.useState)(null),E=(0,Ca.useRef)(null),D=(0,Ca.useRef)(null),h=(0,Ca.useRef)(null),u=Si[r],g=n.range?Na.ranges[n.range]:null,v=jn/p,N=Qn/p,R=(jn-v)/2,T=(Qn-N)/2,U=Math.max(-jn,Math.min(jn*2-v,R+b.x)),A=Math.max(-Qn,Math.min(Qn*2-N,T+b.y)),B=n.boundaryPoints.reduce((d,M)=>({x:d.x+M.x/Math.max(1,n.boundaryPoints.length),y:d.y+M.y/Math.max(1,n.boundaryPoints.length)}),{x:0,y:0}),ie=d=>{let M=new Set,S=[];return d.forEach($=>{let[Z,x]=$.split(",").map(Number),j=[{key:`H,${Z},${x}`,type:"H",x:Z,y:x},{key:`H,${Z},${x+1}`,type:"H",x:Z,y:x+1},{key:`V,${Z},${x}`,type:"V",x:Z,y:x},{key:`V,${Z+1},${x}`,type:"V",x:Z+1,y:x}],K=[!d.has(`${Z},${x-1}`),!d.has(`${Z},${x+1}`),!d.has(`${Z-1},${x}`),!d.has(`${Z+1},${x}`)];j.forEach((ue,ve)=>{K[ve]&&!M.has(ue.key)&&(M.add(ue.key),S.push(ue))})}),S},ze=(d,M)=>ie(d).filter(S=>!M.has(S.key)),He=(d,M)=>ze(d,M).length,Ve=(d,M)=>{let S={};ze(d,M).forEach(Z=>{var x,j,K,ue;Z.type==="H"?((S[x=`${Z.x},${Z.y}`]||(S[x]=[])).push("H"),(S[j=`${Z.x+1},${Z.y}`]||(S[j]=[])).push("H")):((S[K=`${Z.x},${Z.y}`]||(S[K]=[])).push("V"),(S[ue=`${Z.x},${Z.y+1}`]||(S[ue]=[])).push("V"))});let $=0;return Object.values(S).forEach(Z=>{(Z.length===1||Z.length===2&&Z[0]!==Z[1]||Z.length>=3)&&($+=1)}),$},we=(()=>{let d=n.range?Na.ranges[n.range]:Na.ranges.boundary,M=n.height??"1.8",S=n.boundaryMode==="quick"?Math.max(0,Number.parseFloat(n.quickLengthM)||0):n.boundaryClosed?n.boundaryPoints.slice(0,-1).reduce((Yt,hr,vt)=>Yt+(n.excludedBoundaryEdges.has(vt)?0:Math.hypot(n.boundaryPoints[vt+1].x-hr.x,n.boundaryPoints[vt+1].y-hr.y)),0):0,$=n.gateType&&n.gateType!=="none"?Number.parseFloat(n.gateWidthM)||Na.gate[n.gateType].widthDefault:0,Z=Math.max(0,S-$),x=Z>0?Math.ceil(Z/d.panelWidthM):0,j=n.boundaryPoints.length>2&&n.boundaryPoints[0].x===n.boundaryPoints[n.boundaryPoints.length-1].x&&n.boundaryPoints[0].y===n.boundaryPoints[n.boundaryPoints.length-1].y,K=n.boundaryMode==="quick"?Z>0?2:0:n.boundaryClosed?n.boundaryPoints.slice(0,j?-1:void 0).reduce((Yt,hr,vt)=>{let qi=vt>0&&!n.excludedBoundaryEdges.has(vt-1),um=vt<n.boundaryPoints.length-1&&!n.excludedBoundaryEdges.has(vt);return Yt+(qi||um?1:0)},0):0,ue=Z>0?Math.ceil(Z/d.panelWidthM)+1:0,ve=Math.max(0,ue-K),wt=n.mountingType?Na.mounting[n.mountingType]:Na.mounting.concrete,rt=n.gateType&&n.gateType!=="none"?2:0,Ct=ve+K+rt,cm=n.mountingType==="postcrete"?Ct*Na.mounting.postcrete.bagsPerPost:0,Kr=n.gravelBoard==="yes"?x:0;return{range:d,height:M,totalEdgeM:S,fencedLengthM:Z,gateWidthM:$,panelsCount:x,cornerPostCount:K,intermediatePostCount:ve,gatePostCount:rt,totalPostCount:Ct,bagsCount:cm,gravelCount:Kr,capCount:Ct,mounting:wt}})(),le=n.gateType&&n.gateType!=="none"?Na.gate[n.gateType].label:null,Je=Vd(we.height),Ne=we?[{key:`panels-${n.range??"boundary"}-${we.height}`,label:`${we.range.label} panels (${we.height}m)`,qty:we.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...n.mountingType==="concrete"?[{key:`concrete-intermediate-${Je}`,label:"Intermediate concrete posts",qty:we.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${Je}`,label:"End and corner concrete posts",qty:we.cornerPostCount+we.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${Je}`,label:"Timber fence posts",qty:we.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:we.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...le?[{key:`gate-${n.range??"boundary"}`,label:n.range==="skyline"?"Single feather edge gate":"Single lap gate",qty:1,unit:"each",query:n.range==="skyline"?"feather edge gate":"lap gate",category:"fencing"}]:[],...we.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:we.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],St=()=>{if(u==="range"){let d=n.boundaryMode==="quick"?(Number.parseFloat(n.quickLengthM)||0)>0:n.boundaryClosed&&n.boundaryPoints.length>=2;return!!n.range&&d}return u==="height"?!!n.height&&!!n.gravelBoard:u==="gate"?!!n.gateType&&(n.gateType==="none"||n.gateWidthM.trim()!==""):u==="posts"?!!n.mountingType:!0},X=r===Si.length-1?a:"Next",me=d=>{o(M=>{let S=d(new Set(M.grid)),$=new Set([...M.excludedEdges].filter(Z=>ie(S).some(x=>x.key===Z)));return{...M,grid:S,excludedEdges:$}})},Re=(d,M,S)=>{me($=>{let Z=`${d},${M}`;return S?$.add(Z):$.delete(Z),$})},Nt=(d,M,S,$,Z)=>{let x=d,j=M,K=Math.abs(S-d),ue=d<S?1:-1,ve=-Math.abs($-M),wt=M<$?1:-1,rt=K+ve;for(;Re(x,j,Z),!(x===S&&j===$);){let Ct=2*rt;Ct>=ve&&(rt+=ve,x+=ue),Ct<=K&&(rt+=K,j+=wt)}},Bt=(d,M)=>{let S=c.current?.getBoundingClientRect();if(!S)return null;let $=Math.floor((d-S.left)/Hv),Z=Math.floor((M-S.top)/Hv);return $<0||Z<0||$>=Lv||Z>=Lv?null:{x:$,y:Z}},Ut=d=>{if(n.gridMode!=="draw")return;let M=Bt(d.clientX,d.clientY);if(!M)return;d.preventDefault();let S=`${M.x},${M.y}`,$=!n.grid.has(S);l.current={active:!0,paintValue:$,lastX:M.x,lastY:M.y},d.currentTarget.setPointerCapture(d.pointerId),Re(M.x,M.y,$)},Xe=d=>{let M=l.current;if(!M?.active)return;let S=Bt(d.clientX,d.clientY);S&&(S.x===M.lastX&&S.y===M.lastY||(Nt(M.lastX,M.lastY,S.x,S.y,M.paintValue),l.current={...M,lastX:S.x,lastY:S.y}))},ye=d=>{l.current?.active&&(l.current=null,d.currentTarget.releasePointerCapture(d.pointerId))},be=(d,M,S=!1)=>{let $=h.current?.getBoundingClientRect();if(!$)return null;let Z=S?1:.25;return{x:Math.round(Math.max(U,Math.min(U+v,U+(d-$.left)/$.width*v))/Z)*Z,y:Math.round(Math.max(A,Math.min(A+N,A+(M-$.top)/$.height*N))/Z)*Z}},Ye=d=>{if(n.boundaryClosed){let S=d.target;if(S!==d.currentTarget&&!S.classList.contains("fence-boundary__grid"))return;D.current={startX:d.clientX,startY:d.clientY,startViewX:U,startViewY:A},d.currentTarget.setPointerCapture(d.pointerId);return}let M=be(d.clientX,d.clientY,!0);M&&(_(null),o(S=>{let $=[...S.boundaryPoints,M];return hc($,!1)?{...S}:{...S,boundaryPoints:$}}))},z=(d,M)=>{if(d.stopPropagation(),!n.boundaryClosed){if(M!==0||n.boundaryPoints.length<3)return;o(S=>hc(S.boundaryPoints,!0)?S:{...S,boundaryPoints:[...S.boundaryPoints,S.boundaryPoints[0]],boundaryClosed:!0});return}E.current=M,d.currentTarget.setPointerCapture(d.pointerId)},H=d=>{if(D.current){let S=h.current?.getBoundingClientRect();if(!S)return;let $=D.current,Z=$.startViewX-(d.clientX-$.startX)/S.width*v,x=$.startViewY-(d.clientY-$.startY)/S.height*N;f({x:Z-R,y:x-T});return}if(n.boundaryClosed||_(be(d.clientX,d.clientY,!0)),E.current===null)return;let M=be(d.clientX,d.clientY);M&&o(S=>{let $=S.boundaryPoints.length>2&&S.boundaryPoints[0].x===S.boundaryPoints[S.boundaryPoints.length-1].x&&S.boundaryPoints[0].y===S.boundaryPoints[S.boundaryPoints.length-1].y,Z=S.boundaryPoints.map((x,j)=>{let K=j===E.current,ue=$&&E.current===0&&j===S.boundaryPoints.length-1;return K||ue?M:x});return hc(Z,!1)?S:{...S,boundaryPoints:Z}})},ne=d=>{D.current=null,E.current=null,d.currentTarget.hasPointerCapture(d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)},ce=d=>{o(M=>{let S=new Set(M.excludedBoundaryEdges);return S.has(d)?S.delete(d):S.add(d),{...M,excludedBoundaryEdges:S}})},fe=()=>{r===0?e():i(d=>d-1)},Me=()=>{St()&&(r===Si.length-1?t?.(Ne):i(d=>d+1))},Ze=ie(n.grid);return(0,G.jsx)(G.Fragment,{children:(0,G.jsxs)("div",{className:"truss-estimator",children:[(0,G.jsxs)("div",{className:"quick-order-hero",children:[(0,G.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,G.jsx)("h1",{children:"Fencing Calculator"}),(0,G.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,G.jsxs)("div",{className:"truss-estimator__card",children:[(0,G.jsxs)("div",{className:"truss-estimator__body",children:[u==="range"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.ranges).map(([d,M])=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===d?" is-selected":""}`,onClick:()=>o(S=>({...S,range:d,height:S.height&&Qv(d,S.height)?S.height:null})),children:[(0,G.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,G.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb})]},d))})]}):null,u==="range"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,G.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,G.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,G.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(d=>({...d,boundaryMode:"quick"})),children:"Quick estimate"}),(0,G.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(d=>({...d,boundaryMode:"draw"})),children:"Draw your boundary"})]}),n.boundaryMode==="quick"?(0,G.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,G.jsx)("span",{children:"Total fence length (m)"}),(0,G.jsx)("input",{type:"number",min:"0",step:"0.1",value:n.quickLengthM,onChange:d=>o(M=>({...M,quickLengthM:d.target.value}))})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:"fence-boundary__toolbar",children:(0,G.jsxs)("div",{className:"fence-boundary__actions",children:[(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(d=>({...d,boundaryPoints:d.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:n.boundaryPoints.length===0||n.boundaryClosed,children:"Undo"}),(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f({x:0,y:0}),_(null),o(d=>({...d,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:n.boundaryPoints.length===0,children:"Clear"}),(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(d=>({...d,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,G.jsxs)("div",{className:"fence-boundary",children:[(0,G.jsxs)("svg",{ref:h,className:`fence-boundary__canvas${n.boundaryClosed?" is-pan-mode":""}`,viewBox:`${U} ${A} ${v} ${N}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:Ye,onPointerMove:H,onPointerUp:ne,onPointerLeave:()=>{_(null),D.current||(E.current=null)},children:[(0,G.jsx)("defs",{children:(0,G.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,G.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,G.jsx)("rect",{x:-jn,y:-Qn,width:jn*3,height:Qn*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),n.boundaryPoints.length>1?(0,G.jsx)("polyline",{className:"fence-boundary__preview",points:n.boundaryPoints.map(d=>`${d.x},${d.y}`).join(" ")}):null,n.boundaryPoints.length>1?n.boundaryPoints.slice(0,-1).map((d,M)=>{let S=n.boundaryPoints[M+1],$=Math.hypot(S.x-d.x,S.y-d.y),Z=$?-(S.y-d.y)/$:0,x=$?(S.x-d.x)/$:0,j=(d.x+S.x)/2,K=(d.y+S.y)/2,ue=Z*(j-B.x)+x*(K-B.y)>=0?1:-1,ve=j+Z*jv*ue,wt=K+x*jv*ue;return(0,G.jsxs)("g",{children:[(0,G.jsx)("line",{className:"fence-boundary__edge-hit",x1:d.x,y1:d.y,x2:S.x,y2:S.y,onClick:n.boundaryClosed?()=>ce(M):void 0}),(0,G.jsx)("line",{className:`fence-boundary__edge${n.excludedBoundaryEdges.has(M)?" is-excluded":""}`,x1:d.x,y1:d.y,x2:S.x,y2:S.y,pointerEvents:"none"}),(0,G.jsxs)("text",{className:`fence-boundary__edge-label${n.excludedBoundaryEdges.has(M)?" is-excluded":""}`,x:ve,y:wt,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[$.toFixed(2)," m"]})]},`fence-edge-${M}`)}):null,!n.boundaryClosed&&n.boundaryPoints.length>0&&w?(()=>{let d=n.boundaryPoints[n.boundaryPoints.length-1],M=Math.hypot(w.x-d.x,w.y-d.y);if(!M)return null;let S=-(w.y-d.y)/M,$=(w.x-d.x)/M,Z=(d.x+w.x)/2,x=(d.y+w.y)/2;return(0,G.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,G.jsx)("line",{x1:d.x,y1:d.y,x2:w.x,y2:w.y}),(0,G.jsxs)("text",{x:Z+S*.34,y:x+$*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[M.toFixed(2)," m"]})]})})():null,n.boundaryPoints.map((d,M)=>M>0&&M===n.boundaryPoints.length-1&&d.x===n.boundaryPoints[0]?.x&&d.y===n.boundaryPoints[0]?.y?null:(0,G.jsx)("circle",{className:`fence-boundary__point${!n.boundaryClosed&&M===0&&n.boundaryPoints.length>=3?" is-close-target":""}`,cx:d.x,cy:d.y,r:"0.13",onPointerDown:S=>z(S,M)},`fence-point-${M}`))]}),(0,G.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,G.jsx)("button",{type:"button",onClick:()=>m(d=>Math.max(.5,d-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,G.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,G.jsx)("button",{type:"button",onClick:()=>m(d=>Math.min(1,d+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!n.boundaryClosed&&n.boundaryPoints.length>=2?(0,G.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(d=>hc(d.boundaryPoints,!1)?d:{...d,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,G.jsx)("div",{className:"truss-estimator__grid-hint",children:n.boundaryClosed?"Drag the blank canvas to pan. Tap an edge to exclude it from the new fence.":"Click to add points, then finish the fence line. The displayed distances update as you draw."})]}),(0,G.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,G.jsx)("div",{children:n.boundaryMode==="quick"?`${(Number.parseFloat(n.quickLengthM)||0).toFixed(2)} m fence line`:`${we.totalEdgeM.toFixed(2)} m fence line`}),n.boundaryMode==="draw"&&n.boundaryClosed?(0,G.jsxs)("div",{children:[we.cornerPostCount," corner/end posts"]}):null]})]}):null,null,u==="height"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Na.heights.filter(d=>Qv(n.range,d)).map(d=>(0,G.jsx)("button",{type:"button",className:`truss-estimator__visual-card${n.height===d?" is-selected":""}`,onClick:()=>o(M=>({...M,height:d,mountingType:M.mountingType&&Gv(M.mountingType,d)?M.mountingType:null})),children:(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:Ft(`/fencing/height/${d}.webp`),alt:""})},d))}),(0,G.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,G.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(d=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.gravelBoard===d.id?" is-selected":""}`,onClick:()=>o(M=>({...M,gravelBoard:d.id})),children:[(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Ft(d.img),alt:""}),(0,G.jsx)("span",{children:d.label})]},d.id))})]}):null,u==="gate"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,G.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,G.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(d=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${n.gateType===d.id?" is-selected":""}`,onClick:()=>o(M=>({...M,gateType:d.id,gateWidthM:d.id==="none"?"":String(Na.gate[d.id].widthDefault)})),children:[(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Ft(d.img),alt:""}),(0,G.jsx)("span",{children:d.label})]},d.id))}),n.gateType&&n.gateType!=="none"?(0,G.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,G.jsx)("span",{children:"Gate width (m)"}),(0,G.jsx)("input",{type:"text",inputMode:"decimal",value:n.gateWidthM,onChange:d=>o(M=>({...M,gateWidthM:d.target.value}))})]}):null]}):null,u==="posts"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.mounting).filter(([d])=>Gv(d,n.height)).map(([d,M])=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.mountingType===d?" is-selected":""}`,onClick:()=>o(S=>({...S,mountingType:d})),children:[(0,G.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,G.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb})]},d))})]}):null]}),(0,G.jsxs)("div",{className:"truss-estimator__nav",children:[(0,G.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:fe,children:"Back"}),(0,G.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Me,disabled:!St(),children:[(0,G.jsx)("span",{children:X}),(0,G.jsx)("span",{className:"arrow",children:(0,G.jsx)(Qt,{})})]})]})]})]})})}var gc=Y(je()),ge=Y(ee()),Yv={floor:{label:"Floor between rooms",product:"Knauf Acoustic Roll",thickness:"100mm",coverage:12.36},ground:{label:"Ground floor",product:"Rigid PIR insulation board",thickness:"100mm",coverage:2.88},wall:{label:"Cavity wall",product:"Celotex CW4100",thickness:"100mm",coverage:3.24},roof:{label:"Pitched roof",product:"Kingspan K107",thickness:"100mm",coverage:8.64},loft:{label:"Loft",product:"Knauf Loft Roll 44",thickness:"100mm",coverage:13.89}};function Zd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,gc.useState)("floor"),[n,o]=(0,gc.useState)(""),[l,c]=(0,gc.useState)(""),p=Number.parseFloat(n)*Number.parseFloat(l)||0,m=Yv[r],b=Math.ceil(p/m.coverage),f=[{key:`insulation-${r}`,label:`${m.product} ${m.thickness}`,qty:Math.round(p*100)/100,unit:"m2",query:m.product,category:"insulation"}],w=Object.entries(Yv);return(0,ge.jsx)(ge.Fragment,{children:(0,ge.jsxs)("div",{className:"truss-estimator",children:[(0,ge.jsxs)("div",{className:"quick-order-hero",children:[(0,ge.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ge.jsx)("h1",{children:"Insulation Calculator"}),(0,ge.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,ge.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ge.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,ge.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,ge.jsxs)("div",{className:"materials-calculator__section",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,ge.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:w.map(([_,E])=>(0,ge.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===_?" is-selected":""}`,onClick:()=>i(_),children:[(0,ge.jsx)("div",{className:"truss-estimator__option-title",children:E.label}),(0,ge.jsxs)("div",{className:"truss-estimator__option-copy",children:[E.product,", ",E.thickness]})]},_))})]}),(0,ge.jsxs)("div",{className:"materials-calculator__section",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,ge.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ge.jsxs)("label",{className:"truss-estimator__field",children:[(0,ge.jsx)("span",{children:"Length (m)"}),(0,ge.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:_=>o(_.target.value)})]}),(0,ge.jsxs)("label",{className:"truss-estimator__field",children:[(0,ge.jsx)("span",{children:"Width (m)"}),(0,ge.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:_=>c(_.target.value)})]})]})]}),(0,ge.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ge.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:"Insulated area"}),(0,ge.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:m.product}),(0,ge.jsxs)("strong",{children:[b," packs"]})]})]}),(0,ge.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,ge.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ge.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ge.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(f),disabled:p<=0,children:a})]})]})]})})}var Gn=Y(je());var V=Y(ee()),mx=10,fx=1.9*.762,hx=1.9*1.524,bc=()=>({height:"",width:""}),wc=e=>Number.parseFloat(e)||0,$v=({height:e,width:t})=>wc(e)*wc(t);function Kd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Gn.useState)([bc()]),[n,o]=(0,Gn.useState)([bc()]),[l,c]=(0,Gn.useState)("0"),[p,m]=(0,Gn.useState)("0"),[b,f]=(0,Gn.useState)(1),w=r.reduce((N,R)=>N+$v(R),0),_=n.reduce((N,R)=>N+$v(R),0),E=wc(l)*fx+wc(p)*hx,D=Math.max(0,w-_-E),h=D*b/mx,u={key:"paint-emulsion",label:"Matt emulsion, brilliant white",qty:Math.round(h*10)/10,unit:"litres",query:"matt emulsion brilliant white"},g=cl("paint",u)!=null,v=(N,R,T,U)=>{N(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B))};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",{})]}),r.map((N,R)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",R+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 ${R+1} height in metres`,type:"number",min:"0",step:"0.01",value:N.height,onChange:T=>v(i,R,"height",T.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 ${R+1} width in metres`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(i,R,"width",T.target.value)})]}),r.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`wall-${R}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(N=>[...N,bc()]),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",{})]}),n.map((N,R)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",R+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 ${R+1} height in metres`,type:"number",min:"0",step:"0.01",value:N.height,onChange:T=>v(o,R,"height",T.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 ${R+1} width in metres`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(o,R,"width",T.target.value)})]}),n.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>o(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`excluded-${R}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>o(N=>[...N,bc()]),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:l,onChange:N=>c(N.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:p,onChange:N=>m(N.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:b,onChange:N=>f(Number(N.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:[D.toFixed(2)," m\xB2"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Coverage"}),(0,V.jsxs)("strong",{children:[b," ",b===1?"coat":"coats"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paint required"}),(0,V.jsxs)("strong",{children:[h.toFixed(1)," litres"]})]})]}),(0,V.jsx)("p",{className:"paint-calculator__note",children:g?"Based on paint coverage of 10 m\xB2 per litre. Ordered as brilliant white matt emulsion, rounded up to whole tins.":"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"}),g?(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.([u]),disabled:h<=0,children:a}):(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var fr=Y(je()),te=Y(ee()),vc=e=>Number.parseFloat(e)||0,Pd={paving:[{id:"council",label:"Council paving slab (600 \xD7 600mm)"},{id:"raj",label:"Raj blend sandstone (600 \xD7 600mm)"}],block:[{id:"brindle",label:"Brindle block paving (60mm)"},{id:"charcoal",label:"Charcoal block paving (60mm)"}],gravel:[{id:"pea",label:"20mm pea shingle"}]};function Jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,fr.useState)("paving"),[n,o]=(0,fr.useState)("council"),[l,c]=(0,fr.useState)(""),[p,m]=(0,fr.useState)(""),[b,f]=(0,fr.useState)("100"),[w,_]=(0,fr.useState)("50"),[E,D]=(0,fr.useState)(!0),[h,u]=(0,fr.useState)(!0),g=vc(l)*vc(p),v=g,N=g*(vc(b)/1e3),R=g*.04,T=g*(vc(w)/1e3),U=Math.ceil(v/.36),A=Math.ceil(v/.1),B=Math.ceil(N*1700/800),ie=Math.ceil(R*1600/800),ze=Math.ceil(T*1600/800),He=r==="paving"?{qty:U,unit:"each"}:r==="block"?{qty:v,unit:"m2"}:{qty:ze,unit:"bag"},Ve={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],qe=[{key:`surface-${n}`,label:Pd[r].find(le=>le.id===n)?.label??"Surface material",qty:He.qty,unit:He.unit,query:Ve,category:"landscaping"},...E?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:B,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...h?[{key:"bedding",label:"Sharp sand bedding",qty:ie,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];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:"Paving and Driveway Calculator"}),(0,te.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,te.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,te.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,te.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,te.jsxs)("div",{className:"materials-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,te.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(([le,Je,Ne])=>(0,te.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===le?" is-selected":""}`,onClick:()=>{i(le),o(Pd[le][0].id)},children:[(0,te.jsx)("div",{className:"truss-estimator__option-title",children:Je}),(0,te.jsx)("div",{className:"truss-estimator__option-copy",children:Ne})]},le))}),(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Finish"}),(0,te.jsx)("select",{value:n,onChange:le=>o(le.target.value),children:Pd[r].map(le=>(0,te.jsx)("option",{value:le.id,children:le.label},le.id))})]})]}),(0,te.jsxs)("div",{className:"materials-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,te.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,te.jsxs)("label",{className:"truss-estimator__field",children:[(0,te.jsx)("span",{children:"Length (m)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:le=>c(le.target.value)})]}),(0,te.jsxs)("label",{className:"truss-estimator__field",children:[(0,te.jsx)("span",{children:"Width (m)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:le=>m(le.target.value)})]})]}),r==="gravel"&&(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Gravel depth (mm)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"10",value:w,onChange:le=>_(le.target.value)})]}),E&&(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Sub-base depth (mm)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"10",value:b,onChange:le=>f(le.target.value)})]}),(0,te.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,te.jsx)("input",{type:"checkbox",checked:E,onChange:le=>D(le.target.checked)}),(0,te.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,te.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,te.jsx)("input",{type:"checkbox",checked:h,onChange:le=>u(le.target.checked)}),(0,te.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,te.jsxs)("div",{className:"materials-calculator__totals",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,te.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Surface area"}),(0,te.jsxs)("strong",{children:[g.toFixed(2)," m\xB2"]})]}),(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,te.jsx)("strong",{children:r==="paving"?`${U} slabs`:r==="block"?`${v.toFixed(2)} m\xB2`:`${ze} bulk bags`})]}),E&&(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"MOT Type 1"}),(0,te.jsxs)("strong",{children:[B," bulk bags"]})]}),h&&(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Sharp sand"}),(0,te.jsxs)("strong",{children:[ie," bulk bags"]})]})]}),(0,te.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,te.jsxs)("div",{className:"materials-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?.(qe),disabled:g<=0,children:a})]})]})]})})}var ul=Y(je()),re=Y(ee()),gx=2.88,Vv=[{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"}],Xv=()=>({length:"",height:""}),Fd=e=>Number.parseFloat(e)||0;function Id({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ul.useState)([Xv()]),[n,o]=(0,ul.useState)(""),[l,c]=(0,ul.useState)("standard"),[p,m]=(0,ul.useState)("screws"),b=r.reduce((R,T)=>R+Fd(T.length)*Fd(T.height),0),f=Math.max(0,b-Fd(n)),w=Math.ceil(f/gx),_=Math.ceil(f*12),E=Math.ceil(_/1e3),D=Math.ceil(f*1.2),h=Math.ceil(D/90),u=Math.ceil(f/3.5),g=Vv.find(R=>R.id===l)?.label??"Standard",v=[{key:"board",label:`${g} plasterboard`,qty:w,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:u,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:h,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],N=(R,T,U)=>{i(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B))};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:"Plasterboard and Drylining Calculator"}),(0,re.jsx)("p",{children:"Estimate boards, fixings and jointing materials for walls and ceilings."})]}),(0,re.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,re.jsx)("h2",{className:"truss-estimator__step-title",children:"Boards, fixings and jointing"}),(0,re.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,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Board type"}),(0,re.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Vv.map(R=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===R.id?" is-selected":""}`,onClick:()=>c(R.id),children:[(0,re.jsx)("div",{className:"truss-estimator__option-title",children:R.label}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:R.blurb})]},R.id))})]}),(0,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Fixing method"}),(0,re.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(([R,T,U])=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===R?" is-selected":""}`,onClick:()=>m(R),children:[(0,re.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:U})]},R))})]}),(0,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall and ceiling areas"}),(0,re.jsx)("p",{className:"materials-calculator__hint",children:"Add each surface separately so different wall sizes are easy to measure."}),(0,re.jsxs)("div",{className:"materials-calculator__dimensions-header",children:[(0,re.jsx)("span",{children:"Surface"}),(0,re.jsx)("span",{children:"Length (m)"}),(0,re.jsx)("span",{children:"Height (m)"}),(0,re.jsx)("span",{})]}),r.map((R,T)=>(0,re.jsxs)("div",{className:"materials-calculator__surface-row",children:[(0,re.jsxs)("span",{children:["Surface ",T+1]}),(0,re.jsx)("input",{"aria-label":`Surface ${T+1} length`,type:"number",min:"0",step:"0.01",value:R.length,onChange:U=>N(T,"length",U.target.value)}),(0,re.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:R.height,onChange:U=>N(T,"height",U.target.value)}),r.length>1?(0,re.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(U=>U.filter((A,B)=>B!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,re.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(R=>[...R,Xv()]),children:"+ Add another surface"}),(0,re.jsxs)("label",{className:"truss-estimator__field materials-calculator__openings",children:[(0,re.jsxs)("span",{children:["Openings to deduct (m\xB2) ",(0,re.jsx)("small",{children:"optional"})]}),(0,re.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:R=>o(R.target.value)})]})]}),(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:"Board area"}),(0,re.jsxs)("strong",{children:[f.toFixed(2)," m\xB2"]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"2.4 x 1.2 m boards"}),(0,re.jsx)("strong",{children:w})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:p==="screws"?"Drywall screws":"Board adhesive"}),(0,re.jsx)("strong",{children:p==="screws"?`${_} (${E} boxes)`:`${u} bags`})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Joint tape"}),(0,re.jsxs)("strong",{children:[D," m (",h," rolls)"]})]})]}),(0,re.jsx)("p",{className:"materials-calculator__note",children:"Figures are estimates. Confirm board specification, fixing patterns and fire or acoustic requirements 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?.(v),disabled:f<=0,children:a})]})]})]})})}var pl=Y(je());var y=Y(ee()),At={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}}}},yc=["range","pitchAndDimensions","quantityAndGirders","bracing"],bx={range:null,pitch:null,spanMM:"",overhangMM:"",roofLengthM:"",centres:null,girderCount:0,bracing:null,treatment:null,contact:{name:"",email:""}};function wx({degrees:e}){let a=e*Math.PI/180,i=82-Math.min(58,38*Math.tan(a));return(0,y.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,y.jsx)("line",{x1:"6",y1:"82",x2:"94",y2:"82",stroke:"var(--border)",strokeWidth:"2"}),(0,y.jsx)("polygon",{points:`12,82 88,82 50,${i}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function vx({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",i="#d3d8de",n="#7c8494",o=(m,b,f,w,_=8,E)=>{let D=f-m,h=w-b,u=Math.hypot(D,h)||1,g=-h/u,v=D/u,N=_*.2;return(0,y.jsxs)("g",{children:[(0,y.jsx)("line",{x1:m,y1:b,x2:f,y2:w,stroke:a,strokeWidth:_+3,strokeLinecap:"square"}),(0,y.jsx)("line",{x1:m,y1:b,x2:f,y2:w,stroke:t,strokeWidth:_,strokeLinecap:"square"}),(0,y.jsx)("line",{x1:m-g*N,y1:b-v*N,x2:f-g*N,y2:w-v*N,stroke:r,strokeWidth:Math.max(1.5,_*.24),strokeLinecap:"round",opacity:"0.9"})]},E)},l=(m,b,f)=>(0,y.jsxs)("g",{children:[(0,y.jsx)("rect",{x:m-7.5,y:b-5.5,width:"15",height:"11",rx:"2",fill:i,stroke:n,strokeWidth:"1"}),(0,y.jsx)("circle",{cx:m-4,cy:b-2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m+4,cy:b-2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m-4,cy:b+2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m+4,cy:b+2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m,cy:b,r:"1",fill:n})]},f),c=(m,b)=>(0,y.jsx)("rect",{x:m-9,y:"110",width:"18",height:"10",fill:a},b),p=(0,y.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"});return e==="attic"?(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,26,8,"b1"),o(174,112,100,26,8,"b2"),o(26,112,174,112,8,"b3"),o(58,112,58,70,6,"b4"),o(142,112,142,70,6,"b5"),o(58,70,142,70,7,"b6"),(0,y.jsx)("rect",{x:"90",y:"82",width:"20",height:"24",fill:"#cfe3f2",stroke:a,strokeWidth:"2"}),(0,y.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,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,174,26,8,"b1"),o(174,26,174,112,8,"b2"),o(26,112,174,112,8,"b3"),o(90,112,90,75,5,"b4"),o(90,75,132,112,5,"b5"),l(26,112,"p1"),l(174,26,"p2"),l(174,112,"p3"),l(90,112,"p4"),l(90,75,"p5"),l(132,112,"p6")]}):(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,34,8,"b1"),o(174,112,100,34,8,"b2"),o(26,112,174,112,8,"b3"),o(63,112,100,34,5,"b4"),o(137,112,100,34,5,"b5"),o(63,112,54,83,5,"b6"),o(137,112,146,83,5,"b7"),(0,y.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 yx({enabled:e}){return(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[(0,y.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"}),(0,y.jsx)("rect",{x:"17",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,y.jsx)("rect",{x:"165",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("line",{x1:"45",y1:"112",x2:"140",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"}),(0,y.jsx)("line",{x1:"155",y1:"112",x2:"60",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"})]}):null,(0,y.jsx)("rect",{x:"18.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,y.jsx)("rect",{x:"166.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,y.jsx)("rect",{x:"92.5",y:"28.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"})]})}function Zv({treated:e}){let t=e?"#5a7a4a":"var(--accent)";return(0,y.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,y.jsx)("rect",{x:"10",y:"22",width:"80",height:"14",rx:"2",fill:t}),(0,y.jsx)("rect",{x:"10",y:"43",width:"80",height:"14",rx:"2",fill:e?"#8faf7a":"var(--accent-light)"}),(0,y.jsx)("rect",{x:"10",y:"64",width:"80",height:"14",rx:"2",fill:t})]})}function Wd({onBack:e}){let[t,a]=(0,pl.useState)(0),[r,i]=(0,pl.useState)(bx),[n,o]=(0,pl.useState)(!1),[l,c]=(0,pl.useState)(!1),p=()=>{let h=Number.parseFloat(r.roofLengthM)||0,u=Number.parseFloat(r.centres??"");return h<=0||!u?0:Math.ceil(h*1e3/u)+1},b=(()=>{let h=r.range?At.ranges[r.range]:At.ranges.standard,u=r.pitch??"22.5",g=At.pitchMultipliers[u],v=(Number.parseFloat(r.spanMM)||0)/1e3,R=(Number.parseFloat(r.overhangMM)||0)>At.overhang.thresholdMM,T=p(),U=T+r.girderCount,A=Number.parseFloat(r.roofLengthM)||0,B=r.treatment?At.treatment[r.treatment]:At.treatment.untreated,ie=At.estimate.ranges[r.range??"standard"],ze=ie.supplyAt8m*Math.max(.7,v/8)*g*(1+B.surchargePct)+(R?At.overhang.surchargePerTruss:0),He=T*ze,Ve=r.girderCount*ze*At.estimate.girderMultiplier,qe=r.bracing==="yes"?A*At.estimate.bracingPerMetre:0,we=He+Ve+qe+At.estimate.delivery,le=At.estimate.design+T*ie.installPerTruss+r.girderCount*40,Je=we+le,Ne=Je*.2;return{range:h,count:T,girderCount:r.girderCount,overhangApplies:R,overhangUnits:U,roofLengthM:A,treatment:B,trussSupply:He,bracingMaterials:qe,delivery:At.estimate.delivery,labour:le,subtotal:Je,vat:Ne,total:Je+Ne}})(),f=()=>{let h=yc[t];return h==="range"?!!r.range:h==="pitchAndDimensions"?!!r.pitch&&r.spanMM.trim()!==""&&r.overhangMM.trim()!=="":h==="quantityAndGirders"?r.roofLengthM.trim()!==""&&!!r.centres:h==="bracing"?!!r.bracing&&!!r.treatment:!0},w=t===yc.length-1?"View truss request":"Next",_=()=>{n?o(!1):t===0?e():a(h=>h-1)},E=()=>{f()&&(t===yc.length-1?(c(!1),o(!0)):a(h=>h+1))},D=()=>{let h=yc[t];return h==="range"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 1 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your truss range"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Pricing shown is placeholder. Swap in your real engineering and pricing catalogue."}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--range",children:Object.entries(At.ranges).map(([u,g])=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===u?" is-selected":""}`,onClick:()=>i(v=>({...v,range:u})),children:[(0,y.jsx)(vx,{type:u}),(0,y.jsxs)("div",{className:"truss-estimator__option-info",children:[(0,y.jsx)("div",{className:"truss-estimator__option-title",children:g.label}),(0,y.jsx)("div",{className:"truss-estimator__option-copy",children:g.blurb})]})]},u))})]}):h==="pitchAndDimensions"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 2 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Span, overhang and roof pitch"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,y.jsxs)("label",{className:"truss-estimator__field",children:[(0,y.jsx)("span",{children:"Span (mm)"}),(0,y.jsx)("input",{type:"text",inputMode:"numeric",value:r.spanMM,onChange:u=>i(g=>({...g,spanMM:u.target.value}))})]}),(0,y.jsxs)("label",{className:"truss-estimator__field",children:[(0,y.jsx)("span",{children:"Overhang (mm)"}),(0,y.jsx)("input",{type:"text",inputMode:"numeric",value:r.overhangMM,onChange:u=>i(g=>({...g,overhangMM:u.target.value}))}),(0,y.jsxs)("small",{children:["Overhangs beyond ",At.overhang.thresholdMM,"mm add a small surcharge per truss."]})]})]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Roof pitch"}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:At.pitches.map(u=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===u?" is-selected":""}`,onClick:()=>i(g=>({...g,pitch:u})),children:[(0,y.jsx)(wx,{degrees:Number.parseFloat(u)}),(0,y.jsxs)("span",{children:[u,"\xB0"]})]},u))})]}):h==="quantityAndGirders"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 3 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Roof length"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Trusses are based on designs at 400mm or 600mm centres wherever possible."}),(0,y.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,y.jsx)("span",{children:"Roof length (m)"}),(0,y.jsx)("input",{type:"text",inputMode:"decimal",value:r.roofLengthM,onChange:u=>i(g=>({...g,roofLengthM:u.target.value}))})]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Truss centres"}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--centres",children:At.centresOptions.map(u=>(0,y.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===u?" is-selected":""}`,onClick:()=>i(g=>({...g,centres:u})),children:(0,y.jsxs)("div",{className:"truss-estimator__option-title",children:[u,"mm centres"]})},u))}),(0,y.jsxs)("div",{className:"truss-estimator__stat",children:[p()," trusses estimated"]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Girder trusses"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__stepper",children:[(0,y.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.max(0,u.girderCount-1)})),children:"\u2212"}),(0,y.jsx)("span",{children:r.girderCount}),(0,y.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.min(3,u.girderCount+1)})),children:"+"})]})]}):h==="bracing"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 4 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Bracing pack?"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"A timber bracing pack stabilises the roof structure once trusses are erected."}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No bracing pack"},{id:"yes",label:"Add bracing pack"}].map(u=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===u.id?" is-selected":""}`,onClick:()=>i(g=>({...g,bracing:u.id})),children:[(0,y.jsx)(yx,{enabled:u.id==="yes"}),(0,y.jsx)("span",{children:u.label})]},u.id))}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber treatment"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Tanalised timber protects against rot in exposed or damp locations."}),(0,y.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="untreated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"untreated"})),children:[(0,y.jsx)(Zv,{treated:!1}),(0,y.jsx)("span",{children:"Untreated"})]}),(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="treated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"treated"})),children:[(0,y.jsx)(Zv,{treated:!0}),(0,y.jsx)("span",{children:"Treated (+8% cost)"}),(0,y.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return n?(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)("div",{className:"truss-estimator",children:[(0,y.jsxs)("div",{className:"quick-order-hero",children:[(0,y.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,y.jsx)("h1",{children:"Your truss estimate"}),(0,y.jsx)("p",{children:"A provisional quantity and specification based on the dimensions you entered."})]}),(0,y.jsxs)("div",{className:"truss-estimator__card truss-request",style:{minHeight:0},children:[(0,y.jsxs)("div",{className:"truss-request__heading",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Estimated requirement"}),(0,y.jsxs)("h2",{children:[b.range.label," roof trusses"]})]}),(0,y.jsxs)("strong",{children:[b.count,(0,y.jsx)("span",{children:"trusses"})]})]}),(0,y.jsxs)("div",{className:"truss-request__grid",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Span"}),(0,y.jsxs)("strong",{children:[r.spanMM," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Roof length"}),(0,y.jsxs)("strong",{children:[r.roofLengthM," m"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Pitch"}),(0,y.jsxs)("strong",{children:[r.pitch,"\xB0"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Centres"}),(0,y.jsxs)("strong",{children:[r.centres," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Overhang"}),(0,y.jsxs)("strong",{children:[r.overhangMM," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Treatment"}),(0,y.jsx)("strong",{children:b.treatment.label})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Girder trusses"}),(0,y.jsx)("strong",{children:b.girderCount||"None"})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Bracing pack"}),(0,y.jsx)("strong",{children:r.bracing==="yes"?"Included":"Not included"})]})]}),(0,y.jsxs)("div",{className:"truss-request__price",children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Indicative cost estimate"}),(0,y.jsxs)("div",{className:"truss-request__price-grid",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Truss supply allowance"}),(0,y.jsx)("strong",{children:lt(b.trussSupply)})]}),b.bracingMaterials>0&&(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Bracing materials allowance"}),(0,y.jsx)("strong",{children:lt(b.bracingMaterials)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Delivery allowance"}),(0,y.jsx)("strong",{children:lt(b.delivery)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Design and installation labour"}),(0,y.jsx)("strong",{children:lt(b.labour)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,y.jsx)("strong",{children:lt(b.subtotal)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"VAT (20%)"}),(0,y.jsx)("strong",{children:lt(b.vat)})]}),(0,y.jsxs)("div",{className:"truss-request__price-total",children:[(0,y.jsx)("span",{children:"Estimated total"}),(0,y.jsx)("strong",{children:lt(b.total)})]})]}),(0,y.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,y.jsxs)("div",{className:"truss-request__notice",children:[(0,y.jsx)("strong",{children:"Before ordering"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__nav",children:[(0,y.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:_,children:"Back to calculator"}),(0,y.jsx)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",justifyContent:"center",marginTop:0},onClick:()=>c(!0),children:"Request order"})]}),l&&(0,y.jsx)("p",{className:"truss-request__demo",children:"Demo only \u2014 no order has been sent."})]})]})}):(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)("div",{className:"truss-estimator",children:[(0,y.jsxs)("div",{className:"quick-order-hero",children:[(0,y.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,y.jsx)("h1",{children:"Roof Truss Calculator"}),(0,y.jsx)("p",{children:"Estimate trusses, girders and cost for your roof in a few steps."})]}),(0,y.jsxs)("div",{className:"truss-estimator__card",children:[(0,y.jsx)("div",{className:"truss-estimator__body",children:D()}),(0,y.jsxs)("div",{className:"truss-estimator__nav",children:[(0,y.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:_,children:"Back"}),(0,y.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:E,disabled:!f(),children:[(0,y.jsx)("span",{children:w}),(0,y.jsx)("span",{className:"arrow",children:(0,y.jsx)(Qt,{})})]})]})]})]})})}var Ni=Y(je()),F=Y(ee()),Jv=e=>Number.parseFloat(e)||0,_c=(e,t)=>Jv(e)*(t==="m"?1:.3048),Kv=()=>({length:"",width:""}),Pv=[{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 _x({profile:e}){return(0,F.jsxs)("svg",{className:"skirting-calculator__profile-diagram",viewBox:"0 0 120 84","aria-hidden":"true",children:[(0,F.jsx)("path",{d:{chamfered:"M16 70V43L43 16H104V70Z",ogee:"M16 70V47C16 36 27 31 40 31C40 21 50 16 63 16H104V70Z","pencil-round":"M16 70V37C16 25 25 16 37 16H104V70Z",torus:"M16 70V49C16 39 25 34 36 34C36 22 47 16 61 16H104V70Z"}[e]}),(0,F.jsx)("line",{x1:"12",y1:"70",x2:"108",y2:"70"})]})}function em({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ni.useState)("total"),[n,o]=(0,Ni.useState)("m"),[l,c]=(0,Ni.useState)(""),[p,m]=(0,Ni.useState)([Kv()]),[b,f]=(0,Ni.useState)(""),[w,_]=(0,Ni.useState)("chamfered"),E="4.4",D=r==="total"?_c(l,n):p.reduce((N,R)=>N+2*(_c(R.length,n)+_c(R.width,n)),0),h=Math.max(0,D-_c(b,n)),u=Math.ceil(h/Jv(E)),g=[{key:`skirting-${w}`,label:`${Pv.find(N=>N.id===w)?.label} skirting board`,qty:h,unit:"m",query:"skirting board",category:"skirting"}],v=(N,R,T)=>{m(U=>U.map((A,B)=>B===N?{...A,[R]:T}:A))};return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)("div",{className:"truss-estimator",children:[(0,F.jsxs)("div",{className:"quick-order-hero",children:[(0,F.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,F.jsx)("h1",{children:"Skirting Board Calculator"}),(0,F.jsx)("p",{children:"Work out how many skirting board lengths you need for one room or a whole project."})]}),(0,F.jsxs)("div",{className:"truss-estimator__card skirting-calculator",children:[(0,F.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure by room or total length"}),(0,F.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter a single total or work room by room. The run is converted straight into board lengths."}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"How would you like to measure?"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle skirting-calculator__mode-toggle",role:"group","aria-label":"Calculation method",children:[(0,F.jsx)("button",{type:"button",className:r==="total"?"is-selected":"",onClick:()=>i("total"),children:"Total length"}),(0,F.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>i("rooms"),children:"Room by room"})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Measurements"}),(0,F.jsxs)("div",{className:"skirting-calculator__unit-row",children:[(0,F.jsx)("span",{children:"Units"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,F.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,F.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>o("ft"),children:"Feet"})]})]}),r==="total"?(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Total skirting length (",n,")"]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:N=>c(N.target.value)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"skirting-calculator__dimensions-header",children:[(0,F.jsx)("span",{children:"Room"}),(0,F.jsxs)("span",{children:["Length (",n,")"]}),(0,F.jsxs)("span",{children:["Width (",n,")"]}),(0,F.jsx)("span",{})]}),p.map((N,R)=>(0,F.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,F.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",R+1]}),(0,F.jsx)("input",{"aria-label":`Room ${R+1} length in ${n}`,type:"number",min:"0",step:"0.01",value:N.length,onChange:T=>v(R,"length",T.target.value)}),(0,F.jsx)("input",{"aria-label":`Room ${R+1} width in ${n}`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(R,"width",T.target.value)}),p.length>1?(0,F.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>m(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`room-${R}`)),(0,F.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>m(N=>[...N,Kv()]),children:"+ Add another room"})]}),(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Openings and doorways to deduct (",n,") ",(0,F.jsx)("small",{children:"optional"})]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:N=>f(N.target.value)})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Profile"}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Choose the finish you want for the fixed 4.4m white-primed MDF boards."}),(0,F.jsx)("div",{className:"architrave-calculator__profiles",children:Pv.map(N=>(0,F.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===N.id?" is-selected":""}`,onClick:()=>_(N.id),children:[(0,F.jsx)(_x,{profile:N.id}),(0,F.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,F.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,F.jsx)("div",{className:"truss-estimator__field-grid skirting-calculator__options-grid",children:(0,F.jsxs)("label",{className:"truss-estimator__field",children:[(0,F.jsx)("span",{children:"Board length"}),(0,F.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Longer boards can reduce the number of joins, while 10% waste allows for cuts, corners and mistakes."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__totals",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,F.jsxs)("div",{className:"skirting-calculator__result-grid",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Net skirting"}),(0,F.jsxs)("strong",{children:[h.toFixed(2)," m"]})]}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Board lengths"}),(0,F.jsx)("strong",{children:u})]})]}),(0,F.jsx)("p",{className:"skirting-calculator__note",children:"Corners and joins vary by room layout. Measure each wall where possible for the most accurate result."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__actions",children:[(0,F.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,F.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:h<=0,children:a})]})]})]})})}var Yn=Y(je()),oe=Y(ee()),dl=e=>Number.parseFloat(e)||0;function tm({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Yn.useState)("studs"),[n,o]=(0,Yn.useState)(""),[l,c]=(0,Yn.useState)(""),[p,m]=(0,Yn.useState)("600"),[b,f]=(0,Yn.useState)("2.4"),w=n&&l&&p?Math.ceil(dl(l)/(dl(p)/1e3))+1:0,_=w*dl(n),E=dl(b)>0?Math.ceil(_/dl(b)):0,D=[{key:r,label:{studs:"Stud timber",joists:"Joist timber",battens:"Batten timber"}[r],qty:_,unit:"m",query:{studs:"cls studwork timber",joists:"timber joist",battens:"roofing batten"}[r],category:"timber"}],h={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,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:"Timber Calculator"}),(0,oe.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,oe.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,oe.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,oe.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,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(h).map(v=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===v?" is-selected":""}`,onClick:()=>i(v),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:h[v][0]}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:h[v][1]})]},v))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,oe.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsxs)("span",{children:[g.member," (m)"]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:v=>o(v.target.value)})]}),(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsxs)("span",{children:[g.overall," (m)"]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:v=>c(v.target.value)})]})]}),(0,oe.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsx)("span",{children:"Centres (mm)"}),(0,oe.jsxs)("select",{value:p,onChange:v=>m(v.target.value),children:[(0,oe.jsx)("option",{value:"300",children:"300 mm"}),(0,oe.jsx)("option",{value:"400",children:"400 mm"}),(0,oe.jsx)("option",{value:"450",children:"450 mm"}),(0,oe.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsx)("span",{children:"Stock length (m)"}),(0,oe.jsxs)("select",{value:b,onChange:v=>f(v.target.value),children:[(0,oe.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,oe.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,oe.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(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:g.count}),(0,oe.jsx)("strong",{children:w})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Linear metres"}),(0,oe.jsxs)("strong",{children:[_.toFixed(2)," m"]})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsxs)("span",{children:[b," m lengths"]}),(0,oe.jsx)("strong",{children:E})]})]}),(0,oe.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,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?.(D),disabled:_<=0,children:a})]})]})]})})}var am=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Wd},{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 and Block Calculator",desc:"Estimate masonry units and ready-mixed mortar for a wall.",imageUrl:"/tool-images/brick-block.webp",Component:jd},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Kd},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:em},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:Hd},{id:"concrete-aggregate",title:"Concrete and Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:Gd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:Id},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:Zd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:tm},{id:"paving",title:"Paving and Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:Jd}];var kc=Y(je());var Le=Y(je());var xx=new Set(["bag","box","roll","pack"]),kx=new Set(["each","bag","box","roll","pack","tub"]);function ml(e,t){let r=(t?.conversion?.request_uoms_supported??"").split(",").map(o=>o.trim().toLowerCase()).includes("sales_unit");if(e==="each"){let o=(t?.uoi_count??1)===1&&(t?.conversion?.sales_unit_size??1)===1;return r&&o?"sales_unit":e}if(!xx.has(e))return e;if(r)return"sales_unit";let i=t?.uoi;return i!=null&&kx.has(i.toLowerCase())&&(t?.uoi_count??1)===1?i:e}var Fv=new Map;function Sx(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 Ci(e,t,a=12,r){let i=`${Ot().client??""}||${e}||${t??""}||${a}||${r??""}`,n=Fv.get(i);if(n)return n;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(za(`/api/catalogue/search?${o.toString()}`),{headers:hi()}),c=await Qa(l);if(!l.ok)throw new Error(c?.error||c?.message||"Could not reach the product catalogue");let p=Array.isArray(c?.items)?c.items.map(Sx):[];return Fv.set(i,p),p}async function Iv(e,t,a){return await Promise.all(e.map(async i=>{try{let n=a?cl(a,i):null,[o,l]=await Promise.all([n?Ci(n,void 0,void 0,t).then(p=>p.find(m=>m.product_id===n.split(" ")[0]),()=>{}):void 0,Ci(i.query,i.category,void 0,t)]),c=o?[o,...l.filter(p=>p.product_id!==o.product_id)]:l;return{requirement:i,candidates:c}}catch{return{requirement:i,candidates:[]}}}))}async function Wv(){let e=await fetch(za("/api/catalogue"),{headers:hi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Qa(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var C=Y(ee()),Nx=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],rm={wasteFactorEnabled:!0},Cx=3e3,e0=null;function xc(e,t){let a=al(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function qx(e){return e&&e.length>0?e.join(" x "):"-"}function im({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:i}){let n=Nv(),o=`${e}~${t.map(x=>`${x.key}|${x.query}|${x.category??""}|${x.qty}`).join("~")}`,l=o!==e0,[c,p]=(0,Le.useState)(null),[m,b]=(0,Le.useState)([]),[f,w]=(0,Le.useState)(l),[_,E]=(0,Le.useState)(null),[D,h]=(0,Le.useState)("tile"),[u,g]=(0,Le.useState)(null),[v,N]=(0,Le.useState)(""),[R,T]=(0,Le.useState)(null),[U,A]=(0,Le.useState)(""),[B,ie]=(0,Le.useState)([]),[ze,He]=(0,Le.useState)(new Set),[Ve,qe]=(0,Le.useState)(null),[we,le]=(0,Le.useState)(""),[Je,Ne]=(0,Le.useState)([]),St=(0,Le.useRef)(null),X=(0,Le.useRef)(!1),me=x=>`${e}:${x}`,Re=x=>zn(x.chosen,{lineId:me(x.requirement.key),description:x.requirement.label,unit:ml(x.requirement.unit,x.chosen),qty:x.requirement.qty}),Nt=(0,Le.useMemo)(()=>t.map(x=>`${x.key}|${x.query}|${x.category??""}`).join("~"),[t]);(0,Le.useEffect)(()=>{let x=!1;return Wv().then(j=>{x||p(j.itemCount>0)}).catch(()=>{x||p(!1)}),()=>{x=!0}},[]),(0,Le.useEffect)(()=>{if(!a||!c)return;let x=!1,j;l&&w(!0),E(null);let K=Date.now();return(async()=>{let ue=null;try{ue=(await Iv(t,void 0,e)).map(({requirement:wt,candidates:rt})=>({requirement:wt,candidates:rt,chosen:rt[0]??null}))}catch(ve){x||E(ve instanceof Error?ve.message:"Could not load products")}if(!x){if(e0=o,l){let ve=Cx-(Date.now()-K);ve>0&&await new Promise(wt=>{j=window.setTimeout(wt,ve)})}x||(ue&&(b(ue),!X.current&&n&&(X.current=!0,n.addManyToCart(ue.filter(ve=>ve.chosen).map(Re)))),w(!1))}})(),()=>{x=!0,window.clearTimeout(j)}},[a,c,Nt]),(0,Le.useEffect)(()=>{if(!R)return;let x=U.trim();if(!x){ie([]);return}let j=!1,K=window.setTimeout(()=>{Ci(x).then(ue=>{j||ie(ue)}).catch(()=>{j||ie([])})},250);return()=>{j=!0,window.clearTimeout(K)}},[R,U]),(0,Le.useEffect)(()=>{if(!Ve)return;let x=we.trim();if(!x){Ne([]);return}let j=!1,K=window.setTimeout(()=>{Ci(x).then(ue=>{j||Ne(ue)}).catch(()=>{j||Ne([])})},250);return()=>{j=!0,window.clearTimeout(K)}},[Ve,we]);let Bt=(0,Le.useMemo)(()=>{let x=v.trim().toLowerCase(),j=x?m.filter(K=>K.requirement.label.toLowerCase().includes(x)||(K.chosen?.description??"").toLowerCase().includes(x)||(K.chosen?.product_id??"").toLowerCase().includes(x)):m;return u?[...j].sort((K,ue)=>{let ve=K.requirement.label.localeCompare(ue.requirement.label);return u==="asc"?ve:-ve}):j},[m,v,u]),Ut=Bt.filter(x=>x.chosen),Xe=Bt.filter(x=>!x.chosen),ye=m.filter(x=>x.chosen),be=ye.filter(x=>x.chosen?.price==null).length,Ye=ye.reduce((x,j)=>x+(It(Re(j),rm).lineTotal??0),0);if((0,Le.useEffect)(()=>{i?.(Ye)},[Ye,i]),!a||c===!1)return null;let z=n?ye.filter(x=>n.cart[me(x.requirement.key)]).length:0,H=Ve?m.find(x=>x.requirement.key===Ve)??null:null,ce=we.trim()?Je:H?.candidates??[],fe=x=>{let j=R===x.requirement.key;T(j?null:x.requirement.key),A(j?"":x.requirement.query)},Me=(x,j)=>{let K=m.find(ue=>ue.requirement.key===x);b(ue=>ue.map(ve=>ve.requirement.key===x?{...ve,chosen:j}:ve)),n&&K&&n.cart[me(x)]&&n.addToCart(Re({...K,chosen:j})),T(null),A("")},Ze=x=>{b(j=>j.map(K=>K.requirement.key===x?{...K,chosen:null}:K)),n?.cart[me(x)]&&n.removeFromCart(me(x))},d=x=>{qe(x.requirement.key),le(""),Ne([])},M=()=>{qe(null),le(""),Ne([])},S=x=>{if(!n)return;let j=me(x.requirement.key);n.cart[j]?n.removeFromCart(j):n.addToCart(Re(x))},$=x=>{He(j=>{let K=new Set(j);return K.has(x)?K.delete(x):K.add(x),K})},Z=x=>{let j=B.length>0?B:x.candidates;return(0,C.jsxs)("div",{className:"estimator-products__picker",children:[(0,C.jsx)("input",{type:"text",className:"results-search-input",value:U,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:K=>A(K.target.value),"aria-label":`Search a product for ${x.requirement.label}`}),(0,C.jsxs)("div",{className:"estimator-products__options",children:[j.map(K=>(0,C.jsxs)("button",{type:"button",className:`estimator-products__option${K.product_id===x.chosen?.product_id?" is-selected":""}`,onClick:()=>Me(x.requirement.key,K),children:[(0,C.jsx)("span",{children:K.description}),(0,C.jsxs)("span",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${lt(K.price)}`]})]},K.product_id)),j.length===0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,C.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!f&&(0,C.jsxs)("div",{className:"estimator-products__head",children:[(0,C.jsxs)("div",{className:"results-tile-section__head",children:[(0,C.jsx)("h3",{children:"Matched Products"}),(0,C.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!H&&(0,C.jsxs)("div",{className:"results-summary estimator-products__toolbar",children:[be>0&&(0,C.jsxs)("span",{className:"summary-chip summary-chip--neutral",children:[(0,C.jsx)("strong",{children:be})," need pricing"]}),(0,C.jsxs)("div",{className:"estimator-products__controls",children:[(0,C.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:v,onChange:x=>N(x.target.value),"aria-label":"Search matched products"}),(0,C.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,C.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="tile"?" is-active":""}`,"aria-pressed":D==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>h("tile"),children:(0,C.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,C.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,C.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="list"?" is-active":""}`,"aria-pressed":D==="list","aria-label":"List view",title:"List view",onClick:()=>h("list"),children:(0,C.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,C.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,C.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,C.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,C.jsxs)("details",{ref:St,style:{position:"relative"},children:[(0,C.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,C.jsx)("div",{className:"sort-menu-panel",children:Nx.map(x=>{let j=u===x.dir;return(0,C.jsxs)("button",{type:"button",className:`sort-menu-item${j?" is-active":""}`,onClick:()=>{g(j?null:x.dir),St.current?.removeAttribute("open")},children:[(0,C.jsx)("span",{className:"sort-menu-item__check",children:j?"\u2713":""}),x.label]},x.dir)})})]})]})]})]}),H&&(0,C.jsxs)("div",{className:"results-review-page",children:[(0,C.jsxs)("div",{className:"results-review-page__top",children:[(0,C.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:M,children:[(0,C.jsx)(Vr,{}),"Back to results"]}),(0,C.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,C.jsx)("div",{className:"results-review-searchbar",children:(0,C.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:we,onChange:x=>le(x.target.value),"aria-label":`Search a product for ${H.requirement.label}`})}),H.chosen&&(0,C.jsx)("div",{className:"results-candidate-actions",children:(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ze(H.requirement.key),children:"Clear selected product"})})]})]}),(0,C.jsxs)("div",{className:"results-review-page__hero",children:[(0,C.jsx)("div",{className:"results-review-page__image-wrap",children:(0,C.jsx)("img",{className:"fill-img results-review-page__image",src:Ga(H.chosen?.description||H.requirement.label,H.chosen?.product_id,H.chosen?.pdp_photo_url),alt:""})}),(0,C.jsxs)("div",{className:"results-review-page__summary",children:[(0,C.jsx)("h2",{children:H.requirement.label}),(0,C.jsxs)("p",{className:"results-review-page__meta",children:[wi(H.requirement.qty)," ",ka(H.requirement.unit,H.requirement.qty)]}),H.chosen?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"results-review-page__product",children:H.chosen.description}),(0,C.jsxs)("div",{className:"results-row-meta",children:[H.chosen.product_id,H.chosen.price!=null?` \xB7 ${xc(H.chosen.price,H.chosen.price_basis)}`:""]})]}):(0,C.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,C.jsx)("div",{className:"results-review-page__actions",children:(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${n?.cart[me(H.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(H),disabled:!H.chosen||!n,children:n?.cart[me(H.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),ce.length===0?(0,C.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,C.jsxs)("table",{className:"score-breakdown-table",children:[(0,C.jsx)("thead",{children:(0,C.jsxs)("tr",{children:[(0,C.jsx)("th",{children:"Product"}),(0,C.jsx)("th",{children:"Dims (mm)"}),(0,C.jsx)("th",{children:"Price"}),(0,C.jsx)("th",{"aria-label":"Actions"})]})}),(0,C.jsx)("tbody",{children:ce.map(x=>{let j=x.product_id===H.chosen?.product_id;return(0,C.jsxs)("tr",{className:j?"score-breakdown-row--best":"",children:[(0,C.jsxs)("td",{children:[(0,C.jsx)("div",{children:x.description}),(0,C.jsx)("div",{className:"results-row-meta",children:x.product_id})]}),(0,C.jsx)("td",{children:(0,C.jsx)("span",{className:"unit-badge",children:qx(x.measurements_mm)})}),(0,C.jsx)("td",{children:x.price!=null?xc(x.price,x.price_basis):"-"}),(0,C.jsx)("td",{children:(0,C.jsxs)("label",{className:"switch-toggle",title:j?"Currently selected":"Use this candidate",children:[(0,C.jsx)("input",{type:"checkbox",checked:j,onChange:()=>{j?Ze(H.requirement.key):Me(H.requirement.key,x)},"aria-label":j?`${x.description} selected`:`Use ${x.description}`}),(0,C.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},x.product_id)})})]})]}),!H&&f&&(0,C.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,C.jsx)(gi,{}),(0,C.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!H&&_&&(0,C.jsx)("p",{className:"results-empty-hint estimator-products__error",children:_}),!H&&!f&&!_&&Bt.length===0&&m.length>0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!H&&!f&&!_&&D==="tile"&&Ut.length>0&&(0,C.jsx)("div",{className:"results-tile-grid",children:Ut.map(x=>{let{requirement:j,chosen:K}=x,ue=K?It(Re(x),rm):null,ve=n?!!n.cart[me(j.key)]:!1;return(0,C.jsxs)("article",{className:"results-tile-card",children:[(0,C.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>d(x),"aria-label":`Review match for ${j.label}`,children:[(0,C.jsx)("div",{className:"results-tile-card__media",children:(0,C.jsx)("img",{className:"fill-img results-tile-card__image",src:Ga(K?.description||j.label,K?.product_id,K?.pdp_photo_url),alt:""})}),(0,C.jsxs)("div",{className:"results-tile-card__body",children:[K?(0,C.jsxs)("div",{className:"results-tile-card__heading",children:[(0,C.jsx)("div",{className:"results-tile-card__title",children:K.description}),(0,C.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,C.jsx)("span",{children:K.product_id}),K.price!=null?(0,C.jsx)("span",{children:xc(K.price,K.price_basis)}):null]})]}):(0,C.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,C.jsxs)("div",{className:"results-tile-card__match",children:[(0,C.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,C.jsx)("div",{className:"results-tile-card__match-name",children:j.label}),(0,C.jsxs)("div",{className:"results-tile-card__meta",children:[wi(j.qty)," ",ka(j.unit,j.qty)]}),ue?.requiredSellUnits!=null?(0,C.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",ue.requiredSellUnits," ",ue.sellUnit,ue.lineTotal!=null?` \xB7 ${lt(ue.lineTotal)}`:""]}):K?(0,C.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,C.jsxs)("div",{className:"results-tile-card__actions",children:[(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>d(x),children:"Review"}),(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${ve?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(x),disabled:!K||!n,children:ve?"\u2713 Added":"+ Add"})]})]},j.key)})}),!H&&!f&&!_&&D==="list"&&Ut.length>0&&(0,C.jsx)("div",{className:"bom-table-wrap",children:(0,C.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,C.jsxs)("colgroup",{children:[(0,C.jsx)("col",{style:{width:"56px"}}),(0,C.jsx)("col",{className:"col-item"}),(0,C.jsx)("col",{style:{width:"90px"}}),(0,C.jsx)("col",{style:{width:"80px"}}),(0,C.jsx)("col",{style:{width:"220px"}}),(0,C.jsx)("col",{style:{width:"110px"}})]}),(0,C.jsx)("thead",{children:(0,C.jsxs)("tr",{className:"bom-col-header",children:[(0,C.jsx)("th",{"aria-label":"Expand"}),(0,C.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,C.jsx)("tbody",{children:Ut.map(x=>{let{requirement:j,chosen:K}=x,ue=K?It(Re(x),rm):null,ve=n?!!n.cart[me(j.key)]:!1,wt=ze.has(j.key);return(0,C.jsxs)(Le.Fragment,{children:[(0,C.jsxs)("tr",{className:"bom-row",children:[(0,C.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,C.jsx)("button",{type:"button",className:"link-btn",onClick:()=>$(j.key),"aria-expanded":wt,"aria-label":wt?"Collapse product options":"Expand product options",children:wt?"\u25BE":"\u25B8"})}),(0,C.jsxs)("td",{style:{paddingLeft:0},children:[(0,C.jsx)("div",{className:"bom-component-name",children:j.label}),ue?.requiredSellUnits!=null&&(0,C.jsxs)("div",{className:"results-row-meta",children:["Order ",ue.requiredSellUnits," ",ue.sellUnit,ue.lineTotal!=null?` \xB7 ${lt(ue.lineTotal)}`:""]})]}),(0,C.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:wi(j.qty)}),(0,C.jsx)("td",{style:{textAlign:"center"},children:ka(j.unit,j.qty)}),(0,C.jsx)("td",{style:{textAlign:"center"},children:K?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"bom-component-name",children:K.description}),(0,C.jsxs)("div",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${xc(K.price,K.price_basis)}`]})]}):(0,C.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,C.jsx)("td",{style:{textAlign:"center"},children:(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${ve?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(x),disabled:!K||!n,children:ve?"\u2713 Added":"+ Add"})})]}),wt&&(0,C.jsx)("tr",{children:(0,C.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:R===j.key?Z(x):(0,C.jsxs)("div",{className:"estimator-products__picker",children:[(0,C.jsxs)("div",{className:"estimator-products__options",children:[x.candidates.map(rt=>(0,C.jsxs)("button",{type:"button",className:`estimator-products__option${rt.product_id===K?.product_id?" is-selected":""}`,onClick:()=>Me(j.key,rt),children:[(0,C.jsx)("span",{children:rt.description}),(0,C.jsxs)("span",{className:"results-row-meta",children:[rt.product_id,rt.price!=null&&` \xB7 ${lt(rt.price)}`]})]},rt.product_id)),x.candidates.length===0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>fe(x),children:"Search the catalogue"})]})})})]},j.key)})})]})}),!H&&!f&&!_&&Xe.length>0&&(0,C.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,C.jsxs)("div",{className:"results-tile-section__head",children:[(0,C.jsx)("h3",{children:"Require Matching"}),(0,C.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,C.jsx)("div",{className:"results-unmatched-list",children:Xe.map(x=>(0,C.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>d(x),children:[(0,C.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,C.jsx)("span",{className:"results-unmatched-card__title",children:x.requirement.label}),(0,C.jsxs)("span",{className:"results-row-meta",children:[wi(x.requirement.qty)," ",ka(x.requirement.unit,x.requirement.qty)]})]}),(0,C.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},x.requirement.key))})]}),!f&&!_&&m.length>0&&(0,C.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,C.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,C.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."})]}),!H&&!f&&!_&&(r||z>0)&&(0,C.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,C.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),z>0&&n&&(0,C.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:n.openBasket,children:[(0,C.jsxs)("span",{children:["View Basket (",z,")"]}),(0,C.jsx)("span",{className:"arrow",children:(0,C.jsx)(Qt,{})})]})]})]})}var Gt=Y(ee());function nm({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[i,n]=(0,kc.useState)(0),o=(0,kc.useCallback)(l=>n(l),[]);return(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsxs)("div",{className:"truss-estimator",children:[(0,Gt.jsxs)("div",{className:"quick-order-hero",children:[(0,Gt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Gt.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Gt.jsx)("h1",{children:"Your Materials"}),i>0&&(0,Gt.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Gt.jsx)("strong",{children:lt(i)})," Est. total"]})]}),(0,Gt.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Gt.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Gt.jsx)(im,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var om=Y(je());var Wt=Y(ee()),Ex=1500;function t0(e){let{addManyToCart:t,clearCart:a,openBasket:r}=On(),[i,n]=(0,om.useState)(!1),[o,l]=(0,om.useState)(null);return{adding:i,basketError:o,addToBasket:async(p,m)=>{let b=Date.now();n(!0),l(null);try{let f=await Promise.all(p.filter(_=>_.qty>0).map(async _=>{let E=(await Ci(_.search)).find(D=>D.product_id===_.productId);if(!E)throw new Error("A selected product is no longer available in this catalogue.");return zn(E,{lineId:`${e}:${_.key}`,description:E.description,unit:ml(_.unit??"each",E),qty:_.qty,calculatorWasteIncluded:m})})),w=Ex-(Date.now()-b);w>0&&await new Promise(_=>window.setTimeout(_,w)),a(),t(f),r()}catch(f){l(f instanceof Error?f.message:"Could not add the products to your basket.")}finally{n(!1)}}}}function a0({toolTitle:e}){return(0,Wt.jsx)(Wt.Fragment,{children:(0,Wt.jsxs)("div",{className:"truss-estimator",children:[(0,Wt.jsxs)("div",{className:"quick-order-hero",children:[(0,Wt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Wt.jsx)("h1",{children:"Your Materials"}),(0,Wt.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Wt.jsx)("div",{className:"truss-estimator__card",children:(0,Wt.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Wt.jsx)(gi,{}),(0,Wt.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Te=Y(ee());function Sc(e){let[t,a]=(0,$a.useState)(!1);return(0,Te.jsx)(lc,{onOpenBasket:()=>a(!0),children:(0,Te.jsx)(Mx,{...e,showBasket:t,onShowBasket:a})})}function Mx({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:i}){let[n,o]=(0,$a.useState)(null),[l,c]=(0,$a.useState)(null),p=am.find(U=>U.id===n),{cart:m,updateCartQty:b,updateCartSellUnits:f,updateCartConversions:w,removeFromCart:_,clearCart:E}=On(),{adding:D,basketError:h,addToBasket:u}=t0(p?.title??"calculator"),g=(0,$a.useRef)(null),v=Zs("estimating-tools",g);(0,$a.useEffect)(()=>{v("viewed")},[v]);let N=r?"basket":D?"adding":l?"review":n??"list",R=(0,$a.useRef)(N);(0,$a.useEffect)(()=>{R.current!==N&&(R.current=N,window.scrollTo(0,0))},[N]);let T=U=>{if(!p)return;v("estimate_completed",{calculator:p.id,lines:U.length});let A=Tv(p.id,U);A?u(A,U[0]?.calculatorWasteIncluded??!1):c(U)};return(0,Te.jsx)(Fo.Provider,{value:v,children:(0,Te.jsx)("div",{ref:g,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${a?"":" estimating-tools--customer"}`,style:Ot().theme,children:(0,Te.jsx)("main",{className:"main-content",children:r?(0,Te.jsx)(sl,{cart:m,onUpdateQty:b,onUpdateSellUnits:f,onResolveConversions:w,onRemove:_,onBack:()=>i(!1),onStartNewQuote:()=>{E(),o(null),c(null),i(!1)},internal:a}):D&&p?(0,Te.jsx)(a0,{toolTitle:p.title}):p?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("div",{hidden:l!==null,children:(0,Te.jsx)(p.Component,{onBack:()=>o(null),onReview:T})}),h&&(0,Te.jsx)("p",{className:"results-empty-hint estimator-products__error",children:h}),l!==null&&(0,Te.jsx)(nm,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>c(null)})]}):(0,Te.jsx)(Te.Fragment,{children:(0,Te.jsxs)("div",{className:"quick-order-card",children:[(0,Te.jsxs)("div",{className:"quick-order-hero",children:[(0,Te.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,Te.jsx)("h1",{children:"Estimating Tools"}),(0,Te.jsx)("p",{children:"Trade-specific calculators for trusses, fencing, decking, masonry and painting. Dial in your specs and get an instant material estimate."})]}),(0,Te.jsxs)("div",{className:"quick-order-alt",children:[(0,Te.jsx)("div",{className:"quick-order-alt-title",children:"Choose a Calculator"}),(0,Te.jsx)("div",{className:"estimator-tools-grid",children:am.map(U=>(0,Te.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{v("calculator_selected",{calculator:U.id}),o(U.id),c(null)},children:[(0,Te.jsx)("span",{className:"estimator-tool-card__image-wrap",children:(0,Te.jsx)("img",{className:"fill-img estimator-tool-card__image",src:Ft(U.imageUrl),alt:""})}),(0,Te.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Te.jsx)("span",{className:"estimator-tool-card__title",children:U.title}),(0,Te.jsx)("span",{className:"estimator-tool-card__desc",children:U.desc})]})]},U.id))})]})]})})})})})}var Nc=Y(ee());function lm({config:e,children:t}){return pw(e),(0,Nc.jsx)(Nc.Fragment,{children:t})}var sm=Y(ee()),Tx="https://api.metronlabs.ai",zx=["client","api-key","api-url","theme","hide-header","analytics"],Rx=["all","events-only","none"];function i0(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.62",this.id||(this.id=e),this.setAttribute("data-turbo-permanent",""),this.setAttribute("data-turbolinks-permanent",""),!this.root){let i=document.createElement("div"),n=document.createElement("style");n.textContent=`:host { display: block; }
|
|
6993
|
+
`)}function zn(e,t){return{lineId:t.lineId,description:e?.description||t.description||"(no description)",requestedDescription:t.description,productId:e?.product_id??"-",price:e?.price??null,priceBasis:e?.price_basis??null,unit:t.unit,uoi:e?.uoi??t.unit,uoiCount:e?.uoi_count??null,saleUnit:e?.conversion?.sale_unit??null,saleUnitQuantity:e?.conversion?.sale_unit_quantity??null,unitConversions:e?.conversion?.unit_conversions?.map(a=>({requestUom:a.request_uom,quantityPerSaleUnit:a.quantity_per_sale_unit,evidence:a.evidence,confidence:a.confidence})),pdpPhotoUrl:e?.pdp_photo_url??null,measurementsMm:e?.measurements_mm??[],conversionType:e?.conversion?.conversion_type??null,requestUomsSupported:e?.conversion?.request_uoms_supported??null,salesUomNormalised:e?.conversion?.sales_uom_normalised??null,salesUnitSize:e?.conversion?.sales_unit_size??null,salesUnitSizeUom:e?.conversion?.sales_unit_size_uom??null,coverageQty:e?.conversion?.coverage_qty??null,coverageUom:e?.conversion?.coverage_uom??null,itemsPerPallet:e?.conversion?.items_per_pallet??null,itemsPerPack:e?.conversion?.items_per_pack??null,itemsPerBox:e?.conversion?.items_per_box??null,itemsPerM2:e?.conversion?.items_per_m2??null,wasteFactorDefault:e?.conversion?.waste_factor_default??null,roundingRule:e?.conversion?.rounding_rule??null,derivedCoverageM2:e?.conversion?.derived_coverage_m2??null,derivedLengthM:e?.conversion?.derived_length_m??null,quoteQtyFormulaType:e?.conversion?.quote_qty_formula_type??null,conversionConfidence:e?.conversion?.conversion_confidence??null,conversionNotes:e?.conversion?.conversion_notes??null,calculatorWasteIncluded:t.calculatorWasteIncluded,qty:t.qty,linkedContext:t.linkedContext}}var bv=e=>(e??"").trim().toLowerCase(),S_={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",piece:"each",pieces:"each",board:"sheet",bags:"bag",length:"length",lengths:"length",pallet:"pallet",pallets:"pallet"},Ed=new Set(["sheet","length","box","bag","pack","roll","set","tub","each"]),mv=new Set(["box","bag","pack","pallet","roll","set","tub"]),Md=(e,t)=>t==="ml"?e:["l","litre","litres"].includes(t)?e*1e3:null,Td=(e,t)=>t==="g"?e:["kg","kilogram","kilograms"].includes(t)?e*1e3:["t","tonne","tonnes"].includes(t)?e*1e6:null,dr=e=>{let t=bv(e);return S_[t]??t},it=(e,t)=>{let a=dr(e),r=dr(t);return a.length>0&&a===r},fv=(e,t)=>{let a=bv(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},N_=e=>(e??"").split(",").map(t=>dr(t)).filter(Boolean),C_=(e,t)=>{let a=N_(e.requestUomsSupported);return!!(a.length===0||a.includes(t)||it(t,"pallet")&&e.itemsPerPallet!=null&&e.itemsPerPallet>0||it(t,"pack")&&e.itemsPerPack!=null&&e.itemsPerPack>0||it(t,"box")&&e.itemsPerBox!=null&&e.itemsPerBox>0)},hv=(e,t)=>it(t,"pallet")?e.itemsPerPallet??null:it(t,"pack")?e.itemsPerPack??null:it(t,"box")?e.itemsPerBox??null:null,gv=(e,t)=>{let a=t==="volume"?/(\d+(?:[.,]\d+)?)\s*(ml|l|ltr|ltrs|litres?|liters?)\b/i:/(\d+(?:[.,]\d+)?)\s*(kg|kgs|tonnes?)\b/i,r=e.description.match(a);if(!r)return null;let i=Number.parseFloat(r[1].replace(",","."));if(!Number.isFinite(i)||i<=0)return null;let n=r[2].toLowerCase();return t==="volume"?{ml:n==="ml"?i:i*1e3}:{g:n.startsWith("tonne")?i*1e6:i*1e3}},q_=["volume_from_description","same_unit_volume"],E_=["weight_from_description","mass_from_pack","same_unit_mass"],M_=(e,t,a)=>{if(!it(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||!it(r[3],a))return null;let i=Number.parseFloat(r[1].replace(",","."));return Number.isFinite(i)&&i>0?i:null};function ic(e,t){let a=e.map(r=>It(r,t).lineTotal);return a.some(r=>r==null)?null:a.reduce((r,i)=>r+(i??0),0)}function It(e,t){let a=e.qty,r=dr(e.saleUnit??e.salesUnitSizeUom??e.uoi??e.salesUomNormalised)||"-",i=dr(e.unit)||(a>0&&Ed.has(r)?r:"-"),n=e.saleUnitQuantity??e.salesUnitSize??e.uoiCount??1,o=t?.wasteFactorEnabled===!1?0:t?.wasteFactorOverride??e.wasteFactorOverride??e.wasteFactorDefault??0,l=e.sellUnitsOverride!=null&&Number.isFinite(e.sellUnitsOverride)&&e.sellUnitsOverride>0,c=l?Ed.has(r)?Math.ceil(e.sellUnitsOverride):e.sellUnitsOverride:null,p=A=>({requestedAmount:a,requestedUnit:i,salesUnitSize:e.salesUnitSize??e.uoiCount??null,sellUnit:r,calculatedSellUnits:null,requiredSellUnits:c,unitPrice:e.price,lineTotal:e.price!=null&&c!=null?e.price*c:null,calculation:c!=null?`${A} Manually set to ${c} ${r}.`:A,costingMode:"review"});if(!Number.isFinite(a)||a<=0)return p("Quantity needs confirmation.");let m=Md(a,i),b=Td(a,i),f=it(i,r)?null:m!=null&&!q_.includes(e.conversionType??"")?gv(e,"volume"):b!=null&&!E_.includes(e.conversionType??"")?gv(e,"weight"):null,w=f?.ml!=null?m:b,_=f?.ml??f?.g??null;if(w!=null&&_!=null){let A=dr(e.uoi)||r,B=f?.ml!=null?`${_/1e3} l`:`${_/1e3} kg`,ie=l?c:Math.ceil(w*(1+o)/_-1e-9);return{requestedAmount:a,requestedUnit:i,salesUnitSize:1,sellUnit:A,calculatedSellUnits:ie,requiredSellUnits:ie,unitPrice:e.price,lineTotal:e.price!=null?e.price*ie:null,calculation:`${a} ${i}${o>0?` x ${1+o}`:""} / ${B} per ${A} (from product description) = ${ie} ${A}`,costingMode:"derived"}}if(i==="sales_unit"){let A=dr(e.uoi)||r,B=l?c:fv(a*(1+o),e.roundingRule??"round_up_each");return{requestedAmount:a,requestedUnit:A,salesUnitSize:1,sellUnit:A,calculatedSellUnits:B,requiredSellUnits:B,unitPrice:e.price,lineTotal:e.price!=null?e.price*B:null,calculation:`${a} ${A}${o>0?` x ${1+o}`:""} = ${B} ${A}`,costingMode:"direct"}}if(!C_(e,i))return p("Requested unit is not supported by this catalogue conversion.");let E=null,D="review",h=e.roundingRule,u=`Quantity review required, initial request needed ${a} ${i}.`,g=1+o,v=M_(e,i,r),N=e.unitConversions?.find(A=>it(A.requestUom,i));if(!!e.saleUnit&&(it(i,r)||!!N||it(i,"each")&&!mv.has(r)))if(it(i,r))E=a*g/n,D="direct",u=`${a} ${i}${o>0?` x ${g}`:""}`;else if(N){E=a*g/N.quantityPerSaleUnit,D="derived";let A=1/N.quantityPerSaleUnit,B=Math.round(A);u=it(r,"each")&&N.quantityPerSaleUnit<1&&Math.abs(A-B)<1e-9?`${a} ${i}${o>0?` x ${g}`:""} x ${B} per ${i}`:`${a} ${i}${o>0?` x ${g}`:""} / ${N.quantityPerSaleUnit} ${i} per ${r}`}else it(i,"each")&&!mv.has(r)&&(E=a*g/n,D="derived",u=`${a} ${r}${o>0?` x ${g}`:""}`);else if(it(i,r)&&n>0)E=a*g/n,D="direct",u=o>0?`${a} ${i} x ${g} / ${n} ${r} per sell unit`:`${a} ${i} / ${n} ${r} per sell unit`;else if(it(i,"each")&&n>0&&Ed.has(r))E=a*g/n,D="derived",u=o>0?`${a} each x ${g} / ${n} each per ${r}`:`${a} each / ${n} each per ${r}`;else if(hv(e,i)!=null&&n>0){let A=hv(e,i)??0;E=a*A*g/n,D="derived";let B=`${a} ${i} x ${A} each${o>0?` x ${g}`:""}`;u=n===1&&it(r,"each")?B:`${B} / ${n} each per ${r}`}else if(v!=null)E=a*g/v,D="derived",h??(h="round_up_each"),u=`${a} m2 x ${g} / ${v} m2 per ${r} (from product description)`;else if(e.conversionType==="basket_line_unit")n>0&&(E=a*g/n,D="derived",u=`${a} ${i}${o>0?` x ${g}`:""} / ${n} ${i} per ${r}`);else{if(e.conversionType==="count_only")return p(`Quantity review required, initial request needed ${a} ${i}.`);if(["area_from_dims","explicit_coverage_area","roll_area"].includes(e.conversionType??"")){let A=e.coverageQty??e.derivedCoverageM2??null;it(i,"m2")&&A!=null&&A>0&&(E=a*g/A,D="derived",u=`${a} m2 x ${g} / ${A} m2 per ${r}`)}else if(e.conversionType==="count_per_area"){let A=e.coverageQty??null;it(i,"m2")&&A!=null&&A>0?(E=a/A,D="derived",u=`${a} m2 / ${A} m2 per sell unit`):it(i,"m2")&&e.itemsPerM2!=null&&e.itemsPerM2>0&&n>0&&(E=a*e.itemsPerM2*g/n,D="derived",u=`${a} m2 x ${e.itemsPerM2} ${r}/m2 x ${g} / ${n}`)}else if(e.conversionType==="length_from_dims"){let A=e.coverageQty??e.derivedLengthM??null;it(i,"m")&&A!=null&&A>0&&(E=a*g/A,D="derived",u=`${a} m x ${g} / ${A} m per ${r}`)}else if(e.conversionType==="volume_from_description"){let A=Md(a,i),B=Md(e.coverageQty??0,dr(e.coverageUom));A!=null&&B!=null&&B>0&&(E=A*g/B,D="derived",u=`${a} ${i} x ${g} / ${e.coverageQty} ${e.coverageUom} per ${r}`)}else if(e.conversionType==="weight_from_description"||e.conversionType==="mass_from_pack"){let A=dr((e.coverageUom??"").split(" ")[0]),B=Td(a,i),ie=Td(e.coverageQty??0,A);B!=null&&ie!=null&&ie>0&&(E=B*g/ie,D="derived",u=`${a} ${i} x ${g} / ${e.coverageQty} ${A} per ${r}`)}else if(e.conversionType==="same_unit_volume"){let A=e.coverageQty??null;it(i,"m3")&&A!=null&&A>0&&(E=a/A,D="derived",u=`${a} m3 / ${A} m3 per ${r}`)}}if(E==null||!Number.isFinite(E)||E<0)return p(`Quantity review required, initial request needed ${a} ${i}.`);let T=fv(E,h),U=l?c:T;return{requestedAmount:a,requestedUnit:i,salesUnitSize:n,sellUnit:r,calculatedSellUnits:T,requiredSellUnits:U,unitPrice:e.price,lineTotal:e.price!=null&&U!=null?e.price*U:null,calculation:l?`${u} = ${T} ${r} (manually set to ${U})`:`${u} = ${U} ${r}`,costingMode:D}}var wv=()=>import("./xlsx-K4MOA2QM.js"),il=["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"],T_=il.indexOf("Line total");function z_(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 wv(),a=t.utils.book_new(),r=new Date().toISOString().slice(0,10),i=[il],n=0;for(let c of e){let{item:p,best:m,qty:b,band:f,unmatchable:w,decision:_}=c,E=[p.section,p.subsection,p.subheading].filter(Boolean).join(" / "),D=!w&&m?.price!=null?m.price*b:null;D!=null&&(n+=D),i.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(", "),_?.technical_classification??"",_?.include_in_quote==null?"":_.include_in_quote?"yes":"no",_?.approval_required==null?"":_.approval_required?"yes":"no",_?.approval_type??"",_?.missing_information.join(", ")??"",_?.confidence??"",_?.reason??"",w?"-":m?.product_id??_?.selected_candidate_id??"-",w?"-":m?.description??"-",w?"-":m?.price_basis??"-",w?null:m?.price??null,D,w?"-":f,z_(c)])}i.push(Array(il.length).fill(null));let o=Array(il.length).fill(null);o[0]="Estimated total",o[T_]=n,i.push(o),i.push(["DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",...Array(il.length-1).fill(null)]);let l=t.utils.aoa_to_sheet(i);l["!cols"]=[{wch:12},{wch:12},{wch:44},{wch:24},{wch:8},{wch:8},{wch:28},{wch:28},{wch:16},{wch:10},{wch:12},{wch:24},{wch:24},{wch:24},{wch:22},{wch:14},{wch:14},{wch:18},{wch:24},{wch:16},{wch:48},{wch:16},{wch:40},{wch:10},{wch:10},{wch:12},{wch:11},{wch:26}],t.utils.book_append_sheet(a,l,"Schedule match"),t.writeFile(a,`schedule-quote-${r}.xlsx`)}var rl=["Product ID","Description","Costing mode","Required amount","Req unit","Sell unit size","Sell unit","Required sell units","Unit price","Line total"];async function yv(e,t){let a=await wv(),r=a.utils.book_new(),i=new Date().toISOString().slice(0,10),n=t?[["Account",t.name+" ("+t.id+")"],[],rl]:[rl],o=0;for(let p of e){let m=It(p),b=m.lineTotal;b!=null&&(o+=b),n.push([p.productId,p.description,m.costingMode,m.requestedAmount,xa(m.requestedUnit),m.salesUnitSize,xa(m.sellUnit),m.requiredSellUnits,m.unitPrice,b])}n.push(Array(rl.length).fill(null));let l=Array(rl.length).fill(null);l[0]="Estimated total",l[rl.length-1]=o,n.push(l);let c=a.utils.aoa_to_sheet(n);c["!cols"]=[{wch:14},{wch:48},{wch:12},{wch:14},{wch:10},{wch:14},{wch:10},{wch:16},{wch:12},{wch:14}],a.utils.book_append_sheet(r,c,"Basket"),a.writeFile(r,t?`basket-${t.id}-${i}.xlsx`:`basket-${i}.xlsx`)}var s=Y(ee()),Rd="__none__",nl=24,R_=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}];function Sv(e){return e==null?"low":e>=.7?"high":e>=.5?"medium":"low"}var A_=e=>e.attrs.supply_nature==="labour_only"||e.attrs.supply_nature==="plant"||e.flags.includes("referential");function U_(e,t){if(t!==Rd){if(t)return e?.candidates.find(a=>a.product_id===t);if(e?.decision?.selected_candidate_id!=null)return e.candidates.find(a=>a.product_id===e.decision.selected_candidate_id)}}function _v(e){return{product_id:e.productId,description:e.description,source_list:null,price:e.price,price_basis:e.priceBasis,uoi_count:e.uoiCount??null,uoi:e.uoi,pdp_photo_url:e.pdpPhotoUrl??null,measurements_mm:e.measurementsMm??[],conversion:{sale_unit:e.saleUnit,sale_unit_quantity:e.saleUnitQuantity,unit_conversions:e.unitConversions?.map(t=>({request_uom:t.requestUom,quantity_per_sale_unit:t.quantityPerSaleUnit,evidence:t.evidence,confidence:t.confidence})),sales_uom_normalised:e.salesUomNormalised,conversion_type:e.conversionType,request_uoms_supported:e.requestUomsSupported,sales_unit_size:e.salesUnitSize,sales_unit_size_uom:e.salesUnitSizeUom,coverage_qty:e.coverageQty,coverage_uom:e.coverageUom,items_per_pallet:e.itemsPerPallet,items_per_pack:e.itemsPerPack,items_per_box:e.itemsPerBox,items_per_m2:e.itemsPerM2,waste_factor_default:e.wasteFactorDefault,rounding_rule:e.roundingRule,derived_coverage_m2:e.derivedCoverageM2,derived_length_m:e.derivedLengthM,quote_qty_formula_type:e.quoteQtyFormulaType,conversion_confidence:e.conversionConfidence,conversion_notes:e.conversionNotes},scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"manual_cart_selection"}}function D_(e){return e?e.replace(/_/g," "):"not stated"}function O_({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 An(e,t){if(e==null)return"-";let a=al(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function Ad(e){return e&&e.length>0?e.join(" x "):"-"}function B_(e){return e==null?"-":Number.isInteger(e/1e3)?`${e/1e3}m`:`${(e/1e3).toFixed(1)}m`}function Rn(e){let t=(e??[]).map(a=>a.trim()).filter(Boolean);return t.length>0?t.join(", "):"-"}function Xr(e,t){let a=typeof e.description_original=="string"?e.description_original.trim():"";return(typeof e.customer_display_label=="string"?e.customer_display_label.trim():"")||a||"(no description)"}function L_(e,t){return t>0||e==null?null:lt(e)}var xv=[{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 H_(e){let t=new Map;return[...new Set(e.filter(mr).map(r=>r.linked_group_id))].forEach((r,i)=>{let n=i%26;t.set(r,{token:String.fromCharCode(65+n),bubbleStyle:xv[i%xv.length]})}),t}function mr(e){return!1}function Un(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 zd({meta:e}){return e?(0,s.jsx)("span",{className:"results-linked-pill",style:e.bubbleStyle,children:`Link ${e.token}`}):null}function j_(e,t,a){let r=t?.rerank?.recommendedCandidateIds??[];if(r.length===0){let o=e.slice(0,6),l=o.some(c=>c.product_id===a)?void 0:e.find(c=>c.product_id===a);return l?[...o,l]:o}let i=new Map(e.map(o=>[o.product_id,o])),n=r.map(o=>i.get(o)).filter(o=>o!=null);if(a&&!n.some(o=>o.product_id===a)){let o=i.get(a);o&&n.unshift(o)}return[...new Map(n.map(o=>[o.product_id,o])).values()].slice(0,6)}function nc(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 oc(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 Q_({processStages:e,llmCalls:t,totalDurationMs:a,llmDurationMs:r,llmCallCount:i}){let n=[...t].sort((l,c)=>c.durationMs-l.durationMs).slice(0,12),o=Math.max(0,t.length-n.length);return(0,s.jsxs)("div",{className:"results-detail-block",style:{marginBottom:18},children:[(0,s.jsx)("h3",{style:{margin:"0 0 12px"},children:"Pipeline timings"}),(0,s.jsxs)("div",{className:"results-summary",style:{marginBottom:12},children:[(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:oc(a)})," total"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:i})," LLM calls"]}),(0,s.jsxs)("span",{className:"summary-chip",children:[(0,s.jsx)("strong",{children:oc(r)})," LLM time"]})]}),(0,s.jsxs)("table",{className:"score-breakdown-table",style:{marginBottom:14},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Process stage"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:e.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:oc(l.durationMs)})]},`${l.key}-${c}`))})]}),t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{style:{margin:"0 0 10px"},children:"LLM calls"}),(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Call"}),(0,s.jsx)("th",{children:"Duration"})]})}),(0,s.jsx)("tbody",{children:n.map((l,c)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:l.label}),(0,s.jsx)("td",{children:oc(l.durationMs)})]},`${l.key}-${c}`))})]}),o>0&&(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Showing slowest ",n.length," of ",t.length," LLM calls."]})]})]})}function G_({queries:e}){return e.length===0?null:(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Retrieval by procurement query"}),e.map((t,a)=>(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsxs)("div",{className:"results-row-meta",style:{marginBottom:6},children:["Query: ",(0,s.jsx)("strong",{children:t.query})]}),t.candidates.length===0?(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates returned for this query."}):(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Unit"}),(0,s.jsx)("th",{children:"bm25"})]})}),(0,s.jsx)("tbody",{children:t.candidates.slice(0,5).map((r,i)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:r.description}),(0,s.jsx)("div",{className:"results-row-meta",children:r.product_id})]}),(0,s.jsx)("td",{children:Ad(r.measurements_mm)}),(0,s.jsx)("td",{children:al(r.price_basis)||"-"}),(0,s.jsx)("td",{children:r.bm25.toFixed(2)})]},`${r.product_id}-${i}`))})]})]},`${t.query}-${a}`))]})}function kv({item:e,result:t}){let a=t?.retrieval_debug.map(i=>i.query).filter(Boolean)??[],r=[["Procurement intent",e.procurement_intent||"-"],["Procurement aliases",Rn(e.procurement_aliases)],["Retrieval queries",Rn(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)",Ad(e.attrs.measurements_mm)],["Stock length",B_(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",Rn(e.installation_clues)],["System clues",Rn(e.system_clues)],["Component requirements",Rn(e.component_requirements)],["Linked group",Un(e)||"-"],["Flags",Rn(e.flags)]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Search context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:r.map(([i,n])=>(0,s.jsxs)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:i}),(0,s.jsx)("dd",{children:n})]},i))})]})}function Y_({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)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:"Attempted"}),(0,s.jsx)("dd",{children:t.attempted?"yes":"no"})]}),(0,s.jsxs)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:"Applied"}),(0,s.jsx)("dd",{children:t.applied?"yes":"no"})]}),(0,s.jsxs)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:"Returned items"}),(0,s.jsx)("dd",{children:t.returned_item_count??"-"})]}),(0,s.jsxs)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:"Reason"}),(0,s.jsx)("dd",{children:t.reason||"-"})]}),(0,s.jsxs)(xe.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 $_({result:e}){let t=e?.adjudication_debug;if(!t)return null;let a=[["Dependent rerank applied",t.dependent_rerank_applied?"yes":"no"],["Linked parent selected product",t.linked_parent_selected_candidate_description||t.linked_parent_selected_candidate_id||"-"],["Dimension reason overridden",t.dimension_reason_overridden?"yes":"no"]];return(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsx)("h4",{style:{margin:"0 0 12px"},children:"Adjudication context"}),(0,s.jsx)("dl",{className:"results-detail-grid",children:a.map(([r,i])=>(0,s.jsxs)(xe.Fragment,{children:[(0,s.jsx)("dt",{children:r}),(0,s.jsx)("dd",{children:i})]},r))}),t.rerank_line_item_input?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h5",{style:{margin:"12px 0 8px"},children:"Rerank input"}),(0,s.jsx)("pre",{className:"results-pre",children:JSON.stringify(t.rerank_line_item_input,null,2)})]}):null]})}function V_({item:e,decision:t,result:a,showRetrievalDebug:r,reviewOnly:i=!1,linkedGroupMeta:n}){if(!t)return null;let o=t.technical_classification==="no_suitable_candidate"?"No automatic match:":`AI review (${t.confidence??"confidence not stated"}):`;return i?t.reason?(0,s.jsxs)("div",{className:"results-detail-block",children:[(0,s.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,s.jsx)("strong",{children:o}),"\xA0",t.reason]}),mr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",Un(e)]}):null]}):null:!t.reason&&!r?(0,s.jsx)(kv,{item:e,result:a}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(kv,{item:e,result:a}),r&&(0,s.jsx)(Y_,{item:e}),r&&(0,s.jsx)($_,{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]}),mr(e)?(0,s.jsxs)("p",{className:"results-row-meta",style:{marginTop:8},children:["Linked context: ",n?`Link ${n.token} - `:"",Un(e)]}):null]}),r&&(0,s.jsx)(G_,{queries:a?.retrieval_debug??[]})]})}function X_({item:e,candidates:t,result:a,decision:r,unmatchable:i,selectedProductId:n,detailMode:o,onPick:l,onClear:c,showAll:p=!1,internal:m=!1,debugEnabled:b=!1,forceReviewNote:f=!1,linkedGroupMeta:w}){let _=m||o==="detailed",E=b&&o==="detailed",D=_||f?(0,s.jsx)(V_,{item:e,decision:r,result:a,showRetrievalDebug:E,reviewOnly:f&&!_,linkedGroupMeta:w}):null;if(i)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"Classified as labour/plant or referencing another line item - skipped by design."})]});if(t.length===0)return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsx)("p",{className:"results-empty-hint",children:"No candidates were returned for this line item."})]});let h=p||m||o==="detailed"?t:j_(t,a,n);return(0,s.jsxs)(s.Fragment,{children:[D,(0,s.jsxs)("table",{className:"score-breakdown-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Product"}),(0,s.jsx)("th",{children:"Dims (mm)"}),(0,s.jsx)("th",{children:"Price"}),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:h.map((u,g)=>{let v=u.product_id===n;return(0,s.jsxs)("tr",{className:v?"score-breakdown-row--best":"",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{children:u.description}),(0,s.jsx)("div",{className:"results-row-meta",children:u.product_id})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"unit-badge",children:Ad(u.measurements_mm??u.debug?.candidate.measurements_mm)})}),(0,s.jsx)("td",{children:An(u.price,u.price_basis)}),E&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{children:(u.scores?.dimension??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.grade??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.brand??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.fuzzy??0).toFixed(2)}),(0,s.jsx)("td",{children:(u.scores?.bm25??0).toFixed(2)}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(O_,{band:Sv(u.scores?.overall)}),(0,s.jsx)("span",{className:"results-overall-cell",children:(u.scores?.overall??0).toFixed(2)})]})})]}),(0,s.jsx)("td",{children:(0,s.jsxs)("label",{className:"switch-toggle",title:v?"Currently selected":"Use this candidate",children:[(0,s.jsx)("input",{type:"checkbox",checked:v,onChange:()=>{v?c?.():l(u)},"aria-label":v?`${u.description} selected`:`Use ${u.description}`}),(0,s.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},`${u.product_id}-${g}`)})})]})]})}function Ud({scheduleResult:e,onStartOver:t,cart:a,onAddToCart:r,onRemoveFromCart:i,onGoToBasket:n,cartSeeded:o,onCartSeeded:l,reviewGateComplete:c,onReviewGateComplete:p,internal:m=!1}){let b=!m&&Ks()==="QZA6-MRA4",f=b?"quote":"basket",{results:w,lineItems:_,parseReport:E,timings:D}=e,[h,u]=(0,xe.useState)({}),g=Nn(),[v,N]=(0,xe.useState)({}),[R,T]=(0,xe.useState)({}),[U,A]=(0,xe.useState)(""),[B,ie]=(0,xe.useState)(null),[ze,He]=(0,xe.useState)(1),Ve=Ot().debug===!0,[qe,be]=(0,xe.useState)("simple"),[le,Je]=(0,xe.useState)(m?"list":"tile"),[Ne,St]=(0,xe.useState)(!1),[X,me]=(0,xe.useState)(null),[Re,Nt]=(0,xe.useState)(""),[Bt,Ut]=(0,xe.useState)([]),[Xe,ve]=(0,xe.useState)(!1),[we,Ye]=(0,xe.useState)(null),[z,H]=(0,xe.useState)(!1),[ne,ce]=(0,xe.useState)(null),fe=(0,xe.useRef)(null),[Me,Ze]=(0,xe.useState)(new Set),[d,M]=(0,xe.useState)(new Set),[S,$]=(0,xe.useState)(!1);(0,xe.useEffect)(()=>{He(1)},[U,B,le]);let Z=new Map(w.map(k=>[k.line_id,k])),x=H_(_),j=_.map(k=>{let Q=Z.get(k.line_id),he=Q?.decision,ut=A_(k),Ke=h[k.line_id],ea=U_(Q,Ke),Ti=a[k.line_id],d0=Ke===Rd?void 0:v[k.line_id]??(Ti&&Ti.productId!==ea?.product_id?_v(Ti):ea),wm=ut?void 0:d0,m0=k.qty??0;return{item:k,result:Q,decision:he,unmatchable:ut,best:wm,qty:m0,band:Sv(wm?.scores?.overall)}}),ue=j.some(k=>!k.unmatchable&&!k.best&&!d.has(k.item.line_id))?null:ic(Object.values(a),{wasteFactorEnabled:!1,wasteFactorOverride:0}),ke=0;for(let k of j){if(k.unmatchable||k.decision?.include_in_quote!==!0||!k.best)continue;let Q=a[k.item.line_id];(!Q||It(Q).lineTotal==null)&&(ke+=1)}ke>0&&(ue=null);let wt=L_(ue,ke),rt=k=>!k.unmatchable&&!k.best&&k.decision?.technical_classification!=="no_suitable_candidate"&&nc(k.result).length>0,Ct=k=>k.best??nc(k.result)[0],Kr=j.filter(k=>!k.unmatchable&&!k.best).filter(k=>!d.has(k.item.line_id)),Cc=j.filter(k=>d.has(k.item.line_id)),Yt=j;if(U.trim()){let k=U.trim().toLowerCase();Yt=Yt.filter(Q=>Q.item.description_original?.toLowerCase().includes(k)||Ct(Q)?.description?.toLowerCase().includes(k))}if(B){let k=B==="asc"?1:-1;Yt=[...Yt].sort((Q,he)=>k*(Q.item.description_original||"").localeCompare(he.item.description_original||""))}let hr=Math.max(1,Math.ceil(Yt.length/nl)),vt=Math.min(ze,hr),qi=Yt.slice((vt-1)*nl,vt*nl),um=qi.filter(k=>!k.unmatchable&&k.best),Dx=qi.filter(k=>rt(k)),qc=qi.filter(k=>!k.unmatchable&&(k.best||rt(k))),pm=qi.filter(k=>k.unmatchable||!k.best&&!rt(k)),P=X?j.find(k=>k.item.line_id===X)??null:null,n0=!m&&!c&&!P&&Kr.length>0,$n=(0,xe.useRef)(null),Vn=()=>{let k=fe.current;if(!k)return;let{top:Q,left:he,width:ut,height:Ke}=k.getBoundingClientRect(),Ti=k.querySelector(".bom-toolbar-btn")?.closest("td")?.getBoundingClientRect().left;ce({top:Q,left:he,width:Ti?Ti-he:ut,height:Ke})};(0,xe.useEffect)(()=>(window.addEventListener("scroll",Vn,!0),window.addEventListener("resize",Vn),()=>{window.removeEventListener("scroll",Vn,!0),window.removeEventListener("resize",Vn)})),(0,xe.useEffect)(()=>{let k=Q=>{$n.current&&!Q.composedPath().includes($n.current)&&$n.current.removeAttribute("open")};return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[]);let Ei=k=>{me(k),Nt("")},o0=()=>{if(!X)return;let k=a[X];if(k){u(Q=>({...Q,[X]:k.productId})),N(Q=>({...Q,[X]:_v(k)}));return}u(Q=>{let he={...Q};return delete he[X],he}),N(Q=>{let he={...Q};return delete he[X],he})},Va=(k=!1)=>{let Q=X?a[X]:void 0;!k&&Q&&P?.best&&Q.productId!==P.best.product_id&&!window.confirm("You have selected a new product. Leave without updating it?")||(k||o0(),me(null),$(!1))};el(z,()=>H(!1)),el(!!P&&!z,()=>Va());let l0=k=>{if(Ze(Q=>new Set(Q).add(k)),Kr.some(Q=>Q.item.line_id!==k)){Va(!0);return}p(),Va(!0)},s0=k=>{if(Ec(k),M(Q=>new Set(Q).add(k)),Kr.some(Q=>Q.item.line_id!==k)){Va(!0);return}p(),Va(!0)},c0=()=>{M(k=>new Set([...k,...Kr.map(Q=>Q.item.line_id)])),p()},dm=()=>{P?.best&&(fm(P.item.line_id,P.best),r(Xn(P)),S?l0(P.item.line_id):Va(!0))},mm=pm.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:pm.map(k=>{let{item:Q,qty:he}=k;return(0,s.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>Ei(Q.line_id),children:[(0,s.jsx)("span",{className:"results-unmatched-card__main",children:(0,s.jsx)("span",{className:"results-unmatched-card__title",children:Xr(Q,_)})}),(0,s.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},Q.line_id)})})]}):null,Ec=k=>{u(Q=>({...Q,[k]:Rd})),N(Q=>({...Q,[k]:void 0})),T(Q=>({...Q,[k]:void 0})),i(k)},Mc=(k,Q)=>{u(he=>({...he,[k]:Q.product_id})),N(he=>({...he,[k]:Q}))},fm=(k,Q)=>{Q.method==="catalogue_search"&&T(he=>({...he,[k]:Q}))};function Ox(){g("downloaded",{type:"schedule",lines:j.length}),vv(j.map(({item:k,best:Q,qty:he,band:ut,unmatchable:Ke,decision:ea})=>({item:k,best:Q,qty:he,band:ut,unmatchable:Ke,decision:ea})))}function Xn(k){let Q=k.best??nc(k.result)[0];return zn(Q,{lineId:k.item.line_id,description:k.item.description_original,unit:k.item.unit,qty:k.qty,linkedContext:k.item.linked_group_role==="dependent"&&k.item.linked_group_id?_.filter(he=>he.linked_group_id===k.item.linked_group_id&&he.linked_group_role==="anchor").slice(0,1).map(he=>{let ut=a[he.line_id];return{line_id:he.line_id,product_id:ut?.productId??null,measurements_mm:ut?.measurementsMm??he.attrs.measurements_mm,description:ut?.description??he.description_original,qty:he.qty,unit:he.unit,role:"anchor"}}):void 0})}(0,xe.useEffect)(()=>{if(!o){for(let k of j)!k.unmatchable&&k.best&&r(Xn(k));l()}},[o]),(0,xe.useEffect)(()=>{if(!X){Ut([]),Ye(null),ve(!1);return}let k=Re.trim();if(!k){Ut([]),Ye(null),ve(!1);return}let Q=!1,he=window.setTimeout(async()=>{try{ve(!0),Ye(null);let ut=await fetch(za(`/api/catalogue/search?q=${encodeURIComponent(k)}`),{headers:hi()}),Ke=await Qa(ut);if(!ut.ok)throw new Error(Ke?.error||Ke?.message||"Failed to search catalogue");Q||Ut(Array.isArray(Ke?.items)?Ke.items:[])}catch(ut){Q||(Ut([]),Ye(ut?.message||"Failed to search catalogue"))}finally{Q||ve(!1)}},250);return()=>{Q=!0,window.clearTimeout(he)}},[Re,X]);let Tc=Object.keys(a).length,qa=Re.trim(),zc=nc(P?.result),fl=P?.decision?.technical_classification==="no_suitable_candidate"||!!P&&!P.best,hm=P?.decision?.technical_classification!=null,gm=P?.decision?.reason??(fl?"No catalogue candidate found. Refine the request or search the catalogue.":null),u0=Bt.map(k=>({product_id:k.product_id,description:k.description,source_list:k.source_list,price:k.price,price_basis:k.price_basis,uoi_count:k.uoi_count??null,uoi:k.uoi,pdp_photo_url:k.pdp_photo_url??null,conversion:k.conversion,measurements_mm:k.measurements_mm??[],scores:{dimension:0,grade:0,brand:0,fuzzy:0,bm25:0,overall:0},method:"catalogue_search"})),Zn=qa?u0:zc,Mi=P?R[P.item.line_id]:void 0,Kn=!qa&&Mi&&!Zn.some(k=>k.product_id===Mi.product_id)?[...Zn,Mi]:Zn,bm=(()=>{let k=Kn.slice(0,qa?12:6);return qa||!Mi||k.some(Q=>Q.product_id===Mi.product_id)?k:[...k,Mi]})(),hl=!!P?.best&&a[P.item.line_id]?.productId===P.best.product_id,p0=!!P?.best&&!!a[P.item.line_id]&&!hl;return(0,s.jsxs)("div",{className:"wizard-step entry-stage",children:[(0,s.jsxs)("div",{className:`quick-order-card${m?"":" quick-order-card--customer"}`,children:[(0,s.jsx)("div",{className:`quick-order-hero${m?"":" quick-order-hero--customer"}`,children:m?(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:wt??"Review quantities"})," 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:n,disabled:Tc===0,"aria-label":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:b?"View Quote":"View Basket"}),wt!=null&&(0,s.jsx)("strong",{children:wt})]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})}),(0,s.jsxs)("div",{className:"quick-order-panel",style:{paddingTop:16},children:[Ve&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:12},children:(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn","aria-pressed":Ne,onClick:()=>St(k=>!k),children:Ne?"Hide timings":"Show timings"})}),Ve&&Ne&&(0,s.jsx)(Q_,{...D}),!b&&(0,s.jsx)("div",{className:"results-toolbar-row",children:!P&&(0,s.jsx)("div",{className:"results-summary",style:{marginBottom:0},children:(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:U,onChange:k=>A(k.target.value),"aria-label":"Search line items"}),!m&&(0,s.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,s.jsx)("button",{type:"button",className:`results-view-toggle__btn${le==="tile"?" is-active":""}`,"aria-pressed":le==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>Je("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${le==="list"?" is-active":""}`,"aria-pressed":le==="list","aria-label":"List view",title:"List view",onClick:()=>Je("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"})]})})]}),Ve&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>be(k=>k==="simple"?"detailed":"simple"),children:qe==="detailed"?"Hide detailed view":"Show detailed view"}),(0,s.jsxs)("details",{ref:$n,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:R_.map(k=>{let Q=B===k.dir;return(0,s.jsxs)("button",{type:"button",className:`sort-menu-item${Q?" is-active":""}`,onClick:()=>{ie(Q?null:k.dir),$n.current?.removeAttribute("open")},children:[(0,s.jsx)("span",{className:"sort-menu-item__check",children:Q?"\u2713":""}),k.label]},k.dir)})})]})]})})}),le==="tile"||P?(0,s.jsxs)(s.Fragment,{children:[P?(0,s.jsx)("div",{className:"modal-backdrop quick-order-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Product options",onClick:()=>Va(),children:(0,s.jsxs)("section",{className:"quick-order-workflow-modal results-review-modal",onClick:k=>k.stopPropagation(),children:[(0,s.jsx)("button",{type:"button",className:"quick-order-workflow-close results-review-modal__close",onClick:()=>Va(),"aria-label":"Close product options",children:(0,s.jsx)(Io,{})}),(0,s.jsx)("div",{className:"results-review-page",children:m?(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:()=>Va(),children:[(0,s.jsx)(Vr,{}),"Back to results"]}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[Ve&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>be(k=>k==="simple"?"detailed":"simple"),children:qe==="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:Re,onChange:k=>Nt(k.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:()=>Ec(P.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:Ga(Ct(P)?.description||P.item.description_original,Ct(P)?.product_id,Ct(P)?.pdp_photo_url),alt:""})}),(0,s.jsxs)("div",{className:"results-review-page__summary",children:[(0,s.jsx)("h2",{children:Xr(P.item,_)}),(0,s.jsxs)("p",{className:"results-review-page__meta",children:[wi(P.qty)," ",ka(P.item.unit,P.qty)]}),P.best?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:P.best.description}),P.best.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:An(P.best.price,P.best.price_basis)}):null]}):Ct(P)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-review-page__product",children:Ct(P)?.description}),Ct(P)?.price!=null?(0,s.jsx)("div",{className:"results-row-meta",children:An(Ct(P)?.price??null,Ct(P)?.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."}),mr(P.item)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[(0,s.jsx)(zd,{meta:x.get(P.item.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Un(P.item)})]}):null,(0,s.jsx)("div",{className:"results-review-page__actions",children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[P.item.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[P.item.line_id]?i(P.item.line_id):(P.best&&fm(P.item.line_id,P.best),r(Xn(P)))},disabled:!P.best,"aria-label":a[P.item.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[P.item.line_id]?"\u2713 Added":m?"+ Add to selection":`Add to ${f}`})})]})]}),Xe?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,!Xe&&we?(0,s.jsx)("div",{className:"results-empty-card",children:we}):null,!Xe&&!we&&qa&&Zn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No candidate products match this database search."}):!Xe&&!we?(0,s.jsx)(X_,{item:P.item,candidates:Zn,result:P.result,decision:P.decision,unmatchable:P.unmatchable,selectedProductId:P.best?.product_id??null,detailMode:qe,linkedGroupMeta:mr(P.item)?x.get(P.item.linked_group_id):void 0,onPick:k=>Mc(P.item.line_id,k),onClear:()=>Ec(P.item.line_id),showAll:m||Ve||qa.length>0,internal:m,debugEnabled:Ve,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:Xr(P.item,_)||"Original request"})]}),gm?(0,s.jsxs)("section",{className:"customer-review-ai",children:[(0,s.jsx)("strong",{children:fl?"No automatic match:":"AI review:"})," ",gm]}):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:fl?zc.length>0?"Choose a product":"No suitable product found":hm?"Choose a product":"We couldn't review this item"}),(0,s.jsx)("p",{children:fl?zc.length>0?"No product was selected automatically. Review these related options before adding one.":"Search the catalogue to choose an alternative.":hm?`Select the option you want to add to your ${f}.`:"Search the catalogue to choose a product."})]})}),!qa&&Kn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:bm.map(k=>{let Q=k.product_id===P.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${Q?" is-selected":""}`,onClick:()=>Mc(P.item.line_id,k),"aria-pressed":Q,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ga(k.description,k.product_id,k.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:k.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:k.price!=null?`\xA3${An(k.price,k.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:Q?"Selected":"Choose"})]},k.product_id)})}):null,Kn.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:Re,onChange:k=>Nt(k.target.value),"aria-label":"Search catalogue"})]}),qa&&Xe?(0,s.jsx)("div",{className:"results-empty-card",children:"Searching catalogue\u2026"}):null,qa&&!Xe&&we?(0,s.jsx)("div",{className:"results-empty-card",children:we}):null,qa&&!Xe&&!we&&Kn.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No products match this search."}):null,qa&&!Xe&&!we&&Kn.length>0?(0,s.jsx)("div",{className:"customer-review-option-grid",children:bm.map(k=>{let Q=k.product_id===P.best?.product_id;return(0,s.jsxs)("button",{type:"button",className:`customer-review-option${Q?" is-selected":""}`,onClick:()=>Mc(P.item.line_id,k),"aria-pressed":Q,children:[(0,s.jsx)("img",{className:"customer-review-option__image",src:Ga(k.description,k.product_id,k.pdp_photo_url),alt:"",width:64,height:64}),(0,s.jsx)("span",{className:"customer-review-option__copy",children:(0,s.jsx)("strong",{children:k.description})}),(0,s.jsx)("span",{className:"customer-review-option__price",children:k.price!=null?`\xA3${An(k.price,k.price_basis)}`:"-"}),(0,s.jsx)("span",{className:"customer-review-option__state",children:Q?"Selected":"Choose"})]},k.product_id)})}):null]}),P.best?p0?(0,s.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,s.jsx)("button",{type:"button",className:"cta-btn customer-review-add",onClick:()=>{dm()},children:(0,s.jsx)("span",{children:"Update product"})}),(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-add",onClick:()=>i(P.item.line_id),children:(0,s.jsx)("span",{children:`Remove from ${f}`})})]}):(0,s.jsx)("button",{type:"button",className:`cta-btn customer-review-add${hl?" cta-btn-secondary":""}`,onClick:()=>{hl?i(P.item.line_id):dm()},children:(0,s.jsx)("span",{children:hl?`Remove from ${f}`:`Add selected product to ${f}`})}):null,S?(0,s.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary customer-review-skip",onClick:()=>s0(P.item.line_id),children:"Skip this item"}):null]})})]})}):null,(0,s.jsxs)("div",{className:"results-tile-layout",children:[Yt.length===0?(0,s.jsx)("div",{className:"results-empty-card",children:"No line items match the current search/filter."}):null,qc.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:qc.map(k=>{let{item:Q,best:he,qty:ut}=k,Ke=Ct(k),ea=!he&&rt(k);return(0,s.jsxs)("article",{className:"results-tile-card",children:[(0,s.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>Ei(Q.line_id),"aria-label":`Review match for ${Xr(Q,_)||"item"}`,children:[(0,s.jsxs)("div",{className:"results-tile-card__media",children:[ea||mr(Q)?(0,s.jsxs)("div",{className:"results-tile-card__badges",children:[mr(Q)?(0,s.jsx)(zd,{meta:x.get(Q.linked_group_id)}):(0,s.jsx)("span",{}),ea?(0,s.jsx)("span",{style:{padding:"6px 10px",borderRadius:999,background:"#fef3c7",color:"#92400e",fontSize:12,fontWeight:700,lineHeight:1},children:"Partially matched"}):null]}):null,(0,s.jsx)("img",{className:"fill-img results-tile-card__image",src:Ga(Ke?.description||Q.description_original,Ke?.product_id,Ke?.pdp_photo_url),alt:""})]}),(0,s.jsxs)("div",{className:"results-tile-card__body",children:[Ke?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"results-tile-card__heading",children:(0,s.jsx)("div",{className:"results-tile-card__title",children:Ke.description})})}):(0,s.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line item."}),(0,s.jsx)("div",{className:"results-tile-card__match",children:Ke?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"results-tile-card__match-label",children:ea?"\u21B3 partially matched from":"\u21B3 matched from"}),(0,s.jsx)("div",{className:"results-tile-card__match-name",children:Xr(Q,_)}),mr(Q)?(0,s.jsx)("div",{className:"results-row-meta",children:Un(Q)}):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:[m&&(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ei(Q.line_id),children:"Review"}),(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[Q.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>{a[Q.line_id]?i(Q.line_id):r(Xn(k))},disabled:!Ke,"aria-label":a[Q.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[Q.line_id]?"\u2713 Added":m?"+ Add":`Add to ${f}`})]})]},Q.line_id)})})}):null,mm]})]}):(0,s.jsxs)(s.Fragment,{children:[ne&&(0,s.jsx)("div",{className:"results-table__hover-overlay",style:ne,"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"}}),qe==="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"}),qe==="simple"&&(0,s.jsx)("th",{style:{textAlign:"center"},children:m?"Selection":b?"Quote":"Basket"})]})}),(0,s.jsxs)("tbody",{children:[Yt.length===0&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:qe==="simple"?4:3,className:"results-empty-hint",style:{padding:"16px 8px"},children:"No line items match the current search/filter."})}),qc.map(k=>{let{item:Q,result:he,decision:ut,best:Ke}=k;return(0,s.jsxs)("tr",{className:"bom-row results-table__review-row",onClick:()=>Ei(Q.line_id),onMouseEnter:ea=>{fe.current=ea.currentTarget,Vn()},onMouseLeave:()=>{fe.current=null,ce(null)},children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("div",{className:"bom-component-name",children:Xr(Q,_)}),mr(Q)?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,s.jsx)(zd,{meta:x.get(Q.linked_group_id)}),(0,s.jsx)("div",{className:"results-row-meta",style:{marginTop:0},children:Un(Q)})]}):null]}),(0,s.jsx)("td",{children:Ke?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"results-match-cell-text",title:Ke.description,children:Ke.description}),qe==="detailed"&&ut?.technical_classification&&(0,s.jsxs)("div",{className:"results-row-meta",children:[D_(ut.technical_classification),ut.approval_required?" - approval required":""]})]}):(0,s.jsx)("span",{className:"results-empty-hint"})}),(0,s.jsx)("td",{style:{textAlign:"center"},children:Ke?.price!=null?An(Ke.price,Ke.price_basis):"-"}),qe==="simple"&&(0,s.jsx)("td",{style:{textAlign:"center"},children:(0,s.jsx)("button",{type:"button",className:`bom-toolbar-btn${a[Q.line_id]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,style:{width:84,justifyContent:"center"},onClick:ea=>{ea.stopPropagation(),a[Q.line_id]?i(Q.line_id):r(Xn(k))},"aria-label":a[Q.line_id]?m?"Remove from selection":`Remove from ${f}`:m?"Add to selection":`Add to ${f}`,children:a[Q.line_id]?"\u2713 Added":m?"+ Add":`Add to ${f}`})})]},Q.line_id)})]})]})}),mm]}),!P&&hr>1&&(0,s.jsxs)("div",{className:"results-pagination",children:[(0,s.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(vt-1)*nl+1,"\u2013",Math.min(vt*nl,Yt.length)," of ",Yt.length]}),(0,s.jsxs)("div",{className:"results-pagination-controls",children:[(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>He(vt-1),disabled:vt===1,children:"Previous"}),(0,s.jsxs)("span",{className:"results-pagination-page",children:["Page ",vt," of ",hr]}),(0,s.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>He(vt+1),disabled:vt===hr,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."})]}),!P&&(0,s.jsxs)("div",{className:"btn-row results-actions",children:[(0,s.jsxs)("button",{className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",gap:10,justifyContent:"center"},onClick:()=>H(!0),"aria-label":"Start over",children:[(0,s.jsx)(Cd,{}),(0,s.jsx)("span",{children:"Start Over"})]}),(0,s.jsxs)("button",{className:"cta-btn",style:{flex:"0 1 70%"},onClick:n,disabled:Tc===0,"aria-label":m?"View selection":b?"View quote":"View basket",children:[(0,s.jsxs)("span",{children:[m?"View Selection":b?"View Quote":"View Basket"," (",Tc,")"]}),(0,s.jsx)("span",{className:"arrow",children:(0,s.jsx)(Qt,{})})]})]})]})]}),n0&&(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:Kr.map(k=>{let Q=Me.has(k.item.line_id),he=rt(k);return(0,s.jsx)("div",{className:`review-gate-item${Q?" is-reviewed":""}`,children:(0,s.jsxs)("button",{type:"button",className:"review-gate-item__review",onClick:()=>{$(!0),Ei(k.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Xr(k.item,_)}),(0,s.jsx)("span",{children:k.decision?.reason||(he?"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:Q?"Choice made":"Choose a product"})]})},k.item.line_id)})}),(0,s.jsx)("button",{type:"button",className:"review-gate-skip",onClick:c0,children:"Skip all"}),Cc.length>0?(0,s.jsxs)("div",{className:"review-gate-skipped",children:[(0,s.jsx)("strong",{children:"Skipped"}),Cc.map(k=>(0,s.jsxs)("button",{type:"button",className:"review-gate-item is-skipped",onClick:()=>{M(Q=>{let he=new Set(Q);return he.delete(k.item.line_id),he}),$(!0),Ei(k.item.line_id)},children:[(0,s.jsxs)("span",{className:"review-gate-item__copy",children:[(0,s.jsx)("strong",{children:Xr(k.item,_)}),(0,s.jsx)("span",{children:`Not added to your ${f}.`})]}),(0,s.jsx)("span",{className:"review-gate-item__action",children:"Choose a product"})]},k.item.line_id))]}):null]})}),z&&(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:()=>H(!1),children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"modal-btn modal-btn-danger",onClick:()=>{H(!1),t()},autoFocus:!0,children:"Start Over"})]})]})})]})}var ht=Y(je());var Rt=Y(je()),Cv=Y(ee());function Dn(e){return JSON.stringify([e.productId,e.qty,e.unit,e.linkedContext??[]])}function Z_(e,t){let a={...e,[t.lineId]:t};for(let[r,i]of Object.entries(a)){if(!i.linkedContext)continue;let n=i.linkedContext.find(l=>l.role==="anchor"&&l.line_id&&a[l.line_id]),o=n?.line_id?a[n.line_id]:void 0;if(!(!n||!o||n.product_id===o.productId&&n.description===o.description)){if(i.conversionType!=="basket_line_unit"){a[r]={...i,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l)};continue}a[r]={...i,qty:0,sellUnitsOverride:null,linkedContext:i.linkedContext.map(l=>l.line_id===n.line_id?{...l,product_id:o.productId,measurements_mm:o.measurementsMm??[],description:o.description}:l),conversionType:null,requestUomsSupported:null,salesUomNormalised:null,salesUnitSize:null,salesUnitSizeUom:null,coverageQty:null,coverageUom:null,roundingRule:null,conversionConfidence:null,conversionNotes:null}}}return a}var Dd=(0,Rt.createContext)(null);function lc({children:e,onOpenBasket:t}){let[a,r]=(0,Rt.useState)({}),i=(0,Rt.useCallback)(f=>{r(w=>Z_(w,f))},[]),n=(0,Rt.useCallback)(f=>{r(w=>{let _={...w};for(let E of f)_[E.lineId]=E;return _})},[]),o=(0,Rt.useCallback)(f=>{r(w=>{let _={...w};return delete _[f],_})},[]),l=(0,Rt.useCallback)((f,w)=>{r(_=>_[f]?{..._,[f]:{..._[f],qty:w,sellUnitsOverride:null}}:_)},[]),c=(0,Rt.useCallback)((f,w)=>{r(_=>_[f]?{..._,[f]:{..._[f],sellUnitsOverride:w}}:_)},[]),p=(0,Rt.useCallback)(f=>{r(w=>{let _=!1,E={...w};for(let[D,h]of Object.entries(f))E[D]&&(E[D]={...E[D],...h},_=!0);return _?E:w})},[]),m=(0,Rt.useCallback)(()=>r({}),[]),b=(0,Rt.useMemo)(()=>({cart:a,count:Object.keys(a).length,addToCart:i,addManyToCart:n,removeFromCart:o,updateCartQty:l,updateCartSellUnits:c,updateCartConversions:p,clearCart:m,openBasket:t??(()=>{})}),[a,i,n,o,l,c,p,m,t]);return(0,Cv.jsx)(Dd.Provider,{value:b,children:e})}function On(){let e=(0,Rt.useContext)(Dd);if(!e)throw new Error("useCart must be used inside a <CartProvider>");return e}function Nv(){return(0,Rt.useContext)(Dd)}var q=Y(ee()),qv=.2,ol=10,Ev="Enter a valid email address so we can send your quote.",K_=(e,t)=>{let a=`${t.requestedAmount} ${xa(t.requestedUnit,t.requestedAmount)}`,r=`${t.requiredSellUnits} ${xa(t.sellUnit,t.requiredSellUnits??0)}`,i=e.unitConversions?.find(n=>n.requestUom===t.requestedUnit);return i&&i.quantityPerSaleUnit<1?`${a} requested \u2192 order ${r} (${Math.round(1/i.quantityPerSaleUnit)} ${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}`},P_=e=>["box","pack"].includes(e.requestedUnit)?"Pack size needed to calculate the order quantity.":`This product is sold by ${xa(e.sellUnit,1)}.`;function J_(){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 ll(){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 sl({cart:e,onUpdateQty:t,onUpdateSellUnits:a,onResolveConversions:r,onRemove:i,onBack:n,onStartNewQuote:o,onQuoteRequested:l,internal:c=!1}){let p=(0,ht.useId)(),m=!c&&Ks()==="QZA6-MRA4",b=Object.values(e),[f,w]=(0,ht.useState)(""),[_,E]=(0,ht.useState)(!1),[D,h]=(0,ht.useState)(!1),u=Nn(),[g,v]=(0,ht.useState)(""),[N,R]=(0,ht.useState)({}),[T,U]=(0,ht.useState)({}),[A,B]=(0,ht.useState)(1),[ie,ze]=(0,ht.useState)({}),[He,Ve]=(0,ht.useState)(!1),[qe,be]=(0,ht.useState)("0"),[le,Je]=(0,ht.useState)({}),Ne=(0,ht.useRef)(new Map);(0,ht.useEffect)(()=>{if(!r)return;for(let S of Object.values(e))It(S).requiredSellUnits!=null&&Ne.current.delete(S.lineId);let d=Object.values(e).filter(S=>{if(S.productId==="-"||It(S).requiredSellUnits!=null)return!1;let $=Dn(S);return Ne.current.get(S.lineId)===$?!1:(Ne.current.set(S.lineId,$),!0)});if(d.length===0)return;let M=new Map(d.map(S=>[S.lineId,Dn(S)]));Je(S=>({...S,...Object.fromEntries(M)})),fetch(za("/api/catalogue/resolve-conversions"),{method:"POST",headers:{"Content-Type":"application/json",...Cn()},body:JSON.stringify({lines:d.map(S=>({line_id:S.lineId,product_id:S.productId,requested_description:S.requestedDescription??S.description,requested_qty:S.qty,requested_uom:S.unit||null,linked_context:S.linkedContext??[],selected_description:S.description,selected_uoi:S.uoi,selected_uoi_count:S.uoiCount,selected_conversion:{sales_uom_normalised:S.salesUomNormalised,conversion_type:S.conversionType,sales_unit_size:S.salesUnitSize,sales_unit_size_uom:S.salesUnitSizeUom,coverage_qty:S.coverageQty,coverage_uom:S.coverageUom}}))})}).then(S=>S.ok?Qa(S):null).then(S=>{let $={},Z=new Map(d.map(x=>[x.lineId,Dn(x)]));for(let x of S?.data?.items??S?.items??[]){let j=x?.conversion;if(!j||typeof x?.line_id!="string"||Ne.current.get(x.line_id)!==Z.get(x.line_id))continue;let K=e[x.line_id];$[x.line_id]={conversionType:j.conversion_type,requestUomsSupported:j.request_uoms_supported,salesUomNormalised:j.sales_uom_normalised,salesUnitSize:j.sales_unit_size,salesUnitSizeUom:j.sales_unit_size_uom,coverageQty:j.coverage_qty,coverageUom:j.coverage_uom,roundingRule:j.rounding_rule,conversionConfidence:j.conversion_confidence,conversionNotes:j.conversion_notes,...K?.qty===0&&Number.isFinite(j.suggested_order_qty)&&j.suggested_order_qty>0?{qty:j.suggested_order_qty,unit:j.suggested_order_uom||K.unit}:{}}}Object.keys($).length>0&&r($)}).catch(S=>console.error("Catalogue conversion resolution failed",S)).finally(()=>{Je(S=>{let $={...S};for(let[Z,x]of M)$[Z]===x&&delete $[Z];return $})})},[e,r]);function St(d){R(M=>{let S={...M};return delete S[d],S})}function X(d,M){let S=parseFloat(M);!isNaN(S)&&S>=0&&t(d,Math.min(S,1e5)),St(d)}function me(d,M,S){t(d,Math.min(1e5,Math.max(0,M+S))),St(d)}function Re(d){U(M=>{let S={...M};return delete S[d],S})}function Nt(d,M){let S=parseFloat(M);!isNaN(S)&&S>=0&&a(d,Math.min(S,1e5)),Re(d)}function Bt(d,M,S){a(d,Math.min(1e5,Math.max(0,M+S))),Re(d)}async function Ut(){if(Xe.some(({pricing:M})=>M.lineTotal==null)){v("Confirm the highlighted quantities before requesting a quote.");return}let d=f.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){v(Ev);return}v(""),h(!0);try{let M=await fetch(za("/api/quote-requests"),{method:"POST",headers:{"Content-Type":"application/json",...Cn()},body:JSON.stringify({email:d,items:Xe.map(({item:S,pricing:$})=>{let Z=$.requiredSellUnits??$.requestedAmount,x=$.requiredSellUnits!=null?$.sellUnit:$.requestedUnit;return{product_id:S.productId,description:S.description,quantity:Z,unit:xa(x,Z),unit_price:$.requiredSellUnits!=null?$.unitPrice:null,line_total:$.lineTotal}})})});if(!M.ok){let S=await Qa(M);console.error("Quote request failed",M.status,S?.message),v(M.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}Ye!=null&&u("quote_requested",{items:Xe.length,total:Math.round(Ye*100)/100}),E(!0),l?.(),window.scrollTo(0,0)}catch{v("Your request couldn't be sent. Check your connection and try again.")}finally{h(!1)}}let Xe=b.map(d=>({item:d,pricing:It(d,{wasteFactorEnabled:He,wasteFactorOverride:Math.max(0,Number.parseFloat(qe)||0)/100})})),ve=ic(b,{wasteFactorEnabled:He,wasteFactorOverride:Math.max(0,Number.parseFloat(qe)||0)/100}),we=ve==null?null:ve*qv,Ye=ve==null?null:ve*(1+qv),z=Xe.filter(({pricing:d})=>d.lineTotal==null).length,H=Object.keys(le).length,ne=!!r&&b.some(d=>{if(d.productId==="-"||It(d).requiredSellUnits!=null)return!1;let M=Dn(d);return Ne.current.get(d.lineId)!==M||le[d.lineId]===M}),ce=(0,ht.useRef)({items:Xe.length,...Ye==null?{}:{total:Math.round(Ye*100)/100}});(0,ht.useEffect)(()=>{u("basket_viewed",ce.current)},[u]);let fe=Math.max(1,Math.ceil(Xe.length/ol)),Me=Math.min(A,fe),Ze=Xe.slice((Me-1)*ol,Me*ol);return _?(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:f.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."})]})}):!c&&b.length===0?(0,q.jsx)("div",{className:"wizard-step entry-stage",children:(0,q.jsxs)("div",{className:"quote-request-sent",children:[(0,q.jsx)("div",{className:"quote-request-sent-icon","aria-hidden":"true",children:(0,q.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,q.jsx)("path",{d:"M3 9h18l-2 11H5z"}),(0,q.jsx)("path",{d:"M8 9l4-6 4 6"})]})}),(0,q.jsx)("h1",{children:m?"Your quote request is empty":"Your basket is empty"}),(0,q.jsx)("p",{children:m?"Start again with your list to build your quote.":"Start again with your list to fill your basket."}),(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:o,children:(0,q.jsx)("span",{children:"Back to start"})})]})}):(0,q.jsx)("div",{className:`wizard-step entry-stage${m?" basket-layout--qza6-mra4":""}`,children:(0,q.jsxs)("div",{className:`quick-order-card${c?"":" quick-order-card--customer"}`,children:[(0,q.jsxs)("div",{className:`quick-order-hero${c?"":" quick-order-hero--customer"}`,children:[c&&(0,q.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,q.jsxs)("div",{className:"basket-hero-copy",children:[m&&(0,q.jsxs)("button",{type:"button",className:"cta-btn cta-btn-secondary basket-hero-back",onClick:n,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:c?"Your Selection":m?"Request a quote":"Your Basket"}),c&&(0,q.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,q.jsx)("strong",{children:b.length})," ",b.length===1?"item":"items"]})]}),(0,q.jsx)("p",{children:c?"Review the items you've added before exporting them for review.":m?"Check your items and quantities below, and we'll do our best to beat list prices.":"Review your quantities and order summary before you buy."})]})]}),(0,q.jsx)("div",{className:"quick-order-panel",style:{paddingTop:16},children:ne?(0,q.jsxs)("div",{className:"basket-resolving",role:"status","aria-label":"Calculating order quantities",children:[(0,q.jsx)("span",{className:"basket-resolving-wheel","aria-hidden":"true"}),(0,q.jsx)("span",{children:"Calculating your quantities\u2026"})]}):b.length===0?(0,q.jsxs)("div",{className:"quick-order-history-empty",children:[(0,q.jsx)("div",{className:"basket-empty-icon","aria-hidden":"true",children:"\u{1F4CB}"}),(0,q.jsx)("p",{children:"Your selection is empty."}),(0,q.jsx)("p",{className:"basket-empty-hint",children:"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:n,"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":c?"Selection items":m?"Quote request items":"Basket items",children:Ze.map(({item:d,pricing:M})=>{let S=N[d.lineId]??String(M.requestedAmount),$=M.requestedUnit===M.sellUnit||M.costingMode==="review",Z=M.requiredSellUnits==null||M.requestedAmount!==M.requiredSellUnits||M.requestedUnit!==M.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:Ga(d.description,d.productId,d.pdpPhotoUrl),alt:"",width:48,height:48}),(0,q.jsxs)("div",{className:"basket-card-info",children:[(0,q.jsx)("div",{className:"bom-component-name",children:d.description}),Z&&M.costingMode!=="review"&&(0,q.jsxs)("button",{type:"button",className:"basket-calc-toggle",onClick:()=>ze(x=>({...x,[d.lineId]:!x[d.lineId]})),"aria-expanded":!!ie[d.lineId],children:["How we calculated this",(0,q.jsx)("span",{className:`basket-calc-toggle-chevron${ie[d.lineId]?" basket-calc-toggle-chevron--open":""}`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("div",{className:"basket-card-actions",children:(0,q.jsx)("button",{type:"button",className:"mf-remove-small-btn basket-card-remove",onClick:()=>i(d.lineId),"aria-label":`Remove ${d.description}`,children:(0,q.jsx)(J_,{})})})]}),c&&(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:d.conversionType??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Conversion confidence"}),(0,q.jsx)("dd",{children:d.conversionConfidence??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Sales unit"}),(0,q.jsx)("dd",{children:d.salesUnitSize!=null?(0,q.jsxs)(q.Fragment,{children:[d.salesUnitSize," ",ka(d.salesUnitSizeUom,d.salesUnitSize)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Coverage"}),(0,q.jsx)("dd",{children:d.coverageQty!=null?(0,q.jsxs)(q.Fragment,{children:[d.coverageQty," ",ka(d.coverageUom,d.coverageQty)]}):"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Waste factor"}),(0,q.jsx)("dd",{children:d.wasteFactorDefault??"-"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("dt",{children:"Rounding rule"}),(0,q.jsx)("dd",{children:d.roundingRule??"-"})]})]}),d.conversionNotes&&(0,q.jsx)("p",{className:"results-rerank-note",children:d.conversionNotes})]}),M.costingMode==="review"?(0,q.jsxs)("p",{className:"basket-calc-text basket-calc-text--review",children:[(0,q.jsx)("strong",{children:le[d.lineId]===Dn(d)?"Calculating order quantity\u2026":"Quantity needs confirmation."})," ",P_(M)]}):Z&&ie[d.lineId]?(0,q.jsx)("p",{className:"basket-calc-text",children:K_(d,M)}):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:S,disabled:$,onChange:x=>R(j=>({...j,[d.lineId]:x.target.value})),onBlur:x=>X(d.lineId,x.target.value),onKeyDown:x=>{x.key==="Enter"&&x.target.blur()},"aria-label":`${d.description} requested quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",disabled:$,onClick:()=>me(d.lineId,parseFloat(S)||0,1),"aria-label":`Increase ${d.description} quantity`,children:(0,q.jsx)(ll,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",disabled:$,onClick:()=>me(d.lineId,parseFloat(S)||0,-1),"aria-label":`Decrease ${d.description} quantity`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(M.requestedUnit,parseFloat(S)||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:T[d.lineId]??String(M.requiredSellUnits??""),onChange:x=>U(j=>({...j,[d.lineId]:x.target.value})),onBlur:x=>Nt(d.lineId,x.target.value),onKeyDown:x=>{x.key==="Enter"&&x.target.blur()},"aria-label":`${d.description} order quantity`}),(0,q.jsxs)("div",{className:"basket-qty-arrows",children:[(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow",onClick:()=>Bt(d.lineId,parseFloat(T[d.lineId]??String(M.requiredSellUnits??"0"))||0,1),"aria-label":`Increase ${d.description} order quantity`,children:(0,q.jsx)(ll,{})}),(0,q.jsx)("button",{type:"button",className:"basket-qty-arrow basket-qty-arrow--down",onClick:()=>Bt(d.lineId,parseFloat(T[d.lineId]??String(M.requiredSellUnits??"0"))||0,-1),"aria-label":`Decrease ${d.description} order quantity`,children:(0,q.jsx)(ll,{})})]})]}),(0,q.jsx)("span",{className:"basket-metric-unit",children:ka(M.sellUnit,parseFloat(T[d.lineId]??String(M.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:M.lineTotal!=null?lt(M.lineTotal):"-"}),M.lineTotal!=null&&(0,q.jsx)("span",{className:"basket-metric-unit",children:"ex. VAT"})]})]})]})]},d.lineId)})}),fe>1&&(0,q.jsxs)("div",{className:"results-pagination",children:[(0,q.jsxs)("span",{className:"results-pagination-count",children:["Showing ",(Me-1)*ol+1,"\u2013",Math.min(Me*ol,Xe.length)," of ",Xe.length]}),(0,q.jsxs)("div",{className:"results-pagination-controls",children:[(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>B(Me-1),disabled:Me===1,children:"Previous"}),(0,q.jsxs)("span",{className:"results-pagination-page",children:["Page ",Me," of ",fe]}),(0,q.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>B(Me+1),disabled:Me===fe,children:"Next"})]})]})]}),(0,q.jsxs)("aside",{className:"basket-sidebar",children:[(0,q.jsx)("div",{className:"basket-sidebar-title",children:m?"Quote request summary":"Order summary"}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:m?"List price (ex. VAT)":"Subtotal (ex. VAT)"}),(0,q.jsx)("span",{children:ve==null?"To confirm":lt(ve)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row",children:[(0,q.jsx)("span",{children:"VAT (20%)"}),(0,q.jsx)("span",{children:we==null?"To confirm":lt(we)})]}),(0,q.jsxs)("div",{className:"basket-sidebar-row basket-sidebar-row--total",children:[(0,q.jsx)("span",{children:m?"List price (inc.\xA0VAT)":"Total"}),(0,q.jsx)("span",{children:Ye==null?"To confirm":lt(Ye)})]}),!m&&(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:He,onChange:d=>Ve(d.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:qe,onChange:d=>be(d.target.value),disabled:!He,"aria-label":"Waste factor percent"}),(0,q.jsx)("span",{children:"%"})]})]})}),(0,q.jsx)("label",{htmlFor:`${p}-basket-reference`,className:"basket-sidebar-label",children:m?"Enter email for your sharper quote":"Your reference (optional)"}),(0,q.jsx)("input",{id:`${p}-basket-reference`,type:m?"email":"text",className:"basket-sidebar-input",value:f,onChange:d=>{w(d.target.value),m&&v("")},placeholder:m?"you@example.com":"PO number or job reference","aria-invalid":m&&g===Ev,"aria-describedby":m&&g?`${p}-basket-reference-error`:void 0}),m&&g&&(0,q.jsx)("p",{id:`${p}-basket-reference-error`,className:"basket-quote-request-error",role:"alert",children:g}),m?(0,q.jsx)("button",{type:"button",className:"cta-btn",onClick:()=>{Ut()},disabled:D||z>0||H>0,"aria-busy":D,children:(0,q.jsx)("span",{children:D?"Sending\u2026":"Request our best quote"})}):(0,q.jsx)("button",{className:"cta-btn",onClick:()=>{u("downloaded",{type:"basket",items:b.length}),yv(b)},"aria-label":c?"Download selection":"Download basket",children:(0,q.jsx)("span",{children:c?"Download Quote":"Buy Now"})}),(0,q.jsxs)("p",{className:"basket-sidebar-disclaimer",children:[(0,q.jsx)("span",{"aria-hidden":"true",children:"\u26A0\uFE0F"}),m?"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:n,"aria-label":"Back to results",children:[(0,q.jsx)(Vr,{}),(0,q.jsx)("span",{children:"Back to results"})]})})]})})]})})}var Sa=Y(ee()),Bd="metron-quick-quote",F_=1440*60*1e3;function sc(e){return(0,Sa.jsx)(lc,{children:(0,Sa.jsx)(I_,{...e})})}function I_({fullPage:e=!1,hideHeader:t=!1,internal:a=!1}){let[r,i]=(0,De.useState)("entry"),[n,o]=(0,De.useState)(null),[l,c]=(0,De.useState)(""),p=(0,De.useRef)(null),m=(0,De.useRef)(0),[b,f]=(0,De.useState)(0),[w,_]=(0,De.useState)(null),[E,D]=(0,De.useState)(!1),{cart:h,addToCart:u,addManyToCart:g,removeFromCart:v,updateCartQty:N,updateCartSellUnits:R,updateCartConversions:T,clearCart:U}=On(),[A,B]=(0,De.useState)(!1),[ie,ze]=(0,De.useState)(null),He=()=>{ze(null);try{window.sessionStorage.removeItem(rc)}catch{}},Ve=(0,De.useRef)(null),qe=Zs("quick-quote",Ve);(0,De.useEffect)(()=>{qe("viewed")},[qe]);let[be,le]=(0,De.useState)(!1);(0,De.useEffect)(()=>{uv();let ve=window.location.hash,we=null;try{we=JSON.parse(window.sessionStorage.getItem(Bd)??"null")}catch{}if(we&&!(Date.now()-(we.savedAt??0)<F_)&&(we=null),we?.scheduleResult)o("schedule"),_(we.scheduleResult),D(we.reviewGateComplete),B(we.cartSeeded),g(Object.values(we.cart)),ve==="#quote-request"?i("basket"):ve==="#matched-products"&&i("results");else if(ve==="#matched-products"||ve==="#quote-request"){let Ye=new URL(window.location.href);Ye.hash="",Mn("replaceState",window.history.state,Ye)}le(!0)},[]),(0,De.useEffect)(()=>{if(be)try{w?window.sessionStorage.setItem(Bd,JSON.stringify({savedAt:Date.now(),scheduleResult:w,reviewGateComplete:E,cartSeeded:A,cart:h})):window.sessionStorage.removeItem(Bd)}catch{}},[be,w,E,A,h]);let Je=(0,De.useCallback)(ve=>{if(typeof window>"u")return;let we=new URL(window.location.href);we.hash=ve==="basket"?"quote-request":"matched-products";let Ye=ve==="results"&&(window.location.hash==="#matched-products"||window.location.hash==="#quote-request");Mn(Ye?"replaceState":"pushState",{boqQuoteStage:ve},we)},[]),Ne=(0,De.useRef)(!1);(0,De.useEffect)(()=>{let ve=()=>{Ne.current=!1;let we=window.location.hash;we==="#quote-request"?i("basket"):we==="#matched-products"&&w?(o("schedule"),i("results")):i("entry")};return window.addEventListener("popstate",ve),()=>window.removeEventListener("popstate",ve)},[w]);let St=(0,De.useCallback)(()=>{Je("basket"),i("basket")},[Je]),X=(0,De.useCallback)(()=>{if(window.location.hash==="#quote-request"){if(Ne.current)return;Ne.current=!0,ac();return}i(w?"results":"entry")},[w]),me=(0,De.useRef)(r);(0,De.useEffect)(()=>{me.current!==r&&(me.current=r,window.scrollTo(0,0))},[r]);let Re=()=>{i("entry"),o(null),c(""),f(0),_(null),D(!1),U(),B(!1),He()},Nt=(0,De.useCallback)(async(ve,we,Ye=!0)=>{let z=++m.current;c(""),f(0);let H=0,ne=()=>{H=Math.min(H+1,3),f(H)};try{let{jobId:ce}=await bw(ve,we,Ye);if(z!==m.current)return;let{promise:fe,cancel:Me}=vw(()=>ww(ce),5e3,ne,"schedule");p.current=Me;let Ze=await fe;if(Ze.status==="failed"||!Ze.result)throw new Error(Ze.error||"Failed to process schedule");let d=Ze.result.lineItems.length,M=Ze.result.results.filter(S=>S.candidates.length>0).length;qe("results_shown",{lines:d,matched:M,unmatched:d-M}),U(),B(!1),D(!1),_(Ze.result),Je("results"),i("results")}catch(ce){if(z!==m.current)return;qe("error",{stage:"matching"}),c(ce?.message||"Failed to process schedule"),i("entry")}finally{z===m.current&&(p.current?.(),p.current=null)}},[Je,qe,U]),Bt=(0,De.useCallback)(()=>{m.current++,p.current?.(),p.current=null},[]),Ut=(0,De.useCallback)(async(ve,we,Ye=!0)=>{if(!ve.trim())return;o("schedule");let z=new File([ve],"pasted-schedule.txt",{type:"text/plain"});await Nt(z,we,Ye)},[Nt]),Xe=(0,De.useCallback)(async ve=>{o("schedule"),await Nt(ve)},[Nt]);return(0,Sa.jsx)(Fo.Provider,{value:qe,children:(0,Sa.jsx)("div",{ref:Ve,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${!e&&r==="processing"?" app-wrapper--loading":""}`,style:Ot().theme,children:(0,Sa.jsxs)("main",{className:"main-content",children:[l&&(0,Sa.jsxs)("div",{className:"error-box",role:"alert",children:[(0,Sa.jsx)("strong",{children:"Error:"})," ",l]}),r==="entry"&&(0,Sa.jsx)(Sd,{onPasteSchedule:Ut,onUploadSchedule:Xe,onEntryModeChange:o,draft:ie,onSubmitDraft:ze,onCancelMatch:Bt}),r==="results"&&n==="schedule"&&w&&(0,Sa.jsx)(Ud,{scheduleResult:w,onStartOver:Re,cart:h,onAddToCart:u,onRemoveFromCart:v,onGoToBasket:St,cartSeeded:A,onCartSeeded:()=>B(!0),reviewGateComplete:E,onReviewGateComplete:()=>D(!0),internal:a}),r==="basket"&&(0,Sa.jsx)(sl,{cart:h,onUpdateQty:N,onUpdateSellUnits:R,onResolveConversions:T,onRemove:v,onBack:X,onStartNewQuote:Re,onQuoteRequested:()=>{_(null),D(!1),B(!1),U(),He()},internal:a})]})})})}var $a=Y(je());var yi=Y(je());var Mv={"NZ4Y-ZMSQ":{"brick-block":{"brick-common":"105499","brick-engineering-red":"1654","brick-engineering-blue":"1723",block:"501","mortar-cement":"1762 cement","mortar-sand":"564 building sand"},skirting:{"skirting-chamfered":"1525","skirting-ogee":"135 primed mdf ogee","skirting-pencil-round":"892","skirting-torus":"1941"},architrave:{"architrave-ogee":"134 primed mdf ogee","architrave-pencil-round":"1896","architrave-square-edge":"118 primed mdf square","architrave-torus":"1531"},plasterboard:{standard:"1647",moisture:"11 moisture plasterboard",fire:"14 fire plasterboard",sound:"1769",screws:"131160",tape:"1766",adhesive:"108439"},paint:{"paint-emulsion":"157217"},"concrete-aggregate":{cement:"1762 cement","sharp-sand":"563",gravel:"571",mot:"569"},insulation:{"insulation-floor":"152187","insulation-ground":"442","insulation-wall":"147","insulation-roof":"442","insulation-loft":"152180"},timber:{studs:"1213",joists:"208",battens:"1729"},fencing:{"panels-boundary-0.9":"66 lap fence panel","panels-boundary-1.2":"1450","panels-boundary-1.5":"1449","panels-boundary-1.8":"1448","panels-skyline-1.8":"1475","concrete-intermediate-8":"40197","concrete-end-8":"40198","timber-post-6":"141411","timber-post-8":"1709",postcrete:"12142","gate-boundary":"1984","gate-skyline":"40002","gravel-boards":"40200"},decking:{"boards-summit":"24322",joists:"208",screws:"131079"},paving:{"surface-council":"1669","surface-raj":"12363","surface-brindle":"304","surface-charcoal":"296","surface-pea":"431","sub-base":"569",bedding:"563"}}};function cl(e,t){let a=Mv[Ot().client??""]?.[e];if(!a)return null;let r=e==="plasterboard"&&t.key==="board"?t.label.split(" ")[0].toLowerCase():t.key;return a[r]??null}function vi(e,t){let a=Mv[Ot().client??""]?.[e];return!a||t in a}function Tv(e,t){let a=t.map(r=>{let i=cl(e,r);return i?{key:r.key,productId:i.split(" ")[0],search:i,qty:r.qty,unit:r.unit}:null});return a.length>0&&a.every(Boolean)?a:null}var W=Y(ee()),zv=[{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"}],cc=e=>Number.parseFloat(e)||0,Rv=(e,t)=>cc(e)*(t==="m"?1:.3048),Ld=(e,t)=>cc(e.quantity)*(2*Rv(e.height,t)+Rv(e.width,t)),W_=()=>({quantity:"1",width:"",height:""});function ex({profile:e}){return(0,W.jsxs)("svg",{className:"architrave-calculator__profile-diagram",viewBox:"0 0 112 76","aria-hidden":"true",children:[(0,W.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,W.jsx)("line",{x1:"12",y1:"66",x2:"100",y2:"66"})]})}function Hd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,yi.useState)("m"),[n,o]=(0,yi.useState)({quantity:"1",width:"0.76",height:"1.98"}),[l,c]=(0,yi.useState)({quantity:"0",width:"1.52",height:"1.98"}),[p,m]=(0,yi.useState)([]),[b,f]=(0,yi.useState)("ogee"),[w,_]=(0,yi.useState)("2.4"),E=(N,R,T)=>{N(U=>({...U,[R]:T}))},D=Ld(n,r)+Ld(l,r)+p.reduce((N,R)=>N+Ld(R,r),0),h=cc(w)>0?Math.ceil(D/cc(w)):0,u=zv.find(N=>N.id===b)?.label??"",g=[{key:`architrave-${b}`,label:`Architrave (${u})`,qty:D,unit:"m",query:`${u} architrave`,category:"architrave"}],v=(N,R,T,U)=>(0,W.jsxs)("div",{className:"architrave-calculator__opening-row",children:[(0,W.jsx)("span",{children:N}),(0,W.jsx)("input",{"aria-label":`${N} quantity`,type:"number",min:"0",step:"1",value:R.quantity,onChange:A=>T("quantity",A.target.value)}),(0,W.jsx)("input",{"aria-label":`${N} width`,type:"number",min:"0",step:"0.01",value:R.width,onChange:A=>T("width",A.target.value)}),(0,W.jsx)("input",{"aria-label":`${N} height`,type:"number",min:"0",step:"0.01",value:R.height,onChange:A=>T("height",A.target.value)}),U?(0,W.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:U,children:"Remove"}):null]});return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)("div",{className:"truss-estimator",children:[(0,W.jsxs)("div",{className:"quick-order-hero",children:[(0,W.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,W.jsx)("h1",{children:"Architrave Calculator"}),(0,W.jsx)("p",{children:"Estimate architrave lengths and board quantities for door openings."})]}),(0,W.jsxs)("div",{className:"truss-estimator__card architrave-calculator",children:[(0,W.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure your openings"}),(0,W.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,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Door openings"}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Each opening is calculated as two side pieces plus one head piece."}),(0,W.jsxs)("div",{className:"architrave-calculator__unit-row",children:[(0,W.jsx)("span",{children:"Units"}),(0,W.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,W.jsx)("button",{type:"button",className:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metres"}),(0,W.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Feet"})]})]}),(0,W.jsxs)("div",{className:"architrave-calculator__dimensions-header",children:[(0,W.jsx)("span",{children:"Opening"}),(0,W.jsx)("span",{children:"Qty"}),(0,W.jsxs)("span",{children:["Width (",r,")"]}),(0,W.jsxs)("span",{children:["Height (",r,")"]}),(0,W.jsx)("span",{})]}),v("Single doors",n,(N,R)=>E(o,N,R)),v("Double doors",l,(N,R)=>E(c,N,R)),p.map((N,R)=>v(`Alternative door ${R+1}`,N,(T,U)=>m(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B)),()=>m(T=>T.filter((U,A)=>A!==R)))),(0,W.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>m(N=>[...N,W_()]),children:"+ Add alternative-sized door"})]}),(0,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Standard profile"}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Choose the profile you plan to use. Length calculations are the same for each profile."}),(0,W.jsx)("div",{className:"architrave-calculator__profiles",children:zv.filter(N=>vi("architrave",`architrave-${N.id}`)).map(N=>(0,W.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b===N.id?" is-selected":""}`,onClick:()=>f(N.id),children:[(0,W.jsx)(ex,{profile:N.id}),(0,W.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,W.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,W.jsxs)("div",{className:"architrave-calculator__section",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,W.jsx)("div",{className:"architrave-calculator__options",children:(0,W.jsxs)("label",{className:"truss-estimator__field",children:[(0,W.jsx)("span",{children:"Board length (m)"}),(0,W.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,W.jsx)("p",{className:"architrave-calculator__hint",children:"Waste allows for mitred corners, cuts and damaged lengths."})]}),(0,W.jsxs)("div",{className:"architrave-calculator__totals",children:[(0,W.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,W.jsxs)("div",{className:"architrave-calculator__result-grid",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)("span",{children:"Architrave needed"}),(0,W.jsxs)("strong",{children:[D.toFixed(2)," m"]})]}),(0,W.jsxs)("div",{children:[(0,W.jsx)("span",{children:"Board lengths"}),(0,W.jsx)("strong",{children:h})]})]})]}),(0,W.jsxs)("div",{className:"architrave-calculator__actions",children:[(0,W.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,W.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:D<=0,children:a})]})]})]})})}var _i=Y(je()),ae=Y(ee()),Av=60,Uv=10,tx=.02,ax=.012,Dv=1,Ov=4,rx=1.33,ix=1440,nx=1600,Bn=e=>Number.parseFloat(e)||0,ox=(e,t=2)=>e.toFixed(t);function jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,_i.useState)("brick"),[n,o]=(0,_i.useState)("engineering-red"),[l,c]=(0,_i.useState)("metric"),[p,m]=(0,_i.useState)(""),[b,f]=(0,_i.useState)(""),[w,_]=(0,_i.useState)(!0),E=l==="metric"?Bn(p)*Bn(b):Bn(p)*Bn(b)*.092903,h=E*(r==="brick"?Av:Uv),u=Math.ceil(h),v=E*(r==="brick"?tx:ax)*rx/(Dv+Ov),N=Math.ceil(v*Dv*ix),R=Math.ceil(v*Ov*nx),T=l==="metric"?E:E*10.7639,U=[{key:r==="brick"?`brick-${n}`:"block",label:r==="brick"?{common:"Common concrete bricks","engineering-red":"Red engineering bricks","engineering-blue":"Blue engineering bricks"}[n]:"Blocks",qty:u,unit:"each",query:r==="brick"?"facing brick":"concrete block",category:"masonry"},...w?[{key:"mortar-cement",label:"General purpose cement",qty:N,unit:"kg",query:"general purpose cement",category:"cement"},{key:"mortar-sand",label:"Building sand",qty:R,unit:"kg",query:"building sand",category:"aggregate"}]:[]],A=B=>{if(B===l)return;let ie=B==="imperial"?3.28084:.3048;m((Bn(p)*ie).toFixed(2)),f((Bn(b)*ie).toFixed(2)),c(B)};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:"Brick and Block Calculator"}),(0,ae.jsx)("p",{children:"Estimate masonry units, sand and cement for a wall."})]}),(0,ae.jsxs)("div",{className:"truss-estimator__card brick-calculator",children:[(0,ae.jsx)("h2",{className:"truss-estimator__step-title",children:"Wall area and masonry type"}),(0,ae.jsx)("p",{className:"truss-estimator__step-sub",children:"Pick brick or block and enter the wall dimensions for unit counts plus the cement and sand for the mortar."}),(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Masonry type"}),(0,ae.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[["brick","Brick"],["block","Block"]].map(([B,ie])=>(0,ae.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===B?" is-selected":""}`,onClick:()=>i(B),children:[(0,ae.jsx)("div",{className:"truss-estimator__option-title",children:ie}),(0,ae.jsxs)("div",{className:"truss-estimator__option-copy",children:["Approx. ",B==="brick"?Av:Uv," per m\xB2"]})]},B))})]}),r==="brick"&&(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Brick type"}),(0,ae.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(([B,ie,ze])=>(0,ae.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n===B?" is-selected":""}`,onClick:()=>o(B),children:[(0,ae.jsx)("div",{className:"truss-estimator__option-title",children:ie}),(0,ae.jsx)("div",{className:"truss-estimator__option-copy",children:ze})]},B))})]}),(0,ae.jsxs)("div",{className:"brick-calculator__section",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall dimensions"}),(0,ae.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,ae.jsx)("button",{type:"button",className:l==="metric"?"is-selected":"",onClick:()=>A("metric"),children:"Metric"}),(0,ae.jsx)("button",{type:"button",className:l==="imperial"?"is-selected":"",onClick:()=>A("imperial"),children:"Imperial"})]}),(0,ae.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ae.jsxs)("label",{className:"truss-estimator__field",children:[(0,ae.jsxs)("span",{children:["Height (",l==="metric"?"m":"ft",")"]}),(0,ae.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:B=>m(B.target.value)})]}),(0,ae.jsxs)("label",{className:"truss-estimator__field",children:[(0,ae.jsxs)("span",{children:["Width (",l==="metric"?"m":"ft",")"]}),(0,ae.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:B=>f(B.target.value)})]})]})]}),(0,ae.jsx)("div",{className:"brick-calculator__options",children:(0,ae.jsxs)("label",{className:"brick-calculator__checkbox",children:[(0,ae.jsx)("input",{type:"checkbox",checked:w,onChange:B=>_(B.target.checked)}),(0,ae.jsx)("span",{children:"Include mortar (cement and building sand, mixed 1:4)"})]})}),(0,ae.jsxs)("div",{className:"brick-calculator__totals",children:[(0,ae.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ae.jsxs)("div",{className:"brick-calculator__result-grid",children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Wall area"}),(0,ae.jsxs)("strong",{children:[ox(T)," ",l==="metric"?"m\xB2":"ft\xB2"]})]}),(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:r==="brick"?"Bricks":"Blocks"}),(0,ae.jsx)("strong",{children:u.toLocaleString("en-GB")})]}),w?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Cement"}),(0,ae.jsxs)("strong",{children:[N," kg"]})]}),(0,ae.jsxs)("div",{children:[(0,ae.jsx)("span",{children:"Building sand"}),(0,ae.jsxs)("strong",{children:[R," kg"]})]})]}):null]}),(0,ae.jsx)("p",{className:"brick-calculator__note",children:"Estimate based on standard nominal sizes and 10mm joints. Mortar is a general purpose 1:4 cement and sand mix; quantities are approximate, so confirm the specification before ordering."})]}),(0,ae.jsxs)("div",{className:"brick-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?.(U),disabled:E<=0,children:a})]})]})]})})}var xi=Y(je()),I=Y(ee()),lx=1.54,sx=1440,Qd=e=>Number.parseFloat(e)||0,Zr={mot:{label:"MOT Type 1",blurb:"Sub-base for patios and driveways",density:1.7,query:"MOT type 1"},"sharp-sand":{label:"Sharp sand",blurb:"Bedding and general groundwork",density:1.6,query:"sharp sand"},gravel:{label:"20mm gravel",blurb:"Drainage and landscaping",density:1.6,query:"20mm gravel"}};function Gd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,xi.useState)("m"),[n,o]=(0,xi.useState)(""),[l,c]=(0,xi.useState)(""),[p,m]=(0,xi.useState)(""),[b,f]=(0,xi.useState)("concrete"),[w,_]=(0,xi.useState)("mot"),E=r==="m"?1:.3048,D=Qd(n)*E*Qd(l)*E*Qd(p)*(r==="m"?.01:.0254),h=Zr[w],u=D*lx/7,g=u*sx,v=u*2,N=u*4,R=(U,A)=>Math.ceil(U*A*1e3),T=b==="concrete"?[{key:"cement",label:"General purpose cement",qty:Math.ceil(g),unit:"kg",query:"general purpose cement"},{key:"sharp-sand",label:"Sharp sand",qty:R(v,Zr["sharp-sand"].density),unit:"kg",query:Zr["sharp-sand"].query},{key:"gravel",label:"20mm gravel",qty:R(N,Zr.gravel.density),unit:"kg",query:Zr.gravel.query}]:[{key:w,label:h.label,qty:R(D,h.density),unit:"kg",query:h.query}];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:"Concrete and Aggregate Calculator"}),(0,I.jsx)("p",{children:"Calculate fixed site-mix concrete ingredients or aggregate bulk bags."})]}),(0,I.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,I.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose what you need"}),(0,I.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter the area and depth. The calculator works out the materials and adds them to your basket."}),(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Material type"}),(0,I.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b==="concrete"?" is-selected":""}`,onClick:()=>f("concrete"),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:"Site-mixed concrete"}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:"Cement, sharp sand and 20mm aggregate"})]}),(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${b==="aggregate"?" is-selected":""}`,onClick:()=>f("aggregate"),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:"Aggregates"}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:"MOT Type 1, sharp sand or 20mm gravel"})]})]})]}),b==="aggregate"&&(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Aggregate type"}),(0,I.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.keys(Zr).map(U=>(0,I.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===U?" is-selected":""}`,onClick:()=>_(U),children:[(0,I.jsx)("div",{className:"truss-estimator__option-title",children:Zr[U].label}),(0,I.jsx)("div",{className:"truss-estimator__option-copy",children:Zr[U].blurb})]},U))})]}),(0,I.jsxs)("div",{className:"materials-calculator__section",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and depth"}),(0,I.jsxs)("div",{className:"materials-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:r==="m"?"is-selected":"",onClick:()=>i("m"),children:"Metric"}),(0,I.jsx)("button",{type:"button",className:r==="ft"?"is-selected":"",onClick:()=>i("ft"),children:"Imperial"})]})]}),(0,I.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,I.jsxs)("label",{className:"truss-estimator__field",children:[(0,I.jsxs)("span",{children:["Length (",r,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:U=>o(U.target.value)})]}),(0,I.jsxs)("label",{className:"truss-estimator__field",children:[(0,I.jsxs)("span",{children:["Width (",r,")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:U=>c(U.target.value)})]})]}),(0,I.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,I.jsxs)("span",{children:["Depth (",r==="m"?"cm":"inches",")"]}),(0,I.jsx)("input",{type:"number",min:"0",step:"0.1",value:p,onChange:U=>m(U.target.value)})]})]}),(0,I.jsxs)("div",{className:"materials-calculator__totals",children:[(0,I.jsx)("div",{className:"truss-estimator__section-heading",children:"Materials required"}),(0,I.jsx)("div",{className:"materials-calculator__result-grid",children:b==="concrete"?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Cement"}),(0,I.jsxs)("strong",{children:[g.toFixed(0)," kg"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Sharp sand"}),(0,I.jsxs)("strong",{children:[v.toFixed(2)," m\xB3"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"20mm aggregate"}),(0,I.jsxs)("strong",{children:[N.toFixed(2)," m\xB3"]})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:h.label}),(0,I.jsxs)("strong",{children:[D.toFixed(2)," m\xB3"]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("span",{children:"Approx. weight"}),(0,I.jsxs)("strong",{children:[(D*h.density).toFixed(2)," t"]})]}),(0,I.jsx)("div",{})]})}),(0,I.jsx)("p",{className:"materials-calculator__note",children:b==="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."})]}),(0,I.jsxs)("div",{className:"materials-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?.(T),disabled:D<=0,children:a})]})]})]})})}var Ya=Y(je());var O=Y(ee()),Ln=12,Hn=8,uc=.56,Bv=.21,Ra={ranges:{meridian:{label:"Standard grooved timber",blurb:"32 \xD7 125mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.125},summit:{label:"Wide grooved timber",blurb:"32 \xD7 150mm pressure-treated softwood boards.",boardLengthM:3.6,boardWidthM:.15}},boardGapM:.006,wastage:{straight:.05,diagonal:.15},pictureFrame:{extraWastage:.08},joist:{spacingOptions:[{id:"300",label:"300mm centres (heavy duty)",spacingM:.3},{id:"400",label:"400mm centres (standard)",spacingM:.4},{id:"450",label:"450mm centres (light use)",spacingM:.45}]}},ki=["range","grid","pictureFrame","substructure"],cx={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:""}},pc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),dc=(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),ux=(e,t,a,r)=>{let i=pc(e,t,a),n=pc(e,t,r),o=pc(a,r,e),l=pc(a,r,t);return i===0&&dc(e,t,a)||n===0&&dc(e,t,r)||o===0&&dc(a,r,e)||l===0&&dc(a,r,t)?!0:i>0!=n>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 i=e[(r+1)%e.length];for(let n=r+1;n<a;n+=1)if(!(n===r+1||t&&r===0&&n===a-1)&&ux(e[r],i,e[n],e[(n+1)%e.length]))return!0}return!1};function $d({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ya.useState)(0),[n,o]=(0,Ya.useState)(cx),[l,c]=(0,Ya.useState)(1),[p,m]=(0,Ya.useState)({x:0,y:0}),[b,f]=(0,Ya.useState)(null),w=(0,Ya.useRef)(null),_=(0,Ya.useRef)(null),E=(0,Ya.useRef)(null),D=ki[r],h=n.range?Ra.ranges[n.range]:null,u=Ln/l,g=Hn/l,v=(Ln-u)/2,N=(Hn-g)/2,R=Math.max(-Ln,Math.min(Ln*2-u,v+p.x)),T=Math.max(-Hn,Math.min(Hn*2-g,N+p.y)),U=Number.parseFloat(n.quickLengthM),A=Number.parseFloat(n.quickWidthM),B=U>0&&A>0,ie=z=>Math.abs(z.reduce((H,ne,ce)=>{let fe=z[(ce+1)%z.length];return H+ne.x*fe.y-fe.x*ne.y},0))/2,ze=(z,H)=>Math.hypot(H.x-z.x,H.y-z.y),He=n.isOutlineClosed?ie(n.points):0,Ve=n.isOutlineClosed?n.points.reduce((z,H,ne)=>z+ze(H,n.points[(ne+1)%n.points.length]),0):0,qe=n.isOutlineClosed?n.points.reduce((z,H,ne)=>z+(n.wallSegments.has(ne)?0:ze(H,n.points[(ne+1)%n.points.length])),0):0,be=n.points.reduce((z,H)=>({x:z.x+H.x/n.points.length,y:z.y+H.y/n.points.length}),{x:0,y:0}),le=n.points.length>1?(()=>{let z=n.points[0],H=n.points[1],ne=ze(z,H),ce=ne?-(H.y-z.y)/ne:0,fe=ne?(H.x-z.x)/ne:0,Me=(z.x+H.x)/2,Ze=(z.y+H.y)/2,d=ce*(Me-be.x)+fe*(Ze-be.y)>=0?1:-1;return{x:Me+ce*uc*d,y:Ze+fe*uc*d}})():null,Ne=(()=>{let z=n.range?Ra.ranges[n.range]:Ra.ranges.meridian,H=n.deckSizeMode==="quick"?U*A:He,ne=n.deckSizeMode==="quick"?2*(U+A):qe,ce=n.direction==="diagonal"?Ra.wastage.diagonal:Ra.wastage.straight,fe=n.pictureFrame==="yes"?Ra.pictureFrame.extraWastage:0,Ze=H/(z.boardWidthM+Ra.boardGapM)/z.boardLengthM,d=Math.ceil(Ze*(1+ce+fe)),M=Math.ceil(H*30*(1+ce+fe)/200),S=Ra.joist.spacingOptions.find(x=>x.id===n.joistSpacing)??Ra.joist.spacingOptions[1],$=H/S.spacingM,Z=Math.ceil($);return{range:z,area:H,boardCount:d,screwBoxes:M,joistMetres:Z,spacing:S}})(),St=Ne?[{key:`boards-${n.range??"meridian"}`,label:`Deck boards (${Ne.range.label})`,qty:Math.round(Ne.boardCount*Ne.range.boardLengthM*100)/100,unit:"m",query:"timber decking board",category:"decking",calculatorWasteIncluded:!0},{key:"joists",label:"Treated C24 joists",qty:Ne.joistMetres,unit:"m",query:"treated joist",category:"timber",calculatorWasteIncluded:!0},{key:"screws",label:"Green decking screws (200/box)",qty:Ne.screwBoxes,unit:"box",query:"green decking screws",category:"fixings",calculatorWasteIncluded:!0}]:[],X=()=>D==="range"?!!n.range:D==="grid"?n.deckSizeMode==="quick"?B:n.isOutlineClosed&&He>0:D==="pictureFrame"?!!n.pictureFrame&&!!n.direction:D==="substructure"?!!n.joistSpacing:!0,me=r===ki.length-1?a:"Next",Re=(z,H,ne=!1)=>{let ce=E.current?.getBoundingClientRect();if(!ce)return null;let fe=ne?1:.25;return{x:Math.round(Math.max(R,Math.min(R+u,R+(z-ce.left)/ce.width*u))/fe)*fe,y:Math.round(Math.max(T,Math.min(T+g,T+(H-ce.top)/ce.height*g))/fe)*fe}},Nt=z=>{if(n.isOutlineClosed){let ne=z.target;if(ne!==z.currentTarget&&!ne.classList.contains("deck-outline__grid"))return;_.current={startX:z.clientX,startY:z.clientY,startViewX:R,startViewY:T},z.currentTarget.setPointerCapture(z.pointerId);return}if(n.drawMode!=="outline")return;let H=Re(z.clientX,z.clientY,!0);H&&(f(null),o(ne=>{let ce=[...ne.points,H];return Yd(ce,!1)?{...ne,drawError:"Edges cannot cross. Choose another corner."}:{...ne,points:ce,drawError:""}}))},Bt=(z,H)=>{if(!n.isOutlineClosed){z.stopPropagation(),H===0&&n.points.length>=3&&o(ne=>({...ne,isOutlineClosed:!0,drawMode:"edges"}));return}z.stopPropagation(),w.current=H,z.currentTarget.setPointerCapture(z.pointerId)},Ut=z=>{if(_.current){let ce=E.current?.getBoundingClientRect();if(!ce)return;let fe=_.current,Me=fe.startViewX-(z.clientX-fe.startX)/ce.width*u,Ze=fe.startViewY-(z.clientY-fe.startY)/ce.height*g;m({x:Me-v,y:Ze-N});return}!n.isOutlineClosed&&n.drawMode==="outline"&&f(Re(z.clientX,z.clientY,!0));let H=w.current;if(H===null)return;let ne=Re(z.clientX,z.clientY);ne&&o(ce=>{let fe=ce.points.map((Me,Ze)=>Ze===H?ne:Me);return Yd(fe,!0)?{...ce,drawError:"Edges cannot cross. Move the corner to a different position."}:{...ce,points:fe,drawError:""}})},Xe=z=>{_.current=null,w.current=null,z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId)},ve=z=>{o(H=>{let ne=new Set(H.wallSegments);return ne.has(z)?ne.delete(z):ne.add(z),{...H,wallSegments:ne}})},we=()=>{r===0?e():i(z=>z-1)},Ye=()=>{X()&&(r===ki.length-1?t?.(St):i(z=>z+1))};return(0,O.jsx)(O.Fragment,{children:(0,O.jsxs)("div",{className:"truss-estimator",children:[(0,O.jsxs)("div",{className:"quick-order-hero",children:[(0,O.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,O.jsx)("h1",{children:"Decking Calculator"}),(0,O.jsx)("p",{children:"Estimate timber boards, joists and screws for your deck."})]}),(0,O.jsxs)("div",{className:"truss-estimator__card",children:[(0,O.jsxs)("div",{className:"truss-estimator__body",children:[D==="range"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your timber decking"}),(0,O.jsx)("p",{className:"truss-estimator__step-sub",children:"Both options are fixed, orderable pressure-treated timber boards."}),(0,O.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Ra.ranges).filter(([z])=>vi("decking",`boards-${z}`)).map(([z,H])=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===z?" is-selected":""}`,onClick:()=>o(ne=>({...ne,range:z})),children:[(0,O.jsx)("div",{className:"truss-estimator__option-title",children:H.label}),(0,O.jsx)("div",{className:"truss-estimator__option-copy",children:H.blurb}),(0,O.jsxs)("div",{className:"truss-estimator__option-copy",children:[H.boardLengthM,"m boards"]})]},z))})]}):null,D==="grid"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Tell us your deck size"}),(0,O.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,O.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,O.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="quick"?" is-selected":""}`,onClick:()=>o(z=>({...z,deckSizeMode:"quick"})),children:"Quick estimate"}),(0,O.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.deckSizeMode==="draw"?" is-selected":""}`,onClick:()=>o(z=>({...z,deckSizeMode:"draw",drawMode:"outline"})),children:"Draw your space"})]}),n.deckSizeMode==="quick"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,O.jsxs)("label",{className:"truss-estimator__field",children:[(0,O.jsx)("span",{children:"Length (m)"}),(0,O.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickLengthM,onChange:z=>o(H=>({...H,quickLengthM:z.target.value}))})]}),(0,O.jsxs)("label",{className:"truss-estimator__field",children:[(0,O.jsx)("span",{children:"Width (m)"}),(0,O.jsx)("input",{type:"number",inputMode:"decimal",min:"0.1",step:"0.1",value:n.quickWidthM,onChange:z=>o(H=>({...H,quickWidthM:z.target.value}))})]})]}),(0,O.jsx)("div",{className:"truss-estimator__grid-hint",children:"For L-shaped decks, cut-outs, or sides against a wall, use Draw your space."}),B?(0,O.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,O.jsxs)("div",{children:[(U*A).toFixed(2)," m\xB2 deck"]}),(0,O.jsxs)("div",{children:[(2*(U+A)).toFixed(2)," m perimeter"]})]}):null]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Draw your deck"}),(0,O.jsx)("p",{className:"truss-estimator__step-sub",children:"Click to add corners, then close the outline. Drag any handle to refine it."}),(0,O.jsxs)("div",{className:"deck-outline__toolbar",children:[n.isOutlineClosed?(0,O.jsxs)("div",{className:"deck-outline__summary",children:[(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Deck area"}),(0,O.jsxs)("strong",{children:[He.toFixed(2)," m\xB2"]})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Perimeter"}),(0,O.jsxs)("strong",{children:[Ve.toFixed(2)," m"]})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Wall edges"}),(0,O.jsx)("strong",{children:n.wallSegments.size>0?n.wallSegments.size:"None"})]}),(0,O.jsxs)("div",{children:[(0,O.jsx)("span",{children:"Visible edge"}),(0,O.jsxs)("strong",{children:[qe.toFixed(2)," m"]})]})]}):null,(0,O.jsxs)("div",{className:"deck-outline__actions",children:[(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(z=>({...z,points:z.points.slice(0,-1)})),disabled:n.points.length===0||n.isOutlineClosed,children:"Undo"}),(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f(null),o(z=>({...z,points:[],isOutlineClosed:!1,wallSegments:new Set,drawMode:"outline",drawError:""}))},disabled:n.points.length===0,children:"Clear"}),(0,O.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(z=>({...z,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,O.jsx)("div",{className:"deck-editor-layout",children:(0,O.jsxs)("div",{className:"deck-editor-layout__canvas-column",children:[(0,O.jsxs)("div",{className:"deck-outline",children:[(0,O.jsxs)("svg",{ref:E,className:`deck-outline__canvas${n.isOutlineClosed?" is-pan-mode":""}`,viewBox:`${R} ${T} ${u} ${g}`,preserveAspectRatio:"none","aria-label":"Deck outline drawing area",onPointerDown:Nt,onPointerMove:Ut,onPointerUp:Xe,onPointerLeave:()=>{f(null),_.current||(w.current=null)},children:[(0,O.jsx)("defs",{children:(0,O.jsx)("pattern",{id:"deck-outline-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,O.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,O.jsx)("rect",{x:-Ln,y:-Hn,width:Ln*3,height:Hn*3,className:"deck-outline__grid",fill:"url(#deck-outline-grid)"}),n.points.length>1?(0,O.jsx)("polyline",{className:"deck-outline__preview",points:n.points.map(z=>`${z.x},${z.y}`).join(" ")}):null,n.isOutlineClosed?(0,O.jsx)("polygon",{className:"deck-outline__shape",points:n.points.map(z=>`${z.x},${z.y}`).join(" "),stroke:"none"}):null,n.points.length>1?n.points.slice(0,n.isOutlineClosed?void 0:-1).map((z,H)=>{let ne=n.points[n.isOutlineClosed?(H+1)%n.points.length:H+1],ce=ze(z,ne),fe=ce?-(ne.y-z.y)/ce:0,Me=ce?(ne.x-z.x)/ce:0,Ze=(z.x+ne.x)/2,d=(z.y+ne.y)/2,M=fe*(Ze-be.x)+Me*(d-be.y)>=0?1:-1,S=Ze+fe*uc*M,$=d+Me*uc*M;return(0,O.jsxs)("g",{children:[(0,O.jsx)("line",{className:"deck-outline__edge-hit",x1:z.x,y1:z.y,x2:ne.x,y2:ne.y,onClick:n.isOutlineClosed?()=>ve(H):void 0}),(0,O.jsx)("line",{className:`deck-outline__edge${n.wallSegments.has(H)?" is-wall":""}`,x1:z.x,y1:z.y,x2:ne.x,y2:ne.y,pointerEvents:"none"}),(0,O.jsxs)("text",{className:`deck-outline__edge-label${n.wallSegments.has(H)?" is-wall":""}`,x:S,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:Bv/l,children:[ce.toFixed(2)," m"]})]},`segment-${H}`)}):null,!n.isOutlineClosed&&n.points.length>0&&b?(()=>{let z=n.points[n.points.length-1],H=ze(z,b);if(!H)return null;let ne=-(b.y-z.y)/H,ce=(b.x-z.x)/H,fe=(z.x+b.x)/2,Me=(z.y+b.y)/2;return(0,O.jsxs)("g",{className:"deck-outline__live-measurement",children:[(0,O.jsx)("line",{x1:z.x,y1:z.y,x2:b.x,y2:b.y}),(0,O.jsxs)("text",{x:fe+ne*.34,y:Me+ce*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:Bv/l,children:[H.toFixed(2)," m"]})]})})():null,n.points.map((z,H)=>(0,O.jsx)("circle",{className:"deck-outline__point",cx:z.x,cy:z.y,r:"0.13",onPointerDown:ne=>Bt(ne,H)},`point-${H}`))]}),(0,O.jsxs)("div",{className:"deck-outline__zoom","aria-label":"Zoom controls",children:[(0,O.jsx)("button",{type:"button",onClick:()=>c(z=>Math.max(.5,z-.25)),disabled:l===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,O.jsxs)("span",{children:[Math.round(l*100),"%"]}),(0,O.jsx)("button",{type:"button",onClick:()=>c(z=>Math.min(1,z+.25)),disabled:l===1,"aria-label":"Zoom in",children:"+"})]}),n.isOutlineClosed&&n.wallSegments.size===0&&le?(0,O.jsx)("div",{className:"deck-outline__edge-prompt",role:"status",style:{left:`${(le.x-R)/u*100}%`,top:`${(le.y-T)/g*100}%`},children:"Tap an edge to mark it as a wall, or leave it as a visible edge."}):null,!n.isOutlineClosed&&n.points.length>=3?(0,O.jsx)("button",{type:"button",className:"deck-outline__close",onClick:()=>o(z=>Yd(z.points,!0)?{...z,drawError:"Edges cannot cross. Adjust the outline before finishing."}:{...z,isOutlineClosed:!0,drawMode:"edges",drawError:""}),children:"Finish outline"}):null]}),(0,O.jsxs)("div",{className:"deck-outline__supporting",children:[(0,O.jsx)("div",{className:"truss-estimator__grid-hint",children:n.isOutlineClosed?"Drag a corner handle to refine the outline.":"Add at least three corners, then click Finish outline."}),n.drawError?(0,O.jsx)("div",{className:"deck-outline__error",role:"alert",children:n.drawError}):null]})]})})]})]}):null,D==="pictureFrame"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Picture frame border?"}),(0,O.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,O.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(z=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.pictureFrame===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,pictureFrame:z.id})),children:[(0,O.jsx)("img",{className:"truss-estimator__visual-card-img",src:Ft(z.img),alt:""}),(0,O.jsx)("span",{children:z.label})]},z.id))}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Board direction"}),(0,O.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(z=>(0,O.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.direction===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,direction:z.id})),children:[(0,O.jsx)("img",{className:"truss-estimator__visual-card-img",src:Ft(z.img),alt:""}),(0,O.jsx)("span",{children:z.label})]},z.id))})]})]}):null,D==="substructure"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",ki.length]}),(0,O.jsx)("h2",{className:"truss-estimator__step-title",children:"Substructure"}),(0,O.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,O.jsx)("div",{className:"truss-estimator__section-heading",children:"Joist spacing"}),(0,O.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Ra.joist.spacingOptions.map(z=>(0,O.jsx)("button",{type:"button",className:`truss-estimator__option-card${n.joistSpacing===z.id?" is-selected":""}`,onClick:()=>o(H=>({...H,joistSpacing:z.id})),children:(0,O.jsx)("div",{className:"truss-estimator__option-title",children:z.label})},z.id))})]}):null]}),(0,O.jsxs)("div",{className:"truss-estimator__nav",children:[(0,O.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:we,children:"Back"}),(0,O.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Ye,disabled:!X(),children:[(0,O.jsx)("span",{children:me}),(0,O.jsx)("span",{className:"arrow",children:(0,O.jsx)(Qt,{})})]})]})]})]})})}var Ca=Y(je());var G=Y(ee()),Lv=12,Hv=30,jn=12,Qn=8,jv=.56,Na={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 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"],Vd=e=>Number(e)<=1.2?"6":"8",Qv=(e,t)=>vi("fencing",`panels-${e??"boundary"}-${t}`),Gv=(e,t)=>!t||vi("fencing",e==="concrete"?`concrete-intermediate-${Vd(t)}`:`timber-post-${Vd(t)}`),px={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:""}},mc=(e,t,a)=>(t.x-e.x)*(a.y-e.y)-(t.y-e.y)*(a.x-e.x),fc=(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),dx=(e,t,a,r)=>{let i=mc(e,t,a),n=mc(e,t,r),o=mc(a,r,e),l=mc(a,r,t);return i===0&&fc(e,t,a)||n===0&&fc(e,t,r)||o===0&&fc(a,r,e)||l===0&&fc(a,r,t)?!0:i>0!=n>0&&o>0!=l>0},hc=(e,t)=>{let a=t?e.length:e.length-1;for(let r=0;r<a;r+=1)for(let i=r+1;i<a;i+=1)if(!(i===r+1||t&&r===0&&i===a-1)&&dx(e[r],e[(r+1)%e.length],e[i],e[(i+1)%e.length]))return!0;return!1};function Xd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ca.useState)(0),[n,o]=(0,Ca.useState)(px),l=(0,Ca.useRef)(null),c=(0,Ca.useRef)(null),[p,m]=(0,Ca.useState)(1),[b,f]=(0,Ca.useState)({x:0,y:0}),[w,_]=(0,Ca.useState)(null),E=(0,Ca.useRef)(null),D=(0,Ca.useRef)(null),h=(0,Ca.useRef)(null),u=Si[r],g=n.range?Na.ranges[n.range]:null,v=jn/p,N=Qn/p,R=(jn-v)/2,T=(Qn-N)/2,U=Math.max(-jn,Math.min(jn*2-v,R+b.x)),A=Math.max(-Qn,Math.min(Qn*2-N,T+b.y)),B=n.boundaryPoints.reduce((d,M)=>({x:d.x+M.x/Math.max(1,n.boundaryPoints.length),y:d.y+M.y/Math.max(1,n.boundaryPoints.length)}),{x:0,y:0}),ie=d=>{let M=new Set,S=[];return d.forEach($=>{let[Z,x]=$.split(",").map(Number),j=[{key:`H,${Z},${x}`,type:"H",x:Z,y:x},{key:`H,${Z},${x+1}`,type:"H",x:Z,y:x+1},{key:`V,${Z},${x}`,type:"V",x:Z,y:x},{key:`V,${Z+1},${x}`,type:"V",x:Z+1,y:x}],K=[!d.has(`${Z},${x-1}`),!d.has(`${Z},${x+1}`),!d.has(`${Z-1},${x}`),!d.has(`${Z+1},${x}`)];j.forEach((ue,ke)=>{K[ke]&&!M.has(ue.key)&&(M.add(ue.key),S.push(ue))})}),S},ze=(d,M)=>ie(d).filter(S=>!M.has(S.key)),He=(d,M)=>ze(d,M).length,Ve=(d,M)=>{let S={};ze(d,M).forEach(Z=>{var x,j,K,ue;Z.type==="H"?((S[x=`${Z.x},${Z.y}`]||(S[x]=[])).push("H"),(S[j=`${Z.x+1},${Z.y}`]||(S[j]=[])).push("H")):((S[K=`${Z.x},${Z.y}`]||(S[K]=[])).push("V"),(S[ue=`${Z.x},${Z.y+1}`]||(S[ue]=[])).push("V"))});let $=0;return Object.values(S).forEach(Z=>{(Z.length===1||Z.length===2&&Z[0]!==Z[1]||Z.length>=3)&&($+=1)}),$},be=(()=>{let d=n.range?Na.ranges[n.range]:Na.ranges.boundary,M=n.height??"1.8",S=n.boundaryMode==="quick"?Math.max(0,Number.parseFloat(n.quickLengthM)||0):n.boundaryClosed?n.boundaryPoints.slice(0,-1).reduce((Yt,hr,vt)=>Yt+(n.excludedBoundaryEdges.has(vt)?0:Math.hypot(n.boundaryPoints[vt+1].x-hr.x,n.boundaryPoints[vt+1].y-hr.y)),0):0,$=n.gateType&&n.gateType!=="none"?Number.parseFloat(n.gateWidthM)||Na.gate[n.gateType].widthDefault:0,Z=Math.max(0,S-$),x=Z>0?Math.ceil(Z/d.panelWidthM):0,j=n.boundaryPoints.length>2&&n.boundaryPoints[0].x===n.boundaryPoints[n.boundaryPoints.length-1].x&&n.boundaryPoints[0].y===n.boundaryPoints[n.boundaryPoints.length-1].y,K=n.boundaryMode==="quick"?Z>0?2:0:n.boundaryClosed?n.boundaryPoints.slice(0,j?-1:void 0).reduce((Yt,hr,vt)=>{let qi=vt>0&&!n.excludedBoundaryEdges.has(vt-1),um=vt<n.boundaryPoints.length-1&&!n.excludedBoundaryEdges.has(vt);return Yt+(qi||um?1:0)},0):0,ue=Z>0?Math.ceil(Z/d.panelWidthM)+1:0,ke=Math.max(0,ue-K),wt=n.mountingType?Na.mounting[n.mountingType]:Na.mounting.concrete,rt=n.gateType&&n.gateType!=="none"?2:0,Ct=ke+K+rt,cm=n.mountingType==="postcrete"?Ct*Na.mounting.postcrete.bagsPerPost:0,Kr=n.gravelBoard==="yes"?x:0;return{range:d,height:M,totalEdgeM:S,fencedLengthM:Z,gateWidthM:$,panelsCount:x,cornerPostCount:K,intermediatePostCount:ke,gatePostCount:rt,totalPostCount:Ct,bagsCount:cm,gravelCount:Kr,capCount:Ct,mounting:wt}})(),le=n.gateType&&n.gateType!=="none"?Na.gate[n.gateType].label:null,Je=Vd(be.height),Ne=be?[{key:`panels-${n.range??"boundary"}-${be.height}`,label:`${be.range.label} panels (${be.height}m)`,qty:be.panelsCount,unit:"each",query:"fence panel",category:"fencing"},...n.mountingType==="concrete"?[{key:`concrete-intermediate-${Je}`,label:"Intermediate concrete posts",qty:be.intermediatePostCount,unit:"each",query:"concrete fence post",category:"fencing"},{key:`concrete-end-${Je}`,label:"End and corner concrete posts",qty:be.cornerPostCount+be.gatePostCount,unit:"each",query:"concrete end post",category:"fencing"}]:[{key:`timber-post-${Je}`,label:"Timber fence posts",qty:be.totalPostCount,unit:"each",query:"timber fence post",category:"fencing"},{key:"postcrete",label:"Postcrete",qty:be.bagsCount,unit:"bag",query:"postcrete",category:"cement"}],...le?[{key:`gate-${n.range??"boundary"}`,label:n.range==="skyline"?"Single feather edge gate":"Single lap gate",qty:1,unit:"each",query:n.range==="skyline"?"feather edge gate":"lap gate",category:"fencing"}]:[],...be.gravelCount>0?[{key:"gravel-boards",label:"Concrete gravel boards",qty:be.gravelCount,unit:"each",query:"gravel board",category:"fencing"}]:[]]:[],St=()=>{if(u==="range"){let d=n.boundaryMode==="quick"?(Number.parseFloat(n.quickLengthM)||0)>0:n.boundaryClosed&&n.boundaryPoints.length>=2;return!!n.range&&d}return u==="height"?!!n.height&&!!n.gravelBoard:u==="gate"?!!n.gateType&&(n.gateType==="none"||n.gateWidthM.trim()!==""):u==="posts"?!!n.mountingType:!0},X=r===Si.length-1?a:"Next",me=d=>{o(M=>{let S=d(new Set(M.grid)),$=new Set([...M.excludedEdges].filter(Z=>ie(S).some(x=>x.key===Z)));return{...M,grid:S,excludedEdges:$}})},Re=(d,M,S)=>{me($=>{let Z=`${d},${M}`;return S?$.add(Z):$.delete(Z),$})},Nt=(d,M,S,$,Z)=>{let x=d,j=M,K=Math.abs(S-d),ue=d<S?1:-1,ke=-Math.abs($-M),wt=M<$?1:-1,rt=K+ke;for(;Re(x,j,Z),!(x===S&&j===$);){let Ct=2*rt;Ct>=ke&&(rt+=ke,x+=ue),Ct<=K&&(rt+=K,j+=wt)}},Bt=(d,M)=>{let S=c.current?.getBoundingClientRect();if(!S)return null;let $=Math.floor((d-S.left)/Hv),Z=Math.floor((M-S.top)/Hv);return $<0||Z<0||$>=Lv||Z>=Lv?null:{x:$,y:Z}},Ut=d=>{if(n.gridMode!=="draw")return;let M=Bt(d.clientX,d.clientY);if(!M)return;d.preventDefault();let S=`${M.x},${M.y}`,$=!n.grid.has(S);l.current={active:!0,paintValue:$,lastX:M.x,lastY:M.y},d.currentTarget.setPointerCapture(d.pointerId),Re(M.x,M.y,$)},Xe=d=>{let M=l.current;if(!M?.active)return;let S=Bt(d.clientX,d.clientY);S&&(S.x===M.lastX&&S.y===M.lastY||(Nt(M.lastX,M.lastY,S.x,S.y,M.paintValue),l.current={...M,lastX:S.x,lastY:S.y}))},ve=d=>{l.current?.active&&(l.current=null,d.currentTarget.releasePointerCapture(d.pointerId))},we=(d,M,S=!1)=>{let $=h.current?.getBoundingClientRect();if(!$)return null;let Z=S?1:.25;return{x:Math.round(Math.max(U,Math.min(U+v,U+(d-$.left)/$.width*v))/Z)*Z,y:Math.round(Math.max(A,Math.min(A+N,A+(M-$.top)/$.height*N))/Z)*Z}},Ye=d=>{if(n.boundaryClosed){let S=d.target;if(S!==d.currentTarget&&!S.classList.contains("fence-boundary__grid"))return;D.current={startX:d.clientX,startY:d.clientY,startViewX:U,startViewY:A},d.currentTarget.setPointerCapture(d.pointerId);return}let M=we(d.clientX,d.clientY,!0);M&&(_(null),o(S=>{let $=[...S.boundaryPoints,M];return hc($,!1)?{...S}:{...S,boundaryPoints:$}}))},z=(d,M)=>{if(d.stopPropagation(),!n.boundaryClosed){if(M!==0||n.boundaryPoints.length<3)return;o(S=>hc(S.boundaryPoints,!0)?S:{...S,boundaryPoints:[...S.boundaryPoints,S.boundaryPoints[0]],boundaryClosed:!0});return}E.current=M,d.currentTarget.setPointerCapture(d.pointerId)},H=d=>{if(D.current){let S=h.current?.getBoundingClientRect();if(!S)return;let $=D.current,Z=$.startViewX-(d.clientX-$.startX)/S.width*v,x=$.startViewY-(d.clientY-$.startY)/S.height*N;f({x:Z-R,y:x-T});return}if(n.boundaryClosed||_(we(d.clientX,d.clientY,!0)),E.current===null)return;let M=we(d.clientX,d.clientY);M&&o(S=>{let $=S.boundaryPoints.length>2&&S.boundaryPoints[0].x===S.boundaryPoints[S.boundaryPoints.length-1].x&&S.boundaryPoints[0].y===S.boundaryPoints[S.boundaryPoints.length-1].y,Z=S.boundaryPoints.map((x,j)=>{let K=j===E.current,ue=$&&E.current===0&&j===S.boundaryPoints.length-1;return K||ue?M:x});return hc(Z,!1)?S:{...S,boundaryPoints:Z}})},ne=d=>{D.current=null,E.current=null,d.currentTarget.hasPointerCapture(d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)},ce=d=>{o(M=>{let S=new Set(M.excludedBoundaryEdges);return S.has(d)?S.delete(d):S.add(d),{...M,excludedBoundaryEdges:S}})},fe=()=>{r===0?e():i(d=>d-1)},Me=()=>{St()&&(r===Si.length-1?t?.(Ne):i(d=>d+1))},Ze=ie(n.grid);return(0,G.jsx)(G.Fragment,{children:(0,G.jsxs)("div",{className:"truss-estimator",children:[(0,G.jsxs)("div",{className:"quick-order-hero",children:[(0,G.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,G.jsx)("h1",{children:"Fencing Calculator"}),(0,G.jsx)("p",{children:"Estimate panels, posts and cost for your fence line in a few steps."})]}),(0,G.jsxs)("div",{className:"truss-estimator__card",children:[(0,G.jsxs)("div",{className:"truss-estimator__body",children:[u==="range"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your fence panels"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"The calculator uses fixed, orderable timber panels from the catalogue."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.ranges).map(([d,M])=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.range===d?" is-selected":""}`,onClick:()=>o(S=>({...S,range:d,height:S.height&&Qv(d,S.height)?S.height:null})),children:[(0,G.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,G.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb})]},d))})]}):null,u==="range"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:"truss-estimator__section-heading",children:"Measure your fence line"}),(0,G.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,G.jsxs)("div",{className:"truss-estimator__toggle-row",children:[(0,G.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="quick"?" is-selected":""}`,onClick:()=>o(d=>({...d,boundaryMode:"quick"})),children:"Quick estimate"}),(0,G.jsx)("button",{type:"button",className:`truss-estimator__toggle${n.boundaryMode==="draw"?" is-selected":""}`,onClick:()=>o(d=>({...d,boundaryMode:"draw"})),children:"Draw your boundary"})]}),n.boundaryMode==="quick"?(0,G.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact fence-boundary__quick-field",children:[(0,G.jsx)("span",{children:"Total fence length (m)"}),(0,G.jsx)("input",{type:"number",min:"0",step:"0.1",value:n.quickLengthM,onChange:d=>o(M=>({...M,quickLengthM:d.target.value}))})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:"fence-boundary__toolbar",children:(0,G.jsxs)("div",{className:"fence-boundary__actions",children:[(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(d=>({...d,boundaryPoints:d.boundaryPoints.slice(0,-1),boundaryClosed:!1,excludedBoundaryEdges:new Set})),disabled:n.boundaryPoints.length===0||n.boundaryClosed,children:"Undo"}),(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>{f({x:0,y:0}),_(null),o(d=>({...d,boundaryPoints:[],boundaryClosed:!1,excludedBoundaryEdges:new Set}))},disabled:n.boundaryPoints.length===0,children:"Clear"}),(0,G.jsx)("button",{type:"button",className:"deck-outline__action",onClick:()=>o(d=>({...d,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,G.jsxs)("div",{className:"fence-boundary",children:[(0,G.jsxs)("svg",{ref:h,className:`fence-boundary__canvas${n.boundaryClosed?" is-pan-mode":""}`,viewBox:`${U} ${A} ${v} ${N}`,preserveAspectRatio:"none","aria-label":"Fence boundary drawing area",onPointerDown:Ye,onPointerMove:H,onPointerUp:ne,onPointerLeave:()=>{_(null),D.current||(E.current=null)},children:[(0,G.jsx)("defs",{children:(0,G.jsx)("pattern",{id:"fence-boundary-grid",width:"1",height:"1",patternUnits:"userSpaceOnUse",children:(0,G.jsx)("path",{d:"M 1 0 L 0 0 0 1",fill:"none",stroke:"currentColor",strokeWidth:"0.03"})})}),(0,G.jsx)("rect",{x:-jn,y:-Qn,width:jn*3,height:Qn*3,className:"fence-boundary__grid",fill:"url(#fence-boundary-grid)"}),n.boundaryPoints.length>1?(0,G.jsx)("polyline",{className:"fence-boundary__preview",points:n.boundaryPoints.map(d=>`${d.x},${d.y}`).join(" ")}):null,n.boundaryPoints.length>1?n.boundaryPoints.slice(0,-1).map((d,M)=>{let S=n.boundaryPoints[M+1],$=Math.hypot(S.x-d.x,S.y-d.y),Z=$?-(S.y-d.y)/$:0,x=$?(S.x-d.x)/$:0,j=(d.x+S.x)/2,K=(d.y+S.y)/2,ue=Z*(j-B.x)+x*(K-B.y)>=0?1:-1,ke=j+Z*jv*ue,wt=K+x*jv*ue;return(0,G.jsxs)("g",{children:[(0,G.jsx)("line",{className:"fence-boundary__edge-hit",x1:d.x,y1:d.y,x2:S.x,y2:S.y,onClick:n.boundaryClosed?()=>ce(M):void 0}),(0,G.jsx)("line",{className:`fence-boundary__edge${n.excludedBoundaryEdges.has(M)?" is-excluded":""}`,x1:d.x,y1:d.y,x2:S.x,y2:S.y,pointerEvents:"none"}),(0,G.jsxs)("text",{className:`fence-boundary__edge-label${n.excludedBoundaryEdges.has(M)?" is-excluded":""}`,x:ke,y:wt,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[$.toFixed(2)," m"]})]},`fence-edge-${M}`)}):null,!n.boundaryClosed&&n.boundaryPoints.length>0&&w?(()=>{let d=n.boundaryPoints[n.boundaryPoints.length-1],M=Math.hypot(w.x-d.x,w.y-d.y);if(!M)return null;let S=-(w.y-d.y)/M,$=(w.x-d.x)/M,Z=(d.x+w.x)/2,x=(d.y+w.y)/2;return(0,G.jsxs)("g",{className:"fence-boundary__live-measurement",children:[(0,G.jsx)("line",{x1:d.x,y1:d.y,x2:w.x,y2:w.y}),(0,G.jsxs)("text",{x:Z+S*.34,y:x+$*.34,textAnchor:"middle",dominantBaseline:"central",fontSize:.21/p,children:[M.toFixed(2)," m"]})]})})():null,n.boundaryPoints.map((d,M)=>M>0&&M===n.boundaryPoints.length-1&&d.x===n.boundaryPoints[0]?.x&&d.y===n.boundaryPoints[0]?.y?null:(0,G.jsx)("circle",{className:`fence-boundary__point${!n.boundaryClosed&&M===0&&n.boundaryPoints.length>=3?" is-close-target":""}`,cx:d.x,cy:d.y,r:"0.13",onPointerDown:S=>z(S,M)},`fence-point-${M}`))]}),(0,G.jsxs)("div",{className:"fence-boundary__zoom","aria-label":"Zoom controls",children:[(0,G.jsx)("button",{type:"button",onClick:()=>m(d=>Math.max(.5,d-.25)),disabled:p===.5,"aria-label":"Zoom out",children:"\u2212"}),(0,G.jsxs)("span",{children:[Math.round(p*100),"%"]}),(0,G.jsx)("button",{type:"button",onClick:()=>m(d=>Math.min(1,d+.25)),disabled:p===1,"aria-label":"Zoom in",children:"+"})]}),!n.boundaryClosed&&n.boundaryPoints.length>=2?(0,G.jsx)("button",{type:"button",className:"fence-boundary__close",onClick:()=>o(d=>hc(d.boundaryPoints,!1)?d:{...d,boundaryClosed:!0}),children:"Finish fence line"}):null]}),(0,G.jsx)("div",{className:"truss-estimator__grid-hint",children:n.boundaryClosed?"Drag the blank canvas to pan. Tap an edge to exclude it from the new fence.":"Click to add points, then finish the fence line. The displayed distances update as you draw."})]}),(0,G.jsxs)("div",{className:"truss-estimator__grid-stats",children:[(0,G.jsx)("div",{children:n.boundaryMode==="quick"?`${(Number.parseFloat(n.quickLengthM)||0).toFixed(2)} m fence line`:`${be.totalEdgeM.toFixed(2)} m fence line`}),n.boundaryMode==="draw"&&n.boundaryClosed?(0,G.jsxs)("div",{children:[be.cornerPostCount," corner/end posts"]}):null]})]}):null,null,u==="height"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Fence height"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"Select the nearest available panel height."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:Na.heights.filter(d=>Qv(n.range,d)).map(d=>(0,G.jsx)("button",{type:"button",className:`truss-estimator__visual-card${n.height===d?" is-selected":""}`,onClick:()=>o(M=>({...M,height:d,mountingType:M.mountingType&&Gv(M.mountingType,d)?M.mountingType:null})),children:(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--tall",src:Ft(`/fencing/height/${d}.webp`),alt:""})},d))}),(0,G.jsx)("div",{className:"truss-estimator__section-heading",children:"Gravel board?"}),(0,G.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(d=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${n.gravelBoard===d.id?" is-selected":""}`,onClick:()=>o(M=>({...M,gravelBoard:d.id})),children:[(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Ft(d.img),alt:""}),(0,G.jsx)("span",{children:d.label})]},d.id))})]}):null,u==="gate"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Do you need a gate?"}),(0,G.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,G.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(d=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${n.gateType===d.id?" is-selected":""}`,onClick:()=>o(M=>({...M,gateType:d.id,gateWidthM:d.id==="none"?"":String(Na.gate[d.id].widthDefault)})),children:[(0,G.jsx)("img",{className:"truss-estimator__visual-card-img truss-estimator__visual-card-img--mid",src:Ft(d.img),alt:""}),(0,G.jsx)("span",{children:d.label})]},d.id))}),n.gateType&&n.gateType!=="none"?(0,G.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,G.jsx)("span",{children:"Gate width (m)"}),(0,G.jsx)("input",{type:"text",inputMode:"decimal",value:n.gateWidthM,onChange:d=>o(M=>({...M,gateWidthM:d.target.value}))})]}):null]}):null,u==="posts"?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:"truss-estimator__step-label",children:["Step ",r+1," of ",Si.length]}),(0,G.jsx)("h2",{className:"truss-estimator__step-title",children:"Posts and fixing type"}),(0,G.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose how the posts will be set."}),(0,G.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Object.entries(Na.mounting).filter(([d])=>Gv(d,n.height)).map(([d,M])=>(0,G.jsxs)("button",{type:"button",className:`truss-estimator__option-card${n.mountingType===d?" is-selected":""}`,onClick:()=>o(S=>({...S,mountingType:d})),children:[(0,G.jsx)("div",{className:"truss-estimator__option-title",children:M.label}),(0,G.jsx)("div",{className:"truss-estimator__option-copy",children:M.blurb})]},d))})]}):null]}),(0,G.jsxs)("div",{className:"truss-estimator__nav",children:[(0,G.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:fe,children:"Back"}),(0,G.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:Me,disabled:!St(),children:[(0,G.jsx)("span",{children:X}),(0,G.jsx)("span",{className:"arrow",children:(0,G.jsx)(Qt,{})})]})]})]})]})})}var gc=Y(je()),ge=Y(ee()),Yv={floor:{label:"Floor between rooms",product:"Knauf Acoustic Roll",thickness:"100mm",coverage:12.36},ground:{label:"Ground floor",product:"Rigid PIR insulation board",thickness:"100mm",coverage:2.88},wall:{label:"Cavity wall",product:"Celotex CW4100",thickness:"100mm",coverage:3.24},roof:{label:"Pitched roof",product:"Kingspan K107",thickness:"100mm",coverage:8.64},loft:{label:"Loft",product:"Knauf Loft Roll 44",thickness:"100mm",coverage:13.89}};function Zd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,gc.useState)("floor"),[n,o]=(0,gc.useState)(""),[l,c]=(0,gc.useState)(""),p=Number.parseFloat(n)*Number.parseFloat(l)||0,m=Yv[r],b=Math.ceil(p/m.coverage),f=[{key:`insulation-${r}`,label:`${m.product} ${m.thickness}`,qty:Math.round(p*100)/100,unit:"m2",query:m.product,category:"insulation"}],w=Object.entries(Yv);return(0,ge.jsx)(ge.Fragment,{children:(0,ge.jsxs)("div",{className:"truss-estimator",children:[(0,ge.jsxs)("div",{className:"quick-order-hero",children:[(0,ge.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,ge.jsx)("h1",{children:"Insulation Calculator"}),(0,ge.jsx)("p",{children:"Estimate insulation coverage and pack quantities for floors, walls, roofs and lofts."})]}),(0,ge.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,ge.jsx)("h2",{className:"truss-estimator__step-title",children:"Where and what you are insulating"}),(0,ge.jsx)("p",{className:"truss-estimator__step-sub",children:"Choose the application and product, and enter the area, for coverage and pack quantities."}),(0,ge.jsxs)("div",{className:"materials-calculator__section",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Application"}),(0,ge.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:w.map(([_,E])=>(0,ge.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===_?" is-selected":""}`,onClick:()=>i(_),children:[(0,ge.jsx)("div",{className:"truss-estimator__option-title",children:E.label}),(0,ge.jsxs)("div",{className:"truss-estimator__option-copy",children:[E.product,", ",E.thickness]})]},_))})]}),(0,ge.jsxs)("div",{className:"materials-calculator__section",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Area"}),(0,ge.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,ge.jsxs)("label",{className:"truss-estimator__field",children:[(0,ge.jsx)("span",{children:"Length (m)"}),(0,ge.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:_=>o(_.target.value)})]}),(0,ge.jsxs)("label",{className:"truss-estimator__field",children:[(0,ge.jsx)("span",{children:"Width (m)"}),(0,ge.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:_=>c(_.target.value)})]})]})]}),(0,ge.jsxs)("div",{className:"materials-calculator__totals",children:[(0,ge.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,ge.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:"Insulated area"}),(0,ge.jsxs)("strong",{children:[p.toFixed(2)," m\xB2"]})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("span",{children:m.product}),(0,ge.jsxs)("strong",{children:[b," packs"]})]})]}),(0,ge.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,ge.jsxs)("div",{className:"materials-calculator__actions",children:[(0,ge.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,ge.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(f),disabled:p<=0,children:a})]})]})]})})}var Gn=Y(je());var V=Y(ee()),mx=10,fx=1.9*.762,hx=1.9*1.524,bc=()=>({height:"",width:""}),wc=e=>Number.parseFloat(e)||0,$v=({height:e,width:t})=>wc(e)*wc(t);function Kd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Gn.useState)([bc()]),[n,o]=(0,Gn.useState)([bc()]),[l,c]=(0,Gn.useState)("0"),[p,m]=(0,Gn.useState)("0"),[b,f]=(0,Gn.useState)(1),w=r.reduce((N,R)=>N+$v(R),0),_=n.reduce((N,R)=>N+$v(R),0),E=wc(l)*fx+wc(p)*hx,D=Math.max(0,w-_-E),h=D*b/mx,u={key:"paint-emulsion",label:"Matt emulsion, brilliant white",qty:Math.round(h*10)/10,unit:"litres",query:"matt emulsion brilliant white"},g=cl("paint",u)!=null,v=(N,R,T,U)=>{N(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B))};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",{})]}),r.map((N,R)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Wall ",R+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 ${R+1} height in metres`,type:"number",min:"0",step:"0.01",value:N.height,onChange:T=>v(i,R,"height",T.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 ${R+1} width in metres`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(i,R,"width",T.target.value)})]}),r.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`wall-${R}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(N=>[...N,bc()]),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",{})]}),n.map((N,R)=>(0,V.jsxs)("div",{className:"paint-calculator__row",children:[(0,V.jsxs)("span",{className:"paint-calculator__row-label",children:["Area ",R+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 ${R+1} height in metres`,type:"number",min:"0",step:"0.01",value:N.height,onChange:T=>v(o,R,"height",T.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 ${R+1} width in metres`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(o,R,"width",T.target.value)})]}),n.length>1?(0,V.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>o(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`excluded-${R}`)),(0,V.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>o(N=>[...N,bc()]),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:l,onChange:N=>c(N.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:p,onChange:N=>m(N.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:b,onChange:N=>f(Number(N.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:[D.toFixed(2)," m\xB2"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Coverage"}),(0,V.jsxs)("strong",{children:[b," ",b===1?"coat":"coats"]})]}),(0,V.jsxs)("div",{children:[(0,V.jsx)("span",{children:"Paint required"}),(0,V.jsxs)("strong",{children:[h.toFixed(1)," litres"]})]})]}),(0,V.jsx)("p",{className:"paint-calculator__note",children:g?"Based on paint coverage of 10 m\xB2 per litre. Ordered as brilliant white matt emulsion, rounded up to whole tins.":"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"}),g?(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.([u]),disabled:h<=0,children:a}):(0,V.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",disabled:!0,children:"Paint products unavailable"})]})]})]})})}var fr=Y(je()),te=Y(ee()),vc=e=>Number.parseFloat(e)||0,Pd={paving:[{id:"council",label:"Council paving slab (600 \xD7 600mm)"},{id:"raj",label:"Raj blend sandstone (600 \xD7 600mm)"}],block:[{id:"brindle",label:"Brindle block paving (60mm)"},{id:"charcoal",label:"Charcoal block paving (60mm)"}],gravel:[{id:"pea",label:"20mm pea shingle"}]};function Jd({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,fr.useState)("paving"),[n,o]=(0,fr.useState)("council"),[l,c]=(0,fr.useState)(""),[p,m]=(0,fr.useState)(""),[b,f]=(0,fr.useState)("100"),[w,_]=(0,fr.useState)("50"),[E,D]=(0,fr.useState)(!0),[h,u]=(0,fr.useState)(!0),g=vc(l)*vc(p),v=g,N=g*(vc(b)/1e3),R=g*.04,T=g*(vc(w)/1e3),U=Math.ceil(v/.36),A=Math.ceil(v/.1),B=Math.ceil(N*1700/800),ie=Math.ceil(R*1600/800),ze=Math.ceil(T*1600/800),He=r==="paving"?{qty:U,unit:"each"}:r==="block"?{qty:v,unit:"m2"}:{qty:ze,unit:"bag"},Ve={paving:"paving slab",block:"block paver",gravel:"decorative gravel"}[r],qe=[{key:`surface-${n}`,label:Pd[r].find(le=>le.id===n)?.label??"Surface material",qty:He.qty,unit:He.unit,query:Ve,category:"landscaping"},...E?[{key:"sub-base",label:"MOT Type 1 sub-base",qty:B,unit:"bag",query:"MOT Type 1 sub base",category:"aggregate"}]:[],...h?[{key:"bedding",label:"Sharp sand bedding",qty:ie,unit:"bag",query:"sharp sand",category:"aggregate"}]:[]];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:"Paving and Driveway Calculator"}),(0,te.jsx)("p",{children:"Estimate paving, block paving, sub-base and bedding materials for outdoor areas."})]}),(0,te.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,te.jsx)("h2",{className:"truss-estimator__step-title",children:"Surface and ground build-up"}),(0,te.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,te.jsxs)("div",{className:"materials-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Surface material"}),(0,te.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(([le,Je,Ne])=>(0,te.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===le?" is-selected":""}`,onClick:()=>{i(le),o(Pd[le][0].id)},children:[(0,te.jsx)("div",{className:"truss-estimator__option-title",children:Je}),(0,te.jsx)("div",{className:"truss-estimator__option-copy",children:Ne})]},le))}),(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Finish"}),(0,te.jsx)("select",{value:n,onChange:le=>o(le.target.value),children:Pd[r].map(le=>(0,te.jsx)("option",{value:le.id,children:le.label},le.id))})]})]}),(0,te.jsxs)("div",{className:"materials-calculator__section",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Area and groundwork"}),(0,te.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,te.jsxs)("label",{className:"truss-estimator__field",children:[(0,te.jsx)("span",{children:"Length (m)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:le=>c(le.target.value)})]}),(0,te.jsxs)("label",{className:"truss-estimator__field",children:[(0,te.jsx)("span",{children:"Width (m)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"0.01",value:p,onChange:le=>m(le.target.value)})]})]}),r==="gravel"&&(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Gravel depth (mm)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"10",value:w,onChange:le=>_(le.target.value)})]}),E&&(0,te.jsxs)("label",{className:"truss-estimator__field materials-calculator__depth",children:[(0,te.jsx)("span",{children:"Sub-base depth (mm)"}),(0,te.jsx)("input",{type:"number",min:"0",step:"10",value:b,onChange:le=>f(le.target.value)})]}),(0,te.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,te.jsx)("input",{type:"checkbox",checked:E,onChange:le=>D(le.target.checked)}),(0,te.jsx)("span",{children:"Include MOT Type 1 sub-base"})]}),(0,te.jsxs)("label",{className:"brick-calculator__checkbox materials-calculator__waste",children:[(0,te.jsx)("input",{type:"checkbox",checked:h,onChange:le=>u(le.target.checked)}),(0,te.jsx)("span",{children:"Include sharp sand bedding"})]})]}),(0,te.jsxs)("div",{className:"materials-calculator__totals",children:[(0,te.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,te.jsxs)("div",{className:"materials-calculator__result-grid",children:[(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Surface area"}),(0,te.jsxs)("strong",{children:[g.toFixed(2)," m\xB2"]})]}),(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:r==="paving"?"Paving slabs":r==="block"?"Block paving":"Gravel"}),(0,te.jsx)("strong",{children:r==="paving"?`${U} slabs`:r==="block"?`${v.toFixed(2)} m\xB2`:`${ze} bulk bags`})]}),E&&(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"MOT Type 1"}),(0,te.jsxs)("strong",{children:[B," bulk bags"]})]}),h&&(0,te.jsxs)("div",{children:[(0,te.jsx)("span",{children:"Sharp sand"}),(0,te.jsxs)("strong",{children:[ie," bulk bags"]})]})]}),(0,te.jsx)("p",{className:"materials-calculator__note",children:"Slab and block quantities use typical sizes. Confirm pack coverage and laying pattern before ordering."})]}),(0,te.jsxs)("div",{className:"materials-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?.(qe),disabled:g<=0,children:a})]})]})]})})}var ul=Y(je()),re=Y(ee()),gx=2.88,Vv=[{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"}],Xv=()=>({length:"",height:""}),Fd=e=>Number.parseFloat(e)||0;function Id({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,ul.useState)([Xv()]),[n,o]=(0,ul.useState)(""),[l,c]=(0,ul.useState)("standard"),[p,m]=(0,ul.useState)("screws"),b=r.reduce((R,T)=>R+Fd(T.length)*Fd(T.height),0),f=Math.max(0,b-Fd(n)),w=Math.ceil(f/gx),_=Math.ceil(f*12),E=Math.ceil(_/1e3),D=Math.ceil(f*1.2),h=Math.ceil(D/90),u=Math.ceil(f/3.5),g=Vv.find(R=>R.id===l)?.label??"Standard",v=[{key:"board",label:`${g} plasterboard`,qty:w,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:u,unit:"bag",query:"drywall board adhesive",category:"plasterboard"}],{key:"tape",label:"Joint tape",qty:h,unit:"roll",query:"plasterboard joint tape",category:"plasterboard"}],N=(R,T,U)=>{i(A=>A.map((B,ie)=>ie===R?{...B,[T]:U}:B))};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:"Plasterboard and Drylining Calculator"}),(0,re.jsx)("p",{children:"Estimate boards, fixings and jointing materials for walls and ceilings."})]}),(0,re.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,re.jsx)("h2",{className:"truss-estimator__step-title",children:"Boards, fixings and jointing"}),(0,re.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,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Board type"}),(0,re.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:Vv.map(R=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${l===R.id?" is-selected":""}`,onClick:()=>c(R.id),children:[(0,re.jsx)("div",{className:"truss-estimator__option-title",children:R.label}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:R.blurb})]},R.id))})]}),(0,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Fixing method"}),(0,re.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(([R,T,U])=>(0,re.jsxs)("button",{type:"button",className:`truss-estimator__option-card${p===R?" is-selected":""}`,onClick:()=>m(R),children:[(0,re.jsx)("div",{className:"truss-estimator__option-title",children:T}),(0,re.jsx)("div",{className:"truss-estimator__option-copy",children:U})]},R))})]}),(0,re.jsxs)("div",{className:"materials-calculator__section",children:[(0,re.jsx)("div",{className:"truss-estimator__section-heading",children:"Wall and ceiling areas"}),(0,re.jsx)("p",{className:"materials-calculator__hint",children:"Add each surface separately so different wall sizes are easy to measure."}),(0,re.jsxs)("div",{className:"materials-calculator__dimensions-header",children:[(0,re.jsx)("span",{children:"Surface"}),(0,re.jsx)("span",{children:"Length (m)"}),(0,re.jsx)("span",{children:"Height (m)"}),(0,re.jsx)("span",{})]}),r.map((R,T)=>(0,re.jsxs)("div",{className:"materials-calculator__surface-row",children:[(0,re.jsxs)("span",{children:["Surface ",T+1]}),(0,re.jsx)("input",{"aria-label":`Surface ${T+1} length`,type:"number",min:"0",step:"0.01",value:R.length,onChange:U=>N(T,"length",U.target.value)}),(0,re.jsx)("input",{"aria-label":`Surface ${T+1} height`,type:"number",min:"0",step:"0.01",value:R.height,onChange:U=>N(T,"height",U.target.value)}),r.length>1?(0,re.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>i(U=>U.filter((A,B)=>B!==T)),children:"Remove"}):null]},`surface-${T}`)),(0,re.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>i(R=>[...R,Xv()]),children:"+ Add another surface"}),(0,re.jsxs)("label",{className:"truss-estimator__field materials-calculator__openings",children:[(0,re.jsxs)("span",{children:["Openings to deduct (m\xB2) ",(0,re.jsx)("small",{children:"optional"})]}),(0,re.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:R=>o(R.target.value)})]})]}),(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:"Board area"}),(0,re.jsxs)("strong",{children:[f.toFixed(2)," m\xB2"]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"2.4 x 1.2 m boards"}),(0,re.jsx)("strong",{children:w})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:p==="screws"?"Drywall screws":"Board adhesive"}),(0,re.jsx)("strong",{children:p==="screws"?`${_} (${E} boxes)`:`${u} bags`})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("span",{children:"Joint tape"}),(0,re.jsxs)("strong",{children:[D," m (",h," rolls)"]})]})]}),(0,re.jsx)("p",{className:"materials-calculator__note",children:"Figures are estimates. Confirm board specification, fixing patterns and fire or acoustic requirements 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?.(v),disabled:f<=0,children:a})]})]})]})})}var pl=Y(je());var y=Y(ee()),At={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}}}},yc=["range","pitchAndDimensions","quantityAndGirders","bracing"],bx={range:null,pitch:null,spanMM:"",overhangMM:"",roofLengthM:"",centres:null,girderCount:0,bracing:null,treatment:null,contact:{name:"",email:""}};function wx({degrees:e}){let a=e*Math.PI/180,i=82-Math.min(58,38*Math.tan(a));return(0,y.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,y.jsx)("line",{x1:"6",y1:"82",x2:"94",y2:"82",stroke:"var(--border)",strokeWidth:"2"}),(0,y.jsx)("polygon",{points:`12,82 88,82 50,${i}`,fill:"var(--accent-light)",stroke:"var(--accent)",strokeWidth:"3",strokeLinejoin:"round"})]})}function vx({type:e}){let t="#b3835a",a="#5c3b22",r="#d9b48f",i="#d3d8de",n="#7c8494",o=(m,b,f,w,_=8,E)=>{let D=f-m,h=w-b,u=Math.hypot(D,h)||1,g=-h/u,v=D/u,N=_*.2;return(0,y.jsxs)("g",{children:[(0,y.jsx)("line",{x1:m,y1:b,x2:f,y2:w,stroke:a,strokeWidth:_+3,strokeLinecap:"square"}),(0,y.jsx)("line",{x1:m,y1:b,x2:f,y2:w,stroke:t,strokeWidth:_,strokeLinecap:"square"}),(0,y.jsx)("line",{x1:m-g*N,y1:b-v*N,x2:f-g*N,y2:w-v*N,stroke:r,strokeWidth:Math.max(1.5,_*.24),strokeLinecap:"round",opacity:"0.9"})]},E)},l=(m,b,f)=>(0,y.jsxs)("g",{children:[(0,y.jsx)("rect",{x:m-7.5,y:b-5.5,width:"15",height:"11",rx:"2",fill:i,stroke:n,strokeWidth:"1"}),(0,y.jsx)("circle",{cx:m-4,cy:b-2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m+4,cy:b-2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m-4,cy:b+2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m+4,cy:b+2.5,r:"1",fill:n}),(0,y.jsx)("circle",{cx:m,cy:b,r:"1",fill:n})]},f),c=(m,b)=>(0,y.jsx)("rect",{x:m-9,y:"110",width:"18",height:"10",fill:a},b),p=(0,y.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"});return e==="attic"?(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,26,8,"b1"),o(174,112,100,26,8,"b2"),o(26,112,174,112,8,"b3"),o(58,112,58,70,6,"b4"),o(142,112,142,70,6,"b5"),o(58,70,142,70,7,"b6"),(0,y.jsx)("rect",{x:"90",y:"82",width:"20",height:"24",fill:"#cfe3f2",stroke:a,strokeWidth:"2"}),(0,y.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,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,174,26,8,"b1"),o(174,26,174,112,8,"b2"),o(26,112,174,112,8,"b3"),o(90,112,90,75,5,"b4"),o(90,75,132,112,5,"b5"),l(26,112,"p1"),l(174,26,"p2"),l(174,112,"p3"),l(90,112,"p4"),l(90,75,"p5"),l(132,112,"p6")]}):(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[p,c(26,"wl"),c(174,"wr"),o(26,112,100,34,8,"b1"),o(174,112,100,34,8,"b2"),o(26,112,174,112,8,"b3"),o(63,112,100,34,5,"b4"),o(137,112,100,34,5,"b5"),o(63,112,54,83,5,"b6"),o(137,112,146,83,5,"b7"),(0,y.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 yx({enabled:e}){return(0,y.jsxs)("svg",{viewBox:"0 0 200 130",className:"truss-estimator__diagram","aria-hidden":"true",children:[(0,y.jsx)("line",{x1:"6",y1:"122",x2:"194",y2:"122",stroke:"var(--border)",strokeWidth:"2"}),(0,y.jsx)("rect",{x:"17",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,y.jsx)("rect",{x:"165",y:"110",width:"18",height:"10",fill:"#5c3b22"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"174",y1:"112",x2:"100",y2:"34",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#5c3b22",strokeWidth:"11",strokeLinecap:"square"}),(0,y.jsx)("line",{x1:"26",y1:"112",x2:"174",y2:"112",stroke:"#b3835a",strokeWidth:"8",strokeLinecap:"square"}),e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("line",{x1:"45",y1:"112",x2:"140",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"}),(0,y.jsx)("line",{x1:"155",y1:"112",x2:"60",y2:"88",stroke:"var(--accent)",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 5"})]}):null,(0,y.jsx)("rect",{x:"18.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,y.jsx)("rect",{x:"166.5",y:"106.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"}),(0,y.jsx)("rect",{x:"92.5",y:"28.5",width:"15",height:"11",rx:"2",fill:"#d3d8de",stroke:"#7c8494",strokeWidth:"1"})]})}function Zv({treated:e}){let t=e?"#5a7a4a":"var(--accent)";return(0,y.jsxs)("svg",{viewBox:"0 0 100 100",className:"truss-estimator__diagram truss-estimator__diagram--small","aria-hidden":"true",children:[(0,y.jsx)("rect",{x:"10",y:"22",width:"80",height:"14",rx:"2",fill:t}),(0,y.jsx)("rect",{x:"10",y:"43",width:"80",height:"14",rx:"2",fill:e?"#8faf7a":"var(--accent-light)"}),(0,y.jsx)("rect",{x:"10",y:"64",width:"80",height:"14",rx:"2",fill:t})]})}function Wd({onBack:e}){let[t,a]=(0,pl.useState)(0),[r,i]=(0,pl.useState)(bx),[n,o]=(0,pl.useState)(!1),[l,c]=(0,pl.useState)(!1),p=()=>{let h=Number.parseFloat(r.roofLengthM)||0,u=Number.parseFloat(r.centres??"");return h<=0||!u?0:Math.ceil(h*1e3/u)+1},b=(()=>{let h=r.range?At.ranges[r.range]:At.ranges.standard,u=r.pitch??"22.5",g=At.pitchMultipliers[u],v=(Number.parseFloat(r.spanMM)||0)/1e3,R=(Number.parseFloat(r.overhangMM)||0)>At.overhang.thresholdMM,T=p(),U=T+r.girderCount,A=Number.parseFloat(r.roofLengthM)||0,B=r.treatment?At.treatment[r.treatment]:At.treatment.untreated,ie=At.estimate.ranges[r.range??"standard"],ze=ie.supplyAt8m*Math.max(.7,v/8)*g*(1+B.surchargePct)+(R?At.overhang.surchargePerTruss:0),He=T*ze,Ve=r.girderCount*ze*At.estimate.girderMultiplier,qe=r.bracing==="yes"?A*At.estimate.bracingPerMetre:0,be=He+Ve+qe+At.estimate.delivery,le=At.estimate.design+T*ie.installPerTruss+r.girderCount*40,Je=be+le,Ne=Je*.2;return{range:h,count:T,girderCount:r.girderCount,overhangApplies:R,overhangUnits:U,roofLengthM:A,treatment:B,trussSupply:He,bracingMaterials:qe,delivery:At.estimate.delivery,labour:le,subtotal:Je,vat:Ne,total:Je+Ne}})(),f=()=>{let h=yc[t];return h==="range"?!!r.range:h==="pitchAndDimensions"?!!r.pitch&&r.spanMM.trim()!==""&&r.overhangMM.trim()!=="":h==="quantityAndGirders"?r.roofLengthM.trim()!==""&&!!r.centres:h==="bracing"?!!r.bracing&&!!r.treatment:!0},w=t===yc.length-1?"View truss request":"Next",_=()=>{n?o(!1):t===0?e():a(h=>h-1)},E=()=>{f()&&(t===yc.length-1?(c(!1),o(!0)):a(h=>h+1))},D=()=>{let h=yc[t];return h==="range"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 1 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Choose your truss range"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Pricing shown is placeholder. Swap in your real engineering and pricing catalogue."}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--range",children:Object.entries(At.ranges).map(([u,g])=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r.range===u?" is-selected":""}`,onClick:()=>i(v=>({...v,range:u})),children:[(0,y.jsx)(vx,{type:u}),(0,y.jsxs)("div",{className:"truss-estimator__option-info",children:[(0,y.jsx)("div",{className:"truss-estimator__option-title",children:g.label}),(0,y.jsx)("div",{className:"truss-estimator__option-copy",children:g.blurb})]})]},u))})]}):h==="pitchAndDimensions"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 2 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Span, overhang and roof pitch"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,y.jsxs)("label",{className:"truss-estimator__field",children:[(0,y.jsx)("span",{children:"Span (mm)"}),(0,y.jsx)("input",{type:"text",inputMode:"numeric",value:r.spanMM,onChange:u=>i(g=>({...g,spanMM:u.target.value}))})]}),(0,y.jsxs)("label",{className:"truss-estimator__field",children:[(0,y.jsx)("span",{children:"Overhang (mm)"}),(0,y.jsx)("input",{type:"text",inputMode:"numeric",value:r.overhangMM,onChange:u=>i(g=>({...g,overhangMM:u.target.value}))}),(0,y.jsxs)("small",{children:["Overhangs beyond ",At.overhang.thresholdMM,"mm add a small surcharge per truss."]})]})]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Roof pitch"}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--pitch",children:At.pitches.map(u=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card${r.pitch===u?" is-selected":""}`,onClick:()=>i(g=>({...g,pitch:u})),children:[(0,y.jsx)(wx,{degrees:Number.parseFloat(u)}),(0,y.jsxs)("span",{children:[u,"\xB0"]})]},u))})]}):h==="quantityAndGirders"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 3 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Roof length"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Trusses are based on designs at 400mm or 600mm centres wherever possible."}),(0,y.jsxs)("label",{className:"truss-estimator__field truss-estimator__field--compact",children:[(0,y.jsx)("span",{children:"Roof length (m)"}),(0,y.jsx)("input",{type:"text",inputMode:"decimal",value:r.roofLengthM,onChange:u=>i(g=>({...g,roofLengthM:u.target.value}))})]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Truss centres"}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--centres",children:At.centresOptions.map(u=>(0,y.jsx)("button",{type:"button",className:`truss-estimator__option-card truss-estimator__option-card--compact${r.centres===u?" is-selected":""}`,onClick:()=>i(g=>({...g,centres:u})),children:(0,y.jsxs)("div",{className:"truss-estimator__option-title",children:[u,"mm centres"]})},u))}),(0,y.jsxs)("div",{className:"truss-estimator__stat",children:[p()," trusses estimated"]}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Girder trusses"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__stepper",children:[(0,y.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.max(0,u.girderCount-1)})),children:"\u2212"}),(0,y.jsx)("span",{children:r.girderCount}),(0,y.jsx)("button",{type:"button",onClick:()=>i(u=>({...u,girderCount:Math.min(3,u.girderCount+1)})),children:"+"})]})]}):h==="bracing"?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Step 4 of 4"}),(0,y.jsx)("h2",{className:"truss-estimator__step-title",children:"Bracing pack?"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"A timber bracing pack stabilises the roof structure once trusses are erected."}),(0,y.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[{id:"no",label:"No bracing pack"},{id:"yes",label:"Add bracing pack"}].map(u=>(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.bracing===u.id?" is-selected":""}`,onClick:()=>i(g=>({...g,bracing:u.id})),children:[(0,y.jsx)(yx,{enabled:u.id==="yes"}),(0,y.jsx)("span",{children:u.label})]},u.id))}),(0,y.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber treatment"}),(0,y.jsx)("p",{className:"truss-estimator__step-sub",children:"Tanalised timber protects against rot in exposed or damp locations."}),(0,y.jsxs)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--two",children:[(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="untreated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"untreated"})),children:[(0,y.jsx)(Zv,{treated:!1}),(0,y.jsx)("span",{children:"Untreated"})]}),(0,y.jsxs)("button",{type:"button",className:`truss-estimator__visual-card truss-estimator__visual-card--wide${r.treatment==="treated"?" is-selected":""}`,onClick:()=>i(u=>({...u,treatment:"treated"})),children:[(0,y.jsx)(Zv,{treated:!0}),(0,y.jsx)("span",{children:"Treated (+8% cost)"}),(0,y.jsx)("small",{children:"Applies to trusses, girders and overhang"})]})]})]}):null};return n?(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)("div",{className:"truss-estimator",children:[(0,y.jsxs)("div",{className:"quick-order-hero",children:[(0,y.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,y.jsx)("h1",{children:"Your truss estimate"}),(0,y.jsx)("p",{children:"A provisional quantity and specification based on the dimensions you entered."})]}),(0,y.jsxs)("div",{className:"truss-estimator__card truss-request",style:{minHeight:0},children:[(0,y.jsxs)("div",{className:"truss-request__heading",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Estimated requirement"}),(0,y.jsxs)("h2",{children:[b.range.label," roof trusses"]})]}),(0,y.jsxs)("strong",{children:[b.count,(0,y.jsx)("span",{children:"trusses"})]})]}),(0,y.jsxs)("div",{className:"truss-request__grid",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Span"}),(0,y.jsxs)("strong",{children:[r.spanMM," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Roof length"}),(0,y.jsxs)("strong",{children:[r.roofLengthM," m"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Pitch"}),(0,y.jsxs)("strong",{children:[r.pitch,"\xB0"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Centres"}),(0,y.jsxs)("strong",{children:[r.centres," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Overhang"}),(0,y.jsxs)("strong",{children:[r.overhangMM," mm"]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Treatment"}),(0,y.jsx)("strong",{children:b.treatment.label})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Girder trusses"}),(0,y.jsx)("strong",{children:b.girderCount||"None"})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Bracing pack"}),(0,y.jsx)("strong",{children:r.bracing==="yes"?"Included":"Not included"})]})]}),(0,y.jsxs)("div",{className:"truss-request__price",children:[(0,y.jsx)("div",{className:"truss-estimator__step-label",children:"Indicative cost estimate"}),(0,y.jsxs)("div",{className:"truss-request__price-grid",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Truss supply allowance"}),(0,y.jsx)("strong",{children:lt(b.trussSupply)})]}),b.bracingMaterials>0&&(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Bracing materials allowance"}),(0,y.jsx)("strong",{children:lt(b.bracingMaterials)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Delivery allowance"}),(0,y.jsx)("strong",{children:lt(b.delivery)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Design and installation labour"}),(0,y.jsx)("strong",{children:lt(b.labour)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Subtotal (ex. VAT)"}),(0,y.jsx)("strong",{children:lt(b.subtotal)})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"VAT (20%)"}),(0,y.jsx)("strong",{children:lt(b.vat)})]}),(0,y.jsxs)("div",{className:"truss-request__price-total",children:[(0,y.jsx)("span",{children:"Estimated total"}),(0,y.jsx)("strong",{children:lt(b.total)})]})]}),(0,y.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,y.jsxs)("div",{className:"truss-request__notice",children:[(0,y.jsx)("strong",{children:"Before ordering"}),(0,y.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,y.jsxs)("div",{className:"truss-estimator__nav",children:[(0,y.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:_,children:"Back to calculator"}),(0,y.jsx)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",justifyContent:"center",marginTop:0},onClick:()=>c(!0),children:"Request order"})]}),l&&(0,y.jsx)("p",{className:"truss-request__demo",children:"Demo only \u2014 no order has been sent."})]})]})}):(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)("div",{className:"truss-estimator",children:[(0,y.jsxs)("div",{className:"quick-order-hero",children:[(0,y.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,y.jsx)("h1",{children:"Roof Truss Calculator"}),(0,y.jsx)("p",{children:"Estimate trusses, girders and cost for your roof in a few steps."})]}),(0,y.jsxs)("div",{className:"truss-estimator__card",children:[(0,y.jsx)("div",{className:"truss-estimator__body",children:D()}),(0,y.jsxs)("div",{className:"truss-estimator__nav",children:[(0,y.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:_,children:"Back"}),(0,y.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:"0 1 70%",marginTop:0},onClick:E,disabled:!f(),children:[(0,y.jsx)("span",{children:w}),(0,y.jsx)("span",{className:"arrow",children:(0,y.jsx)(Qt,{})})]})]})]})]})})}var Ni=Y(je()),F=Y(ee()),Jv=e=>Number.parseFloat(e)||0,_c=(e,t)=>Jv(e)*(t==="m"?1:.3048),Kv=()=>({length:"",width:""}),Pv=[{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 _x({profile:e}){return(0,F.jsxs)("svg",{className:"skirting-calculator__profile-diagram",viewBox:"0 0 120 84","aria-hidden":"true",children:[(0,F.jsx)("path",{d:{chamfered:"M16 70V43L43 16H104V70Z",ogee:"M16 70V47C16 36 27 31 40 31C40 21 50 16 63 16H104V70Z","pencil-round":"M16 70V37C16 25 25 16 37 16H104V70Z",torus:"M16 70V49C16 39 25 34 36 34C36 22 47 16 61 16H104V70Z"}[e]}),(0,F.jsx)("line",{x1:"12",y1:"70",x2:"108",y2:"70"})]})}function em({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Ni.useState)("total"),[n,o]=(0,Ni.useState)("m"),[l,c]=(0,Ni.useState)(""),[p,m]=(0,Ni.useState)([Kv()]),[b,f]=(0,Ni.useState)(""),[w,_]=(0,Ni.useState)("chamfered"),E="4.4",D=r==="total"?_c(l,n):p.reduce((N,R)=>N+2*(_c(R.length,n)+_c(R.width,n)),0),h=Math.max(0,D-_c(b,n)),u=Math.ceil(h/Jv(E)),g=[{key:`skirting-${w}`,label:`${Pv.find(N=>N.id===w)?.label} skirting board`,qty:h,unit:"m",query:"skirting board",category:"skirting"}],v=(N,R,T)=>{m(U=>U.map((A,B)=>B===N?{...A,[R]:T}:A))};return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)("div",{className:"truss-estimator",children:[(0,F.jsxs)("div",{className:"quick-order-hero",children:[(0,F.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,F.jsx)("h1",{children:"Skirting Board Calculator"}),(0,F.jsx)("p",{children:"Work out how many skirting board lengths you need for one room or a whole project."})]}),(0,F.jsxs)("div",{className:"truss-estimator__card skirting-calculator",children:[(0,F.jsx)("h2",{className:"truss-estimator__step-title",children:"Measure by room or total length"}),(0,F.jsx)("p",{className:"truss-estimator__step-sub",children:"Enter a single total or work room by room. The run is converted straight into board lengths."}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"How would you like to measure?"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle skirting-calculator__mode-toggle",role:"group","aria-label":"Calculation method",children:[(0,F.jsx)("button",{type:"button",className:r==="total"?"is-selected":"",onClick:()=>i("total"),children:"Total length"}),(0,F.jsx)("button",{type:"button",className:r==="rooms"?"is-selected":"",onClick:()=>i("rooms"),children:"Room by room"})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Measurements"}),(0,F.jsxs)("div",{className:"skirting-calculator__unit-row",children:[(0,F.jsx)("span",{children:"Units"}),(0,F.jsxs)("div",{className:"brick-calculator__unit-toggle",role:"group","aria-label":"Measurement units",children:[(0,F.jsx)("button",{type:"button",className:n==="m"?"is-selected":"",onClick:()=>o("m"),children:"Metres"}),(0,F.jsx)("button",{type:"button",className:n==="ft"?"is-selected":"",onClick:()=>o("ft"),children:"Feet"})]})]}),r==="total"?(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Total skirting length (",n,")"]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:N=>c(N.target.value)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"skirting-calculator__dimensions-header",children:[(0,F.jsx)("span",{children:"Room"}),(0,F.jsxs)("span",{children:["Length (",n,")"]}),(0,F.jsxs)("span",{children:["Width (",n,")"]}),(0,F.jsx)("span",{})]}),p.map((N,R)=>(0,F.jsxs)("div",{className:"skirting-calculator__room-row",children:[(0,F.jsxs)("span",{className:"skirting-calculator__room-label",children:["Room ",R+1]}),(0,F.jsx)("input",{"aria-label":`Room ${R+1} length in ${n}`,type:"number",min:"0",step:"0.01",value:N.length,onChange:T=>v(R,"length",T.target.value)}),(0,F.jsx)("input",{"aria-label":`Room ${R+1} width in ${n}`,type:"number",min:"0",step:"0.01",value:N.width,onChange:T=>v(R,"width",T.target.value)}),p.length>1?(0,F.jsx)("button",{type:"button",className:"paint-calculator__remove",onClick:()=>m(T=>T.filter((U,A)=>A!==R)),children:"Remove"}):null]},`room-${R}`)),(0,F.jsx)("button",{type:"button",className:"paint-calculator__add",onClick:()=>m(N=>[...N,Kv()]),children:"+ Add another room"})]}),(0,F.jsxs)("label",{className:"truss-estimator__field skirting-calculator__single-field",children:[(0,F.jsxs)("span",{children:["Openings and doorways to deduct (",n,") ",(0,F.jsx)("small",{children:"optional"})]}),(0,F.jsx)("input",{type:"number",min:"0",step:"0.01",value:b,onChange:N=>f(N.target.value)})]})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Profile"}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Choose the finish you want for the fixed 4.4m white-primed MDF boards."}),(0,F.jsx)("div",{className:"architrave-calculator__profiles",children:Pv.map(N=>(0,F.jsxs)("button",{type:"button",className:`truss-estimator__option-card${w===N.id?" is-selected":""}`,onClick:()=>_(N.id),children:[(0,F.jsx)(_x,{profile:N.id}),(0,F.jsx)("div",{className:"truss-estimator__option-title",children:N.label}),(0,F.jsx)("div",{className:"truss-estimator__option-copy",children:N.blurb})]},N.id))})]}),(0,F.jsxs)("div",{className:"skirting-calculator__section",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Board and waste"}),(0,F.jsx)("div",{className:"truss-estimator__field-grid skirting-calculator__options-grid",children:(0,F.jsxs)("label",{className:"truss-estimator__field",children:[(0,F.jsx)("span",{children:"Board length"}),(0,F.jsx)("input",{value:"4.40 m",disabled:!0})]})}),(0,F.jsx)("p",{className:"skirting-calculator__hint",children:"Longer boards can reduce the number of joins, while 10% waste allows for cuts, corners and mistakes."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__totals",children:[(0,F.jsx)("div",{className:"truss-estimator__section-heading",children:"Totals"}),(0,F.jsxs)("div",{className:"skirting-calculator__result-grid",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Net skirting"}),(0,F.jsxs)("strong",{children:[h.toFixed(2)," m"]})]}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{children:"Board lengths"}),(0,F.jsx)("strong",{children:u})]})]}),(0,F.jsx)("p",{className:"skirting-calculator__note",children:"Corners and joins vary by room layout. Measure each wall where possible for the most accurate result."})]}),(0,F.jsxs)("div",{className:"skirting-calculator__actions",children:[(0,F.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary estimator-actions__back",onClick:e,children:"Back"}),(0,F.jsx)("button",{type:"button",className:"cta-btn estimator-actions__calculate",onClick:()=>t?.(g),disabled:h<=0,children:a})]})]})]})})}var Yn=Y(je()),oe=Y(ee()),dl=e=>Number.parseFloat(e)||0;function tm({onBack:e,onReview:t,submitLabel:a="Add to basket"}){let[r,i]=(0,Yn.useState)("studs"),[n,o]=(0,Yn.useState)(""),[l,c]=(0,Yn.useState)(""),[p,m]=(0,Yn.useState)("600"),[b,f]=(0,Yn.useState)("2.4"),w=n&&l&&p?Math.ceil(dl(l)/(dl(p)/1e3))+1:0,_=w*dl(n),E=dl(b)>0?Math.ceil(_/dl(b)):0,D=[{key:r,label:{studs:"Stud timber",joists:"Joist timber",battens:"Batten timber"}[r],qty:_,unit:"m",query:{studs:"cls studwork timber",joists:"timber joist",battens:"roofing batten"}[r],category:"timber"}],h={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,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:"Timber Calculator"}),(0,oe.jsx)("p",{children:"Estimate studs, joists or battens from a run length, width and spacing."})]}),(0,oe.jsxs)("div",{className:"truss-estimator__card materials-calculator",children:[(0,oe.jsx)("h2",{className:"truss-estimator__step-title",children:"Member size and spacing"}),(0,oe.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,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Timber use"}),(0,oe.jsx)("div",{className:"truss-estimator__option-grid truss-estimator__option-grid--three",children:Object.keys(h).map(v=>(0,oe.jsxs)("button",{type:"button",className:`truss-estimator__option-card${r===v?" is-selected":""}`,onClick:()=>i(v),children:[(0,oe.jsx)("div",{className:"truss-estimator__option-title",children:h[v][0]}),(0,oe.jsx)("div",{className:"truss-estimator__option-copy",children:h[v][1]})]},v))})]}),(0,oe.jsxs)("div",{className:"materials-calculator__section",children:[(0,oe.jsx)("div",{className:"truss-estimator__section-heading",children:"Dimensions and spacing"}),(0,oe.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsxs)("span",{children:[g.member," (m)"]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:n,onChange:v=>o(v.target.value)})]}),(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsxs)("span",{children:[g.overall," (m)"]}),(0,oe.jsx)("input",{type:"number",min:"0",step:"0.01",value:l,onChange:v=>c(v.target.value)})]})]}),(0,oe.jsxs)("div",{className:"truss-estimator__field-grid",children:[(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsx)("span",{children:"Centres (mm)"}),(0,oe.jsxs)("select",{value:p,onChange:v=>m(v.target.value),children:[(0,oe.jsx)("option",{value:"300",children:"300 mm"}),(0,oe.jsx)("option",{value:"400",children:"400 mm"}),(0,oe.jsx)("option",{value:"450",children:"450 mm"}),(0,oe.jsx)("option",{value:"600",children:"600 mm"})]})]}),(0,oe.jsxs)("label",{className:"truss-estimator__field",children:[(0,oe.jsx)("span",{children:"Stock length (m)"}),(0,oe.jsxs)("select",{value:b,onChange:v=>f(v.target.value),children:[(0,oe.jsx)("option",{value:"2.4",children:"2.40 m"}),(0,oe.jsx)("option",{value:"3.6",children:"3.60 m"}),(0,oe.jsx)("option",{value:"4.8",children:"4.80 m"})]})]})]})]}),(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:g.count}),(0,oe.jsx)("strong",{children:w})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsx)("span",{children:"Linear metres"}),(0,oe.jsxs)("strong",{children:[_.toFixed(2)," m"]})]}),(0,oe.jsxs)("div",{children:[(0,oe.jsxs)("span",{children:[b," m lengths"]}),(0,oe.jsx)("strong",{children:E})]})]}),(0,oe.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,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?.(D),disabled:_<=0,children:a})]})]})]})})}var am=[{id:"truss",title:"Roof Truss Calculator",desc:"Estimate trusses, girders and roof structure costs.",imageUrl:"/tool-images/truss.webp",Component:Wd},{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 and Block Calculator",desc:"Estimate masonry units and ready-mixed mortar for a wall.",imageUrl:"/tool-images/brick-block.webp",Component:jd},{id:"paint",title:"Paint Calculator",desc:"Estimate paint for walls, doors and multiple coats.",imageUrl:"/tool-images/paint.webp",Component:Kd},{id:"skirting",title:"Skirting Board Calculator",desc:"Estimate skirting lengths for rooms and wall runs.",imageUrl:"/tool-images/skirting.webp",Component:em},{id:"architrave",title:"Architrave Calculator",desc:"Estimate architrave lengths for door and window openings.",imageUrl:"/tool-images/architrave.webp",Component:Hd},{id:"concrete-aggregate",title:"Concrete and Aggregate Calculator",desc:"Estimate concrete, MOT, sand and gravel quantities.",imageUrl:"/tool-images/concrete-aggregate.webp",Component:Gd},{id:"plasterboard",title:"Plasterboard Calculator",desc:"Estimate plasterboard sheets, screws, tape and adhesive.",imageUrl:"/tool-images/plasterboard.webp",Component:Id},{id:"insulation",title:"Insulation Calculator",desc:"Estimate insulation packs for floors, walls, roofs and lofts.",imageUrl:"/tool-images/insulation.webp",Component:Zd},{id:"timber",title:"Timber Calculator",desc:"Estimate studs, joists and battens from spacing and lengths.",imageUrl:"/tool-images/timber.webp",Component:tm},{id:"paving",title:"Paving and Driveway Calculator",desc:"Estimate paving, block paving, MOT and sharp sand.",imageUrl:"/tool-images/paving.webp",Component:Jd}];var kc=Y(je());var Le=Y(je());var xx=new Set(["bag","box","roll","pack"]),kx=new Set(["each","bag","box","roll","pack","tub"]);function ml(e,t){let r=(t?.conversion?.request_uoms_supported??"").split(",").map(o=>o.trim().toLowerCase()).includes("sales_unit");if(e==="each"){let o=(t?.uoi_count??1)===1&&(t?.conversion?.sales_unit_size??1)===1;return r&&o?"sales_unit":e}if(!xx.has(e))return e;if(r)return"sales_unit";let i=t?.uoi;return i!=null&&kx.has(i.toLowerCase())&&(t?.uoi_count??1)===1?i:e}var Fv=new Map;function Sx(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 Ci(e,t,a=12,r){let i=`${Ot().client??""}||${e}||${t??""}||${a}||${r??""}`,n=Fv.get(i);if(n)return n;let o=new URLSearchParams({q:e,limit:String(a)});t&&o.set("category",t),r&&o.set("account",r);let l=await fetch(za(`/api/catalogue/search?${o.toString()}`),{headers:hi()}),c=await Qa(l);if(!l.ok)throw new Error(c?.error||c?.message||"Could not reach the product catalogue");let p=Array.isArray(c?.items)?c.items.map(Sx):[];return Fv.set(i,p),p}async function Iv(e,t,a){return await Promise.all(e.map(async i=>{try{let n=a?cl(a,i):null,[o,l]=await Promise.all([n?Ci(n,void 0,void 0,t).then(p=>p.find(m=>m.product_id===n.split(" ")[0]),()=>{}):void 0,Ci(i.query,i.category,void 0,t)]),c=o?[o,...l.filter(p=>p.product_id!==o.product_id)]:l;return{requirement:i,candidates:c}}catch{return{requirement:i,candidates:[]}}}))}async function Wv(){let e=await fetch(za("/api/catalogue"),{headers:hi()});if(!e.ok)return{itemCount:0,uploadedAt:null};let t=await Qa(e);return{itemCount:Number(t?.itemCount)||0,uploadedAt:t?.uploadedAt??null}}var C=Y(ee()),Nx=[{dir:"asc",label:"Description (A-Z)"},{dir:"desc",label:"Description (Z-A)"}],rm={wasteFactorEnabled:!0},Cx=3e3,e0=null;function xc(e,t){let a=al(t);return a?`${e.toFixed(2)} ${a}`:e.toFixed(2)}function qx(e){return e&&e.length>0?e.join(" x "):"-"}function im({toolId:e,requirements:t,ready:a,onBack:r,onTotalChange:i}){let n=Nv(),o=`${e}~${t.map(x=>`${x.key}|${x.query}|${x.category??""}|${x.qty}`).join("~")}`,l=o!==e0,[c,p]=(0,Le.useState)(null),[m,b]=(0,Le.useState)([]),[f,w]=(0,Le.useState)(l),[_,E]=(0,Le.useState)(null),[D,h]=(0,Le.useState)("tile"),[u,g]=(0,Le.useState)(null),[v,N]=(0,Le.useState)(""),[R,T]=(0,Le.useState)(null),[U,A]=(0,Le.useState)(""),[B,ie]=(0,Le.useState)([]),[ze,He]=(0,Le.useState)(new Set),[Ve,qe]=(0,Le.useState)(null),[be,le]=(0,Le.useState)(""),[Je,Ne]=(0,Le.useState)([]),St=(0,Le.useRef)(null),X=(0,Le.useRef)(!1),me=x=>`${e}:${x}`,Re=x=>zn(x.chosen,{lineId:me(x.requirement.key),description:x.requirement.label,unit:ml(x.requirement.unit,x.chosen),qty:x.requirement.qty}),Nt=(0,Le.useMemo)(()=>t.map(x=>`${x.key}|${x.query}|${x.category??""}`).join("~"),[t]);(0,Le.useEffect)(()=>{let x=!1;return Wv().then(j=>{x||p(j.itemCount>0)}).catch(()=>{x||p(!1)}),()=>{x=!0}},[]),(0,Le.useEffect)(()=>{if(!a||!c)return;let x=!1,j;l&&w(!0),E(null);let K=Date.now();return(async()=>{let ue=null;try{ue=(await Iv(t,void 0,e)).map(({requirement:wt,candidates:rt})=>({requirement:wt,candidates:rt,chosen:rt[0]??null}))}catch(ke){x||E(ke instanceof Error?ke.message:"Could not load products")}if(!x){if(e0=o,l){let ke=Cx-(Date.now()-K);ke>0&&await new Promise(wt=>{j=window.setTimeout(wt,ke)})}x||(ue&&(b(ue),!X.current&&n&&(X.current=!0,n.addManyToCart(ue.filter(ke=>ke.chosen).map(Re)))),w(!1))}})(),()=>{x=!0,window.clearTimeout(j)}},[a,c,Nt]),(0,Le.useEffect)(()=>{if(!R)return;let x=U.trim();if(!x){ie([]);return}let j=!1,K=window.setTimeout(()=>{Ci(x).then(ue=>{j||ie(ue)}).catch(()=>{j||ie([])})},250);return()=>{j=!0,window.clearTimeout(K)}},[R,U]),(0,Le.useEffect)(()=>{if(!Ve)return;let x=be.trim();if(!x){Ne([]);return}let j=!1,K=window.setTimeout(()=>{Ci(x).then(ue=>{j||Ne(ue)}).catch(()=>{j||Ne([])})},250);return()=>{j=!0,window.clearTimeout(K)}},[Ve,be]);let Bt=(0,Le.useMemo)(()=>{let x=v.trim().toLowerCase(),j=x?m.filter(K=>K.requirement.label.toLowerCase().includes(x)||(K.chosen?.description??"").toLowerCase().includes(x)||(K.chosen?.product_id??"").toLowerCase().includes(x)):m;return u?[...j].sort((K,ue)=>{let ke=K.requirement.label.localeCompare(ue.requirement.label);return u==="asc"?ke:-ke}):j},[m,v,u]),Ut=Bt.filter(x=>x.chosen),Xe=Bt.filter(x=>!x.chosen),ve=m.filter(x=>x.chosen),we=ve.filter(x=>x.chosen?.price==null).length,Ye=ve.reduce((x,j)=>x+(It(Re(j),rm).lineTotal??0),0);if((0,Le.useEffect)(()=>{i?.(Ye)},[Ye,i]),!a||c===!1)return null;let z=n?ve.filter(x=>n.cart[me(x.requirement.key)]).length:0,H=Ve?m.find(x=>x.requirement.key===Ve)??null:null,ce=be.trim()?Je:H?.candidates??[],fe=x=>{let j=R===x.requirement.key;T(j?null:x.requirement.key),A(j?"":x.requirement.query)},Me=(x,j)=>{let K=m.find(ue=>ue.requirement.key===x);b(ue=>ue.map(ke=>ke.requirement.key===x?{...ke,chosen:j}:ke)),n&&K&&n.cart[me(x)]&&n.addToCart(Re({...K,chosen:j})),T(null),A("")},Ze=x=>{b(j=>j.map(K=>K.requirement.key===x?{...K,chosen:null}:K)),n?.cart[me(x)]&&n.removeFromCart(me(x))},d=x=>{qe(x.requirement.key),le(""),Ne([])},M=()=>{qe(null),le(""),Ne([])},S=x=>{if(!n)return;let j=me(x.requirement.key);n.cart[j]?n.removeFromCart(j):n.addToCart(Re(x))},$=x=>{He(j=>{let K=new Set(j);return K.has(x)?K.delete(x):K.add(x),K})},Z=x=>{let j=B.length>0?B:x.candidates;return(0,C.jsxs)("div",{className:"estimator-products__picker",children:[(0,C.jsx)("input",{type:"text",className:"results-search-input",value:U,autoFocus:!0,placeholder:"Search products in catalogue...",onChange:K=>A(K.target.value),"aria-label":`Search a product for ${x.requirement.label}`}),(0,C.jsxs)("div",{className:"estimator-products__options",children:[j.map(K=>(0,C.jsxs)("button",{type:"button",className:`estimator-products__option${K.product_id===x.chosen?.product_id?" is-selected":""}`,onClick:()=>Me(x.requirement.key,K),children:[(0,C.jsx)("span",{children:K.description}),(0,C.jsxs)("span",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${lt(K.price)}`]})]},K.product_id)),j.length===0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No matching products."})]})]})};return(0,C.jsxs)("section",{className:"estimator-products results-tile-section","aria-label":"Matched products",children:[!f&&(0,C.jsxs)("div",{className:"estimator-products__head",children:[(0,C.jsxs)("div",{className:"results-tile-section__head",children:[(0,C.jsx)("h3",{children:"Matched Products"}),(0,C.jsx)("p",{children:"Products matched to your estimate, check before adding to your basket."})]}),!H&&(0,C.jsx)("div",{className:"results-summary estimator-products__toolbar",children:(0,C.jsxs)("div",{className:"estimator-products__controls",children:[(0,C.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search description...",value:v,onChange:x=>N(x.target.value),"aria-label":"Search matched products"}),(0,C.jsxs)("div",{className:"results-view-toggle","aria-label":"Results view",children:[(0,C.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="tile"?" is-active":""}`,"aria-pressed":D==="tile","aria-label":"Tile view",title:"Tile view",onClick:()=>h("tile"),children:(0,C.jsxs)("svg",{width:"18",height:"12",viewBox:"0 0 15 10",fill:"currentColor",children:[(0,C.jsx)("rect",{x:"0.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"5.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"10.5",y:"0.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"0.5",y:"5.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"5.5",y:"5.5",width:"4",height:"4"}),(0,C.jsx)("rect",{x:"10.5",y:"5.5",width:"4",height:"4"})]})}),(0,C.jsx)("button",{type:"button",className:`results-view-toggle__btn${D==="list"?" is-active":""}`,"aria-pressed":D==="list","aria-label":"List view",title:"List view",onClick:()=>h("list"),children:(0,C.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[(0,C.jsx)("line",{x1:"0.5",y1:"2.5",x2:"14.5",y2:"2.5"}),(0,C.jsx)("line",{x1:"0.5",y1:"7.5",x2:"14.5",y2:"7.5"}),(0,C.jsx)("line",{x1:"0.5",y1:"12.5",x2:"14.5",y2:"12.5"})]})})]}),(0,C.jsxs)("details",{ref:St,style:{position:"relative"},children:[(0,C.jsx)("summary",{className:"bom-toolbar-btn sort-menu-summary","aria-label":"Sort materials",style:{fontSize:16},children:"\u21C5"}),(0,C.jsx)("div",{className:"sort-menu-panel",children:Nx.map(x=>{let j=u===x.dir;return(0,C.jsxs)("button",{type:"button",className:`sort-menu-item${j?" is-active":""}`,onClick:()=>{g(j?null:x.dir),St.current?.removeAttribute("open")},children:[(0,C.jsx)("span",{className:"sort-menu-item__check",children:j?"\u2713":""}),x.label]},x.dir)})})]})]})})]}),H&&(0,C.jsxs)("div",{className:"results-review-page",children:[(0,C.jsxs)("div",{className:"results-review-page__top",children:[(0,C.jsxs)("button",{type:"button",className:"bom-toolbar-btn bom-toolbar-btn--accent",onClick:M,children:[(0,C.jsx)(Vr,{}),"Back to results"]}),(0,C.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,C.jsx)("div",{className:"results-review-searchbar",children:(0,C.jsx)("input",{type:"text",className:"results-search-input",placeholder:"Search products in catalogue...",value:be,onChange:x=>le(x.target.value),"aria-label":`Search a product for ${H.requirement.label}`})}),H.chosen&&(0,C.jsx)("div",{className:"results-candidate-actions",children:(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>Ze(H.requirement.key),children:"Clear selected product"})})]})]}),(0,C.jsxs)("div",{className:"results-review-page__hero",children:[(0,C.jsx)("div",{className:"results-review-page__image-wrap",children:(0,C.jsx)("img",{className:"fill-img results-review-page__image",src:Ga(H.chosen?.description||H.requirement.label,H.chosen?.product_id,H.chosen?.pdp_photo_url),alt:""})}),(0,C.jsxs)("div",{className:"results-review-page__summary",children:[(0,C.jsx)("h2",{children:H.requirement.label}),(0,C.jsxs)("p",{className:"results-review-page__meta",children:[wi(H.requirement.qty)," ",ka(H.requirement.unit,H.requirement.qty)]}),H.chosen?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"results-review-page__product",children:H.chosen.description}),(0,C.jsxs)("div",{className:"results-row-meta",children:[H.chosen.product_id,H.chosen.price!=null?` \xB7 ${xc(H.chosen.price,H.chosen.price_basis)}`:""]})]}):(0,C.jsx)("div",{className:"results-empty-hint",children:"No product currently selected for this line."}),(0,C.jsx)("div",{className:"results-review-page__actions",children:(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${n?.cart[me(H.requirement.key)]?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(H),disabled:!H.chosen||!n,children:n?.cart[me(H.requirement.key)]?"\u2713 Added":"+ Add to basket"})})]})]}),ce.length===0?(0,C.jsx)("p",{className:"results-empty-hint",children:"No matching products."}):(0,C.jsxs)("table",{className:"score-breakdown-table",children:[(0,C.jsx)("thead",{children:(0,C.jsxs)("tr",{children:[(0,C.jsx)("th",{children:"Product"}),(0,C.jsx)("th",{children:"Dims (mm)"}),(0,C.jsx)("th",{children:"Price"}),(0,C.jsx)("th",{"aria-label":"Actions"})]})}),(0,C.jsx)("tbody",{children:ce.map(x=>{let j=x.product_id===H.chosen?.product_id;return(0,C.jsxs)("tr",{className:j?"score-breakdown-row--best":"",children:[(0,C.jsxs)("td",{children:[(0,C.jsx)("div",{children:x.description}),(0,C.jsx)("div",{className:"results-row-meta",children:x.product_id})]}),(0,C.jsx)("td",{children:(0,C.jsx)("span",{className:"unit-badge",children:qx(x.measurements_mm)})}),(0,C.jsx)("td",{children:x.price!=null?xc(x.price,x.price_basis):"-"}),(0,C.jsx)("td",{children:(0,C.jsxs)("label",{className:"switch-toggle",title:j?"Currently selected":"Use this candidate",children:[(0,C.jsx)("input",{type:"checkbox",checked:j,onChange:()=>{j?Ze(H.requirement.key):Me(H.requirement.key,x)},"aria-label":j?`${x.description} selected`:`Use ${x.description}`}),(0,C.jsx)("span",{className:"switch-toggle-track","aria-hidden":"true"})]})})]},x.product_id)})})]})]}),!H&&f&&(0,C.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{padding:"32px 24px"},children:[(0,C.jsx)(gi,{}),(0,C.jsx)("p",{className:"banter-message is-visible",style:{fontSize:15,minHeight:0},children:"Matching your materials against the catalogue\u2026"})]}),!H&&_&&(0,C.jsx)("p",{className:"results-empty-hint estimator-products__error",children:_}),!H&&!f&&!_&&Bt.length===0&&m.length>0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No materials match the current search."}),!H&&!f&&!_&&D==="tile"&&Ut.length>0&&(0,C.jsx)("div",{className:"results-tile-grid",children:Ut.map(x=>{let{requirement:j,chosen:K}=x,ue=K?It(Re(x),rm):null,ke=n?!!n.cart[me(j.key)]:!1;return(0,C.jsxs)("article",{className:"results-tile-card",children:[(0,C.jsxs)("button",{type:"button",className:"results-tile-card__surface",onClick:()=>d(x),"aria-label":`Review match for ${j.label}`,children:[(0,C.jsx)("div",{className:"results-tile-card__media",children:(0,C.jsx)("img",{className:"fill-img results-tile-card__image",src:Ga(K?.description||j.label,K?.product_id,K?.pdp_photo_url),alt:""})}),(0,C.jsxs)("div",{className:"results-tile-card__body",children:[K?(0,C.jsxs)("div",{className:"results-tile-card__heading",children:[(0,C.jsx)("div",{className:"results-tile-card__title",children:K.description}),(0,C.jsxs)("div",{className:"results-tile-card__match-meta",children:[(0,C.jsx)("span",{children:K.product_id}),K.price!=null?(0,C.jsx)("span",{children:xc(K.price,K.price_basis)}):null]})]}):(0,C.jsx)("div",{className:"results-empty-hint",children:"No product matched for this line."}),(0,C.jsxs)("div",{className:"results-tile-card__match",children:[(0,C.jsx)("div",{className:"results-tile-card__match-label",children:"\u21B3 calculated as"}),(0,C.jsx)("div",{className:"results-tile-card__match-name",children:j.label}),(0,C.jsxs)("div",{className:"results-tile-card__meta",children:[wi(j.qty)," ",ka(j.unit,j.qty)]}),ue?.requiredSellUnits!=null?(0,C.jsxs)("div",{className:"results-tile-card__meta estimator-products__order",children:["Order ",ue.requiredSellUnits," ",ue.sellUnit,ue.lineTotal!=null?` \xB7 ${lt(ue.lineTotal)}`:""]}):K?(0,C.jsx)("div",{className:"results-row-meta",children:"Quantity needs review"}):null]})]})]}),(0,C.jsxs)("div",{className:"results-tile-card__actions",children:[(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>d(x),children:"Review"}),(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(x),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})]})]},j.key)})}),!H&&!f&&!_&&D==="list"&&Ut.length>0&&(0,C.jsx)("div",{className:"bom-table-wrap",children:(0,C.jsxs)("table",{className:"bom-table results-table","aria-label":"Matched materials",children:[(0,C.jsxs)("colgroup",{children:[(0,C.jsx)("col",{style:{width:"56px"}}),(0,C.jsx)("col",{className:"col-item"}),(0,C.jsx)("col",{style:{width:"90px"}}),(0,C.jsx)("col",{style:{width:"80px"}}),(0,C.jsx)("col",{style:{width:"220px"}}),(0,C.jsx)("col",{style:{width:"110px"}})]}),(0,C.jsx)("thead",{children:(0,C.jsxs)("tr",{className:"bom-col-header",children:[(0,C.jsx)("th",{"aria-label":"Expand"}),(0,C.jsx)("th",{style:{textAlign:"left"},children:"Description"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Qty"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Unit"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Product Matched"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Basket"})]})}),(0,C.jsx)("tbody",{children:Ut.map(x=>{let{requirement:j,chosen:K}=x,ue=K?It(Re(x),rm):null,ke=n?!!n.cart[me(j.key)]:!1,wt=ze.has(j.key);return(0,C.jsxs)(Le.Fragment,{children:[(0,C.jsxs)("tr",{className:"bom-row",children:[(0,C.jsx)("td",{className:"bom-actions",style:{textAlign:"center",paddingLeft:0,paddingRight:0},children:(0,C.jsx)("button",{type:"button",className:"link-btn",onClick:()=>$(j.key),"aria-expanded":wt,"aria-label":wt?"Collapse product options":"Expand product options",children:wt?"\u25BE":"\u25B8"})}),(0,C.jsxs)("td",{style:{paddingLeft:0},children:[(0,C.jsx)("div",{className:"bom-component-name",children:j.label}),ue?.requiredSellUnits!=null&&(0,C.jsxs)("div",{className:"results-row-meta",children:["Order ",ue.requiredSellUnits," ",ue.sellUnit,ue.lineTotal!=null?` \xB7 ${lt(ue.lineTotal)}`:""]})]}),(0,C.jsx)("td",{className:"bom-qty col-order",style:{textAlign:"center"},children:wi(j.qty)}),(0,C.jsx)("td",{style:{textAlign:"center"},children:ka(j.unit,j.qty)}),(0,C.jsx)("td",{style:{textAlign:"center"},children:K?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"bom-component-name",children:K.description}),(0,C.jsxs)("div",{className:"results-row-meta",children:[K.product_id,K.price!=null&&` \xB7 ${xc(K.price,K.price_basis)}`]})]}):(0,C.jsx)("span",{className:"results-empty-hint",children:"No match"})}),(0,C.jsx)("td",{style:{textAlign:"center"},children:(0,C.jsx)("button",{type:"button",className:`bom-toolbar-btn${ke?" bom-toolbar-btn--added":" bom-toolbar-btn--accent"}`,onClick:()=>S(x),disabled:!K||!n,children:ke?"\u2713 Added":"+ Add"})})]}),wt&&(0,C.jsx)("tr",{children:(0,C.jsx)("td",{colSpan:6,style:{paddingLeft:0,paddingRight:0},children:R===j.key?Z(x):(0,C.jsxs)("div",{className:"estimator-products__picker",children:[(0,C.jsxs)("div",{className:"estimator-products__options",children:[x.candidates.map(rt=>(0,C.jsxs)("button",{type:"button",className:`estimator-products__option${rt.product_id===K?.product_id?" is-selected":""}`,onClick:()=>Me(j.key,rt),children:[(0,C.jsx)("span",{children:rt.description}),(0,C.jsxs)("span",{className:"results-row-meta",children:[rt.product_id,rt.price!=null&&` \xB7 ${lt(rt.price)}`]})]},rt.product_id)),x.candidates.length===0&&(0,C.jsx)("p",{className:"results-empty-hint",children:"No candidates found."})]}),(0,C.jsx)("button",{type:"button",className:"bom-toolbar-btn",onClick:()=>fe(x),children:"Search the catalogue"})]})})})]},j.key)})})]})}),!H&&!f&&!_&&Xe.length>0&&(0,C.jsxs)("section",{className:"results-tile-section results-tile-section--unmatched","aria-label":"Items requiring matching",children:[(0,C.jsxs)("div",{className:"results-tile-section__head",children:[(0,C.jsx)("h3",{children:"Require Matching"}),(0,C.jsx)("p",{children:"We couldn\u2019t confidently match these to a product. Open one to pick from the closest options."})]}),(0,C.jsx)("div",{className:"results-unmatched-list",children:Xe.map(x=>(0,C.jsxs)("button",{type:"button",className:"results-unmatched-card",onClick:()=>d(x),children:[(0,C.jsxs)("span",{className:"results-unmatched-card__main",children:[(0,C.jsx)("span",{className:"results-unmatched-card__title",children:x.requirement.label}),(0,C.jsxs)("span",{className:"results-row-meta",children:[wi(x.requirement.qty)," ",ka(x.requirement.unit,x.requirement.qty)]})]}),(0,C.jsx)("span",{className:"bom-toolbar-btn results-unmatched-card__prompt",children:"Review"})]},x.requirement.key))})]}),!f&&!_&&m.length>0&&(0,C.jsxs)("div",{className:"disclaimer-box",style:{alignItems:"center"},children:[(0,C.jsx)("span",{className:"disclaimer-icon",children:"\u26A0\uFE0F"}),(0,C.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."})]}),!H&&!f&&!_&&(r||z>0)&&(0,C.jsxs)("div",{className:"btn-row estimator-products__footer",children:[r&&(0,C.jsx)("button",{type:"button",className:"cta-btn cta-btn-secondary",style:{flex:"0 1 30%",justifyContent:"center",marginTop:0},onClick:r,children:"Back"}),z>0&&n&&(0,C.jsxs)("button",{type:"button",className:"cta-btn",style:{flex:r?"0 1 70%":1,marginTop:0},onClick:n.openBasket,children:[(0,C.jsxs)("span",{children:["View Basket (",z,")"]}),(0,C.jsx)("span",{className:"arrow",children:(0,C.jsx)(Qt,{})})]})]})]})}var Gt=Y(ee());function nm({toolId:e,toolTitle:t,requirements:a,onBack:r}){let[i,n]=(0,kc.useState)(0),o=(0,kc.useCallback)(l=>n(l),[]);return(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsxs)("div",{className:"truss-estimator",children:[(0,Gt.jsxs)("div",{className:"quick-order-hero",children:[(0,Gt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Gt.jsxs)("div",{className:"quick-order-hero-title-row",children:[(0,Gt.jsx)("h1",{children:"Your Materials"}),i>0&&(0,Gt.jsxs)("span",{className:"summary-chip summary-chip--scope",children:[(0,Gt.jsx)("strong",{children:lt(i)})," Est. total"]})]}),(0,Gt.jsxs)("p",{children:["Quantities from the ",t,", matched against your merchant\u2019s catalogue."]})]}),(0,Gt.jsx)("div",{className:"truss-estimator__card",style:{minHeight:0},children:(0,Gt.jsx)(im,{toolId:e,requirements:a,ready:!0,onBack:r,onTotalChange:o})})]})})}var om=Y(je());var Wt=Y(ee()),Ex=1500;function t0(e){let{addManyToCart:t,clearCart:a,openBasket:r}=On(),[i,n]=(0,om.useState)(!1),[o,l]=(0,om.useState)(null);return{adding:i,basketError:o,addToBasket:async(p,m)=>{let b=Date.now();n(!0),l(null);try{let f=await Promise.all(p.filter(_=>_.qty>0).map(async _=>{let E=(await Ci(_.search)).find(D=>D.product_id===_.productId);if(!E)throw new Error("A selected product is no longer available in this catalogue.");return zn(E,{lineId:`${e}:${_.key}`,description:E.description,unit:ml(_.unit??"each",E),qty:_.qty,calculatorWasteIncluded:m})})),w=Ex-(Date.now()-b);w>0&&await new Promise(_=>window.setTimeout(_,w)),a(),t(f),r()}catch(f){l(f instanceof Error?f.message:"Could not add the products to your basket.")}finally{n(!1)}}}}function a0({toolTitle:e}){return(0,Wt.jsx)(Wt.Fragment,{children:(0,Wt.jsxs)("div",{className:"truss-estimator",children:[(0,Wt.jsxs)("div",{className:"quick-order-hero",children:[(0,Wt.jsx)("div",{className:"quick-order-eyebrow",children:"Estimating Tools"}),(0,Wt.jsx)("h1",{children:"Your Materials"}),(0,Wt.jsxs)("p",{children:["Calculating quantities from the ",e,"."]})]}),(0,Wt.jsx)("div",{className:"truss-estimator__card",children:(0,Wt.jsxs)("div",{className:"processing-container processing-variant-banter",role:"status","aria-label":"Loading",style:{flex:1,justifyContent:"center"},children:[(0,Wt.jsx)(gi,{}),(0,Wt.jsx)("p",{className:"banter-message is-visible",children:"Preparing your materials\u2026"})]})})]})})}var Te=Y(ee());function Sc(e){let[t,a]=(0,$a.useState)(!1);return(0,Te.jsx)(lc,{onOpenBasket:()=>a(!0),children:(0,Te.jsx)(Mx,{...e,showBasket:t,onShowBasket:a})})}function Mx({fullPage:e=!1,hideHeader:t=!1,internal:a=!1,showBasket:r,onShowBasket:i}){let[n,o]=(0,$a.useState)(null),[l,c]=(0,$a.useState)(null),p=am.find(U=>U.id===n),{cart:m,updateCartQty:b,updateCartSellUnits:f,updateCartConversions:w,removeFromCart:_,clearCart:E}=On(),{adding:D,basketError:h,addToBasket:u}=t0(p?.title??"calculator"),g=(0,$a.useRef)(null),v=Zs("estimating-tools",g);(0,$a.useEffect)(()=>{v("viewed")},[v]);let N=r?"basket":D?"adding":l?"review":n??"list",R=(0,$a.useRef)(N);(0,$a.useEffect)(()=>{R.current!==N&&(R.current=N,window.scrollTo(0,0))},[N]);let T=U=>{if(!p)return;v("estimate_completed",{calculator:p.id,lines:U.length});let A=Tv(p.id,U);A?u(A,U[0]?.calculatorWasteIncluded??!1):c(U)};return(0,Te.jsx)(Fo.Provider,{value:v,children:(0,Te.jsx)("div",{ref:g,className:`app-wrapper${e?"":" app-wrapper--embedded"}${t?" app-wrapper--no-header":""}${a?"":" estimating-tools--customer"}`,style:Ot().theme,children:(0,Te.jsx)("main",{className:"main-content",children:r?(0,Te.jsx)(sl,{cart:m,onUpdateQty:b,onUpdateSellUnits:f,onResolveConversions:w,onRemove:_,onBack:()=>i(!1),onStartNewQuote:()=>{E(),o(null),c(null),i(!1)},internal:a}):D&&p?(0,Te.jsx)(a0,{toolTitle:p.title}):p?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("div",{hidden:l!==null,children:(0,Te.jsx)(p.Component,{onBack:()=>o(null),onReview:T})}),h&&(0,Te.jsx)("p",{className:"results-empty-hint estimator-products__error",children:h}),l!==null&&(0,Te.jsx)(nm,{toolId:p.id,toolTitle:p.title,requirements:l,onBack:()=>c(null)})]}):(0,Te.jsx)(Te.Fragment,{children:(0,Te.jsxs)("div",{className:"quick-order-card",children:[(0,Te.jsxs)("div",{className:"quick-order-hero",children:[(0,Te.jsx)("div",{className:"quick-order-eyebrow",children:"Construction Services"}),(0,Te.jsx)("h1",{children:"Estimating Tools"}),(0,Te.jsx)("p",{children:"Trade-specific calculators for trusses, fencing, decking, masonry and painting. Dial in your specs and get an instant material estimate."})]}),(0,Te.jsxs)("div",{className:"quick-order-alt",children:[(0,Te.jsx)("div",{className:"quick-order-alt-title",children:"Choose a Calculator"}),(0,Te.jsx)("div",{className:"estimator-tools-grid",children:am.map(U=>(0,Te.jsxs)("button",{type:"button",className:"estimator-tool-card",onClick:()=>{v("calculator_selected",{calculator:U.id}),o(U.id),c(null)},children:[(0,Te.jsx)("span",{className:"estimator-tool-card__image-wrap",children:(0,Te.jsx)("img",{className:"fill-img estimator-tool-card__image",src:Ft(U.imageUrl),alt:""})}),(0,Te.jsxs)("span",{className:"estimator-tool-card__content",children:[(0,Te.jsx)("span",{className:"estimator-tool-card__title",children:U.title}),(0,Te.jsx)("span",{className:"estimator-tool-card__desc",children:U.desc})]})]},U.id))})]})]})})})})})}var Nc=Y(ee());function lm({config:e,children:t}){return pw(e),(0,Nc.jsx)(Nc.Fragment,{children:t})}var sm=Y(ee()),Tx="https://api.metronlabs.ai",zx=["client","api-key","api-url","theme","hide-header","analytics"],Rx=["all","events-only","none"];function i0(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.63",this.id||(this.id=e),this.setAttribute("data-turbo-permanent",""),this.setAttribute("data-turbolinks-permanent",""),!this.root){let i=document.createElement("div"),n=document.createElement("style");n.textContent=`:host { display: block; }
|
|
6994
6994
|
:host > div { all: initial; display: block; }
|
|
6995
6995
|
${uw}`,this.shadowRoot.replaceChildren(n,i),this.root=(0,r0.createRoot)(i)}this.renderWidget()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||!this.root||(this.root.unmount(),this.root=null)})}attributeChangedCallback(){this.root&&this.renderWidget()}renderWidget(){let i=this.getAttribute("client")??void 0,n=this.getAttribute("api-key")??void 0;(!i||!n)&&console.error(`<${e}> needs client and api-key attributes.`);let o={apiBaseUrl:this.getAttribute("api-url")||Tx,client:i,apiKey:n,theme:Ux(e,this.getAttribute("theme")),analytics:Ax(this.getAttribute("analytics"))};this.root.render((0,sm.jsx)(lm,{config:o,children:(0,sm.jsx)(t,{hideHeader:this.hasAttribute("hide-header")})}))}},a.observedAttributes=zx,a))}function Ax(e){return Rx.find(t=>t===e)??"all"}function Ux(e,t){if(t)try{return JSON.parse(t)}catch{console.error(`<${e}> theme attribute isn't valid JSON; using the default colours.`);return}}i0("metron-labs-quick-quote",sc);i0("metron-labs-estimating-tools",Sc);
|
|
6996
6996
|
/*! Bundled license information:
|