function Zf(i,u){for(var s=0;sd[p]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))d(p);new MutationObserver(p=>{for(const h of p)if(h.type==="childList")for(const g of h.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&d(g)}).observe(document,{childList:!0,subtree:!0});function s(p){const h={};return p.integrity&&(h.integrity=p.integrity),p.referrerPolicy&&(h.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?h.credentials="include":p.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function d(p){if(p.ep)return;p.ep=!0;const h=s(p);fetch(p.href,h)}})();function qf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var hs={exports:{}},ll={},ms={exports:{}},ue={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var mc;function bf(){if(mc)return ue;mc=1;var i=Symbol.for("react.element"),u=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),g=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),N=Symbol.iterator;function M(y){return y===null||typeof y!="object"?null:(y=N&&y[N]||y["@@iterator"],typeof y=="function"?y:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,T={};function E(y,R,ee){this.props=y,this.context=R,this.refs=T,this.updater=ee||H}E.prototype.isReactComponent={},E.prototype.setState=function(y,R){if(typeof y!="object"&&typeof y!="function"&&y!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,y,R,"setState")},E.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function A(){}A.prototype=E.prototype;function $(y,R,ee){this.props=y,this.context=R,this.refs=T,this.updater=ee||H}var G=$.prototype=new A;G.constructor=$,K(G,E.prototype),G.isPureReactComponent=!0;var U=Array.isArray,ce=Object.prototype.hasOwnProperty,de={current:null},Ce={key:!0,ref:!0,__self:!0,__source:!0};function xe(y,R,ee){var re,le={},oe=null,ae=null;if(R!=null)for(re in R.ref!==void 0&&(ae=R.ref),R.key!==void 0&&(oe=""+R.key),R)ce.call(R,re)&&!Ce.hasOwnProperty(re)&&(le[re]=R[re]);var se=arguments.length-2;if(se===1)le.children=ee;else if(1>>1,R=W[y];if(0>>1;yp(le,F))oep(ae,le)?(W[y]=ae,W[oe]=F,y=oe):(W[y]=le,W[re]=F,y=re);else if(oep(ae,F))W[y]=ae,W[oe]=F,y=oe;else break e}}return X}function p(W,X){var F=W.sortIndex-X.sortIndex;return F!==0?F:W.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;i.unstable_now=function(){return h.now()}}else{var g=Date,j=g.now();i.unstable_now=function(){return g.now()-j}}var w=[],_=[],P=1,N=null,M=3,H=!1,K=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(W){for(var X=s(_);X!==null;){if(X.callback===null)d(_);else if(X.startTime<=W)d(_),X.sortIndex=X.expirationTime,u(w,X);else break;X=s(_)}}function U(W){if(T=!1,G(W),!K)if(s(w)!==null)K=!0,Oe(ce);else{var X=s(_);X!==null&&ve(U,X.startTime-W)}}function ce(W,X){K=!1,T&&(T=!1,A(xe),xe=-1),H=!0;var F=M;try{for(G(X),N=s(w);N!==null&&(!(N.expirationTime>X)||W&&!Ke());){var y=N.callback;if(typeof y=="function"){N.callback=null,M=N.priorityLevel;var R=y(N.expirationTime<=X);X=i.unstable_now(),typeof R=="function"?N.callback=R:N===s(w)&&d(w),G(X)}else d(w);N=s(w)}if(N!==null)var ee=!0;else{var re=s(_);re!==null&&ve(U,re.startTime-X),ee=!1}return ee}finally{N=null,M=F,H=!1}}var de=!1,Ce=null,xe=-1,Ze=5,Ie=-1;function Ke(){return!(i.unstable_now()-IeW||125y?(W.sortIndex=F,u(_,W),s(w)===null&&W===s(_)&&(T?(A(xe),xe=-1):T=!0,ve(U,F-y))):(W.sortIndex=R,u(w,W),K||H||(K=!0,Oe(ce))),W},i.unstable_shouldYield=Ke,i.unstable_wrapCallback=function(W){var X=M;return function(){var F=M;M=X;try{return W.apply(this,arguments)}finally{M=F}}}})(ys)),ys}var wc;function op(){return wc||(wc=1,gs.exports=lp()),gs.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var kc;function ip(){if(kc)return dt;kc=1;var i=Ps(),u=op();function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),w=Object.prototype.hasOwnProperty,_=/^[: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]*$/,P={},N={};function M(e){return w.call(N,e)?!0:w.call(P,e)?!1:_.test(e)?N[e]=!0:(P[e]=!0,!1)}function H(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function K(e,t,n,r){if(t===null||typeof t>"u"||H(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function T(e,t,n,r,l,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){E[e]=new T(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];E[t]=new T(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){E[e]=new T(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){E[e]=new T(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){E[e]=new T(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){E[e]=new T(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){E[e]=new T(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){E[e]=new T(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){E[e]=new T(e,5,!1,e.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(A,$);E[t]=new T(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(A,$);E[t]=new T(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(A,$);E[t]=new T(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){E[e]=new T(e,1,!1,e.toLowerCase(),null,!1,!1)}),E.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){E[e]=new T(e,1,!1,e.toLowerCase(),null,!0,!0)});function G(e,t,n,r){var l=E.hasOwnProperty(t)?E[t]:null;(l!==null?l.type!==0:r||!(2f||l[a]!==o[f]){var m=` `+l[a].replace(" at new "," at ");return e.displayName&&m.includes("")&&(m=m.replace("",e.displayName)),m}while(1<=a&&0<=f);break}}}finally{ee=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?R(e):""}function le(e){switch(e.tag){case 5:return R(e.type);case 16:return R("Lazy");case 13:return R("Suspense");case 19:return R("SuspenseList");case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ce:return"Fragment";case de:return"Portal";case Ze:return"Profiler";case xe:return"StrictMode";case Te:return"Suspense";case Be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ke:return(e.displayName||"Context")+".Consumer";case Ie:return(e._context.displayName||"Context")+".Provider";case Ee:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case qe:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Oe:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function ae(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===xe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function We(e){var t=fe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function At(e){e._valueTracker||(e._valueTracker=We(e))}function En(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $t(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}}function Vt(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _n(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=se(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function en(e,t){t=t.checked,t!=null&&G(e,"checked",t,!1)}function Ht(e,t){en(e,t);var n=se(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?tn(e,t.type,n):t.hasOwnProperty("defaultValue")&&tn(e,t.type,se(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nn(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function tn(e,t,n){(t!=="number"||$t(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _t=Array.isArray;function Dt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=pt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function we(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Tn=["Webkit","ms","Moz","O"];Object.keys(yt).forEach(function(e){Tn.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yt[t]=yt[e]})});function Vn(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yt.hasOwnProperty(e)&&yt[e]?(""+t).trim():t+"px"}function I(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Vn(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var te=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ie(e,t){if(t){if(te[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(s(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(s(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(t.style!=null&&typeof t.style!="object")throw Error(s(62))}}function De(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 xt=null;function kr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ro=null,Hn=null,Qn=null;function Ls(e){if(e=Vr(e)){if(typeof Ro!="function")throw Error(s(280));var t=e.stateNode;t&&(t=Ol(t),Ro(e.stateNode,e.type,t))}}function Os(e){Hn?Qn?Qn.push(e):Qn=[e]:Hn=e}function Ds(){if(Hn){var e=Hn,t=Qn;if(Qn=Hn=null,Ls(e),t)for(e=0;e>>=0,e===0?32:31-(fd(e)/pd|0)|0}var ml=64,vl=4194304;function Er(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var f=a&~l;f!==0?r=Er(f):(o&=a,o!==0&&(r=Er(o)))}else a=n&~l,a!==0?r=Er(a):o!==0&&(r=Er(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function _r(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nt(t),e[t]=n}function gd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Dr),aa=" ",ua=!1;function ca(e,t){switch(e){case"keyup":return Qd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function da(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jn=!1;function Yd(e,t){switch(e){case"compositionend":return da(t);case"keypress":return t.which!==32?null:(ua=!0,aa);case"textInput":return e=t.data,e===aa&&ua?null:e;default:return null}}function Jd(e,t){if(Jn)return e==="compositionend"||!Jo&&ca(e,t)?(e=na(),Sl=$o=sn=null,Jn=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ya(n)}}function wa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ka(){for(var e=window,t=$t();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$t(e.document)}return t}function Zo(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")}function rf(e){var t=ka(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&wa(n.ownerDocument.documentElement,n)){if(r!==null&&Zo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=xa(n,o);var a=xa(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Gn=null,qo=null,Fr=null,bo=!1;function Sa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bo||Gn==null||Gn!==$t(r)||(r=Gn,"selectionStart"in r&&Zo(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}),Fr&&Wr(Fr,r)||(Fr=r,r=Rl(qo,"onSelect"),0er||(e.current=di[er],di[er]=null,er--)}function ye(e,t){er++,di[er]=e.current,e.current=t}var dn={},be=cn(dn),it=cn(!1),Ln=dn;function tr(e,t){var n=e.type.contextTypes;if(!n)return dn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function st(e){return e=e.childContextTypes,e!=null}function Dl(){Se(it),Se(be)}function Wa(e,t,n){if(be.current!==dn)throw Error(s(168));ye(be,t),ye(it,n)}function Fa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(s(108,ae(e)||"Unknown",l));return F({},n,r)}function Ml(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dn,Ln=be.current,ye(be,e),ye(it,it.current),!0}function Ua(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=Fa(e,t,Ln),r.__reactInternalMemoizedMergedChildContext=e,Se(it),Se(be),ye(be,e)):Se(it),ye(it,n)}var Kt=null,Il=!1,fi=!1;function Ba(e){Kt===null?Kt=[e]:Kt.push(e)}function vf(e){Il=!0,Ba(e)}function fn(){if(!fi&&Kt!==null){fi=!0;var e=0,t=ge;try{var n=Kt;for(ge=1;e>=a,l-=a,Yt=1<<32-Nt(t)+l|n<b?(Qe=q,q=null):Qe=q.sibling;var he=z(x,q,k[b],D);if(he===null){q===null&&(q=Qe);break}e&&q&&he.alternate===null&&t(x,q),v=o(he,v,b),Z===null?J=he:Z.sibling=he,Z=he,q=Qe}if(b===k.length)return n(x,q),je&&Dn(x,b),J;if(q===null){for(;bb?(Qe=q,q=null):Qe=q.sibling;var kn=z(x,q,he.value,D);if(kn===null){q===null&&(q=Qe);break}e&&q&&kn.alternate===null&&t(x,q),v=o(kn,v,b),Z===null?J=kn:Z.sibling=kn,Z=kn,q=Qe}if(he.done)return n(x,q),je&&Dn(x,b),J;if(q===null){for(;!he.done;b++,he=k.next())he=O(x,he.value,D),he!==null&&(v=o(he,v,b),Z===null?J=he:Z.sibling=he,Z=he);return je&&Dn(x,b),J}for(q=r(x,q);!he.done;b++,he=k.next())he=B(q,x,b,he.value,D),he!==null&&(e&&he.alternate!==null&&q.delete(he.key===null?b:he.key),v=o(he,v,b),Z===null?J=he:Z.sibling=he,Z=he);return e&&q.forEach(function(Xf){return t(x,Xf)}),je&&Dn(x,b),J}function Le(x,v,k,D){if(typeof k=="object"&&k!==null&&k.type===Ce&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case ce:e:{for(var J=k.key,Z=v;Z!==null;){if(Z.key===J){if(J=k.type,J===Ce){if(Z.tag===7){n(x,Z.sibling),v=l(Z,k.props.children),v.return=x,x=v;break e}}else if(Z.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===Oe&&Ka(J)===Z.type){n(x,Z.sibling),v=l(Z,k.props),v.ref=Hr(x,Z,k),v.return=x,x=v;break e}n(x,Z);break}else t(x,Z);Z=Z.sibling}k.type===Ce?(v=$n(k.props.children,x.mode,D,k.key),v.return=x,x=v):(D=co(k.type,k.key,k.props,null,x.mode,D),D.ref=Hr(x,v,k),D.return=x,x=D)}return a(x);case de:e:{for(Z=k.key;v!==null;){if(v.key===Z)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(x,v.sibling),v=l(v,k.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=us(k,x.mode,D),v.return=x,x=v}return a(x);case Oe:return Z=k._init,Le(x,v,Z(k._payload),D)}if(_t(k))return Q(x,v,k,D);if(X(k))return Y(x,v,k,D);Bl(x,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(x,v.sibling),v=l(v,k),v.return=x,x=v):(n(x,v),v=as(k,x.mode,D),v.return=x,x=v),a(x)):n(x,v)}return Le}var or=Ya(!0),Ja=Ya(!1),Al=cn(null),$l=null,ir=null,yi=null;function xi(){yi=ir=$l=null}function wi(e){var t=Al.current;Se(Al),e._currentValue=t}function ki(e,t,n){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===n)break;e=e.return}}function sr(e,t){$l=e,yi=ir=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(at=!0),e.firstContext=null)}function St(e){var t=e._currentValue;if(yi!==e)if(e={context:e,memoizedValue:t,next:null},ir===null){if($l===null)throw Error(s(308));ir=e,$l.dependencies={lanes:0,firstContext:e}}else ir=ir.next=e;return t}var Mn=null;function Si(e){Mn===null?Mn=[e]:Mn.push(e)}function Ga(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Si(t)):(n.next=l.next,l.next=n),t.interleaved=n,Gt(e,r)}function Gt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var pn=!1;function ji(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Gt(e,n)}return l=r.interleaved,l===null?(t.next=t,Si(r)):(t.next=l.next,l.next=t),r.interleaved=t,Gt(e,n)}function Vl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wo(e,n)}}function Za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Hl(e,t,n,r){var l=e.updateQueue;pn=!1;var o=l.firstBaseUpdate,a=l.lastBaseUpdate,f=l.shared.pending;if(f!==null){l.shared.pending=null;var m=f,C=m.next;m.next=null,a===null?o=C:a.next=C,a=m;var L=e.alternate;L!==null&&(L=L.updateQueue,f=L.lastBaseUpdate,f!==a&&(f===null?L.firstBaseUpdate=C:f.next=C,L.lastBaseUpdate=m))}if(o!==null){var O=l.baseState;a=0,L=C=m=null,f=o;do{var z=f.lane,B=f.eventTime;if((r&z)===z){L!==null&&(L=L.next={eventTime:B,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var Q=e,Y=f;switch(z=t,B=n,Y.tag){case 1:if(Q=Y.payload,typeof Q=="function"){O=Q.call(B,O,z);break e}O=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=Y.payload,z=typeof Q=="function"?Q.call(B,O,z):Q,z==null)break e;O=F({},O,z);break e;case 2:pn=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,z=l.effects,z===null?l.effects=[f]:z.push(f))}else B={eventTime:B,lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},L===null?(C=L=B,m=O):L=L.next=B,a|=z;if(f=f.next,f===null){if(f=l.shared.pending,f===null)break;z=f,f=z.next,z.next=null,l.lastBaseUpdate=z,l.shared.pending=null}}while(!0);if(L===null&&(m=O),l.baseState=m,l.firstBaseUpdate=C,l.lastBaseUpdate=L,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Fn|=a,e.lanes=a,e.memoizedState=O}}function qa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Pi.transition;Pi.transition={};try{e(!1),t()}finally{ge=n,Pi.transition=r}}function gu(){return jt().memoizedState}function wf(e,t,n){var r=yn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},yu(e))xu(t,n);else if(n=Ga(e,t,n,r),n!==null){var l=ot();Ot(n,e,r,l),wu(n,t,r)}}function kf(e,t,n){var r=yn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(yu(e))xu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,f=o(a,n);if(l.hasEagerState=!0,l.eagerState=f,Pt(f,a)){var m=t.interleaved;m===null?(l.next=l,Si(t)):(l.next=m.next,m.next=l),t.interleaved=l;return}}catch{}finally{}n=Ga(e,t,l,r),n!==null&&(l=ot(),Ot(n,e,r,l),wu(n,t,r))}}function yu(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function xu(e,t){Jr=Yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wo(e,n)}}var Xl={readContext:St,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},Sf={readContext:St,useCallback:function(e,t){return Ft().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:uu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Jl(4194308,4,fu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Jl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Jl(4,2,e,t)},useMemo:function(e,t){var n=Ft();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ft();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=wf.bind(null,Ne,e),[r.memoizedState,e]},useRef:function(e){var t=Ft();return e={current:e},t.memoizedState=e},useState:su,useDebugValue:Mi,useDeferredValue:function(e){return Ft().memoizedState=e},useTransition:function(){var e=su(!1),t=e[0];return e=xf.bind(null,e[1]),Ft().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ne,l=Ft();if(je){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),He===null)throw Error(s(349));(Wn&30)!==0||nu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,uu(lu.bind(null,r,o,e),[e]),r.flags|=2048,Zr(9,ru.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ft(),t=He.identifierPrefix;if(je){var n=Jt,r=Yt;n=(r&~(1<<32-Nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[It]=t,e[$r]=r,Bu(e,t,!1,!1),t.stateNode=e;e:{switch(a=De(n,r),n){case"dialog":ke("cancel",e),ke("close",e),l=r;break;case"iframe":case"object":case"embed":ke("load",e),l=r;break;case"video":case"audio":for(l=0;lfr&&(t.flags|=128,r=!0,qr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ql(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),qr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!je)return tt(t),null}else 2*ze()-o.renderingStartTime>fr&&n!==1073741824&&(t.flags|=128,r=!0,qr(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ze(),t.sibling=null,n=_e.current,ye(_e,r?n&1|2:n&1),t):(tt(t),null);case 22:case 23:return os(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(gt&1073741824)!==0&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),null;case 24:return null;case 25:return null}throw Error(s(156,t.tag))}function Rf(e,t){switch(hi(t),t.tag){case 1:return st(t.type)&&Dl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ar(),Se(it),Se(be),Ni(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ei(t),null;case 13:if(Se(_e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(_e),null;case 4:return ar(),null;case 10:return wi(t.type._context),null;case 22:case 23:return os(),null;case 24:return null;default:return null}}var eo=!1,nt=!1,zf=typeof WeakSet=="function"?WeakSet:Set,V=null;function cr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Re(e,t,r)}else n.current=null}function Yi(e,t,n){try{n()}catch(r){Re(e,t,r)}}var Vu=!1;function Lf(e,t){if(oi=wl,e=ka(),Zo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,f=-1,m=-1,C=0,L=0,O=e,z=null;t:for(;;){for(var B;O!==n||l!==0&&O.nodeType!==3||(f=a+l),O!==o||r!==0&&O.nodeType!==3||(m=a+r),O.nodeType===3&&(a+=O.nodeValue.length),(B=O.firstChild)!==null;)z=O,O=B;for(;;){if(O===e)break t;if(z===n&&++C===l&&(f=a),z===o&&++L===r&&(m=a),(B=O.nextSibling)!==null)break;O=z,z=O.parentNode}O=B}n=f===-1||m===-1?null:{start:f,end:m}}else n=null}n=n||{start:0,end:0}}else n=null;for(ii={focusedElem:e,selectionRange:n},wl=!1,V=t;V!==null;)if(t=V,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,V=e;else for(;V!==null;){t=V;try{var Q=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Q!==null){var Y=Q.memoizedProps,Le=Q.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Rt(t.type,Y),Le);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(D){Re(t,t.return,D)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return Q=Vu,Vu=!1,Q}function br(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Yi(t,n,o)}l=l.next}while(l!==r)}}function to(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ji(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Hu(e){var t=e.alternate;t!==null&&(e.alternate=null,Hu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[It],delete t[$r],delete t[ci],delete t[hf],delete t[mf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qu(e){return e.tag===5||e.tag===3||e.tag===4}function Ku(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qu(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.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 Gi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ll));else if(r!==4&&(e=e.child,e!==null))for(Gi(e,t,n),e=e.sibling;e!==null;)Gi(e,t,n),e=e.sibling}function Xi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Xi(e,t,n),e=e.sibling;e!==null;)Xi(e,t,n),e=e.sibling}var Ye=null,zt=!1;function mn(e,t,n){for(n=n.child;n!==null;)Yu(e,t,n),n=n.sibling}function Yu(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(hl,n)}catch{}switch(n.tag){case 5:nt||cr(n,t);case 6:var r=Ye,l=zt;Ye=null,mn(e,t,n),Ye=r,zt=l,Ye!==null&&(zt?(e=Ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ye.removeChild(n.stateNode));break;case 18:Ye!==null&&(zt?(e=Ye,n=n.stateNode,e.nodeType===8?ui(e.parentNode,n):e.nodeType===1&&ui(e,n),zr(e)):ui(Ye,n.stateNode));break;case 4:r=Ye,l=zt,Ye=n.stateNode.containerInfo,zt=!0,mn(e,t,n),Ye=r,zt=l;break;case 0:case 11:case 14:case 15:if(!nt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,a=o.destroy;o=o.tag,a!==void 0&&((o&2)!==0||(o&4)!==0)&&Yi(n,t,a),l=l.next}while(l!==r)}mn(e,t,n);break;case 1:if(!nt&&(cr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Re(n,t,f)}mn(e,t,n);break;case 21:mn(e,t,n);break;case 22:n.mode&1?(nt=(r=nt)||n.memoizedState!==null,mn(e,t,n),nt=r):mn(e,t,n);break;default:mn(e,t,n)}}function Ju(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new zf),t.forEach(function(r){var l=Af.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Lt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),r&=~o}if(r=l,r=ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Df(r/1960))-r,10e?16:e,gn===null)var r=!1;else{if(e=gn,gn=null,io=0,(pe&6)!==0)throw Error(s(331));var l=pe;for(pe|=4,V=e.current;V!==null;){var o=V,a=o.child;if((V.flags&16)!==0){var f=o.deletions;if(f!==null){for(var m=0;mze()-bi?Bn(e,0):qi|=n),ct(e,t)}function sc(e,t){t===0&&((e.mode&1)===0?t=1:(t=vl,vl<<=1,(vl&130023424)===0&&(vl=4194304)));var n=ot();e=Gt(e,t),e!==null&&(_r(e,t,n),ct(e,n))}function Bf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sc(e,n)}function Af(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(s(314))}r!==null&&r.delete(t),sc(e,n)}var ac;ac=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||it.current)at=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return at=!1,Pf(e,t,n);at=(e.flags&131072)!==0}else at=!1,je&&(t.flags&1048576)!==0&&Aa(t,Fl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bl(e,t),e=t.pendingProps;var l=tr(t,be.current);sr(t,n),l=Ri(null,t,r,e,l,n);var o=zi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,st(r)?(o=!0,Ml(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ji(t),l.updater=Zl,t.stateNode=l,l._reactInternals=t,Wi(t,r,e,n),t=Ai(null,t,r,!0,o,n)):(t.tag=0,je&&o&&pi(t),lt(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(bl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vf(r),e=Rt(r,e),l){case 0:t=Bi(null,t,r,e,n);break e;case 1:t=Du(null,t,r,e,n);break e;case 11:t=Tu(null,t,r,e,n);break e;case 14:t=Ru(null,t,r,Rt(r.type,e),n);break e}throw Error(s(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Rt(r,l),Bi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Rt(r,l),Du(e,t,r,l,n);case 3:e:{if(Mu(t),e===null)throw Error(s(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Xa(e,t),Hl(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=ur(Error(s(423)),t),t=Iu(e,t,r,n,l);break e}else if(r!==l){l=ur(Error(s(424)),t),t=Iu(e,t,r,n,l);break e}else for(vt=un(t.stateNode.containerInfo.firstChild),mt=t,je=!0,Tt=null,n=Ja(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===l){t=Zt(e,t,n);break e}lt(e,t,r,n)}t=t.child}return t;case 5:return ba(t),e===null&&vi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,si(r,l)?a=null:o!==null&&si(r,o)&&(t.flags|=32),Ou(e,t),lt(e,t,a,n),t.child;case 6:return e===null&&vi(t),null;case 13:return Wu(e,t,n);case 4:return Ci(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,n):lt(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Rt(r,l),Tu(e,t,r,l,n);case 7:return lt(e,t,t.pendingProps,n),t.child;case 8:return lt(e,t,t.pendingProps.children,n),t.child;case 12:return lt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,a=l.value,ye(Al,r._currentValue),r._currentValue=a,o!==null)if(Pt(o.value,a)){if(o.children===l.children&&!it.current){t=Zt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){a=o.child;for(var m=f.firstContext;m!==null;){if(m.context===r){if(o.tag===1){m=Xt(-1,n&-n),m.tag=2;var C=o.updateQueue;if(C!==null){C=C.shared;var L=C.pending;L===null?m.next=m:(m.next=L.next,L.next=m),C.pending=m}}o.lanes|=n,m=o.alternate,m!==null&&(m.lanes|=n),ki(o.return,n,t),f.lanes|=n;break}m=m.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(s(341));a.lanes|=n,f=a.alternate,f!==null&&(f.lanes|=n),ki(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}lt(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,sr(t,n),l=St(l),r=r(l),t.flags|=1,lt(e,t,r,n),t.child;case 14:return r=t.type,l=Rt(r,t.pendingProps),l=Rt(r.type,l),Ru(e,t,r,l,n);case 15:return zu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Rt(r,l),bl(e,t),t.tag=1,st(r)?(e=!0,Ml(t)):e=!1,sr(t,n),Su(t,r,l),Wi(t,r,l,n),Ai(null,t,r,!0,e,n);case 19:return Uu(e,t,n);case 22:return Lu(e,t,n)}throw Error(s(156,t.tag))};function uc(e,t){return $s(e,t)}function $f(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,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 Et(e,t,n,r){return new $f(e,t,n,r)}function ss(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vf(e){if(typeof e=="function")return ss(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ee)return 11;if(e===qe)return 14}return 2}function wn(e,t){var n=e.alternate;return n===null?(n=Et(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function co(e,t,n,r,l,o){var a=2;if(r=e,typeof e=="function")ss(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ce:return $n(n.children,l,o,t);case xe:a=8,l|=8;break;case Ze:return e=Et(12,n,t,l|2),e.elementType=Ze,e.lanes=o,e;case Te:return e=Et(13,n,t,l),e.elementType=Te,e.lanes=o,e;case Be:return e=Et(19,n,t,l),e.elementType=Be,e.lanes=o,e;case ve:return fo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ie:a=10;break e;case Ke:a=9;break e;case Ee:a=11;break e;case qe:a=14;break e;case Oe:a=16,r=null;break e}throw Error(s(130,e==null?e:typeof e,""))}return t=Et(a,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function $n(e,t,n,r){return e=Et(7,e,r,t),e.lanes=n,e}function fo(e,t,n,r){return e=Et(22,e,r,t),e.elementType=ve,e.lanes=n,e.stateNode={isHidden:!1},e}function as(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function us(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Hf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Io(0),this.expirationTimes=Io(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Io(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function cs(e,t,n,r,l,o,a,f,m){return e=new Hf(e,t,n,f,m),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Et(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ji(o),e}function Qf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(u){console.error(u)}}return i(),vs.exports=ip(),vs.exports}var jc;function sp(){if(jc)return xo;jc=1;var i=Bc();return xo.createRoot=i.createRoot,xo.hydrateRoot=i.hydrateRoot,xo}var ap=sp();Bc();/** * @remix-run/router v1.23.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function al(){return al=Object.assign?Object.assign.bind():function(i){for(var u=1;u"u")throw new Error(u)}function Ts(i,u){if(!i){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function cp(){return Math.random().toString(36).substr(2,8)}function Ec(i,u){return{usr:i.state,key:i.key,idx:u}}function js(i,u,s,d){return s===void 0&&(s=null),al({pathname:typeof i=="string"?i:i.pathname,search:"",hash:""},typeof u=="string"?yr(u):u,{state:s,key:u&&u.key||d||cp()})}function Co(i){let{pathname:u="/",search:s="",hash:d=""}=i;return s&&s!=="?"&&(u+=s.charAt(0)==="?"?s:"?"+s),d&&d!=="#"&&(u+=d.charAt(0)==="#"?d:"#"+d),u}function yr(i){let u={};if(i){let s=i.indexOf("#");s>=0&&(u.hash=i.substr(s),i=i.substr(0,s));let d=i.indexOf("?");d>=0&&(u.search=i.substr(d),i=i.substr(0,d)),i&&(u.pathname=i)}return u}function dp(i,u,s,d){d===void 0&&(d={});let{window:p=document.defaultView,v5Compat:h=!1}=d,g=p.history,j=Sn.Pop,w=null,_=P();_==null&&(_=0,g.replaceState(al({},g.state,{idx:_}),""));function P(){return(g.state||{idx:null}).idx}function N(){j=Sn.Pop;let E=P(),A=E==null?null:E-_;_=E,w&&w({action:j,location:T.location,delta:A})}function M(E,A){j=Sn.Push;let $=js(T.location,E,A);_=P()+1;let G=Ec($,_),U=T.createHref($);try{g.pushState(G,"",U)}catch(ce){if(ce instanceof DOMException&&ce.name==="DataCloneError")throw ce;p.location.assign(U)}h&&w&&w({action:j,location:T.location,delta:1})}function H(E,A){j=Sn.Replace;let $=js(T.location,E,A);_=P();let G=Ec($,_),U=T.createHref($);g.replaceState(G,"",U),h&&w&&w({action:j,location:T.location,delta:0})}function K(E){let A=p.location.origin!=="null"?p.location.origin:p.location.href,$=typeof E=="string"?E:Co(E);return $=$.replace(/ $/,"%20"),Pe(A,"No window.location.(origin|href) available to create URL for href: "+$),new URL($,A)}let T={get action(){return j},get location(){return i(p,g)},listen(E){if(w)throw new Error("A history only accepts one active listener");return p.addEventListener(Cc,N),w=E,()=>{p.removeEventListener(Cc,N),w=null}},createHref(E){return u(p,E)},createURL:K,encodeLocation(E){let A=K(E);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:M,replace:H,go(E){return g.go(E)}};return T}var _c;(function(i){i.data="data",i.deferred="deferred",i.redirect="redirect",i.error="error"})(_c||(_c={}));function fp(i,u,s){return s===void 0&&(s="/"),pp(i,u,s)}function pp(i,u,s,d){let p=typeof u=="string"?yr(u):u,h=vr(p.pathname||"/",s);if(h==null)return null;let g=Ac(i);hp(g);let j=null,w=Ep(h);for(let _=0;j==null&&_{let w={relativePath:j===void 0?h.path||"":j,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};w.relativePath.startsWith("/")&&(Pe(w.relativePath.startsWith(d),'Absolute route path "'+w.relativePath+'" nested under path '+('"'+d+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),w.relativePath=w.relativePath.slice(d.length));let _=jn([d,w.relativePath]),P=s.concat(w);h.children&&h.children.length>0&&(Pe(h.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+_+'".')),Ac(h.children,u,P,_)),!(h.path==null&&!h.index)&&u.push({path:_,score:kp(_,h.index),routesMeta:P})};return i.forEach((h,g)=>{var j;if(h.path===""||!((j=h.path)!=null&&j.includes("?")))p(h,g);else for(let w of $c(h.path))p(h,g,w)}),u}function $c(i){let u=i.split("/");if(u.length===0)return[];let[s,...d]=u,p=s.endsWith("?"),h=s.replace(/\?$/,"");if(d.length===0)return p?[h,""]:[h];let g=$c(d.join("/")),j=[];return j.push(...g.map(w=>w===""?h:[h,w].join("/"))),p&&j.push(...g),j.map(w=>i.startsWith("/")&&w===""?"/":w)}function hp(i){i.sort((u,s)=>u.score!==s.score?s.score-u.score:Sp(u.routesMeta.map(d=>d.childrenIndex),s.routesMeta.map(d=>d.childrenIndex)))}const mp=/^:[\w-]+$/,vp=3,gp=2,yp=1,xp=10,wp=-2,Nc=i=>i==="*";function kp(i,u){let s=i.split("/"),d=s.length;return s.some(Nc)&&(d+=wp),u&&(d+=gp),s.filter(p=>!Nc(p)).reduce((p,h)=>p+(mp.test(h)?vp:h===""?yp:xp),d)}function Sp(i,u){return i.length===u.length&&i.slice(0,-1).every((d,p)=>d===u[p])?i[i.length-1]-u[u.length-1]:0}function jp(i,u,s){let{routesMeta:d}=i,p={},h="/",g=[];for(let j=0;j{let{paramName:M,isOptional:H}=P;if(M==="*"){let T=j[N]||"";g=h.slice(0,h.length-T.length).replace(/(.)\/+$/,"$1")}const K=j[N];return H&&!K?_[M]=void 0:_[M]=(K||"").replace(/%2F/g,"/"),_},{}),pathname:h,pathnameBase:g,pattern:i}}function Cp(i,u,s){u===void 0&&(u=!1),s===void 0&&(s=!0),Ts(i==="*"||!i.endsWith("*")||i.endsWith("/*"),'Route path "'+i+'" will be treated as if it were '+('"'+i.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+i.replace(/\*$/,"/*")+'".'));let d=[],p="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(g,j,w)=>(d.push({paramName:j,isOptional:w!=null}),w?"/?([^\\/]+)?":"/([^\\/]+)"));return i.endsWith("*")?(d.push({paramName:"*"}),p+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?p+="\\/*$":i!==""&&i!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,u?void 0:"i"),d]}function Ep(i){try{return i.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return Ts(!1,'The URL path "'+i+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),i}}function vr(i,u){if(u==="/")return i;if(!i.toLowerCase().startsWith(u.toLowerCase()))return null;let s=u.endsWith("/")?u.length-1:u.length,d=i.charAt(s);return d&&d!=="/"?null:i.slice(s)||"/"}const _p=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Np=i=>_p.test(i);function Pp(i,u){u===void 0&&(u="/");let{pathname:s,search:d="",hash:p=""}=typeof i=="string"?yr(i):i,h;if(s)if(Np(s))h=s;else{if(s.includes("//")){let g=s;s=Vc(s),Ts(!1,"Pathnames cannot have embedded double slashes - normalizing "+(g+" -> "+s))}s.startsWith("/")?h=Pc(s.substring(1),"/"):h=Pc(s,u)}else h=u;return{pathname:h,search:zp(d),hash:Lp(p)}}function Pc(i,u){let s=u.replace(/\/+$/,"").split("/");return i.split("/").forEach(p=>{p===".."?s.length>1&&s.pop():p!=="."&&s.push(p)}),s.length>1?s.join("/"):"/"}function xs(i,u,s,d){return"Cannot include a '"+i+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(d)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Tp(i){return i.filter((u,s)=>s===0||u.route.path&&u.route.path.length>0)}function Rs(i,u){let s=Tp(i);return u?s.map((d,p)=>p===s.length-1?d.pathname:d.pathnameBase):s.map(d=>d.pathnameBase)}function zs(i,u,s,d){d===void 0&&(d=!1);let p;typeof i=="string"?p=yr(i):(p=al({},i),Pe(!p.pathname||!p.pathname.includes("?"),xs("?","pathname","search",p)),Pe(!p.pathname||!p.pathname.includes("#"),xs("#","pathname","hash",p)),Pe(!p.search||!p.search.includes("#"),xs("#","search","hash",p)));let h=i===""||p.pathname==="",g=h?"/":p.pathname,j;if(g==null)j=s;else{let N=u.length-1;if(!d&&g.startsWith("..")){let M=g.split("/");for(;M[0]==="..";)M.shift(),N-=1;p.pathname=M.join("/")}j=N>=0?u[N]:"/"}let w=Pp(p,j),_=g&&g!=="/"&&g.endsWith("/"),P=(h||g===".")&&s.endsWith("/");return!w.pathname.endsWith("/")&&(_||P)&&(w.pathname+="/"),w}const Vc=i=>i.replace(/\/\/+/g,"/"),jn=i=>Vc(i.join("/")),Rp=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),zp=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,Lp=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i;function Op(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}const Hc=["post","put","patch","delete"];new Set(Hc);const Dp=["get",...Hc];new Set(Dp);/** * React Router v6.30.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ul(){return ul=Object.assign?Object.assign.bind():function(i){for(var u=1;u{j.current=!0}),S.useCallback(function(_,P){if(P===void 0&&(P={}),!j.current)return;if(typeof _=="number"){d.go(_);return}let N=zs(_,JSON.parse(g),h,P.relative==="path");i==null&&u!=="/"&&(N.pathname=N.pathname==="/"?u:jn([u,N.pathname])),(P.replace?d.replace:d.push)(N,P.state,P)},[u,d,g,h,i])}function Po(i,u){let{relative:s}=u===void 0?{}:u,{future:d}=S.useContext(bt),{matches:p}=S.useContext(Cn),{pathname:h}=wr(),g=JSON.stringify(Rs(p,d.v7_relativeSplatPath));return S.useMemo(()=>zs(i,JSON.parse(g),h,s==="path"),[i,g,h,s])}function Wp(i,u){return Fp(i,u)}function Fp(i,u,s,d){xr()||Pe(!1);let{navigator:p}=S.useContext(bt),{matches:h}=S.useContext(Cn),g=h[h.length-1],j=g?g.params:{};g&&g.pathname;let w=g?g.pathnameBase:"/";g&&g.route;let _=wr(),P;if(u){var N;let E=typeof u=="string"?yr(u):u;w==="/"||(N=E.pathname)!=null&&N.startsWith(w)||Pe(!1),P=E}else P=_;let M=P.pathname||"/",H=M;if(w!=="/"){let E=w.replace(/^\//,"").split("/");H="/"+M.replace(/^\//,"").split("/").slice(E.length).join("/")}let K=fp(i,{pathname:H}),T=Vp(K&&K.map(E=>Object.assign({},E,{params:Object.assign({},j,E.params),pathname:jn([w,p.encodeLocation?p.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?w:jn([w,p.encodeLocation?p.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),h,s,d);return u&&T?S.createElement(No.Provider,{value:{location:ul({pathname:"/",search:"",hash:"",state:null,key:"default"},P),navigationType:Sn.Pop}},T):T}function Up(){let i=Yp(),u=Op(i)?i.status+" "+i.statusText:i instanceof Error?i.message:JSON.stringify(i),s=i instanceof Error?i.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},u),s?S.createElement("pre",{style:p},s):null,null)}const Bp=S.createElement(Up,null);class Ap extends S.Component{constructor(u){super(u),this.state={location:u.location,revalidation:u.revalidation,error:u.error}}static getDerivedStateFromError(u){return{error:u}}static getDerivedStateFromProps(u,s){return s.location!==u.location||s.revalidation!=="idle"&&u.revalidation==="idle"?{error:u.error,location:u.location,revalidation:u.revalidation}:{error:u.error!==void 0?u.error:s.error,location:s.location,revalidation:u.revalidation||s.revalidation}}componentDidCatch(u,s){console.error("React Router caught the following error during render",u,s)}render(){return this.state.error!==void 0?S.createElement(Cn.Provider,{value:this.props.routeContext},S.createElement(Kc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $p(i){let{routeContext:u,match:s,children:d}=i,p=S.useContext(_o);return p&&p.static&&p.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=s.route.id),S.createElement(Cn.Provider,{value:u},d)}function Vp(i,u,s,d){var p;if(u===void 0&&(u=[]),s===void 0&&(s=null),d===void 0&&(d=null),i==null){var h;if(!s)return null;if(s.errors)i=s.matches;else if((h=d)!=null&&h.v7_partialHydration&&u.length===0&&!s.initialized&&s.matches.length>0)i=s.matches;else return null}let g=i,j=(p=s)==null?void 0:p.errors;if(j!=null){let P=g.findIndex(N=>N.route.id&&(j==null?void 0:j[N.route.id])!==void 0);P>=0||Pe(!1),g=g.slice(0,Math.min(g.length,P+1))}let w=!1,_=-1;if(s&&d&&d.v7_partialHydration)for(let P=0;P=0?g=g.slice(0,_+1):g=[g[0]];break}}}return g.reduceRight((P,N,M)=>{let H,K=!1,T=null,E=null;s&&(H=j&&N.route.id?j[N.route.id]:void 0,T=N.route.errorElement||Bp,w&&(_<0&&M===0?(Gp("route-fallback"),K=!0,E=null):_===M&&(K=!0,E=N.route.hydrateFallbackElement||null)));let A=u.concat(g.slice(0,M+1)),$=()=>{let G;return H?G=T:K?G=E:N.route.Component?G=S.createElement(N.route.Component,null):N.route.element?G=N.route.element:G=P,S.createElement($p,{match:N,routeContext:{outlet:P,matches:A,isDataRoute:s!=null},children:G})};return s&&(N.route.ErrorBoundary||N.route.errorElement||M===0)?S.createElement(Ap,{location:s.location,revalidation:s.revalidation,component:T,error:H,children:$(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):$()},null)}var Gc=(function(i){return i.UseBlocker="useBlocker",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i})(Gc||{}),Xc=(function(i){return i.UseBlocker="useBlocker",i.UseLoaderData="useLoaderData",i.UseActionData="useActionData",i.UseRouteError="useRouteError",i.UseNavigation="useNavigation",i.UseRouteLoaderData="useRouteLoaderData",i.UseMatches="useMatches",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i.UseRouteId="useRouteId",i})(Xc||{});function Hp(i){let u=S.useContext(_o);return u||Pe(!1),u}function Qp(i){let u=S.useContext(Qc);return u||Pe(!1),u}function Kp(i){let u=S.useContext(Cn);return u||Pe(!1),u}function Zc(i){let u=Kp(),s=u.matches[u.matches.length-1];return s.route.id||Pe(!1),s.route.id}function Yp(){var i;let u=S.useContext(Kc),s=Qp(),d=Zc();return u!==void 0?u:(i=s.errors)==null?void 0:i[d]}function Jp(){let{router:i}=Hp(Gc.UseNavigateStable),u=Zc(Xc.UseNavigateStable),s=S.useRef(!1);return Yc(()=>{s.current=!0}),S.useCallback(function(p,h){h===void 0&&(h={}),s.current&&(typeof p=="number"?i.navigate(p):i.navigate(p,ul({fromRouteId:u},h)))},[i,u])}const Tc={};function Gp(i,u,s){Tc[i]||(Tc[i]=!0)}function Xp(i,u){i==null||i.v7_startTransition,i==null||i.v7_relativeSplatPath}function ws(i){let{to:u,replace:s,state:d,relative:p}=i;xr()||Pe(!1);let{future:h,static:g}=S.useContext(bt),{matches:j}=S.useContext(Cn),{pathname:w}=wr(),_=Jc(),P=zs(u,Rs(j,h.v7_relativeSplatPath),w,p==="path"),N=JSON.stringify(P);return S.useEffect(()=>_(JSON.parse(N),{replace:s,state:d,relative:p}),[_,N,p,s,d]),null}function il(i){Pe(!1)}function Zp(i){let{basename:u="/",children:s=null,location:d,navigationType:p=Sn.Pop,navigator:h,static:g=!1,future:j}=i;xr()&&Pe(!1);let w=u.replace(/^\/*/,"/"),_=S.useMemo(()=>({basename:w,navigator:h,static:g,future:ul({v7_relativeSplatPath:!1},j)}),[w,j,h,g]);typeof d=="string"&&(d=yr(d));let{pathname:P="/",search:N="",hash:M="",state:H=null,key:K="default"}=d,T=S.useMemo(()=>{let E=vr(P,w);return E==null?null:{location:{pathname:E,search:N,hash:M,state:H,key:K},navigationType:p}},[w,P,N,M,H,K,p]);return T==null?null:S.createElement(bt.Provider,{value:_},S.createElement(No.Provider,{children:s,value:T}))}function qp(i){let{children:u,location:s}=i;return Wp(Es(u),s)}new Promise(()=>{});function Es(i,u){u===void 0&&(u=[]);let s=[];return S.Children.forEach(i,(d,p)=>{if(!S.isValidElement(d))return;let h=[...u,p];if(d.type===S.Fragment){s.push.apply(s,Es(d.props.children,h));return}d.type!==il&&Pe(!1),!d.props.index||!d.props.children||Pe(!1);let g={id:d.props.id||h.join("-"),caseSensitive:d.props.caseSensitive,element:d.props.element,Component:d.props.Component,index:d.props.index,path:d.props.path,loader:d.props.loader,action:d.props.action,errorElement:d.props.errorElement,ErrorBoundary:d.props.ErrorBoundary,hasErrorBoundary:d.props.ErrorBoundary!=null||d.props.errorElement!=null,shouldRevalidate:d.props.shouldRevalidate,handle:d.props.handle,lazy:d.props.lazy};d.props.children&&(g.children=Es(d.props.children,h)),s.push(g)}),s}/** * React Router DOM v6.30.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Eo(){return Eo=Object.assign?Object.assign.bind():function(i){for(var u=1;u{_&&Rc?Rc(()=>w(N)):w(N)},[w,_]);return S.useLayoutEffect(()=>g.listen(P),[g,P]),S.useEffect(()=>Xp(d),[d]),S.createElement(Zp,{basename:u,children:s,location:j.location,navigationType:j.action,navigator:g,future:d})}const sh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ah=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uh=S.forwardRef(function(u,s){let{onClick:d,relative:p,reloadDocument:h,replace:g,state:j,target:w,to:_,preventScrollReset:P,viewTransition:N}=u,M=qc(u,th),{basename:H}=S.useContext(bt),K,T=!1;if(typeof _=="string"&&ah.test(_)&&(K=_,sh))try{let G=new URL(window.location.href),U=_.startsWith("//")?new URL(G.protocol+_):new URL(_),ce=vr(U.pathname,H);U.origin===G.origin&&ce!=null?_=ce+U.search+U.hash:T=!0}catch{}let E=Mp(_,{relative:p}),A=fh(_,{replace:g,state:j,target:w,preventScrollReset:P,relative:p,viewTransition:N});function $(G){d&&d(G),G.defaultPrevented||A(G)}return S.createElement("a",Eo({},M,{href:K||E,onClick:T||h?d:$,ref:s,target:w}))}),ch=S.forwardRef(function(u,s){let{"aria-current":d="page",caseSensitive:p=!1,className:h="",end:g=!1,style:j,to:w,viewTransition:_,children:P}=u,N=qc(u,nh),M=Po(w,{relative:N.relative}),H=wr(),K=S.useContext(Qc),{navigator:T,basename:E}=S.useContext(bt),A=K!=null&&ph(M)&&_===!0,$=T.encodeLocation?T.encodeLocation(M).pathname:M.pathname,G=H.pathname,U=K&&K.navigation&&K.navigation.location?K.navigation.location.pathname:null;p||(G=G.toLowerCase(),U=U?U.toLowerCase():null,$=$.toLowerCase()),U&&E&&(U=vr(U,E)||U);const ce=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let de=G===$||!g&&G.startsWith($)&&G.charAt(ce)==="/",Ce=U!=null&&(U===$||!g&&U.startsWith($)&&U.charAt($.length)==="/"),xe={isActive:de,isPending:Ce,isTransitioning:A},Ze=de?d:void 0,Ie;typeof h=="function"?Ie=h(xe):Ie=[h,de?"active":null,Ce?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let Ke=typeof j=="function"?j(xe):j;return S.createElement(uh,Eo({},N,{"aria-current":Ze,className:Ie,ref:s,style:Ke,to:w,viewTransition:_}),typeof P=="function"?P(xe):P)});var _s;(function(i){i.UseScrollRestoration="useScrollRestoration",i.UseSubmit="useSubmit",i.UseSubmitFetcher="useSubmitFetcher",i.UseFetcher="useFetcher",i.useViewTransitionState="useViewTransitionState"})(_s||(_s={}));var zc;(function(i){i.UseFetcher="useFetcher",i.UseFetchers="useFetchers",i.UseScrollRestoration="useScrollRestoration"})(zc||(zc={}));function dh(i){let u=S.useContext(_o);return u||Pe(!1),u}function fh(i,u){let{target:s,replace:d,state:p,preventScrollReset:h,relative:g,viewTransition:j}=u===void 0?{}:u,w=Jc(),_=wr(),P=Po(i,{relative:g});return S.useCallback(N=>{if(eh(N,s)){N.preventDefault();let M=d!==void 0?d:Co(_)===Co(P);w(i,{replace:M,state:p,preventScrollReset:h,relative:g,viewTransition:j})}},[_,w,P,d,p,s,i,h,g,j])}function ph(i,u){u===void 0&&(u={});let s=S.useContext(lh);s==null&&Pe(!1);let{basename:d}=dh(_s.useViewTransitionState),p=Po(i,{relative:u.relative});if(!s.isTransitioning)return!1;let h=vr(s.currentLocation.pathname,d)||s.currentLocation.pathname,g=vr(s.nextLocation.pathname,d)||s.nextLocation.pathname;return Cs(p.pathname,g)!=null||Cs(p.pathname,h)!=null}function hh(){if(window.matchMedia("(display-mode: standalone)").matches)return;const i=document.cookie.split(";").map(s=>s.trim()).find(s=>s.startsWith("hnf_inactivity_mins="));if(!i)return;const u=parseInt(i.split("=")[1]);return isNaN(u)||u<=0?void 0:u*60*1e3}const Lc={background:"var(--navy-dark)",border:"1px solid var(--surface-2)",borderRadius:"6px",color:"var(--text)",padding:"0.625rem 0.75rem",fontSize:"1rem",width:"100%",outline:"none"},mh={background:"var(--hk-green)",color:"#fff",border:"none",borderRadius:"6px",padding:"0.625rem",fontSize:"1rem",fontWeight:600,marginTop:"0.25rem",width:"100%"};function vh({children:i}){const[u,s]=S.useState("checking"),[d,p]=S.useState(null),[h,g]=S.useState(""),[j,w]=S.useState(""),[_,P]=S.useState(""),[N,M]=S.useState(!1),H=S.useRef(null);S.useEffect(()=>{fetch("/api/auth/verify?app=hk-planner",{credentials:"include"}).then(async T=>{T.ok?(p(await T.json()),s("authed")):s("login")}).catch(()=>s("login"))},[]),S.useEffect(()=>{const T=hh();if(u!=="authed"||!T)return;async function E(){await fetch("/api/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),p(null),s("login")}function A(){H.current&&clearTimeout(H.current),H.current=setTimeout(E,T)}const $=["mousemove","keydown","click","touchstart"];return $.forEach(G=>window.addEventListener(G,A,{passive:!0})),A(),()=>{H.current&&clearTimeout(H.current),$.forEach(G=>window.removeEventListener(G,A))}},[u]);async function K(T){T.preventDefault(),M(!0),P("");try{if(!(await fetch("/api/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:h,password:j})})).ok){P("Invalid email or password");return}const A=await fetch("/api/auth/verify?app=hk-planner",{credentials:"include"});A.ok?(p(await A.json()),s("authed")):P("You don't have access to this app.")}catch{P("Connection error — please try again")}finally{M(!1)}}return u==="checking"?c.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100dvh"},children:c.jsx("div",{style:{color:"var(--text-muted)"},children:"Loading…"})}):u==="login"?c.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100dvh",padding:"1.5rem",background:"var(--navy-dark)"},children:c.jsxs("div",{style:{background:"var(--navy)",borderRadius:"var(--radius)",padding:"2rem",width:"100%",maxWidth:"360px",border:"1px solid var(--surface-2)"},children:[c.jsx("h1",{style:{fontSize:"1.4rem",marginBottom:"0.25rem",color:"#74c69d"},children:"HK Planner"}),c.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.875rem",marginBottom:"1.5rem"},children:void 0}),c.jsxs("form",{onSubmit:K,style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[c.jsx("input",{type:"email",value:h,onChange:T=>g(T.target.value),placeholder:"Email",required:!0,autoComplete:"email",style:Lc}),c.jsx("input",{type:"password",value:j,onChange:T=>w(T.target.value),placeholder:"Password",required:!0,autoComplete:"current-password",style:Lc}),_&&c.jsx("p",{style:{color:"#f87171",fontSize:"0.875rem"},children:_}),c.jsx("button",{type:"submit",disabled:N,style:mh,children:N?"Signing in…":"Sign in"})]})]})}):c.jsx(c.Fragment,{children:i(d)})}/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bc=(...i)=>i.filter((u,s,d)=>!!u&&u.trim()!==""&&d.indexOf(u)===s).join(" ").trim();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gh=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yh=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,s,d)=>d?d.toUpperCase():s.toLowerCase());/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oc=i=>{const u=yh(i);return u.charAt(0).toUpperCase()+u.slice(1)};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var ks={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xh=i=>{for(const u in i)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1},wh=S.createContext({}),kh=()=>S.useContext(wh),Sh=S.forwardRef(({color:i,size:u,strokeWidth:s,absoluteStrokeWidth:d,className:p="",children:h,iconNode:g,...j},w)=>{const{size:_=24,strokeWidth:P=2,absoluteStrokeWidth:N=!1,color:M="currentColor",className:H=""}=kh()??{},K=d??N?Number(s??P)*24/Number(u??_):s??P;return S.createElement("svg",{ref:w,...ks,width:u??_??ks.width,height:u??_??ks.height,stroke:i??M,strokeWidth:K,className:bc("lucide",H,p),...!h&&!xh(j)&&{"aria-hidden":"true"},...j},[...g.map(([T,E])=>S.createElement(T,E)),...Array.isArray(h)?h:[h]])});/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cl=(i,u)=>{const s=S.forwardRef(({className:d,...p},h)=>S.createElement(Sh,{ref:h,iconNode:u,className:bc(`lucide-${gh(Oc(i))}`,`lucide-${i}`,d),...p}));return s.displayName=Oc(i),s};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jh=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Dc=cl("calendar-clock",jh);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ch=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Eh=cl("grip-vertical",Ch);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _h=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Nh=cl("log-out",_h);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ph=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ns=cl("refresh-cw",Ph);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Th=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Rh=cl("settings",Th);function zh({visible:i}){return i?c.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"var(--sidebar)",color:"var(--text-light)",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"10px 16px",fontSize:"14px",boxShadow:"0 -2px 8px rgba(0,0,0,0.3)"},children:[c.jsx("span",{children:"A new version is available."}),c.jsxs("button",{onClick:()=>window.location.reload(),style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--accent)",color:"var(--sidebar)",border:"none",borderRadius:"4px",padding:"6px 14px",fontWeight:600,cursor:"pointer",fontSize:"13px"},children:[c.jsx(Ns,{size:14,strokeWidth:1.75}),"Reload"]})]}):null}const Lh=120*1e3;function Oh(i){const[u,s]=S.useState(!1);return S.useEffect(()=>{let d=null;async function p(){try{const j=await fetch(i,{cache:"no-store"});if(!j.ok)return;const _=(await j.json()).version;if(!_)return;d===null?d=_:_!==d&&s(!0)}catch{}}p();const h=setInterval(p,Lh);function g(){document.visibilityState==="visible"&&p()}return document.addEventListener("visibilitychange",g),()=>{clearInterval(h),document.removeEventListener("visibilitychange",g)}},[i]),u}function ed(i,u){return i.is_admin||i.caps.includes(u)}const Dh="width=1280",Mh="width=device-width, initial-scale=1.0";function Mc(i){const u=document.querySelector('meta[name="viewport"]');u&&(u.content=i)}function Ih(i){S.useEffect(()=>(Mc(Dh),window.parent.postMessage({type:"hnf:viewport",mode:i},"*"),()=>{Mc(Mh),window.parent.postMessage({type:"hnf:viewport",mode:"responsive"},"*")}),[i])}function Wh({user:i,children:u}){Ih("desktop");async function s(){await fetch("/hk-planner/api/auth/logout",{method:"POST",credentials:"include"}),window.location.reload()}return c.jsxs("div",{style:{display:"flex",height:"100dvh",overflow:"hidden"},children:[c.jsxs("nav",{style:{width:"200px",flexShrink:0,background:"var(--navy)",display:"flex",flexDirection:"column",padding:"1rem 0",borderRight:"1px solid var(--surface-2)"},children:[c.jsx("div",{style:{padding:"0 1rem 1rem",borderBottom:"1px solid var(--surface-2)"},children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[c.jsx(Dc,{size:20,strokeWidth:1.75,color:"#74c69d"}),c.jsx("span",{style:{color:"#74c69d",fontWeight:700,fontSize:"0.95rem"},children:"HK Planner"})]})}),c.jsxs("div",{className:"nav-scroll",style:{flex:1,padding:"0.5rem 0",overflowY:"auto"},children:[c.jsx(Ic,{to:"/planner",icon:Dc,label:"Planner"}),ed(i,"settings")&&c.jsx(Ic,{to:"/settings",icon:Rh,label:"Settings"})]}),c.jsxs("div",{style:{padding:"0.75rem 1rem",borderTop:"1px solid var(--surface-2)"},children:[c.jsxs("div",{style:{marginBottom:"0.5rem"},children:[c.jsx("div",{style:{color:"var(--text)",fontSize:"0.8rem",fontWeight:600},children:i.name}),c.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.72rem"},children:i.email})]}),c.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:"0.5rem",background:"none",border:"none",color:"var(--text-muted)",fontSize:"0.8rem",padding:"0.375rem 0",width:"100%",cursor:"pointer"},children:[c.jsx(Nh,{size:14,strokeWidth:1.75}),"Sign out"]})]})]}),c.jsx("main",{style:{flex:1,overflow:"auto",background:"var(--body-bg)"},children:u})]})}function Ic({to:i,icon:u,label:s}){return c.jsxs(ch,{to:i,style:({isActive:d})=>({display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.625rem 1rem",textDecoration:"none",color:d?"#74c69d":"var(--text)",background:d?"var(--surface)":"transparent",borderLeft:d?"2px solid #74c69d":"2px solid transparent",fontSize:"0.875rem",transition:"background 0.15s"}),children:[c.jsx(u,{size:15,strokeWidth:1.75}),s]})}const Fh="/hk-planner/api";async function Xe(i,u){const s=await fetch(Fh+i,{credentials:"include",...u});if(s.status===401)throw(window.top??window).location.href="/login",new Error("Unauthenticated");if(!s.ok){const d=await s.json().catch(()=>({}));throw new Error(d.error||`HTTP ${s.status}`)}return s.json()}function Uh(i,u,s=!1){const d=new URLSearchParams;return i&&d.set("week_start",i),u&&d.set("last_viewed",u),s&&d.set("force_refresh","1"),Xe(`/bookings?${d}`)}function td(){return Xe("/config")}function Bh(i,u,s){return Xe("/config/time-requirements",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cat:i,action:u,value:s})})}function Ah(i){return Xe("/config/staff",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staff_data:i})})}function $h(i){return Xe("/config/pickup",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pickup_data:i})})}function Vh(i){return Xe("/config/general-tasks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({general_tasks:i})})}function Hh(i){return Xe("/config/last-reviewed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:i})})}function Qh(){return Xe("/categories")}function Kh(i,u){return Xe("/categories",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:i,excluded:u})})}function Yh(){return Xe("/newbook/test",{method:"POST"})}function Jh(){return Xe("/workforce/departments")}function Gh(i){return Xe("/config/workforce-departments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dept_ids:i})})}function Xh(){return Xe("/workforce/sync",{method:"POST"})}function Wc(i,u){return Xe(`/workforce/shifts?start=${i}&end=${u}`)}function Zh(){return Xe("/workforce/staff")}function qh(i){return Xe("/config/adjustments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({adjustments:i})})}function bh(i){return Xe("/config/warning-thresholds",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}function wo(){const i=new Date;return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function ko(i,u){const[s,d,p]=i.split("-").map(Number),h=new Date(s,d-1,p);return h.setDate(h.getDate()+u),`${h.getFullYear()}-${String(h.getMonth()+1).padStart(2,"0")}-${String(h.getDate()).padStart(2,"0")}`}function To(i){const u=new Date(i+"T00:00:00");return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()]+" "+u.getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][u.getMonth()]}function em(i){const u=new Date(i+"T00:00:00");return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][(u.getDay()+6)%7]}function tm(i){const u=new Date(i+"T00:00:00");return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][u.getDay()]}function sl(i){const u=new Date(i+"T00:00:00").getDay();return u===0||u===6}function nm(i,u){const s=u.pickup_hint??0,d=u.pickup_lead??0,p=s>0?`${s} room${s===1?"":"s"} picked up within ${d} day${d===1?"":"s"} of arrival`:"no late pickups";return`Last ${tm(i)}: ${u.prior_occ} occ (${u.prior_vac} vac) — ${p}`}function Fc(i){return new Date(i+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function Ge(i){return i.toFixed(2)+"h"}function gr(i,u,s,d,p){var _;const h=Math.max(0,p-d),g=(_=i[u])==null?void 0:_[s];if(!g||!g.count)return 0;const j=g.total-g.count,w=d>j?Math.max(0,g.total-d):g.count;return Math.min(w,h)}function rm(i,u,s,d,p){const h={};for(const g of i.dates){const j=em(g),w=d.reduce((P,N)=>P+(N.hours[j]||0)/60,0),_=p.reduce((P,N)=>P+(N.hours[g]||0),0);h[g]={booked:0,pickup:0,general:w,adjustments:_,total:w+_,by_cat:{},pickup_by_cat:{}}}for(const g of i.categories){const j=u[g.id]||{depart:0,stay:0,arrive:0};i.dates.forEach((w,_)=>{const P=g.days[w],N=P.stays+P.arrivals,M=gr(s,g.id,w,N,g.total_rooms),H=(P.departs*(j.depart||0)+P.stays*(j.stay||0)+P.arrivals*(j.arrive||0))/60,K=M*(j.arrive||0)/60;h[w].by_cat[g.id]=H,h[w].pickup_by_cat[g.id]=(h[w].pickup_by_cat[g.id]||0)+K,h[w].booked+=H,h[w].pickup+=K,h[w].total+=H+K;const T=i.dates[_+1];if(T&&M>0){const E=M*(j.depart||0)/60;h[T].pickup_by_cat[g.id]=(h[T].pickup_by_cat[g.id]||0)+E,h[T].pickup+=E,h[T].total+=E}})}return h}function lm(){const[i,u]=S.useState(null),[s,d]=S.useState({}),[p,h]=S.useState([]),[g,j]=S.useState({}),[w,_]=S.useState([]),[P,N]=S.useState([]),[M,H]=S.useState(4),[K,T]=S.useState(1),[E,A]=S.useState(1),[$,G]=S.useState(2),[U,ce]=S.useState({}),[de,Ce]=S.useState([]),[xe,Ze]=S.useState(!1),[Ie,Ke]=S.useState(null),[Ee,Te]=S.useState(""),[Be,qe]=S.useState(""),[Oe,ve]=S.useState(!0),[W,X]=S.useState(""),[F,y]=S.useState(null),R=S.useRef({}),ee=S.useRef(null),re=S.useRef(!1),le=S.useRef(null);le.current=Ie;function oe(ne,me,Ae=400){clearTimeout(R.current[ne]),R.current[ne]=setTimeout(me,Ae)}function ae(ne,me=!1){ee.current&&clearTimeout(ee.current),y({text:ne,err:me}),ee.current=setTimeout(()=>y(null),me?5e3:2500)}function se(){const ne=wo();ne!==Be&&(qe(ne),Hh(ne).catch(()=>{}))}const fe=S.useCallback(async(ne=!1,me)=>{ve(!0),X("");const Ae=wo(),rt=le.current||Ae,ft=ko(rt,6),pt=me!==void 0?me||ko(Ae,-1):Ee||Be||ko(Ae,-1);try{const[$e,we,yt]=await Promise.all([Uh(rt,pt,ne),td(),Wc(rt,ft).catch(()=>({}))]);u($e),d(we.time_requirements||{}),h(we.staff_data||[]),j(we.pickup_data||{}),_(we.general_tasks||[]),N(we.adjustments||[]),H(we.warn_over_red_hrs??4),T(we.warn_over_amber_hrs??1),A(we.warn_under_amber_hrs??1),G(we.warn_under_red_hrs??2),ce(yt),we.last_reviewed&&(qe(we.last_reviewed),Ee||Te(we.last_reviewed))}catch($e){X($e instanceof Error?$e.message:"Failed to load data")}finally{ve(!1)}},[Ee,Be]);S.useEffect(()=>{fe(!1)},[]),S.useEffect(()=>{Object.keys(U).length>0&&!re.current&&(re.current=!0,Zh().then(Ce).catch(()=>{}))},[U]),S.useEffect(()=>{function ne(){p.length&&navigator.sendBeacon("/hk-planner/api/config/staff",JSON.stringify({staff_data:p})),Object.keys(g).length&&navigator.sendBeacon("/hk-planner/api/config/pickup",JSON.stringify({pickup_data:g})),P.length&&navigator.sendBeacon("/hk-planner/api/config/adjustments",JSON.stringify({adjustments:P}))}return window.addEventListener("beforeunload",ne),()=>window.removeEventListener("beforeunload",ne)},[p,g,P]);function We(ne){const me=wo(),Ae=ko(le.current||me,ne);le.current=Ae,Ke(Ae),se(),fe(!0)}function At(){le.current=null,Ke(null),se(),fe(!0)}function En(){se(),fe(!0)}function $t(ne,me,Ae,rt){const ft=rt.days[me],pt=ft.stays+ft.arrivals,$e=Math.max(0,rt.total_rooms-pt),we=gr(g,ne,me,pt,rt.total_rooms),yt=Math.max(0,Math.min(we+Ae,$e)),Tn={...g,[ne]:{...g[ne]||{},[me]:{count:yt,total:pt+yt}}};j(Tn),se(),oe("pickup",()=>$h(Tn).then(()=>ae("Pickup saved")).catch(Vn=>ae(Vn.message,!0)))}function Vt(ne){N(ne),oe("adjustments",()=>qh(ne).then(()=>ae("Adjustments saved")).catch(me=>ae(me.message,!0)))}function _n(){Vt([...P,{label:"",hours:{}}])}function en(ne){h(ne),se(),oe("staff",()=>Ah(ne).then(()=>ae("Staff hours saved")).catch(me=>ae(me.message,!0)))}function Ht(){en([...p,{name:"",hours:{}}])}async function Nn(){Ze(!0);try{if(await Xh(),i){const ne=await Wc(i.dates[0],i.dates[i.dates.length-1]);ce(ne)}ae("Rota synced from Workforce")}catch(ne){ae(ne instanceof Error?ne.message:"Sync failed",!0)}finally{Ze(!1)}}function tn(){if(!i)return"";const ne=i.dates.filter($e=>U[$e]);if(!ne.length)return"Not synced";const me=ne.reduce(($e,we)=>new Date(U[we].synced_at)!U[$e]).length?`Partial sync — from ${rt} ${ft}`:`From ${rt} ${ft}`}const _t=i?rm(i,s,g,w,P):null,Dt=wo(),Pn=Ie||Dt;return c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"1600px"},children:[c.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.75rem",marginBottom:"1.25rem"},children:[c.jsxs("div",{children:[c.jsx("h1",{style:{fontSize:"1.15rem",fontWeight:700,color:"var(--text-dark)"},children:"Housekeeping Planner"}),i&&c.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-mid)",marginTop:"0.1rem"},children:[Fc(i.dates[0])," – ",Fc(i.dates[i.dates.length-1])]})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginLeft:"auto",flexWrap:"wrap"},children:[c.jsx(hr,{onClick:()=>We(-7),children:"‹ Prev"}),c.jsx(hr,{onClick:At,primary:!0,children:"Today"}),c.jsx(hr,{onClick:()=>We(7),children:"Next ›"}),c.jsx("input",{type:"date",value:Pn,onChange:ne=>{if(ne.target.value){const me=ne.target.value;le.current=me,Ke(me),se(),oe("weekStart",()=>fe(!0),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.35rem 0.5rem",fontSize:"0.82rem",color:"var(--text-dark)"}}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsxs("label",{style:{fontSize:"0.78rem",color:"var(--text-mid)",display:"flex",alignItems:"center",gap:"0.3rem"},children:[c.jsx("span",{children:"Since"}),c.jsx("input",{type:"date",value:Ee,onChange:ne=>{if(ne.target.value){const me=ne.target.value;Te(me),oe("lastViewed",()=>fe(!0,me),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.5rem",fontSize:"0.78rem",color:"var(--text-dark)"}})]}),c.jsx(hr,{onClick:()=>{se(),fe(!0)},children:"Update to now"}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsx("button",{onClick:En,title:"Refresh",style:{background:"var(--card-bg)",border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.35rem 0.5rem",display:"flex",alignItems:"center",gap:"0.3rem",fontSize:"0.82rem",color:"var(--text-dark)"},children:c.jsx(Ns,{size:13,strokeWidth:1.75,style:{animation:Oe?"spin 1s linear infinite":"none"}})})]})]}),c.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),F&&c.jsx("div",{style:{display:"inline-block",marginBottom:"0.75rem",padding:"0.35rem 0.75rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:500,background:F.err?"#fee2e2":"#dcfce7",color:F.err?"var(--danger)":"var(--success)"},children:F.text}),W&&c.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"#fee2e2",color:"var(--danger)",fontSize:"0.875rem"},children:["Error: ",W]}),Oe&&!i&&c.jsx("div",{style:{color:"var(--text-mid)",padding:"2rem 0",textAlign:"center"},children:"Loading bookings…"}),i&&_t&&c.jsxs(c.Fragment,{children:[c.jsx(So,{title:"7-Day Occupancy",children:c.jsx("div",{className:"table-scroll",children:c.jsx(om,{bookings:i,pickup:g,onPickupChange:$t})})}),c.jsx(So,{title:"Required Hours",children:c.jsx("div",{className:"table-scroll",children:c.jsx(am,{bookings:i,required:_t})})}),c.jsx(So,{title:"Adjustments",action:c.jsx(hr,{onClick:_n,children:"+ Add adjustment"}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(fm,{bookings:i,adjustments:P,onChange:Vt})})}),c.jsx(So,{title:"Staff Rota",action:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[c.jsxs("button",{onClick:Nn,disabled:xe,style:{display:"flex",alignItems:"center",gap:"0.3rem",background:"var(--card-bg)",color:"var(--text-dark)",border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.65rem",fontSize:"0.78rem",fontWeight:600},children:[c.jsx(Ns,{size:11,strokeWidth:1.75,style:{animation:xe?"spin 1s linear infinite":"none"}}),xe?"Syncing…":"Sync from Workforce"]}),c.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:tn()}),c.jsx(hr,{onClick:Ht,children:"+ Add staff"})]}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(cm,{bookings:i,staff:p,required:_t,warnOverRed:M,warnOverAmber:K,warnUnderAmber:E,warnUnderRed:$,onChange:en,wfShifts:U,wfStaff:de})})})]})]})}function So({title:i,children:u,action:s}){return c.jsxs("div",{style:{marginBottom:"1.5rem"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[c.jsx("h2",{style:{fontSize:"0.72rem",fontWeight:700,color:"var(--text-mid)",textTransform:"uppercase",letterSpacing:"0.08em"},children:i}),s]}),u]})}function hr({children:i,onClick:u,primary:s}){return c.jsx("button",{onClick:u,style:{background:s?"var(--hk-green)":"var(--card-bg)",color:s?"#fff":"var(--text-dark)",border:`1px solid ${s?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.35rem 0.75rem",fontSize:"0.82rem",fontWeight:600},children:i})}function om({bookings:i,pickup:u,onPickupChange:s}){const{dates:d,categories:p}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsxs("thead",{children:[c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",rowSpan:2,children:"Category"}),d.map(h=>c.jsx("th",{colSpan:2,style:{borderLeft:"2px solid rgba(255,255,255,0.3)",...sl(h)?{background:"#253555"}:{}},children:To(h)},h))]}),c.jsx("tr",{children:d.map(h=>c.jsxs(c.Fragment,{children:[c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"72px",background:sl(h)?"#2a3d5e":"#1e2d42",borderLeft:"2px solid rgba(255,255,255,0.3)"},children:"Rooms"},h+"-r"),c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"56px",textAlign:"center",background:sl(h)?"#2a3d5e":"#1e2d42",borderLeft:"1px solid rgba(255,255,255,0.1)"},children:"D / S / A"},h+"-d")]}))})]}),c.jsx("tbody",{children:p.map((h,g)=>{const j=g===p.length-1;return c.jsx(im,{cat:h,dates:d,pickup:u,onPickupChange:(w,_)=>s(h.id,w,_,h),isLast:j},h.id)})}),c.jsx("tfoot",{children:c.jsx(sm,{dates:d,cats:p,pickup:u})})]})}function im({cat:i,dates:u,pickup:s,onPickupChange:d,isLast:p}){const h=p?"2px solid var(--card-border)":void 0;return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{borderBottom:h},children:i.name}),u.map((g,j)=>{var ce;const w=i.days[g],_=w.stays+w.arrivals,P=Math.max(0,i.total_rooms-_),N=gr(s,i.id,g,_,i.total_rooms),M=u[j-1],H=M?i.days[M].stays+i.days[M].arrivals:0,K=M?gr(s,i.id,M,H,i.total_rooms):0,T=w.delta_new||0,E=w.delta_cancelled||0,A=sl(g),$=(ce=s[i.id])==null?void 0:ce[g],G=nm(g,w);let U="";if($&&$.count){const de=$.total-$.count,Ce=_>de?"changed":"unchanged",xe=_>de?"decreased":"remains";U=`+${$.count} pickup set when booked was ${de} (target ${$.total}). Booked ${Ce}, so pickup ${xe}.`}return U=(U?U+" | ":"")+G,c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",borderBottom:h,padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[(T>0||E>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[T>0&&c.jsxs("span",{className:"delta-new",children:["▲",T]}),E>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",E]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},title:U,children:[_,N>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",N]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)",marginBottom:"4px"},children:[P," vac",N>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",P-N,")"]})]}),c.jsxs("div",{className:"pickup-ctrl",children:[c.jsx("button",{className:"pickup-btn",disabled:N<=0,onClick:()=>d(g,-1),children:"−"}),c.jsx("span",{className:"pickup-num",children:N}),c.jsx("button",{className:"pickup-btn",disabled:N>=P,title:G,onClick:()=>d(g,1),children:"+"})]})]},g+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",borderBottom:h,padding:"0.4rem 0.3rem",textAlign:"center",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[w.departs,"d",K>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",K]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[w.stays,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[w.arrivals,"a",N>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",N]})]})]},g+"-dsa")]})})]})}function sm({dates:i,cats:u,pickup:s}){return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontStyle:"italic"},children:"Total"}),i.map((d,p)=>{let h=0,g=0,j=0,w=0,_=0,P=0,N=0,M=0,H=0;for(const T of u){const E=T.days[d],A=E.stays+E.arrivals,$=Math.max(0,T.total_rooms-A),G=gr(s,T.id,d,A,T.total_rooms),U=i[p-1],ce=U?T.days[U].stays+T.days[U].arrivals:0,de=U?gr(s,T.id,U,ce,T.total_rooms):0;h+=A,g+=$,j+=G,w+=de,_+=E.departs,P+=E.stays,N+=E.arrivals,M+=E.delta_new||0,H+=E.delta_cancelled||0}const K=sl(d);return c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...K?{background:"rgba(100,120,160,0.07)"}:{}},children:[(M>0||H>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[M>0&&c.jsxs("span",{className:"delta-new",children:["▲",M]}),H>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",H]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},children:[h,j>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",j]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:[g," vac",j>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",g-j,")"]})]})]},d+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",padding:"0.4rem 0.3rem",textAlign:"center",...K?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[_,"d",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[P,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[N,"a",j>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",j]})]})]},d+"-dsa")]})})]})}function am({bookings:i,required:u}){const{dates:s,categories:d}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),s.map(p=>c.jsx("th",{children:To(p)},p))]})}),c.jsx("tbody",{children:d.map(p=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:p.name}),s.map(h=>{const g=u[h].by_cat[p.id]||0,j=u[h].pickup_by_cat[p.id]||0;return c.jsxs("td",{children:[g===0&&j===0?"—":Ge(g),j>.001&&c.jsxs("span",{className:"pickup-tag",children:[" (+",Ge(j),")"]})]},h)})]},p.id))}),c.jsxs("tfoot",{children:[c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Booked hrs"}),s.map(p=>c.jsx("td",{children:Ge(u[p].booked)},p))]}),c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Pickup hrs"}),s.map(p=>c.jsx("td",{children:u[p].pickup>.001?Ge(u[p].pickup):"—"},p))]}),c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Recurring tasks"}),s.map(p=>c.jsx("td",{children:u[p].general>.001?Ge(u[p].general):"—"},p))]}),s.some(p=>u[p].adjustments!==0)&&c.jsxs("tr",{style:{background:"#f1f5f9"},children:[c.jsx("td",{className:"col-label",style:{color:"var(--text-mid)",fontSize:"0.78rem"},children:"Adjustments"}),s.map(p=>{const h=u[p].adjustments;return c.jsx("td",{style:{color:h<0?"var(--danger)":h>0?"#1a7a4a":"var(--text-mid)"},children:h===0?"—":(h>0?"+":"")+Ge(h)},p)})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",children:"Total Required"}),s.map(p=>c.jsxs("td",{style:{fontWeight:700},children:[Ge(u[p].total),u[p].pickup>.001&&c.jsxs("span",{className:"pickup-tag",style:{display:"block",fontSize:"0.7rem"},children:["inc ",Ge(u[p].pickup)," pickup"]})]},p))]})]})]})}function um(i,u){const s={};for(const d of u){const p=i[d];if(p)for(const h of p.staff)s[h.id]||(s[h.id]={id:h.id,name:h.name,days:{}}),s[h.id].days[d]={hours:h.hours,times:h.times}}return Object.values(s).sort((d,p)=>d.name.localeCompare(p.name))}function cm({bookings:i,staff:u,required:s,warnOverRed:d,warnOverAmber:p,warnUnderAmber:h,warnUnderRed:g,onChange:j,wfShifts:w,wfStaff:_}){const{dates:P}=i;function N(T,E){const A=u.map(($,G)=>G===T?{...$,name:E}:$);j(A)}function M(T,E,A){const $=parseFloat(A),G=u.map((U,ce)=>{if(ce!==T)return U;const de={...U.hours};return!isNaN($)&&$>=0?de[E]=$:delete de[E],{...U,hours:de}});j(G)}function H(T){j(u.filter((E,A)=>A!==T))}const K=um(w,P);return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Staff Member"}),P.map(T=>c.jsx("th",{children:To(T)},T)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[K.map(T=>c.jsxs("tr",{style:{background:"rgba(42,100,72,0.05)"},children:[c.jsxs("td",{className:"col-label",children:[c.jsx("span",{style:{display:"inline-block",fontSize:"0.67rem",fontWeight:700,background:"rgba(42,100,72,0.18)",color:"#1a7a4a",borderRadius:"3px",padding:"0 4px",marginRight:"0.4rem",lineHeight:"1.5"},children:"WF"}),T.name]}),P.map(E=>{const A=T.days[E];return c.jsx("td",{style:{textAlign:"center",padding:"0.3rem 0.4rem",verticalAlign:"middle"},children:A?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:"0.68rem",color:"var(--text-mid)",lineHeight:1.25},children:A.times}),c.jsx("div",{style:{fontWeight:600},children:Ge(A.hours)})]}):c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"})},E)}),c.jsx("td",{})]},"wf-"+T.id)),_.length>0&&c.jsx("datalist",{id:"wf-staff-datalist",children:_.map(T=>c.jsx("option",{value:T.name},T.id))}),u.map((T,E)=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:T.name,placeholder:"Staff name",list:_.length>0?"wf-staff-datalist":void 0,onChange:A=>N(E,A.target.value)})}),P.map(A=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:24,step:.5,value:T.hours[A]??"",placeholder:"0",onChange:$=>M(E,A,$.target.value)})},A)),c.jsx("td",{children:c.jsx("button",{onClick:()=>H(E),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},E))]}),c.jsx("tfoot",{children:(()=>{const T={};for(const E of P){const A=K.reduce((G,U)=>{var ce;return G+(((ce=U.days[E])==null?void 0:ce.hours)||0)},0),$=u.reduce((G,U)=>G+(U.hours[E]||0),0);T[E]=A+$}return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total Available"}),P.map(E=>c.jsx("td",{children:Ge(T[E])},E)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"vs Booked"}),P.map(E=>c.jsx("td",{children:c.jsx(Ss,{available:T[E],required:s[E].booked,warnOverAmber:p,warnUnderAmber:h})},E)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"with Recurring Tasks"}),P.map(E=>c.jsx("td",{children:c.jsx(Ss,{available:T[E],required:s[E].booked+s[E].general,warnOverAmber:p,warnUnderAmber:h})},E)),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"with Pickup"}),P.map(E=>c.jsx("td",{children:c.jsx(Ss,{available:T[E],required:s[E].booked+s[E].general+s[E].pickup,warnOverAmber:p,warnUnderAmber:h})},E)),c.jsx("td",{})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",style:{fontWeight:700},children:"with Adjustments"}),P.map(E=>c.jsx("td",{children:c.jsx(dm,{available:T[E],required:s[E].total,warnOverRed:d,warnOverAmber:p,warnUnderAmber:h,warnUnderRed:g})},E)),c.jsx("td",{})]})]})})()})]})}function Ss({available:i,required:u,warnOverAmber:s,warnUnderAmber:d}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const p=i-u,h=p>s?"⚠":p<-d?"✗":"✓";return c.jsxs("span",{style:{color:"var(--text-mid)",fontSize:"0.82rem"},children:[h," ",p>=0?"+":"",Ge(p)]})}function dm({available:i,required:u,warnOverRed:s,warnOverAmber:d,warnUnderAmber:p,warnUnderRed:h}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const g=i-u;return g>s?c.jsxs("span",{className:"diff-over-red",children:["⚠ ",Ge(g)," spare"]}):g>d?c.jsxs("span",{className:"diff-over",children:["⚠ ",Ge(g)," spare"]}):g<-h?c.jsxs("span",{className:"diff-under",children:["✗ ",Ge(Math.abs(g))," short"]}):g<-p?c.jsxs("span",{className:"diff-under-amber",children:["✗ ",Ge(Math.abs(g))," short"]}):c.jsxs("span",{className:"diff-ok",children:["✓ ",g>=0?"+":"",Ge(g)]})}function fm({bookings:i,adjustments:u,onChange:s}){const{dates:d}=i;function p(j,w){s(u.map((_,P)=>P===j?{..._,label:w}:_))}function h(j,w,_){const P=parseFloat(_);s(u.map((N,M)=>{if(M!==j)return N;const H={...N.hours};return isNaN(P)?delete H[w]:H[w]=P,{...N,hours:H}}))}function g(j){s(u.filter((w,_)=>_!==j))}return u.length===0?c.jsx("p",{style:{color:"var(--text-mid)",fontSize:"0.82rem",padding:"0.5rem 0"},children:'No adjustments — use "+ Add adjustment" above to add a one-off hour offset for a specific date.'}):c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Label"}),d.map(j=>c.jsx("th",{children:To(j)},j)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsx("tbody",{children:u.map((j,w)=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:j.label,placeholder:"e.g. Rooms from Sunday",onChange:_=>p(w,_.target.value)})}),d.map(_=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",step:.25,value:j.hours[_]??"",placeholder:"0",onChange:P=>h(w,_,P.target.value)})},_)),c.jsx("td",{children:c.jsx("button",{onClick:()=>g(w),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},w))}),c.jsx("tfoot",{children:c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total"}),d.map(j=>{const w=u.reduce((_,P)=>_+(P.hours[j]||0),0);return c.jsx("td",{style:{color:w<0?"var(--danger)":w>0?"#1a7a4a":"var(--text-mid)",fontWeight:w!==0?600:void 0},children:w===0?"—":(w>0?"+":"")+Ge(w)},j)}),c.jsx("td",{})]})})]})}const Uc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function pm(){const[i,u]=S.useState([]),[s,d]=S.useState(!0),[p,h]=S.useState(!1),[g,j]=S.useState(!1),[w,_]=S.useState(""),[P,N]=S.useState(""),[M,H]=S.useState(null),[K,T]=S.useState([]),[E,A]=S.useState([]),[$,G]=S.useState(!0),[U,ce]=S.useState(""),[de,Ce]=S.useState(!1),[xe,Ze]=S.useState(!1),[Ie,Ke]=S.useState(""),[Ee,Te]=S.useState([]),[Be,qe]=S.useState(!1),[Oe,ve]=S.useState(""),[W,X]=S.useState(""),[F,y]=S.useState({}),[R,ee]=S.useState(""),[re,le]=S.useState(""),[oe,ae]=S.useState(4),[se,fe]=S.useState(1),[We,At]=S.useState(1),[En,$t]=S.useState(2),[Vt,_n]=S.useState(!1),[en,Ht]=S.useState(""),[Nn,tn]=S.useState("");S.useEffect(()=>{Promise.all([Qh(),td(),Jh().catch(I=>(I.message.includes("503")||I.message.toLowerCase().includes("not configured")?Ce(!0):ce(I.message),null))]).then(([I,te,ie])=>{u(I.categories),Te(te.general_tasks||[]),y(te.time_requirements||{}),A(te.workforce_departments||[]),ae(te.warn_over_red_hrs??4),fe(te.warn_over_amber_hrs??1),At(te.warn_under_amber_hrs??1),$t(te.warn_under_red_hrs??2),ie&&T(ie),d(!1),G(!1)}).catch(I=>{_(I.message),d(!1),G(!1)})},[]);function _t(I){u(i.map((te,ie)=>ie===I?{...te,excluded:!te.excluded}:te))}function Dt(I,te){H(te),I.dataTransfer.effectAllowed="move"}function Pn(I,te){if(I.preventDefault(),M===null||M===te)return;const ie=[...i],[De]=ie.splice(M,1);ie.splice(te,0,De),u(ie),H(te)}function ne(){H(null)}async function me(){h(!0),_(""),N("");try{await Kh(i.map(I=>I.id),i.filter(I=>I.excluded).map(I=>I.id)),N("Saved"),setTimeout(()=>N(""),2500)}catch(I){_(I instanceof Error?I.message:"Save failed")}finally{h(!1)}}async function Ae(){j(!0),_(""),N("");try{const I=await Yh();N(I.ok?`Connection OK: ${I.message||""}`:`Failed: ${I.error||"unknown"}`)}catch(I){_(I instanceof Error?I.message:"Test failed")}finally{j(!1)}}function rt(I){A(te=>te.includes(I)?te.filter(ie=>ie!==I):[...te,I])}async function ft(){Ze(!0),ce(""),Ke("");try{await Gh(E),Ke("Departments saved"),setTimeout(()=>Ke(""),2500)}catch(I){ce(I instanceof Error?I.message:"Save failed")}finally{Ze(!1)}}function pt(I,te){Te(Ee.map((ie,De)=>De===I?{...ie,name:te}:ie))}function $e(I,te,ie){const De=parseInt(ie,10);Te(Ee.map((xt,kr)=>kr!==I?xt:{...xt,hours:{...xt.hours,[te]:isNaN(De)?0:Math.max(0,De)}}))}function we(I){Te(Ee.filter((te,ie)=>ie!==I))}async function yt(){qe(!0),X(""),ve("");try{await Vh(Ee),ve("Saved"),setTimeout(()=>ve(""),2500)}catch(I){X(I instanceof Error?I.message:"Save failed")}finally{qe(!1)}}async function Tn(I,te,ie){const De={...F,[I]:{...F[I]||{depart:0,stay:0,arrive:0},[te]:ie}};y(De);try{await Bh(I,te,ie),ee("Saved"),setTimeout(()=>ee(""),1500)}catch(xt){le(xt instanceof Error?xt.message:"Save failed")}}async function Vn(){_n(!0),tn(""),Ht("");try{await bh({warn_over_red_hrs:oe,warn_over_amber_hrs:se,warn_under_amber_hrs:We,warn_under_red_hrs:En}),Ht("Saved"),setTimeout(()=>Ht(""),2500)}catch(I){tn(I instanceof Error?I.message:"Save failed")}finally{_n(!1)}}return s?c.jsx("div",{style:{padding:"2rem",color:"var(--text-mid)"},children:"Loading…"}):c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"680px"},children:[c.jsx("h1",{style:{fontSize:"1.1rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"1.5rem"},children:"Settings"}),c.jsx(ol,{title:"Room Categories"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Drag to reorder. Toggle to exclude categories from the planner."}),w&&c.jsx(Bt,{type:"error",children:w}),P&&c.jsx(Bt,{type:"ok",children:P}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:i.map((I,te)=>c.jsxs("div",{draggable:!0,onDragStart:ie=>Dt(ie,te),onDragOver:ie=>Pn(ie,te),onDragEnd:ne,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 0.875rem",border:"1px solid var(--card-border)",borderRadius:"8px",background:I.excluded?"#f8fafc":"var(--card-bg)",opacity:M===te?.5:1},children:[c.jsx(Eh,{size:16,color:"var(--text-mid)",style:{cursor:"grab",flexShrink:0}}),c.jsx("span",{style:{flex:1,fontSize:"0.9rem",color:I.excluded?"var(--text-mid)":"var(--text-dark)",textDecoration:I.excluded?"line-through":"none"},children:I.name}),c.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",marginRight:"0.5rem"},children:[I.room_count," rooms"]}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8rem",color:"var(--text-mid)"},children:[c.jsx("input",{type:"checkbox",checked:!I.excluded,onChange:()=>_t(te)}),"Active"]})]},I.id))}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(mr,{onClick:me,disabled:p,primary:!0,children:p?"Saving…":"Save Order & Visibility"}),c.jsx(mr,{onClick:Ae,disabled:g,children:g?"Testing…":"Test Newbook Connection"})]}),c.jsx(jo,{}),c.jsx(ol,{title:"Workforce Departments"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Select the department(s) whose shifts should appear in the HK staff rota."}),de&&c.jsxs("div",{style:{padding:"0.75rem",borderRadius:"8px",background:"#f8fafc",border:"1px solid var(--card-border)",color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:["Workforce integration not configured — add the bearer token in ",c.jsx("strong",{children:"Settings → Integrations → Workforce"}),"."]}),!de&&$&&c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:"Loading departments…"}),!de&&!$&&c.jsxs("div",{style:{marginBottom:"2.5rem"},children:[U&&c.jsx(Bt,{type:"error",children:U}),Ie&&c.jsx(Bt,{type:"ok",children:Ie}),K.length===0?c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"1rem"},children:"No departments found for this location."}):c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem",marginBottom:"1rem"},children:K.map(I=>c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.5rem 0.75rem",border:"1px solid var(--card-border)",borderRadius:"7px",background:E.includes(I.id)?"rgba(42,100,72,0.05)":"var(--card-bg)",cursor:"pointer",fontSize:"0.9rem",color:"var(--text-dark)"},children:[c.jsx("input",{type:"checkbox",checked:E.includes(I.id),onChange:()=>rt(I.id)}),I.name]},I.id))}),E.length===0&&K.length>0&&c.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"#b45309"},children:"Select at least one department to enable Workforce sync."}),c.jsx(mr,{onClick:ft,disabled:xe,primary:!0,children:xe?"Saving…":"Save Departments"})]}),c.jsx(jo,{}),c.jsx(ol,{title:"Recurring General Tasks"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Tasks that recur every week. Enter minutes per day. These add to the total required hours every week."}),W&&c.jsx(Bt,{type:"error",children:W}),Oe&&c.jsx(Bt,{type:"ok",children:Oe}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"1rem"},children:c.jsxs("table",{className:"hk-table",style:{minWidth:"560px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Task"}),Uc.map(I=>c.jsx("th",{children:I},I)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[Ee.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:9,style:{color:"var(--text-mid)",textAlign:"center",padding:"1rem"},children:"No tasks yet"})}),Ee.map((I,te)=>c.jsxs("tr",{children:[c.jsx("td",{style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:I.name,placeholder:"Task name",onChange:ie=>pt(te,ie.target.value)})}),Uc.map(ie=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:I.hours[ie]||"",placeholder:"0",onChange:De=>$e(te,ie,De.target.value)})},ie)),c.jsx("td",{children:c.jsx("button",{onClick:()=>we(te),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},te))]})]})}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(mr,{onClick:()=>Te([...Ee,{name:"",hours:{}}]),children:"+ Add task"}),c.jsx(mr,{onClick:yt,disabled:Be,primary:!0,children:Be?"Saving…":"Save Tasks"})]}),c.jsx(jo,{}),c.jsx(ol,{title:"Time Requirements (minutes per room)"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"How many minutes each room type takes depending on guest status."}),re&&c.jsx(Bt,{type:"error",children:re}),R&&c.jsx(Bt,{type:"ok",children:R}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"2rem"},children:c.jsxs("table",{className:"hk-table",style:{maxWidth:"500px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),c.jsx("th",{children:"Depart (mins)"}),c.jsx("th",{children:"Stay (mins)"}),c.jsx("th",{children:"Arrive (mins)"})]})}),c.jsx("tbody",{children:i.filter(I=>!I.excluded).map(I=>{const te=F[I.id]||{depart:0,stay:0,arrive:0};return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:I.name}),["depart","stay","arrive"].map(ie=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:te[ie]||"",placeholder:"0",onChange:De=>Tn(I.id,ie,parseInt(De.target.value,10)||0),onBlur:De=>Tn(I.id,ie,parseInt(De.target.value,10)||0)})},ie))]},I.id)})})]})}),c.jsx(jo,{}),c.jsx(ol,{title:"Warning Thresholds"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:'Controls the colour and icon shown on the "with Adjustments" row in the staff rota. All values are in hours.'}),Nn&&c.jsx(Bt,{type:"error",children:Nn}),en&&c.jsx(Bt,{type:"ok",children:en}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.625rem",marginBottom:"1.25rem",maxWidth:"420px"},children:[{label:"⚠ Red warning — spare over",value:oe,set:ae,help:"default 4h"},{label:"⚠ Amber warning — spare over",value:se,set:fe,help:"default 1h"},{label:"✗ Amber cross — short over",value:We,set:At,help:"default 1h"},{label:"✗ Red cross — short over",value:En,set:$t,help:"default 2h"}].map(({label:I,value:te,set:ie,help:De})=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[c.jsx("span",{style:{flex:1,fontSize:"0.875rem",color:"var(--text-dark)"},children:I}),c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:24,step:.5,value:te,onChange:xt=>ie(parseFloat(xt.target.value)||0),style:{width:"68px"}}),c.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",minWidth:"52px"},children:De})]},I))}),c.jsx("p",{style:{fontSize:"0.78rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Green ✓ is automatic — shown when the difference is within the amber spare and short thresholds above."}),c.jsx("div",{style:{marginBottom:"2.5rem"},children:c.jsx(mr,{onClick:Vn,disabled:Vt,primary:!0,children:Vt?"Saving…":"Save Thresholds"})})]})}function ol({title:i}){return c.jsx("h2",{style:{fontSize:"0.95rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"0.25rem"},children:i})}function jo(){return c.jsx("div",{style:{height:"1px",background:"var(--card-border)",margin:"0.5rem 0 2rem"}})}function Bt({type:i,children:u}){return c.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.75rem",borderRadius:"8px",fontSize:"0.875rem",background:i==="ok"?"#dcfce7":"#fee2e2",color:i==="ok"?"var(--success)":"var(--danger)"},children:u})}function mr({children:i,onClick:u,disabled:s,primary:d}){return c.jsx("button",{onClick:u,disabled:s,style:{background:d?"var(--hk-green)":"var(--card-bg)",color:d?"#fff":"var(--text-dark)",border:`1px solid ${d?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.5rem 1.25rem",fontSize:"0.875rem",fontWeight:600},children:i})}function hm({user:i}){return c.jsx(Wh,{user:i,children:c.jsxs(qp,{children:[c.jsx(il,{path:"/",element:c.jsx(ws,{to:"/planner",replace:!0})}),c.jsx(il,{path:"/planner",element:c.jsx(lm,{})}),c.jsx(il,{path:"/settings",element:ed(i,"settings")?c.jsx(pm,{}):c.jsx(ws,{to:"/planner",replace:!0})}),c.jsx(il,{path:"*",element:c.jsx(ws,{to:"/planner",replace:!0})})]})})}function mm(){const i=Oh("/hk-planner/health");return c.jsxs(c.Fragment,{children:[c.jsx(ih,{basename:"/hk-planner",children:c.jsx(vh,{children:u=>c.jsx(hm,{user:u})})}),c.jsx(zh,{visible:i})]})}new URLSearchParams(window.location.search).has("install")&&window.addEventListener("beforeinstallprompt",i=>{i.preventDefault(),i.prompt()},{once:!0});ap.createRoot(document.getElementById("root")).render(c.jsx(S.StrictMode,{children:c.jsx(mm,{})}));