function qf(o,u){for(var s=0;sd[p]})}}}return Object.freeze(Object.defineProperty(o,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 bf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var hs={exports:{}},il={},ms={exports:{}},de={};/** * @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 vc;function ep(){if(vc)return de;vc=1;var o=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"),k=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),N=Symbol.iterator;function I(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,ne){this.props=y,this.context=R,this.refs=T,this.updater=ne||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 B(){}B.prototype=E.prototype;function $(y,R,ne){this.props=y,this.context=R,this.refs=T,this.updater=ne||H}var G=$.prototype=new B;G.constructor=$,K(G,E.prototype),G.isPureReactComponent=!0;var F=Array.isArray,oe=Object.prototype.hasOwnProperty,pe={current:null},Ee={key:!0,ref:!0,__self:!0,__source:!0};function xe(y,R,ne){var re,se={},ae=null,fe=null;if(R!=null)for(re in R.ref!==void 0&&(fe=R.ref),R.key!==void 0&&(ae=""+R.key),R)oe.call(R,re)&&!Ee.hasOwnProperty(re)&&(se[re]=R[re]);var ue=arguments.length-2;if(ue===1)se.children=ne;else if(1>>1,R=W[y];if(0>>1;yp(se,U))aep(fe,se)?(W[y]=fe,W[ae]=U,y=ae):(W[y]=se,W[re]=U,y=re);else if(aep(fe,U))W[y]=fe,W[ae]=U,y=ae;else break e}}return X}function p(W,X){var U=W.sortIndex-X.sortIndex;return U!==0?U:W.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;o.unstable_now=function(){return h.now()}}else{var g=Date,j=g.now();o.unstable_now=function(){return g.now()-j}}var k=[],_=[],P=1,N=null,I=3,H=!1,K=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,B=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(k,X);else break;X=s(_)}}function F(W){if(T=!1,G(W),!K)if(s(k)!==null)K=!0,Me(oe);else{var X=s(_);X!==null&&ge(F,X.startTime-W)}}function oe(W,X){K=!1,T&&(T=!1,B(xe),xe=-1),H=!0;var U=I;try{for(G(X),N=s(k);N!==null&&(!(N.expirationTime>X)||W&&!qe());){var y=N.callback;if(typeof y=="function"){N.callback=null,I=N.priorityLevel;var R=y(N.expirationTime<=X);X=o.unstable_now(),typeof R=="function"?N.callback=R:N===s(k)&&d(k),G(X)}else d(k);N=s(k)}if(N!==null)var ne=!0;else{var re=s(_);re!==null&&ge(F,re.startTime-X),ne=!1}return ne}finally{N=null,I=U,H=!1}}var pe=!1,Ee=null,xe=-1,Ze=5,Oe=-1;function qe(){return!(o.unstable_now()-OeW||125y?(W.sortIndex=U,u(_,W),s(k)===null&&W===s(_)&&(T?(B(xe),xe=-1):T=!0,ge(F,U-y))):(W.sortIndex=R,u(k,W),K||H||(K=!0,Me(oe))),W},o.unstable_shouldYield=qe,o.unstable_wrapCallback=function(W){var X=I;return function(){var U=I;I=X;try{return W.apply(this,arguments)}finally{I=U}}}})(ys)),ys}var wc;function op(){return wc||(wc=1,gs.exports=ip()),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 Sc;function sp(){if(Sc)return ht;Sc=1;var o=Ts(),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"),k=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 I(e){return k.call(N,e)?!0:k.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,i,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=i,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 B=/[\-:]([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(B,$);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(B,$);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(B,$);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]!==i[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{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?R(e):""}function se(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 ae(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 Ee:return"Fragment";case pe:return"Portal";case Ze:return"Profiler";case xe:return"StrictMode";case _e:return"Suspense";case Be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qe:return(e.displayName||"Context")+".Consumer";case Oe:return(e._context.displayName||"Context")+".Provider";case De:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case be:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case Me:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}function fe(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 ae(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 ue(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ce(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function je(e){var t=ce(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,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,i.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 lt(e){e._valueTracker||(e._valueTracker=je(e))}function qt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ce(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Bt(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 bt(e,t){var n=t.checked;return U({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nn(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ue(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 At(e,t){en(e,t);var n=ue(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")?nn(e,t.type,n):t.hasOwnProperty("defaultValue")&&nn(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tn(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 nn(e,t,n){(t!=="number"||Bt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $t=Array.isArray;function Ot(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=ve.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function it(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var at={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},Ve=["Webkit","ms","Moz","O"];Object.keys(at).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),at[t]=at[e]})});function ze(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||at.hasOwnProperty(e)&&at[e]?(""+t).trim():t+"px"}function D(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=ze(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var b=U({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 le(e,t){if(t){if(b[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 Fe(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 Sr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ti=null,Hn=null,Qn=null;function Os(e){if(e=Hr(e)){if(typeof Ti!="function")throw Error(s(280));var t=e.stateNode;t&&(t=Dl(t),Ti(e.stateNode,e.type,t))}}function Ds(e){Hn?Qn?Qn.push(e):Qn=[e]:Hn=e}function Ms(){if(Hn){var e=Hn,t=Qn;if(Qn=Hn=null,Os(e),t)for(e=0;e>>=0,e===0?32:31-(pd(e)/hd|0)|0}var vl=64,gl=4194304;function _r(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 yl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var f=a&~l;f!==0?r=_r(f):(i&=a,i!==0&&(r=_r(i)))}else a=n&~l,a!==0?r=_r(a):i!==0&&(r=_r(i));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&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 Nr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_t(t),e[t]=n}function yd(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=Mr),ua=" ",ca=!1;function da(e,t){switch(e){case"keyup":return Kd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gn=!1;function Gd(e,t){switch(e){case"compositionend":return fa(t);case"keypress":return t.which!==32?null:(ca=!0,ua);case"textInput":return e=t.data,e===ua&&ca?null:e;default:return null}}function Jd(e,t){if(Gn)return e==="compositionend"||!Yi&&da(e,t)?(e=ra(),jl=Ai=un=null,Gn=!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=xa(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 Sa(){for(var e=window,t=Bt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bt(e.document)}return t}function Xi(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 lf(e){var t=Sa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&wa(n.ownerDocument.documentElement,n)){if(r!==null&&Xi(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,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=ka(n,i);var a=ka(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(),i>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,Jn=null,Zi=null,Ur=null,qi=!1;function ja(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qi||Jn==null||Jn!==Bt(r)||(r=Jn,"selectionStart"in r&&Xi(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}),Ur&&Fr(Ur,r)||(Ur=r,r=zl(Zi,"onSelect"),0er||(e.current=co[er],co[er]=null,er--)}function ke(e,t){er++,co[er]=e.current,e.current=t}var pn={},et=fn(pn),ut=fn(!1),zn=pn;function tr(e,t){var n=e.type.contextTypes;if(!n)return pn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ct(e){return e=e.childContextTypes,e!=null}function Ml(){Se(ut),Se(et)}function Fa(e,t,n){if(et.current!==pn)throw Error(s(168));ke(et,t),ke(ut,n)}function Ua(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,fe(e)||"Unknown",l));return U({},n,r)}function Il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,zn=et.current,ke(et,e),ke(ut,ut.current),!0}function Ba(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=Ua(e,t,zn),r.__reactInternalMemoizedMergedChildContext=e,Se(ut),Se(et),ke(et,e)):Se(ut),ke(ut,n)}var Ht=null,Wl=!1,fo=!1;function Aa(e){Ht===null?Ht=[e]:Ht.push(e)}function gf(e){Wl=!0,Aa(e)}function hn(){if(!fo&&Ht!==null){fo=!0;var e=0,t=ye;try{var n=Ht;for(ye=1;e>=a,l-=a,Qt=1<<32-_t(t)+l|n<ee?(Ke=q,q=null):Ke=q.sibling;var me=z(x,q,w[ee],M);if(me===null){q===null&&(q=Ke);break}e&&q&&me.alternate===null&&t(x,q),v=i(me,v,ee),Z===null?J=me:Z.sibling=me,Z=me,q=Ke}if(ee===w.length)return n(x,q),Ce&&On(x,ee),J;if(q===null){for(;eeee?(Ke=q,q=null):Ke=q.sibling;var jn=z(x,q,me.value,M);if(jn===null){q===null&&(q=Ke);break}e&&q&&jn.alternate===null&&t(x,q),v=i(jn,v,ee),Z===null?J=jn:Z.sibling=jn,Z=jn,q=Ke}if(me.done)return n(x,q),Ce&&On(x,ee),J;if(q===null){for(;!me.done;ee++,me=w.next())me=O(x,me.value,M),me!==null&&(v=i(me,v,ee),Z===null?J=me:Z.sibling=me,Z=me);return Ce&&On(x,ee),J}for(q=r(x,q);!me.done;ee++,me=w.next())me=A(q,x,ee,me.value,M),me!==null&&(e&&me.alternate!==null&&q.delete(me.key===null?ee:me.key),v=i(me,v,ee),Z===null?J=me:Z.sibling=me,Z=me);return e&&q.forEach(function(Zf){return t(x,Zf)}),Ce&&On(x,ee),J}function We(x,v,w,M){if(typeof w=="object"&&w!==null&&w.type===Ee&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case oe:e:{for(var J=w.key,Z=v;Z!==null;){if(Z.key===J){if(J=w.type,J===Ee){if(Z.tag===7){n(x,Z.sibling),v=l(Z,w.props.children),v.return=x,x=v;break e}}else if(Z.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===Me&&Ya(J)===Z.type){n(x,Z.sibling),v=l(Z,w.props),v.ref=Qr(x,Z,w),v.return=x,x=v;break e}n(x,Z);break}else t(x,Z);Z=Z.sibling}w.type===Ee?(v=An(w.props.children,x.mode,M,w.key),v.return=x,x=v):(M=di(w.type,w.key,w.props,null,x.mode,M),M.ref=Qr(x,v,w),M.return=x,x=M)}return a(x);case pe:e:{for(Z=w.key;v!==null;){if(v.key===Z)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(x,v.sibling),v=l(v,w.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=us(w,x.mode,M),v.return=x,x=v}return a(x);case Me:return Z=w._init,We(x,v,Z(w._payload),M)}if($t(w))return Q(x,v,w,M);if(X(w))return Y(x,v,w,M);Al(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(x,v.sibling),v=l(v,w),v.return=x,x=v):(n(x,v),v=as(w,x.mode,M),v.return=x,x=v),a(x)):n(x,v)}return We}var ir=Ga(!0),Ja=Ga(!1),$l=fn(null),Vl=null,or=null,yo=null;function xo(){yo=or=Vl=null}function ko(e){var t=$l.current;Se($l),e._currentValue=t}function wo(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){Vl=e,yo=or=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(dt=!0),e.firstContext=null)}function St(e){var t=e._currentValue;if(yo!==e)if(e={context:e,memoizedValue:t,next:null},or===null){if(Vl===null)throw Error(s(308));or=e,Vl.dependencies={lanes:0,firstContext:e}}else or=or.next=e;return t}var Dn=null;function So(e){Dn===null?Dn=[e]:Dn.push(e)}function Xa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,So(t)):(n.next=l.next,l.next=n),t.interleaved=n,Yt(e,r)}function Yt(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 mn=!1;function jo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Za(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 Gt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(he&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Yt(e,n)}return l=r.interleaved,l===null?(t.next=t,So(r)):(t.next=l.next,l.next=t),r.interleaved=t,Yt(e,n)}function Hl(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,Ii(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=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};i===null?l=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,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 Ql(e,t,n,r){var l=e.updateQueue;mn=!1;var i=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?i=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(i!==null){var O=l.baseState;a=0,L=C=m=null,f=i;do{var z=f.lane,A=f.eventTime;if((r&z)===z){L!==null&&(L=L.next={eventTime:A,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var Q=e,Y=f;switch(z=t,A=n,Y.tag){case 1:if(Q=Y.payload,typeof Q=="function"){O=Q.call(A,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(A,O,z):Q,z==null)break e;O=U({},O,z);break e;case 2:mn=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,z=l.effects,z===null?l.effects=[f]:z.push(f))}else A={eventTime:A,lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},L===null?(C=L=A,m=O):L=L.next=A,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 i===null&&(l.shared.lanes=0);Wn|=a,e.lanes=a,e.memoizedState=O}}function ba(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Po.transition;Po.transition={};try{e(!1),t()}finally{ye=n,Po.transition=r}}function yu(){return jt().memoizedState}function wf(e,t,n){var r=kn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xu(e))ku(t,n);else if(n=Xa(e,t,n,r),n!==null){var l=st();Lt(n,e,r,l),wu(n,t,r)}}function Sf(e,t,n){var r=kn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xu(e))ku(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,f=i(a,n);if(l.hasEagerState=!0,l.eagerState=f,Nt(f,a)){var m=t.interleaved;m===null?(l.next=l,So(t)):(l.next=m.next,m.next=l),t.interleaved=l;return}}catch{}finally{}n=Xa(e,t,l,r),n!==null&&(l=st(),Lt(n,e,r,l),wu(n,t,r))}}function xu(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function ku(e,t){Jr=Gl=!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,Ii(e,n)}}var Zl={readContext:St,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},jf={readContext:St,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:cu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Jl(4194308,4,pu.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=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();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,Pe,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:au,useDebugValue:Mo,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=au(!1),t=e[0];return e=kf.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Pe,l=Wt();if(Ce){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Qe===null)throw Error(s(349));(In&30)!==0||ru(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,cu(iu.bind(null,r,i,e),[e]),r.flags|=2048,qr(9,lu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Wt(),t=Qe.identifierPrefix;if(Ce){var n=Kt,r=Qt;n=(r&~(1<<32-_t(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xr++,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[Mt]=t,e[Vr]=r,Au(e,t,!1,!1),t.stateNode=e;e:{switch(a=Fe(n,r),n){case"dialog":we("cancel",e),we("close",e),l=r;break;case"iframe":case"object":case"embed":we("load",e),l=r;break;case"video":case"audio":for(l=0;lfr&&(t.flags|=128,r=!0,br(i,!1),t.lanes=4194304)}else{if(!r)if(e=Kl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),br(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ce)return nt(t),null}else 2*Ie()-i.renderingStartTime>fr&&n!==1073741824&&(t.flags|=128,r=!0,br(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ie(),t.sibling=null,n=Ne.current,ke(Ne,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return is(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(yt&1073741824)!==0&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(s(156,t.tag))}function zf(e,t){switch(ho(t),t.tag){case 1:return ct(t.type)&&Ml(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ar(),Se(ut),Se(et),No(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Eo(t),null;case 13:if(Se(Ne),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(Ne),null;case 4:return ar(),null;case 10:return ko(t.type._context),null;case 22:case 23:return is(),null;case 24:return null;default:return null}}var ti=!1,rt=!1,Lf=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){Le(e,t,r)}else n.current=null}function Yo(e,t,n){try{n()}catch(r){Le(e,t,r)}}var Hu=!1;function Of(e,t){if(lo=wl,e=Sa(),Xi(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,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.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 A;O!==n||l!==0&&O.nodeType!==3||(f=a+l),O!==i||r!==0&&O.nodeType!==3||(m=a+r),O.nodeType===3&&(a+=O.nodeValue.length),(A=O.firstChild)!==null;)z=O,O=A;for(;;){if(O===e)break t;if(z===n&&++C===l&&(f=a),z===i&&++L===r&&(m=a),(A=O.nextSibling)!==null)break;O=z,z=O.parentNode}O=A}n=f===-1||m===-1?null:{start:f,end:m}}else n=null}n=n||{start:0,end:0}}else n=null;for(io={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,We=Q.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Tt(t.type,Y),We);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(M){Le(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return Q=Hu,Hu=!1,Q}function el(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 i=l.destroy;l.destroy=void 0,i!==void 0&&Yo(t,n,i)}l=l.next}while(l!==r)}}function ni(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 Go(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 Qu(e){var t=e.alternate;t!==null&&(e.alternate=null,Qu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mt],delete t[Vr],delete t[uo],delete t[mf],delete t[vf])),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 Ku(e){return e.tag===5||e.tag===3||e.tag===4}function Yu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ku(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 Jo(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=Ol));else if(r!==4&&(e=e.child,e!==null))for(Jo(e,t,n),e=e.sibling;e!==null;)Jo(e,t,n),e=e.sibling}function Xo(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(Xo(e,t,n),e=e.sibling;e!==null;)Xo(e,t,n),e=e.sibling}var Ge=null,Rt=!1;function gn(e,t,n){for(n=n.child;n!==null;)Gu(e,t,n),n=n.sibling}function Gu(e,t,n){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(ml,n)}catch{}switch(n.tag){case 5:rt||cr(n,t);case 6:var r=Ge,l=Rt;Ge=null,gn(e,t,n),Ge=r,Rt=l,Ge!==null&&(Rt?(e=Ge,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ge.removeChild(n.stateNode));break;case 18:Ge!==null&&(Rt?(e=Ge,n=n.stateNode,e.nodeType===8?ao(e.parentNode,n):e.nodeType===1&&ao(e,n),Lr(e)):ao(Ge,n.stateNode));break;case 4:r=Ge,l=Rt,Ge=n.stateNode.containerInfo,Rt=!0,gn(e,t,n),Ge=r,Rt=l;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,a=i.destroy;i=i.tag,a!==void 0&&((i&2)!==0||(i&4)!==0)&&Yo(n,t,a),l=l.next}while(l!==r)}gn(e,t,n);break;case 1:if(!rt&&(cr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Le(n,t,f)}gn(e,t,n);break;case 21:gn(e,t,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,gn(e,t,n),rt=r):gn(e,t,n);break;default:gn(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 Lf),t.forEach(function(r){var l=$f.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function zt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),r&=~i}if(r=l,r=Ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mf(r/1960))-r,10e?16:e,xn===null)var r=!1;else{if(e=xn,xn=null,si=0,(he&6)!==0)throw Error(s(331));var l=he;for(he|=4,V=e.current;V!==null;){var i=V,a=i.child;if((V.flags&16)!==0){var f=i.deletions;if(f!==null){for(var m=0;mIe()-bo?Un(e,0):qo|=n),pt(e,t)}function ac(e,t){t===0&&((e.mode&1)===0?t=1:(t=gl,gl<<=1,(gl&130023424)===0&&(gl=4194304)));var n=st();e=Yt(e,t),e!==null&&(Nr(e,t,n),pt(e,n))}function Af(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ac(e,n)}function $f(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),ac(e,n)}var uc;uc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)dt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return dt=!1,Tf(e,t,n);dt=(e.flags&131072)!==0}else dt=!1,Ce&&(t.flags&1048576)!==0&&$a(t,Ul,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ei(e,t),e=t.pendingProps;var l=tr(t,et.current);sr(t,n),l=Ro(null,t,r,e,l,n);var i=zo();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,ct(r)?(i=!0,Il(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,jo(t),l.updater=ql,t.stateNode=l,l._reactInternals=t,Wo(t,r,e,n),t=Ao(null,t,r,!0,i,n)):(t.tag=0,Ce&&i&&po(t),ot(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ei(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Hf(r),e=Tt(r,e),l){case 0:t=Bo(null,t,r,e,n);break e;case 1:t=Mu(null,t,r,e,n);break e;case 11:t=Ru(null,t,r,e,n);break e;case 14:t=zu(null,t,r,Tt(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:Tt(r,l),Bo(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Tt(r,l),Mu(e,t,r,l,n);case 3:e:{if(Iu(t),e===null)throw Error(s(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Za(e,t),Ql(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=ur(Error(s(423)),t),t=Wu(e,t,r,n,l);break e}else if(r!==l){l=ur(Error(s(424)),t),t=Wu(e,t,r,n,l);break e}else for(gt=dn(t.stateNode.containerInfo.firstChild),vt=t,Ce=!0,Pt=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=Jt(e,t,n);break e}ot(e,t,r,n)}t=t.child}return t;case 5:return eu(t),e===null&&vo(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,oo(r,l)?a=null:i!==null&&oo(r,i)&&(t.flags|=32),Du(e,t),ot(e,t,a,n),t.child;case 6:return e===null&&vo(t),null;case 13:return Fu(e,t,n);case 4:return Co(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ir(t,null,r,n):ot(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Tt(r,l),Ru(e,t,r,l,n);case 7:return ot(e,t,t.pendingProps,n),t.child;case 8:return ot(e,t,t.pendingProps.children,n),t.child;case 12:return ot(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,a=l.value,ke($l,r._currentValue),r._currentValue=a,i!==null)if(Nt(i.value,a)){if(i.children===l.children&&!ut.current){t=Jt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var f=i.dependencies;if(f!==null){a=i.child;for(var m=f.firstContext;m!==null;){if(m.context===r){if(i.tag===1){m=Gt(-1,n&-n),m.tag=2;var C=i.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}}i.lanes|=n,m=i.alternate,m!==null&&(m.lanes|=n),wo(i.return,n,t),f.lanes|=n;break}m=m.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(s(341));a.lanes|=n,f=a.alternate,f!==null&&(f.lanes|=n),wo(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}ot(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,ot(e,t,r,n),t.child;case 14:return r=t.type,l=Tt(r,t.pendingProps),l=Tt(r.type,l),zu(e,t,r,l,n);case 15:return Lu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Tt(r,l),ei(e,t),t.tag=1,ct(r)?(e=!0,Il(t)):e=!1,sr(t,n),ju(t,r,l),Wo(t,r,l,n),Ao(null,t,r,!0,e,n);case 19:return Bu(e,t,n);case 22:return Ou(e,t,n)}throw Error(s(156,t.tag))};function cc(e,t){return Vs(e,t)}function Vf(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 Vf(e,t,n,r)}function ss(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hf(e){if(typeof e=="function")return ss(e)?1:0;if(e!=null){if(e=e.$$typeof,e===De)return 11;if(e===be)return 14}return 2}function Sn(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 di(e,t,n,r,l,i){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 Ee:return An(n.children,l,i,t);case xe:a=8,l|=8;break;case Ze:return e=Et(12,n,t,l|2),e.elementType=Ze,e.lanes=i,e;case _e:return e=Et(13,n,t,l),e.elementType=_e,e.lanes=i,e;case Be:return e=Et(19,n,t,l),e.elementType=Be,e.lanes=i,e;case ge:return fi(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oe:a=10;break e;case qe:a=9;break e;case De:a=11;break e;case be:a=14;break e;case Me: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=i,t}function An(e,t,n,r){return e=Et(7,e,r,t),e.lanes=n,e}function fi(e,t,n,r){return e=Et(22,e,r,t),e.elementType=ge,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 Qf(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=Mi(0),this.expirationTimes=Mi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mi(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function cs(e,t,n,r,l,i,a,f,m){return e=new Qf(e,t,n,f,m),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Et(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jo(i),e}function Kf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(u){console.error(u)}}return o(),vs.exports=sp(),vs.exports}var Cc;function ap(){if(Cc)return xi;Cc=1;var o=Bc();return xi.createRoot=o.createRoot,xi.hydrateRoot=o.hydrateRoot,xi}var up=ap();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 cl(){return cl=Object.assign?Object.assign.bind():function(o){for(var u=1;u"u")throw new Error(u)}function Rs(o,u){if(!o){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function dp(){return Math.random().toString(36).substr(2,8)}function _c(o,u){return{usr:o.state,key:o.key,idx:u}}function Cs(o,u,s,d){return s===void 0&&(s=null),cl({pathname:typeof o=="string"?o:o.pathname,search:"",hash:""},typeof u=="string"?yr(u):u,{state:s,key:u&&u.key||d||dp()})}function ji(o){let{pathname:u="/",search:s="",hash:d=""}=o;return s&&s!=="?"&&(u+=s.charAt(0)==="?"?s:"?"+s),d&&d!=="#"&&(u+=d.charAt(0)==="#"?d:"#"+d),u}function yr(o){let u={};if(o){let s=o.indexOf("#");s>=0&&(u.hash=o.substr(s),o=o.substr(0,s));let d=o.indexOf("?");d>=0&&(u.search=o.substr(d),o=o.substr(0,d)),o&&(u.pathname=o)}return u}function fp(o,u,s,d){d===void 0&&(d={});let{window:p=document.defaultView,v5Compat:h=!1}=d,g=p.history,j=Cn.Pop,k=null,_=P();_==null&&(_=0,g.replaceState(cl({},g.state,{idx:_}),""));function P(){return(g.state||{idx:null}).idx}function N(){j=Cn.Pop;let E=P(),B=E==null?null:E-_;_=E,k&&k({action:j,location:T.location,delta:B})}function I(E,B){j=Cn.Push;let $=Cs(T.location,E,B);_=P()+1;let G=_c($,_),F=T.createHref($);try{g.pushState(G,"",F)}catch(oe){if(oe instanceof DOMException&&oe.name==="DataCloneError")throw oe;p.location.assign(F)}h&&k&&k({action:j,location:T.location,delta:1})}function H(E,B){j=Cn.Replace;let $=Cs(T.location,E,B);_=P();let G=_c($,_),F=T.createHref($);g.replaceState(G,"",F),h&&k&&k({action:j,location:T.location,delta:0})}function K(E){let B=p.location.origin!=="null"?p.location.origin:p.location.href,$=typeof E=="string"?E:ji(E);return $=$.replace(/ $/,"%20"),Te(B,"No window.location.(origin|href) available to create URL for href: "+$),new URL($,B)}let T={get action(){return j},get location(){return o(p,g)},listen(E){if(k)throw new Error("A history only accepts one active listener");return p.addEventListener(Ec,N),k=E,()=>{p.removeEventListener(Ec,N),k=null}},createHref(E){return u(p,E)},createURL:K,encodeLocation(E){let B=K(E);return{pathname:B.pathname,search:B.search,hash:B.hash}},push:I,replace:H,go(E){return g.go(E)}};return T}var Nc;(function(o){o.data="data",o.deferred="deferred",o.redirect="redirect",o.error="error"})(Nc||(Nc={}));function pp(o,u,s){return s===void 0&&(s="/"),hp(o,u,s)}function hp(o,u,s,d){let p=typeof u=="string"?yr(u):u,h=vr(p.pathname||"/",s);if(h==null)return null;let g=Ac(o);mp(g);let j=null,k=_p(h);for(let _=0;j==null&&_{let k={relativePath:j===void 0?h.path||"":j,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};k.relativePath.startsWith("/")&&(Te(k.relativePath.startsWith(d),'Absolute route path "'+k.relativePath+'" nested under path '+('"'+d+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),k.relativePath=k.relativePath.slice(d.length));let _=En([d,k.relativePath]),P=s.concat(k);h.children&&h.children.length>0&&(Te(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:Sp(_,h.index),routesMeta:P})};return o.forEach((h,g)=>{var j;if(h.path===""||!((j=h.path)!=null&&j.includes("?")))p(h,g);else for(let k of $c(h.path))p(h,g,k)}),u}function $c(o){let u=o.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(k=>k===""?h:[h,k].join("/"))),p&&j.push(...g),j.map(k=>o.startsWith("/")&&k===""?"/":k)}function mp(o){o.sort((u,s)=>u.score!==s.score?s.score-u.score:jp(u.routesMeta.map(d=>d.childrenIndex),s.routesMeta.map(d=>d.childrenIndex)))}const vp=/^:[\w-]+$/,gp=3,yp=2,xp=1,kp=10,wp=-2,Pc=o=>o==="*";function Sp(o,u){let s=o.split("/"),d=s.length;return s.some(Pc)&&(d+=wp),u&&(d+=yp),s.filter(p=>!Pc(p)).reduce((p,h)=>p+(vp.test(h)?gp:h===""?xp:kp),d)}function jp(o,u){return o.length===u.length&&o.slice(0,-1).every((d,p)=>d===u[p])?o[o.length-1]-u[u.length-1]:0}function Cp(o,u,s){let{routesMeta:d}=o,p={},h="/",g=[];for(let j=0;j{let{paramName:I,isOptional:H}=P;if(I==="*"){let T=j[N]||"";g=h.slice(0,h.length-T.length).replace(/(.)\/+$/,"$1")}const K=j[N];return H&&!K?_[I]=void 0:_[I]=(K||"").replace(/%2F/g,"/"),_},{}),pathname:h,pathnameBase:g,pattern:o}}function Ep(o,u,s){u===void 0&&(u=!1),s===void 0&&(s=!0),Rs(o==="*"||!o.endsWith("*")||o.endsWith("/*"),'Route path "'+o+'" will be treated as if it were '+('"'+o.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+o.replace(/\*$/,"/*")+'".'));let d=[],p="^"+o.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(g,j,k)=>(d.push({paramName:j,isOptional:k!=null}),k?"/?([^\\/]+)?":"/([^\\/]+)"));return o.endsWith("*")?(d.push({paramName:"*"}),p+=o==="*"||o==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?p+="\\/*$":o!==""&&o!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,u?void 0:"i"),d]}function _p(o){try{return o.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return Rs(!1,'The URL path "'+o+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),o}}function vr(o,u){if(u==="/")return o;if(!o.toLowerCase().startsWith(u.toLowerCase()))return null;let s=u.endsWith("/")?u.length-1:u.length,d=o.charAt(s);return d&&d!=="/"?null:o.slice(s)||"/"}const Np=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pp=o=>Np.test(o);function Tp(o,u){u===void 0&&(u="/");let{pathname:s,search:d="",hash:p=""}=typeof o=="string"?yr(o):o,h;if(s)if(Pp(s))h=s;else{if(s.includes("//")){let g=s;s=Vc(s),Rs(!1,"Pathnames cannot have embedded double slashes - normalizing "+(g+" -> "+s))}s.startsWith("/")?h=Tc(s.substring(1),"/"):h=Tc(s,u)}else h=u;return{pathname:h,search:Lp(d),hash:Op(p)}}function Tc(o,u){let s=u.replace(/\/+$/,"").split("/");return o.split("/").forEach(p=>{p===".."?s.length>1&&s.pop():p!=="."&&s.push(p)}),s.length>1?s.join("/"):"/"}function xs(o,u,s,d){return"Cannot include a '"+o+"' 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 Rp(o){return o.filter((u,s)=>s===0||u.route.path&&u.route.path.length>0)}function zs(o,u){let s=Rp(o);return u?s.map((d,p)=>p===s.length-1?d.pathname:d.pathnameBase):s.map(d=>d.pathnameBase)}function Ls(o,u,s,d){d===void 0&&(d=!1);let p;typeof o=="string"?p=yr(o):(p=cl({},o),Te(!p.pathname||!p.pathname.includes("?"),xs("?","pathname","search",p)),Te(!p.pathname||!p.pathname.includes("#"),xs("#","pathname","hash",p)),Te(!p.search||!p.search.includes("#"),xs("#","search","hash",p)));let h=o===""||p.pathname==="",g=h?"/":p.pathname,j;if(g==null)j=s;else{let N=u.length-1;if(!d&&g.startsWith("..")){let I=g.split("/");for(;I[0]==="..";)I.shift(),N-=1;p.pathname=I.join("/")}j=N>=0?u[N]:"/"}let k=Tp(p,j),_=g&&g!=="/"&&g.endsWith("/"),P=(h||g===".")&&s.endsWith("/");return!k.pathname.endsWith("/")&&(_||P)&&(k.pathname+="/"),k}const Vc=o=>o.replace(/\/\/+/g,"/"),En=o=>Vc(o.join("/")),zp=o=>o.replace(/\/+$/,"").replace(/^\/*/,"/"),Lp=o=>!o||o==="?"?"":o.startsWith("?")?o:"?"+o,Op=o=>!o||o==="#"?"":o.startsWith("#")?o:"#"+o;function Dp(o){return o!=null&&typeof o.status=="number"&&typeof o.statusText=="string"&&typeof o.internal=="boolean"&&"data"in o}const Hc=["post","put","patch","delete"];new Set(Hc);const Mp=["get",...Hc];new Set(Mp);/** * 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 dl(){return dl=Object.assign?Object.assign.bind():function(o){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=Ls(_,JSON.parse(g),h,P.relative==="path");o==null&&u!=="/"&&(N.pathname=N.pathname==="/"?u:En([u,N.pathname])),(P.replace?d.replace:d.push)(N,P.state,P)},[u,d,g,h,o])}function Ni(o,u){let{relative:s}=u===void 0?{}:u,{future:d}=S.useContext(Zt),{matches:p}=S.useContext(_n),{pathname:h}=kr(),g=JSON.stringify(zs(p,d.v7_relativeSplatPath));return S.useMemo(()=>Ls(o,JSON.parse(g),h,s==="path"),[o,g,h,s])}function Fp(o,u){return Up(o,u)}function Up(o,u,s,d){xr()||Te(!1);let{navigator:p}=S.useContext(Zt),{matches:h}=S.useContext(_n),g=h[h.length-1],j=g?g.params:{};g&&g.pathname;let k=g?g.pathnameBase:"/";g&&g.route;let _=kr(),P;if(u){var N;let E=typeof u=="string"?yr(u):u;k==="/"||(N=E.pathname)!=null&&N.startsWith(k)||Te(!1),P=E}else P=_;let I=P.pathname||"/",H=I;if(k!=="/"){let E=k.replace(/^\//,"").split("/");H="/"+I.replace(/^\//,"").split("/").slice(E.length).join("/")}let K=pp(o,{pathname:H}),T=Hp(K&&K.map(E=>Object.assign({},E,{params:Object.assign({},j,E.params),pathname:En([k,p.encodeLocation?p.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?k:En([k,p.encodeLocation?p.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),h,s,d);return u&&T?S.createElement(_i.Provider,{value:{location:dl({pathname:"/",search:"",hash:"",state:null,key:"default"},P),navigationType:Cn.Pop}},T):T}function Bp(){let o=Gp(),u=Dp(o)?o.status+" "+o.statusText:o instanceof Error?o.message:JSON.stringify(o),s=o instanceof Error?o.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 Ap=S.createElement(Bp,null);class $p 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(_n.Provider,{value:this.props.routeContext},S.createElement(Kc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Vp(o){let{routeContext:u,match:s,children:d}=o,p=S.useContext(Ei);return p&&p.static&&p.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=s.route.id),S.createElement(_n.Provider,{value:u},d)}function Hp(o,u,s,d){var p;if(u===void 0&&(u=[]),s===void 0&&(s=null),d===void 0&&(d=null),o==null){var h;if(!s)return null;if(s.errors)o=s.matches;else if((h=d)!=null&&h.v7_partialHydration&&u.length===0&&!s.initialized&&s.matches.length>0)o=s.matches;else return null}let g=o,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||Te(!1),g=g.slice(0,Math.min(g.length,P+1))}let k=!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,I)=>{let H,K=!1,T=null,E=null;s&&(H=j&&N.route.id?j[N.route.id]:void 0,T=N.route.errorElement||Ap,k&&(_<0&&I===0?(Xp("route-fallback"),K=!0,E=null):_===I&&(K=!0,E=N.route.hydrateFallbackElement||null)));let B=u.concat(g.slice(0,I+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(Vp,{match:N,routeContext:{outlet:P,matches:B,isDataRoute:s!=null},children:G})};return s&&(N.route.ErrorBoundary||N.route.errorElement||I===0)?S.createElement($p,{location:s.location,revalidation:s.revalidation,component:T,error:H,children:$(),routeContext:{outlet:null,matches:B,isDataRoute:!0}}):$()},null)}var Jc=(function(o){return o.UseBlocker="useBlocker",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o})(Jc||{}),Xc=(function(o){return o.UseBlocker="useBlocker",o.UseLoaderData="useLoaderData",o.UseActionData="useActionData",o.UseRouteError="useRouteError",o.UseNavigation="useNavigation",o.UseRouteLoaderData="useRouteLoaderData",o.UseMatches="useMatches",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o.UseRouteId="useRouteId",o})(Xc||{});function Qp(o){let u=S.useContext(Ei);return u||Te(!1),u}function Kp(o){let u=S.useContext(Qc);return u||Te(!1),u}function Yp(o){let u=S.useContext(_n);return u||Te(!1),u}function Zc(o){let u=Yp(),s=u.matches[u.matches.length-1];return s.route.id||Te(!1),s.route.id}function Gp(){var o;let u=S.useContext(Kc),s=Kp(),d=Zc();return u!==void 0?u:(o=s.errors)==null?void 0:o[d]}function Jp(){let{router:o}=Qp(Jc.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"?o.navigate(p):o.navigate(p,dl({fromRouteId:u},h)))},[o,u])}const Rc={};function Xp(o,u,s){Rc[o]||(Rc[o]=!0)}function Zp(o,u){o==null||o.v7_startTransition,o==null||o.v7_relativeSplatPath}function ks(o){let{to:u,replace:s,state:d,relative:p}=o;xr()||Te(!1);let{future:h,static:g}=S.useContext(Zt),{matches:j}=S.useContext(_n),{pathname:k}=kr(),_=Gc(),P=Ls(u,zs(j,h.v7_relativeSplatPath),k,p==="path"),N=JSON.stringify(P);return S.useEffect(()=>_(JSON.parse(N),{replace:s,state:d,relative:p}),[_,N,p,s,d]),null}function al(o){Te(!1)}function qp(o){let{basename:u="/",children:s=null,location:d,navigationType:p=Cn.Pop,navigator:h,static:g=!1,future:j}=o;xr()&&Te(!1);let k=u.replace(/^\/*/,"/"),_=S.useMemo(()=>({basename:k,navigator:h,static:g,future:dl({v7_relativeSplatPath:!1},j)}),[k,j,h,g]);typeof d=="string"&&(d=yr(d));let{pathname:P="/",search:N="",hash:I="",state:H=null,key:K="default"}=d,T=S.useMemo(()=>{let E=vr(P,k);return E==null?null:{location:{pathname:E,search:N,hash:I,state:H,key:K},navigationType:p}},[k,P,N,I,H,K,p]);return T==null?null:S.createElement(Zt.Provider,{value:_},S.createElement(_i.Provider,{children:s,value:T}))}function bp(o){let{children:u,location:s}=o;return Fp(_s(u),s)}new Promise(()=>{});function _s(o,u){u===void 0&&(u=[]);let s=[];return S.Children.forEach(o,(d,p)=>{if(!S.isValidElement(d))return;let h=[...u,p];if(d.type===S.Fragment){s.push.apply(s,_s(d.props.children,h));return}d.type!==al&&Te(!1),!d.props.index||!d.props.children||Te(!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=_s(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 Ci(){return Ci=Object.assign?Object.assign.bind():function(o){for(var u=1;u{_&&zc?zc(()=>k(N)):k(N)},[k,_]);return S.useLayoutEffect(()=>g.listen(P),[g,P]),S.useEffect(()=>Zp(d),[d]),S.createElement(qp,{basename:u,children:s,location:j.location,navigationType:j.action,navigator:g,future:d})}const ah=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ch=S.forwardRef(function(u,s){let{onClick:d,relative:p,reloadDocument:h,replace:g,state:j,target:k,to:_,preventScrollReset:P,viewTransition:N}=u,I=qc(u,nh),{basename:H}=S.useContext(Zt),K,T=!1;if(typeof _=="string"&&uh.test(_)&&(K=_,ah))try{let G=new URL(window.location.href),F=_.startsWith("//")?new URL(G.protocol+_):new URL(_),oe=vr(F.pathname,H);F.origin===G.origin&&oe!=null?_=oe+F.search+F.hash:T=!0}catch{}let E=Ip(_,{relative:p}),B=ph(_,{replace:g,state:j,target:k,preventScrollReset:P,relative:p,viewTransition:N});function $(G){d&&d(G),G.defaultPrevented||B(G)}return S.createElement("a",Ci({},I,{href:K||E,onClick:T||h?d:$,ref:s,target:k}))}),dh=S.forwardRef(function(u,s){let{"aria-current":d="page",caseSensitive:p=!1,className:h="",end:g=!1,style:j,to:k,viewTransition:_,children:P}=u,N=qc(u,rh),I=Ni(k,{relative:N.relative}),H=kr(),K=S.useContext(Qc),{navigator:T,basename:E}=S.useContext(Zt),B=K!=null&&hh(I)&&_===!0,$=T.encodeLocation?T.encodeLocation(I).pathname:I.pathname,G=H.pathname,F=K&&K.navigation&&K.navigation.location?K.navigation.location.pathname:null;p||(G=G.toLowerCase(),F=F?F.toLowerCase():null,$=$.toLowerCase()),F&&E&&(F=vr(F,E)||F);const oe=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let pe=G===$||!g&&G.startsWith($)&&G.charAt(oe)==="/",Ee=F!=null&&(F===$||!g&&F.startsWith($)&&F.charAt($.length)==="/"),xe={isActive:pe,isPending:Ee,isTransitioning:B},Ze=pe?d:void 0,Oe;typeof h=="function"?Oe=h(xe):Oe=[h,pe?"active":null,Ee?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let qe=typeof j=="function"?j(xe):j;return S.createElement(ch,Ci({},N,{"aria-current":Ze,className:Oe,ref:s,style:qe,to:k,viewTransition:_}),typeof P=="function"?P(xe):P)});var Ns;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(Ns||(Ns={}));var Lc;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(Lc||(Lc={}));function fh(o){let u=S.useContext(Ei);return u||Te(!1),u}function ph(o,u){let{target:s,replace:d,state:p,preventScrollReset:h,relative:g,viewTransition:j}=u===void 0?{}:u,k=Gc(),_=kr(),P=Ni(o,{relative:g});return S.useCallback(N=>{if(th(N,s)){N.preventDefault();let I=d!==void 0?d:ji(_)===ji(P);k(o,{replace:I,state:p,preventScrollReset:h,relative:g,viewTransition:j})}},[_,k,P,d,p,s,o,h,g,j])}function hh(o,u){u===void 0&&(u={});let s=S.useContext(ih);s==null&&Te(!1);let{basename:d}=fh(Ns.useViewTransitionState),p=Ni(o,{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 Es(p.pathname,g)!=null||Es(p.pathname,h)!=null}function mh(){if(window.matchMedia("(display-mode: standalone)").matches)return;const o=document.cookie.split(";").map(s=>s.trim()).find(s=>s.startsWith("hnf_inactivity_mins="));if(!o)return;const u=parseInt(o.split("=")[1]);return isNaN(u)||u<=0?void 0:u*60*1e3}const Oc={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"},vh={background:"var(--hk-green)",color:"#fff",border:"none",borderRadius:"6px",padding:"0.625rem",fontSize:"1rem",fontWeight:600,marginTop:"0.25rem",width:"100%"};function gh({children:o}){const[u,s]=S.useState("checking"),[d,p]=S.useState(null),[h,g]=S.useState(""),[j,k]=S.useState(""),[_,P]=S.useState(""),[N,I]=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=mh();if(u!=="authed"||!T)return;async function E(){await fetch("/api/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),p(null),s("login")}function B(){H.current&&clearTimeout(H.current),H.current=setTimeout(E,T)}const $=["mousemove","keydown","click","touchstart"];return $.forEach(G=>window.addEventListener(G,B,{passive:!0})),B(),()=>{H.current&&clearTimeout(H.current),$.forEach(G=>window.removeEventListener(G,B))}},[u]);async function K(T){T.preventDefault(),I(!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 B=await fetch("/api/auth/verify?app=hk-planner",{credentials:"include"});B.ok?(p(await B.json()),s("authed")):P("You don't have access to this app.")}catch{P("Connection error — please try again")}finally{I(!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:Oc}),c.jsx("input",{type:"password",value:j,onChange:T=>k(T.target.value),placeholder:"Password",required:!0,autoComplete:"current-password",style:Oc}),_&&c.jsx("p",{style:{color:"#f87171",fontSize:"0.875rem"},children:_}),c.jsx("button",{type:"submit",disabled:N,style:vh,children:N?"Signing in…":"Sign in"})]})]})}):c.jsx(c.Fragment,{children:o(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=(...o)=>o.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 yh=o=>o.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 xh=o=>o.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 Dc=o=>{const u=xh(o);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 ws={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 kh=o=>{for(const u in o)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1},wh=S.createContext({}),Sh=()=>S.useContext(wh),jh=S.forwardRef(({color:o,size:u,strokeWidth:s,absoluteStrokeWidth:d,className:p="",children:h,iconNode:g,...j},k)=>{const{size:_=24,strokeWidth:P=2,absoluteStrokeWidth:N=!1,color:I="currentColor",className:H=""}=Sh()??{},K=d??N?Number(s??P)*24/Number(u??_):s??P;return S.createElement("svg",{ref:k,...ws,width:u??_??ws.width,height:u??_??ws.height,stroke:o??I,strokeWidth:K,className:bc("lucide",H,p),...!h&&!kh(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 wr=(o,u)=>{const s=S.forwardRef(({className:d,...p},h)=>S.createElement(jh,{ref:h,iconNode:u,className:bc(`lucide-${yh(Dc(o))}`,`lucide-${o}`,d),...p}));return s.displayName=Dc(o),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 Ch=[["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"}]],Mc=wr("calendar-clock",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 Eh=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],ed=wr("clock",Eh);/** * @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=[["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"}]],Nh=wr("grip-vertical",_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:"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"}]],Th=wr("log-out",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 Rh=[["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"}]],Ps=wr("refresh-cw",Rh);/** * @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 zh=[["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"}]],Lh=wr("settings",zh);function Oh({visible:o}){return o?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(Ps,{size:14,strokeWidth:1.75}),"Reload"]})]}):null}const Dh=120*1e3;function Mh(o){const[u,s]=S.useState(!1);return S.useEffect(()=>{let d=null;async function p(){try{const j=await fetch(o,{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,Dh);function g(){document.visibilityState==="visible"&&p()}return document.addEventListener("visibilitychange",g),()=>{clearInterval(h),document.removeEventListener("visibilitychange",g)}},[o]),u}function td(o,u){return o.is_admin||o.caps.includes(u)}const Ih="width=1280",Wh="width=device-width, initial-scale=1.0";function Ic(o){const u=document.querySelector('meta[name="viewport"]');u&&(u.content=o)}function Fh(o){S.useEffect(()=>(Ic(Ih),window.parent.postMessage({type:"hnf:viewport",mode:o},"*"),()=>{Ic(Wh),window.parent.postMessage({type:"hnf:viewport",mode:"responsive"},"*")}),[o])}function Uh({user:o,children:u}){Fh("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(Mc,{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(Wc,{to:"/planner",icon:Mc,label:"Planner"}),td(o,"settings")&&c.jsx(Wc,{to:"/settings",icon:Lh,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:o.name}),c.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.72rem"},children:o.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(Th,{size:14,strokeWidth:1.75}),"Sign out"]})]})]}),c.jsx("main",{style:{flex:1,overflow:"auto",background:"var(--body-bg)"},children:u})]})}function Wc({to:o,icon:u,label:s}){return c.jsxs(dh,{to:o,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 Bh="/hk-planner/api";async function Ye(o,u){const s=await fetch(Bh+o,{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 Ah(o,u,s=!1){const d=new URLSearchParams;return o&&d.set("week_start",o),u&&d.set("last_viewed",u),s&&d.set("force_refresh","1"),Ye(`/bookings?${d}`)}function nd(){return Ye("/config")}function $h(o,u,s){return Ye("/config/time-requirements",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cat:o,action:u,value:s})})}function Vh(o){return Ye("/config/staff",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staff_data:o})})}function Hh(o){return Ye("/config/pickup",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pickup_data:o})})}function Qh(o){return Ye("/config/general-tasks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({general_tasks:o})})}function Kh(o){return Ye("/config/last-reviewed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:o})})}function Yh(){return Ye("/categories")}function Gh(o,u){return Ye("/categories",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:o,excluded:u})})}function Jh(){return Ye("/newbook/test",{method:"POST"})}function Xh(){return Ye("/workforce/departments")}function Zh(o){return Ye("/config/workforce-departments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dept_ids:o})})}function qh(o,u){return Ye(`/workforce/sync?start=${o}&end=${u}`,{method:"POST"})}function bh(o,u){return Ye(`/workforce/sync-timesheets?start=${o}&end=${u}`,{method:"POST"})}function Ss(o,u){return Ye(`/workforce/shifts?start=${o}&end=${u}`)}function em(){return Ye("/workforce/staff")}function tm(o){return Ye("/config/adjustments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({adjustments:o})})}function nm(o){return Ye("/config/warning-thresholds",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})}function ol(){const o=new Date;return`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`}function ki(o,u){const[s,d,p]=o.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 Pi(o){const u=new Date(o+"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 rm(o){const u=new Date(o+"T00:00:00");return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][(u.getDay()+6)%7]}function lm(o){const u=new Date(o+"T00:00:00");return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][u.getDay()]}function ul(o){const u=new Date(o+"T00:00:00").getDay();return u===0||u===6}function im(o,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 ${lm(o)}: ${u.prior_occ} occ (${u.prior_vac} vac) — ${p}`}function Fc(o){return new Date(o+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function Xe(o){return o.toFixed(2)+"h"}function gr(o,u,s,d,p){var _;const h=Math.max(0,p-d),g=(_=o[u])==null?void 0:_[s];if(!g||!g.count)return 0;const j=g.total-g.count,k=d>j?Math.max(0,g.total-d):g.count;return Math.min(k,h)}function om(o,u,s,d,p){const h={};for(const g of o.dates){const j=rm(g),k=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:k,adjustments:_,total:k+_,by_cat:{},pickup_by_cat:{}}}for(const g of o.categories){const j=u[g.id]||{depart:0,stay:0,arrive:0};o.dates.forEach((k,_)=>{const P=g.days[k],N=P.stays+P.arrivals,I=gr(s,g.id,k,N,g.total_rooms),H=(P.departs*(j.depart||0)+P.stays*(j.stay||0)+P.arrivals*(j.arrive||0))/60,K=I*(j.arrive||0)/60;h[k].by_cat[g.id]=H,h[k].pickup_by_cat[g.id]=(h[k].pickup_by_cat[g.id]||0)+K,h[k].booked+=H,h[k].pickup+=K,h[k].total+=H+K;const T=o.dates[_+1];if(T&&I>0){const E=I*(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 sm(){const[o,u]=S.useState(null),[s,d]=S.useState({}),[p,h]=S.useState([]),[g,j]=S.useState({}),[k,_]=S.useState([]),[P,N]=S.useState([]),[I,H]=S.useState(4),[K,T]=S.useState(1),[E,B]=S.useState(1),[$,G]=S.useState(2),[F,oe]=S.useState({}),[pe,Ee]=S.useState([]),[xe,Ze]=S.useState(!1),[Oe,qe]=S.useState(!1),[De,_e]=S.useState(null),[Be,be]=S.useState(""),[Me,ge]=S.useState(""),[W,X]=S.useState(!0),[U,y]=S.useState(""),[R,ne]=S.useState(null),re=S.useRef({}),se=S.useRef(null),ae=S.useRef(!1),fe=S.useRef(null);fe.current=De;function ue(te,ie,ve=400){clearTimeout(re.current[te]),re.current[te]=setTimeout(ie,ve)}function ce(te,ie=!1){se.current&&clearTimeout(se.current),ne({text:te,err:ie}),se.current=setTimeout(()=>ne(null),ie?15e3:2500)}function je(){const te=ol();te!==Me&&(ge(te),Kh(te).catch(()=>{}))}const lt=S.useCallback(async(te=!1,ie)=>{X(!0),y("");const ve=ol(),Re=fe.current||ve,it=ki(Re,6),at=ie!==void 0?ie||ki(ve,-1):Be||Me||ki(ve,-1);try{const[Ve,ze,D]=await Promise.all([Ah(Re,at,te),nd(),Ss(Re,it).catch(()=>({}))]);u(Ve),d(ze.time_requirements||{}),h(ze.staff_data||[]),j(ze.pickup_data||{}),_(ze.general_tasks||[]),N(ze.adjustments||[]),H(ze.warn_over_red_hrs??4),T(ze.warn_over_amber_hrs??1),B(ze.warn_under_amber_hrs??1),G(ze.warn_under_red_hrs??2),oe(D),ze.last_reviewed&&(ge(ze.last_reviewed),Be||be(ze.last_reviewed))}catch(Ve){y(Ve instanceof Error?Ve.message:"Failed to load data")}finally{X(!1)}},[Be,Me]);S.useEffect(()=>{lt(!1)},[]),S.useEffect(()=>{Object.keys(F).length>0&&!ae.current&&(ae.current=!0,em().then(Ee).catch(()=>{}))},[F]),S.useEffect(()=>{function te(ve,Re){fetch(ve,{method:"PUT",keepalive:!0,credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re)})}function ie(){p.length&&te("/hk-planner/api/config/staff",{staff_data:p}),Object.keys(g).length&&te("/hk-planner/api/config/pickup",{pickup_data:g}),P.length&&te("/hk-planner/api/config/adjustments",{adjustments:P})}return window.addEventListener("beforeunload",ie),()=>window.removeEventListener("beforeunload",ie)},[p,g,P]);function qt(te){const ie=ol(),ve=ki(fe.current||ie,te);fe.current=ve,_e(ve),je(),lt(!0)}function Bt(){fe.current=null,_e(null),je(),lt(!0)}function bt(){je(),lt(!0)}function Nn(te,ie,ve,Re){const it=Re.days[ie],at=it.stays+it.arrivals,Ve=Math.max(0,Re.total_rooms-at),ze=gr(g,te,ie,at,Re.total_rooms),D=Math.max(0,Math.min(ze+ve,Ve)),b={...g,[te]:{...g[te]||{},[ie]:{count:D,total:at+D}}};j(b),je(),ue("pickup",()=>Hh(b).then(()=>ce("Pickup saved")).catch(le=>ce(le.message,!0)))}function en(te){N(te),ue("adjustments",()=>tm(te).then(()=>ce("Adjustments saved")).catch(ie=>ce(ie.message,!0)))}function At(){en([...P,{label:"",hours:{}}])}function tn(te){h(te),je(),ue("staff",()=>Vh(te).then(()=>ce("Staff hours saved")).catch(ie=>ce(ie.message,!0)))}function nn(){tn([...p,{name:"",hours:{}}])}async function $t(){if(!o)return;const te=o.dates[0],ie=o.dates[o.dates.length-1];Ze(!0);try{await qh(te,ie);const ve=await Ss(te,ie);oe(ve),ce("Rota synced from Workforce")}catch(ve){ce(ve instanceof Error?ve.message:"Sync failed",!0)}finally{Ze(!1)}}async function Ot(){if(!o)return;const te=o.dates[0],ie=ol(),ve=o.dates[o.dates.length-1]>ie?ie:o.dates[o.dates.length-1];qe(!0);try{await bh(te,ve);const Re=await Ss(te,ve);oe(Re),ce("Timesheets pulled from Workforce")}catch(Re){ce(Re instanceof Error?Re.message:"Timesheet sync failed",!0)}finally{qe(!1)}}function Pn(){if(!o)return"";const te=o.dates.filter(Ve=>F[Ve]);if(!te.length)return"Not synced";const ie=te.reduce((Ve,ze)=>new Date(F[ze].synced_at)!F[Ve]).length?`Partial sync — from ${Re} ${it}`:`From ${Re} ${it}`}const rn=o?om(o,s,g,k,P):null,$n=ol(),Vn=De||$n;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"}),o&&c.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-mid)",marginTop:"0.1rem"},children:[Fc(o.dates[0])," – ",Fc(o.dates[o.dates.length-1])]})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginLeft:"auto",flexWrap:"wrap"},children:[c.jsx(hr,{onClick:()=>qt(-7),children:"‹ Prev"}),c.jsx(hr,{onClick:Bt,primary:!0,children:"Today"}),c.jsx(hr,{onClick:()=>qt(7),children:"Next ›"}),c.jsx("input",{type:"date",value:Vn,onChange:te=>{if(te.target.value){const ie=te.target.value;fe.current=ie,_e(ie),je(),ue("weekStart",()=>lt(!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:Be,onChange:te=>{if(te.target.value){const ie=te.target.value;be(ie),ue("lastViewed",()=>lt(!0,ie),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:()=>{je(),lt(!0)},children:"Update to now"}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsx("button",{onClick:bt,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(Ps,{size:13,strokeWidth:1.75,style:{animation:W?"spin 1s linear infinite":"none"}})})]})]}),c.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),R&&c.jsx("div",{style:{display:"inline-block",marginBottom:"0.75rem",padding:"0.35rem 0.75rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:500,background:R.err?"#fee2e2":"#dcfce7",color:R.err?"var(--danger)":"var(--success)"},children:R.text}),U&&c.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"#fee2e2",color:"var(--danger)",fontSize:"0.875rem"},children:["Error: ",U]}),W&&!o&&c.jsx("div",{style:{color:"var(--text-mid)",padding:"2rem 0",textAlign:"center"},children:"Loading bookings…"}),o&&rn&&c.jsxs(c.Fragment,{children:[c.jsx(wi,{title:"7-Day Occupancy",children:c.jsx("div",{className:"table-scroll",children:c.jsx(am,{bookings:o,pickup:g,onPickupChange:Nn})})}),c.jsx(wi,{title:"Required Hours",children:c.jsx("div",{className:"table-scroll",children:c.jsx(dm,{bookings:o,required:rn})})}),c.jsx(wi,{title:"Adjustments",action:c.jsx(hr,{onClick:At,children:"+ Add adjustment"}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(mm,{bookings:o,adjustments:P,onChange:en})})}),c.jsx(wi,{title:"Staff Rota",action:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[c.jsxs("button",{onClick:$t,disabled:xe||Oe,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(Ps,{size:11,strokeWidth:1.75,style:{animation:xe?"spin 1s linear infinite":"none"}}),xe?"Syncing…":"Sync rota"]}),c.jsxs("button",{onClick:Ot,disabled:xe||Oe,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(ed,{size:11,strokeWidth:1.75,style:{animation:Oe?"spin 1s linear infinite":"none"}}),Oe?"Pulling…":"Pull timesheets"]}),c.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:Pn()}),c.jsx(hr,{onClick:nn,children:"+ Add staff"})]}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(pm,{bookings:o,staff:p,required:rn,warnOverRed:I,warnOverAmber:K,warnUnderAmber:E,warnUnderRed:$,onChange:tn,wfShifts:F,wfStaff:pe})})})]})]})}function wi({title:o,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:o}),s]}),u]})}function hr({children:o,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:o})}function am({bookings:o,pickup:u,onPickupChange:s}){const{dates:d,categories:p}=o;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)",...ul(h)?{background:"#253555"}:{}},children:Pi(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:ul(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:ul(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(um,{cat:h,dates:d,pickup:u,onPickupChange:(k,_)=>s(h.id,k,_,h),isLast:j},h.id)})}),c.jsx("tfoot",{children:c.jsx(cm,{dates:d,cats:p,pickup:u})})]})}function um({cat:o,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:o.name}),u.map((g,j)=>{var oe;const k=o.days[g],_=k.stays+k.arrivals,P=Math.max(0,o.total_rooms-_),N=gr(s,o.id,g,_,o.total_rooms),I=u[j-1],H=I?o.days[I].stays+o.days[I].arrivals:0,K=I?gr(s,o.id,I,H,o.total_rooms):0,T=k.delta_new||0,E=k.delta_cancelled||0,B=ul(g),$=(oe=s[o.id])==null?void 0:oe[g],G=im(g,k);let F="";if($&&$.count){const pe=$.total-$.count,Ee=_>pe?"changed":"unchanged",xe=_>pe?"decreased":"remains";F=`+${$.count} pickup set when booked was ${pe} (target ${$.total}). Booked ${Ee}, so pickup ${xe}.`}return F=(F?F+" | ":"")+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)",...B?{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:F,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",...B?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[k.departs,"d",K>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",K]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[k.stays,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[k.arrivals,"a",N>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",N]})]})]},g+"-dsa")]})})]})}function cm({dates:o,cats:u,pickup:s}){return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontStyle:"italic"},children:"Total"}),o.map((d,p)=>{let h=0,g=0,j=0,k=0,_=0,P=0,N=0,I=0,H=0;for(const T of u){const E=T.days[d],B=E.stays+E.arrivals,$=Math.max(0,T.total_rooms-B),G=gr(s,T.id,d,B,T.total_rooms),F=o[p-1],oe=F?T.days[F].stays+T.days[F].arrivals:0,pe=F?gr(s,T.id,F,oe,T.total_rooms):0;h+=B,g+=$,j+=G,k+=pe,_+=E.departs,P+=E.stays,N+=E.arrivals,I+=E.delta_new||0,H+=E.delta_cancelled||0}const K=ul(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:[(I>0||H>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[I>0&&c.jsxs("span",{className:"delta-new",children:["▲",I]}),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",k>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",k]})]}),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 dm({bookings:o,required:u}){const{dates:s,categories:d}=o;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:Pi(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?"—":Xe(g),j>.001&&c.jsxs("span",{className:"pickup-tag",children:[" (+",Xe(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:Xe(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?Xe(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?Xe(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?"+":"")+Xe(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:[Xe(u[p].total),u[p].pickup>.001&&c.jsxs("span",{className:"pickup-tag",style:{display:"block",fontSize:"0.7rem"},children:["inc ",Xe(u[p].pickup)," pickup"]})]},p))]})]})]})}function fm(o,u){const s={};for(const d of u){const p=o[d];if(p)for(const h of p.staff)h.times==="?"&&h.hours===0||(s[h.id]||(s[h.id]={id:h.id,name:h.name,days:{}}),s[h.id].days[d]={hours:h.hours,times:h.times,status:h.status})}return Object.values(s).sort((d,p)=>d.name.localeCompare(p.name))}function pm({bookings:o,staff:u,required:s,warnOverRed:d,warnOverAmber:p,warnUnderAmber:h,warnUnderRed:g,onChange:j,wfShifts:k,wfStaff:_}){const{dates:P}=o;function N(T,E){const B=u.map(($,G)=>G===T?{...$,name:E}:$);j(B)}function I(T,E,B){const $=parseFloat(B),G=u.map((F,oe)=>{if(oe!==T)return F;const pe={...F.hours};return!isNaN($)&&$>=0?pe[E]=$:delete pe[E],{...F,hours:pe}});j(G)}function H(T){j(u.filter((E,B)=>B!==T))}const K=fm(k,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:Pi(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=>{var F;const B=T.days[E],$=((F=k[E])==null?void 0:F.source)==="timesheet",G=$&&(B==null?void 0:B.status)!=="APPROVED";return c.jsx("td",{style:{textAlign:"center",padding:"0.3rem 0.4rem",verticalAlign:"middle"},children:B?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:"0.68rem",color:"var(--text-mid)",lineHeight:1.25},children:B.times}),c.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.2rem"},children:[$&&c.jsx(ed,{size:10,strokeWidth:1.75,style:{color:G?"#d97706":"#1a7a4a",flexShrink:0}}),Xe(B.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:B=>N(E,B.target.value)})}),P.map(B=>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[B]??"",placeholder:"0",onChange:$=>I(E,B,$.target.value)})},B)),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 B=K.reduce((G,F)=>{var oe;return G+(((oe=F.days[E])==null?void 0:oe.hours)||0)},0),$=u.reduce((G,F)=>G+(F.hours[E]||0),0);T[E]=B+$}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:Xe(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(js,{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(js,{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(js,{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(hm,{available:T[E],required:s[E].total,warnOverRed:d,warnOverAmber:p,warnUnderAmber:h,warnUnderRed:g})},E)),c.jsx("td",{})]})]})})()})]})}function js({available:o,required:u,warnOverAmber:s,warnUnderAmber:d}){if(o===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const p=o-u,h=p>s?"⚠":p<-d?"✗":"✓";return c.jsxs("span",{style:{color:"var(--text-mid)",fontSize:"0.82rem"},children:[h," ",p>=0?"+":"",Xe(p)]})}function hm({available:o,required:u,warnOverRed:s,warnOverAmber:d,warnUnderAmber:p,warnUnderRed:h}){if(o===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const g=o-u;return g>s?c.jsxs("span",{className:"diff-over-red",children:["⚠ ",Xe(g)," spare"]}):g>d?c.jsxs("span",{className:"diff-over",children:["⚠ ",Xe(g)," spare"]}):g<-h?c.jsxs("span",{className:"diff-under",children:["✗ ",Xe(Math.abs(g))," short"]}):g<-p?c.jsxs("span",{className:"diff-under-amber",children:["✗ ",Xe(Math.abs(g))," short"]}):c.jsxs("span",{className:"diff-ok",children:["✓ ",g>=0?"+":"",Xe(g)]})}function mm({bookings:o,adjustments:u,onChange:s}){const{dates:d}=o;function p(j,k){s(u.map((_,P)=>P===j?{..._,label:k}:_))}function h(j,k,_){const P=parseFloat(_);s(u.map((N,I)=>{if(I!==j)return N;const H={...N.hours};return isNaN(P)?delete H[k]:H[k]=P,{...N,hours:H}}))}function g(j){s(u.filter((k,_)=>_!==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:Pi(j)},j)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsx("tbody",{children:u.map((j,k)=>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(k,_.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(k,_,P.target.value)})},_)),c.jsx("td",{children:c.jsx("button",{onClick:()=>g(k),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},k))}),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 k=u.reduce((_,P)=>_+(P.hours[j]||0),0);return c.jsx("td",{style:{color:k<0?"var(--danger)":k>0?"#1a7a4a":"var(--text-mid)",fontWeight:k!==0?600:void 0},children:k===0?"—":(k>0?"+":"")+Xe(k)},j)}),c.jsx("td",{})]})})]})}const Uc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function vm(){const[o,u]=S.useState([]),[s,d]=S.useState(!0),[p,h]=S.useState(!1),[g,j]=S.useState(!1),[k,_]=S.useState(""),[P,N]=S.useState(""),[I,H]=S.useState(null),[K,T]=S.useState([]),[E,B]=S.useState([]),[$,G]=S.useState(!0),[F,oe]=S.useState(""),[pe,Ee]=S.useState(!1),[xe,Ze]=S.useState(!1),[Oe,qe]=S.useState(""),[De,_e]=S.useState([]),[Be,be]=S.useState(!1),[Me,ge]=S.useState(""),[W,X]=S.useState(""),[U,y]=S.useState({}),[R,ne]=S.useState(""),[re,se]=S.useState(""),[ae,fe]=S.useState(4),[ue,ce]=S.useState(1),[je,lt]=S.useState(1),[qt,Bt]=S.useState(2),[bt,Nn]=S.useState(!1),[en,At]=S.useState(""),[tn,nn]=S.useState("");S.useEffect(()=>{Promise.all([Yh(),nd(),Xh().catch(D=>(D.message.includes("503")||D.message.toLowerCase().includes("not configured")?Ee(!0):oe(D.message),null))]).then(([D,b,le])=>{u(D.categories),_e(b.general_tasks||[]),y(b.time_requirements||{}),B(b.workforce_departments||[]),fe(b.warn_over_red_hrs??4),ce(b.warn_over_amber_hrs??1),lt(b.warn_under_amber_hrs??1),Bt(b.warn_under_red_hrs??2),le&&T(le),d(!1),G(!1)}).catch(D=>{_(D.message),d(!1),G(!1)})},[]);function $t(D){u(o.map((b,le)=>le===D?{...b,excluded:!b.excluded}:b))}function Ot(D,b){H(b),D.dataTransfer.effectAllowed="move"}function Pn(D,b){if(D.preventDefault(),I===null||I===b)return;const le=[...o],[Fe]=le.splice(I,1);le.splice(b,0,Fe),u(le),H(b)}function rn(){H(null)}async function $n(){h(!0),_(""),N("");try{await Gh(o.map(D=>D.id),o.filter(D=>D.excluded).map(D=>D.id)),N("Saved"),setTimeout(()=>N(""),2500)}catch(D){_(D instanceof Error?D.message:"Save failed")}finally{h(!1)}}async function Vn(){j(!0),_(""),N("");try{const D=await Jh();N(D.ok?`Connection OK: ${D.message||""}`:`Failed: ${D.error||"unknown"}`)}catch(D){_(D instanceof Error?D.message:"Test failed")}finally{j(!1)}}function te(D){B(b=>b.includes(D)?b.filter(le=>le!==D):[...b,D])}async function ie(){Ze(!0),oe(""),qe("");try{await Zh(E),qe("Departments saved"),setTimeout(()=>qe(""),2500)}catch(D){oe(D instanceof Error?D.message:"Save failed")}finally{Ze(!1)}}function ve(D,b){_e(De.map((le,Fe)=>Fe===D?{...le,name:b}:le))}function Re(D,b,le){const Fe=parseInt(le,10);_e(De.map((xt,Sr)=>Sr!==D?xt:{...xt,hours:{...xt.hours,[b]:isNaN(Fe)?0:Math.max(0,Fe)}}))}function it(D){_e(De.filter((b,le)=>le!==D))}async function at(){be(!0),X(""),ge("");try{await Qh(De),ge("Saved"),setTimeout(()=>ge(""),2500)}catch(D){X(D instanceof Error?D.message:"Save failed")}finally{be(!1)}}async function Ve(D,b,le){const Fe={...U,[D]:{...U[D]||{depart:0,stay:0,arrive:0},[b]:le}};y(Fe);try{await $h(D,b,le),ne("Saved"),setTimeout(()=>ne(""),1500)}catch(xt){se(xt instanceof Error?xt.message:"Save failed")}}async function ze(){Nn(!0),nn(""),At("");try{await nm({warn_over_red_hrs:ae,warn_over_amber_hrs:ue,warn_under_amber_hrs:je,warn_under_red_hrs:qt}),At("Saved"),setTimeout(()=>At(""),2500)}catch(D){nn(D instanceof Error?D.message:"Save failed")}finally{Nn(!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(sl,{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."}),k&&c.jsx(Ut,{type:"error",children:k}),P&&c.jsx(Ut,{type:"ok",children:P}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:o.map((D,b)=>c.jsxs("div",{draggable:!0,onDragStart:le=>Ot(le,b),onDragOver:le=>Pn(le,b),onDragEnd:rn,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 0.875rem",border:"1px solid var(--card-border)",borderRadius:"8px",background:D.excluded?"#f8fafc":"var(--card-bg)",opacity:I===b?.5:1},children:[c.jsx(Nh,{size:16,color:"var(--text-mid)",style:{cursor:"grab",flexShrink:0}}),c.jsx("span",{style:{flex:1,fontSize:"0.9rem",color:D.excluded?"var(--text-mid)":"var(--text-dark)",textDecoration:D.excluded?"line-through":"none"},children:D.name}),c.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",marginRight:"0.5rem"},children:[D.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:!D.excluded,onChange:()=>$t(b)}),"Active"]})]},D.id))}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(mr,{onClick:$n,disabled:p,primary:!0,children:p?"Saving…":"Save Order & Visibility"}),c.jsx(mr,{onClick:Vn,disabled:g,children:g?"Testing…":"Test Newbook Connection"})]}),c.jsx(Si,{}),c.jsx(sl,{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."}),pe&&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"}),"."]}),!pe&&$&&c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:"Loading departments…"}),!pe&&!$&&c.jsxs("div",{style:{marginBottom:"2.5rem"},children:[F&&c.jsx(Ut,{type:"error",children:F}),Oe&&c.jsx(Ut,{type:"ok",children:Oe}),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(D=>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(D.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(D.id),onChange:()=>te(D.id)}),D.name]},D.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:ie,disabled:xe,primary:!0,children:xe?"Saving…":"Save Departments"})]}),c.jsx(Si,{}),c.jsx(sl,{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(Ut,{type:"error",children:W}),Me&&c.jsx(Ut,{type:"ok",children:Me}),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(D=>c.jsx("th",{children:D},D)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[De.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:9,style:{color:"var(--text-mid)",textAlign:"center",padding:"1rem"},children:"No tasks yet"})}),De.map((D,b)=>c.jsxs("tr",{children:[c.jsx("td",{style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:D.name,placeholder:"Task name",onChange:le=>ve(b,le.target.value)})}),Uc.map(le=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:D.hours[le]||"",placeholder:"0",onChange:Fe=>Re(b,le,Fe.target.value)})},le)),c.jsx("td",{children:c.jsx("button",{onClick:()=>it(b),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},b))]})]})}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(mr,{onClick:()=>_e([...De,{name:"",hours:{}}]),children:"+ Add task"}),c.jsx(mr,{onClick:at,disabled:Be,primary:!0,children:Be?"Saving…":"Save Tasks"})]}),c.jsx(Si,{}),c.jsx(sl,{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(Ut,{type:"error",children:re}),R&&c.jsx(Ut,{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:o.filter(D=>!D.excluded).map(D=>{const b=U[D.id]||{depart:0,stay:0,arrive:0};return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:D.name}),["depart","stay","arrive"].map(le=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:b[le]||"",placeholder:"0",onChange:Fe=>Ve(D.id,le,parseInt(Fe.target.value,10)||0),onBlur:Fe=>Ve(D.id,le,parseInt(Fe.target.value,10)||0)})},le))]},D.id)})})]})}),c.jsx(Si,{}),c.jsx(sl,{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.'}),tn&&c.jsx(Ut,{type:"error",children:tn}),en&&c.jsx(Ut,{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:ae,set:fe,help:"default 4h"},{label:"⚠ Amber warning — spare over",value:ue,set:ce,help:"default 1h"},{label:"✗ Amber cross — short over",value:je,set:lt,help:"default 1h"},{label:"✗ Red cross — short over",value:qt,set:Bt,help:"default 2h"}].map(({label:D,value:b,set:le,help:Fe})=>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:D}),c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:24,step:.5,value:b,onChange:xt=>le(parseFloat(xt.target.value)||0),style:{width:"68px"}}),c.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",minWidth:"52px"},children:Fe})]},D))}),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:ze,disabled:bt,primary:!0,children:bt?"Saving…":"Save Thresholds"})})]})}function sl({title:o}){return c.jsx("h2",{style:{fontSize:"0.95rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"0.25rem"},children:o})}function Si(){return c.jsx("div",{style:{height:"1px",background:"var(--card-border)",margin:"0.5rem 0 2rem"}})}function Ut({type:o,children:u}){return c.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.75rem",borderRadius:"8px",fontSize:"0.875rem",background:o==="ok"?"#dcfce7":"#fee2e2",color:o==="ok"?"var(--success)":"var(--danger)"},children:u})}function mr({children:o,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:o})}function gm({user:o}){return c.jsx(Uh,{user:o,children:c.jsxs(bp,{children:[c.jsx(al,{path:"/",element:c.jsx(ks,{to:"/planner",replace:!0})}),c.jsx(al,{path:"/planner",element:c.jsx(sm,{})}),c.jsx(al,{path:"/settings",element:td(o,"settings")?c.jsx(vm,{}):c.jsx(ks,{to:"/planner",replace:!0})}),c.jsx(al,{path:"*",element:c.jsx(ks,{to:"/planner",replace:!0})})]})})}function ym(){const o=Mh("/hk-planner/health");return c.jsxs(c.Fragment,{children:[c.jsx(sh,{basename:"/hk-planner",children:c.jsx(gh,{children:u=>c.jsx(gm,{user:u})})}),c.jsx(Oh,{visible:o})]})}new URLSearchParams(window.location.search).has("install")&&window.addEventListener("beforeinstallprompt",o=>{o.preventDefault(),o.prompt()},{once:!0});up.createRoot(document.getElementById("root")).render(c.jsx(S.StrictMode,{children:c.jsx(ym,{})}));