diff --git a/frontend/dist/assets/index-BY6qKqNq.css b/frontend/dist/assets/index-B7_UXJgZ.css similarity index 60% rename from frontend/dist/assets/index-BY6qKqNq.css rename to frontend/dist/assets/index-B7_UXJgZ.css index cf65869..ad212a8 100644 --- a/frontend/dist/assets/index-BY6qKqNq.css +++ b/frontend/dist/assets/index-B7_UXJgZ.css @@ -1 +1 @@ -*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--navy: #1a1a2e;--navy-dark: #0f0f20;--gold: #c9a84c;--gold-light: #e8c96d;--surface: rgba(255,255,255,.07);--surface-2: rgba(255,255,255,.08);--text: rgba(255,255,255,.88);--text-muted: rgba(255,255,255,.48);--body-bg: #f4f5f7;--card-bg: #ffffff;--card-border: #e4e8ee;--text-dark: #1e293b;--text-mid: #64748b;--shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);--shadow-md: 0 4px 12px rgba(0,0,0,.08);--danger: #dc2626;--success: #16a34a;--warning: #d97706;--hk-green: #2d6a4f;--radius: 10px;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif}body{background:var(--body-bg);color:var(--text-dark);font-family:var(--font);min-height:100dvh}button{cursor:pointer;font-family:inherit}input,textarea,select{font-family:inherit}.hk-table{width:100%;border-collapse:collapse;font-size:.82rem;table-layout:fixed}.hk-table th{background:var(--navy);color:var(--text);padding:.45rem .5rem;text-align:center;font-weight:600;white-space:nowrap}.hk-table th.col-label{text-align:left;width:140px}.hk-table td{padding:.35rem .5rem;border-bottom:1px solid var(--card-border);text-align:center;vertical-align:middle}.hk-table td.col-label{text-align:left;font-weight:600;color:var(--text-dark);background:var(--card-bg)}.hk-table tfoot td{font-weight:600;background:#f8fafc}.row-depart{background:#fff8f0}.row-stay{background:#f0f7ff}.row-arrive{background:#f0fff5}.row-depart td,.row-stay td,.row-arrive td{border-bottom:none}.row-group-last td{border-bottom:2px solid var(--card-border)!important}.pickup-tag{color:var(--hk-green);font-size:.75rem;font-weight:600}.delta-new{color:var(--success);font-size:.72rem}.delta-canc{color:var(--danger);font-size:.72rem}.pickup-ctrl{display:flex;align-items:center;justify-content:center;gap:3px;margin-top:2px}.pickup-btn{background:none;border:1px solid var(--card-border);border-radius:3px;padding:0 5px;line-height:1.4;font-size:.8rem;color:var(--text-mid)}.pickup-btn:disabled{opacity:.35;cursor:not-allowed}.pickup-num{min-width:16px;text-align:center;font-size:.8rem;font-weight:600}.diff-ok{color:var(--success);font-weight:600}.diff-under{color:var(--danger);font-weight:600}.diff-over{color:var(--warning);font-weight:600}.hk-num-input{width:60px;border:1px solid var(--card-border);border-radius:4px;padding:.3rem .4rem;font-size:.82rem;text-align:center;background:var(--body-bg);color:var(--text-dark)}.hk-num-input:focus{outline:2px solid var(--hk-green);border-color:transparent}.hk-text-input{border:1px solid var(--card-border);border-radius:4px;padding:.3rem .5rem;font-size:.82rem;background:var(--body-bg);color:var(--text-dark);width:100%}.hk-text-input:focus{outline:2px solid var(--hk-green);border-color:transparent}.table-scroll{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--card-border);box-shadow:var(--shadow-sm)}.nav-scroll::-webkit-scrollbar,.sidebar::-webkit-scrollbar,.sidebar-nav::-webkit-scrollbar{width:4px}.nav-scroll::-webkit-scrollbar-track,.sidebar::-webkit-scrollbar-track,.sidebar-nav::-webkit-scrollbar-track{background:transparent}.nav-scroll::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb,.sidebar-nav::-webkit-scrollbar-thumb{background:#c9a84c59;border-radius:2px}.nav-scroll::-webkit-scrollbar-thumb:hover,.sidebar::-webkit-scrollbar-thumb:hover,.sidebar-nav::-webkit-scrollbar-thumb:hover{background:#c9a84ca6}.nav-scroll,.sidebar,.sidebar-nav{scrollbar-width:thin;scrollbar-color:rgba(201,168,76,.35) transparent} +*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--navy: #1a1a2e;--navy-dark: #0f0f20;--gold: #c9a84c;--gold-light: #e8c96d;--surface: rgba(255,255,255,.07);--surface-2: rgba(255,255,255,.08);--text: rgba(255,255,255,.88);--text-muted: rgba(255,255,255,.48);--body-bg: #f4f5f7;--card-bg: #ffffff;--card-border: #e4e8ee;--text-dark: #1e293b;--text-mid: #64748b;--shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);--shadow-md: 0 4px 12px rgba(0,0,0,.08);--danger: #dc2626;--success: #16a34a;--warning: #d97706;--hk-green: #2d6a4f;--radius: 10px;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif}body{background:var(--body-bg);color:var(--text-dark);font-family:var(--font);min-height:100dvh}button{cursor:pointer;font-family:inherit}input,textarea,select{font-family:inherit}.hk-table{width:100%;border-collapse:collapse;font-size:.82rem;table-layout:fixed}.hk-table th{background:var(--navy);color:var(--text);padding:.45rem .5rem;text-align:center;font-weight:600;white-space:nowrap}.hk-table th.col-label{text-align:left;width:140px}.hk-table td{padding:.35rem .5rem;border-bottom:1px solid var(--card-border);text-align:center;vertical-align:middle}.hk-table td.col-label{text-align:left;font-weight:600;color:var(--text-dark);background:var(--card-bg)}.hk-table tfoot td{font-weight:600;background:#f8fafc}.row-depart{background:#fff8f0}.row-stay{background:#f0f7ff}.row-arrive{background:#f0fff5}.row-depart td,.row-stay td,.row-arrive td{border-bottom:none}.row-group-last td{border-bottom:2px solid var(--card-border)!important}.pickup-tag{color:var(--hk-green);font-size:.75rem;font-weight:600}.delta-new{color:var(--success);font-size:.72rem}.delta-canc{color:var(--danger);font-size:.72rem}.pickup-ctrl{display:flex;align-items:center;justify-content:center;gap:3px;margin-top:2px}.pickup-btn{background:none;border:1px solid var(--card-border);border-radius:3px;padding:0 5px;line-height:1.4;font-size:.8rem;color:var(--text-mid)}.pickup-btn:disabled{opacity:.35;cursor:not-allowed}.pickup-num{min-width:16px;text-align:center;font-size:.8rem;font-weight:600}.diff-ok{color:var(--success);font-weight:600}.diff-under{color:var(--danger);font-weight:600}.diff-under-amber,.diff-over{color:var(--warning);font-weight:600}.diff-over-red{color:var(--danger);font-weight:600}.hk-num-input{width:60px;border:1px solid var(--card-border);border-radius:4px;padding:.3rem .4rem;font-size:.82rem;text-align:center;background:var(--body-bg);color:var(--text-dark)}.hk-num-input:focus{outline:2px solid var(--hk-green);border-color:transparent}.hk-text-input{border:1px solid var(--card-border);border-radius:4px;padding:.3rem .5rem;font-size:.82rem;background:var(--body-bg);color:var(--text-dark);width:100%}.hk-text-input:focus{outline:2px solid var(--hk-green);border-color:transparent}.table-scroll{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--card-border);box-shadow:var(--shadow-sm)}.nav-scroll::-webkit-scrollbar,.sidebar::-webkit-scrollbar,.sidebar-nav::-webkit-scrollbar{width:4px}.nav-scroll::-webkit-scrollbar-track,.sidebar::-webkit-scrollbar-track,.sidebar-nav::-webkit-scrollbar-track{background:transparent}.nav-scroll::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb,.sidebar-nav::-webkit-scrollbar-thumb{background:#c9a84c59;border-radius:2px}.nav-scroll::-webkit-scrollbar-thumb:hover,.sidebar::-webkit-scrollbar-thumb:hover,.sidebar-nav::-webkit-scrollbar-thumb:hover{background:#c9a84ca6}.nav-scroll,.sidebar,.sidebar-nav{scrollbar-width:thin;scrollbar-color:rgba(201,168,76,.35) transparent} diff --git a/frontend/dist/assets/index-CG3D4SXd.js b/frontend/dist/assets/index-CG3D4SXd.js new file mode 100644 index 0000000..65b7060 --- /dev/null +++ b/frontend/dist/assets/index-CG3D4SXd.js @@ -0,0 +1,127 @@ +function Xf(i,u){for(var a=0;ad[p]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))d(p);new MutationObserver(p=>{for(const m of p)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&d(g)}).observe(document,{childList:!0,subtree:!0});function a(p){const m={};return p.integrity&&(m.integrity=p.integrity),p.referrerPolicy&&(m.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?m.credentials="include":p.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function d(p){if(p.ep)return;p.ep=!0;const m=a(p);fetch(p.href,m)}})();function Zf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var cs={exports:{}},Gr={},ds={exports:{}},ae={};/** + * @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 hc;function qf(){if(hc)return ae;hc=1;var i=Symbol.for("react.element"),u=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),g=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),N=Symbol.iterator;function M(y){return y===null||typeof y!="object"?null:(y=N&&y[N]||y["@@iterator"],typeof y=="function"?y:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,R={};function C(y,T,ne){this.props=y,this.context=T,this.refs=R,this.updater=ne||H}C.prototype.isReactComponent={},C.prototype.setState=function(y,T){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,T,"setState")},C.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function A(){}A.prototype=C.prototype;function $(y,T,ne){this.props=y,this.context=T,this.refs=R,this.updater=ne||H}var G=$.prototype=new A;G.constructor=$,K(G,C.prototype),G.isPureReactComponent=!0;var B=Array.isArray,ue=Object.prototype.hasOwnProperty,de={current:null},je={key:!0,ref:!0,__self:!0,__source:!0};function xe(y,T,ne){var le,oe={},ie=null,ce=null;if(T!=null)for(le in T.ref!==void 0&&(ce=T.ref),T.key!==void 0&&(ie=""+T.key),T)ue.call(T,le)&&!je.hasOwnProperty(le)&&(oe[le]=T[le]);var se=arguments.length-2;if(se===1)oe.children=ne;else if(1>>1,T=F[y];if(0>>1;yp(oe,W))iep(ce,oe)?(F[y]=ce,F[ie]=W,y=ie):(F[y]=oe,F[le]=W,y=le);else if(iep(ce,W))F[y]=ce,F[ie]=W,y=ie;else break e}}return X}function p(F,X){var W=F.sortIndex-X.sortIndex;return W!==0?W:F.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var g=Date,w=g.now();i.unstable_now=function(){return g.now()-w}}var k=[],_=[],P=1,N=null,M=3,H=!1,K=!1,R=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(F){for(var X=a(_);X!==null;){if(X.callback===null)d(_);else if(X.startTime<=F)d(_),X.sortIndex=X.expirationTime,u(k,X);else break;X=a(_)}}function B(F){if(R=!1,G(F),!K)if(a(k)!==null)K=!0,Le(ue);else{var X=a(_);X!==null&&me(B,X.startTime-F)}}function ue(F,X){K=!1,R&&(R=!1,A(xe),xe=-1),H=!0;var W=M;try{for(G(X),N=a(k);N!==null&&(!(N.expirationTime>X)||F&&!He());){var y=N.callback;if(typeof y=="function"){N.callback=null,M=N.priorityLevel;var T=y(N.expirationTime<=X);X=i.unstable_now(),typeof T=="function"?N.callback=T:N===a(k)&&d(k),G(X)}else d(k);N=a(k)}if(N!==null)var ne=!0;else{var le=a(_);le!==null&&me(B,le.startTime-X),ne=!1}return ne}finally{N=null,M=W,H=!1}}var de=!1,je=null,xe=-1,Je=5,Me=-1;function He(){return!(i.unstable_now()-MeF||125y?(F.sortIndex=W,u(_,F),a(k)===null&&F===a(_)&&(R?(A(xe),xe=-1):R=!0,me(B,W-y))):(F.sortIndex=T,u(k,F),K||H||(K=!0,Le(ue))),F},i.unstable_shouldYield=He,i.unstable_wrapCallback=function(F){var X=M;return function(){var W=M;M=X;try{return F.apply(this,arguments)}finally{M=W}}}})(hs)),hs}var xc;function lp(){return xc||(xc=1,ps.exports=rp()),ps.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var kc;function op(){if(kc)return at;kc=1;var i=_s(),u=lp();function a(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 M(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 R(e,t,n,r,l,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new R(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new R(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new R(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new R(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){C[e]=new R(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new R(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new R(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new R(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new R(e,5,!1,e.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(A,$);C[t]=new R(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(A,$);C[t]=new R(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(A,$);C[t]=new R(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new R(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new R("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new R(e,1,!1,e.toLowerCase(),null,!0,!0)});function G(e,t,n,r){var l=C.hasOwnProperty(t)?C[t]:null;(l!==null?l.type!==0:r||!(2f||l[s]!==o[f]){var h=` +`+l[s].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=s&&0<=f);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function oe(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ie(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 je:return"Fragment";case de:return"Portal";case Je:return"Profiler";case xe:return"StrictMode";case Pe:return"Suspense";case We:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case He:return(e.displayName||"Context")+".Consumer";case Me:return(e._context.displayName||"Context")+".Provider";case Ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ge:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Le:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function ce(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 ie(t);case 8:return t===xe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ue(e){var t=fe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $t(e){e._valueTracker||(e._valueTracker=Ue(e))}function Mn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vt(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 Ht(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function In(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=se(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function yn(e,t){t=t.checked,t!=null&&G(e,"checked",t,!1)}function xn(e,t){yn(e,t);var n=se(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?I(e,t.type,n):t.hasOwnProperty("defaultValue")&&I(e,t.type,se(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function kn(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 I(e,t,n){(t!=="number"||Vt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ee=Array.isArray;function re(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=ct.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Sn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},nl=["Webkit","ms","Moz","O"];Object.keys(Yt).forEach(function(e){nl.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yt[t]=Yt[e]})});function rl(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yt.hasOwnProperty(e)&&Yt[e]?(""+t).trim():t+"px"}function Ts(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=rl(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ed=W({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 wo(e,t){if(t){if(ed[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function jo(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 Co=null;function Eo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _o=null,Fn=null,Wn=null;function zs(e){if(e=Dr(e)){if(typeof _o!="function")throw Error(a(280));var t=e.stateNode;t&&(t=_l(t),_o(e.stateNode,e.type,t))}}function Ls(e){Fn?Wn?Wn.push(e):Wn=[e]:Fn=e}function Os(){if(Fn){var e=Fn,t=Wn;if(Wn=Fn=null,zs(e),t)for(e=0;e>>=0,e===0?32:31-(dd(e)/fd|0)|0}var al=64,ul=4194304;function vr(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 cl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var f=s&~l;f!==0?r=vr(f):(o&=s,o!==0&&(r=vr(o)))}else s=n&~l,s!==0?r=vr(s):o!==0&&(r=vr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function gr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function vd(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=Er),sa=" ",aa=!1;function ua(e,t){switch(e){case"keyup":return Hd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ca(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function Kd(e,t){switch(e){case"compositionend":return ca(t);case"keypress":return t.which!==32?null:(aa=!0,sa);case"textInput":return e=t.data,e===sa&&aa?null:e;default:return null}}function Yd(e,t){if(An)return e==="compositionend"||!Ho&&ua(e,t)?(e=ta(),ml=Wo=qt=null,An=!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=ga(n)}}function xa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ka(){for(var e=window,t=Vt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vt(e.document)}return t}function Yo(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 nf(e){var t=ka(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xa(n.ownerDocument.documentElement,n)){if(r!==null&&Yo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=ya(n,o);var s=ya(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,$n=null,Jo=null,Rr=null,Go=!1;function Sa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Go||$n==null||$n!==Vt(r)||(r=$n,"selectionStart"in r&&Yo(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}),Rr&&Pr(Rr,r)||(Rr=r,r=jl(Jo,"onSelect"),0Yn||(e.current=si[Yn],si[Yn]=null,Yn--)}function ye(e,t){Yn++,si[Yn]=e.current,e.current=t}var nn={},Xe=tn(nn),rt=tn(!1),Cn=nn;function Jn(e,t){var n=e.type.contextTypes;if(!n)return nn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function lt(e){return e=e.childContextTypes,e!=null}function Nl(){Se(rt),Se(Xe)}function Ia(e,t,n){if(Xe.current!==nn)throw Error(a(168));ye(Xe,t),ye(rt,n)}function Fa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(a(108,ce(e)||"Unknown",l));return W({},n,r)}function Pl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,Cn=Xe.current,ye(Xe,e),ye(rt,rt.current),!0}function Wa(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=Fa(e,t,Cn),r.__reactInternalMemoizedMergedChildContext=e,Se(rt),Se(Xe),ye(Xe,e)):Se(rt),ye(rt,n)}var Dt=null,Rl=!1,ai=!1;function Ua(e){Dt===null?Dt=[e]:Dt.push(e)}function mf(e){Rl=!0,Ua(e)}function rn(){if(!ai&&Dt!==null){ai=!0;var e=0,t=ge;try{var n=Dt;for(ge=1;e>=s,l-=s,Mt=1<<32-St(t)+l|n<te?(Ve=q,q=null):Ve=q.sibling;var he=z(x,q,S[te],D);if(he===null){q===null&&(q=Ve);break}e&&q&&he.alternate===null&&t(x,q),v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he,q=Ve}if(te===S.length)return n(x,q),we&&_n(x,te),J;if(q===null){for(;tete?(Ve=q,q=null):Ve=q.sibling;var pn=z(x,q,he.value,D);if(pn===null){q===null&&(q=Ve);break}e&&q&&pn.alternate===null&&t(x,q),v=o(pn,v,te),Z===null?J=pn:Z.sibling=pn,Z=pn,q=Ve}if(he.done)return n(x,q),we&&_n(x,te),J;if(q===null){for(;!he.done;te++,he=S.next())he=O(x,he.value,D),he!==null&&(v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he);return we&&_n(x,te),J}for(q=r(x,q);!he.done;te++,he=S.next())he=U(q,x,te,he.value,D),he!==null&&(e&&he.alternate!==null&&q.delete(he.key===null?te:he.key),v=o(he,v,te),Z===null?J=he:Z.sibling=he,Z=he);return e&&q.forEach(function(Gf){return t(x,Gf)}),we&&_n(x,te),J}function ze(x,v,S,D){if(typeof S=="object"&&S!==null&&S.type===je&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case ue:e:{for(var J=S.key,Z=v;Z!==null;){if(Z.key===J){if(J=S.type,J===je){if(Z.tag===7){n(x,Z.sibling),v=l(Z,S.props.children),v.return=x,x=v;break e}}else if(Z.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===Le&&Qa(J)===Z.type){n(x,Z.sibling),v=l(Z,S.props),v.ref=Mr(x,Z,S),v.return=x,x=v;break e}n(x,Z);break}else t(x,Z);Z=Z.sibling}S.type===je?(v=Dn(S.props.children,x.mode,D,S.key),v.return=x,x=v):(D=ro(S.type,S.key,S.props,null,x.mode,D),D.ref=Mr(x,v,S),D.return=x,x=D)}return s(x);case de:e:{for(Z=S.key;v!==null;){if(v.key===Z)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){n(x,v.sibling),v=l(v,S.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=os(S,x.mode,D),v.return=x,x=v}return s(x);case Le:return Z=S._init,ze(x,v,Z(S._payload),D)}if(ee(S))return Q(x,v,S,D);if(X(S))return Y(x,v,S,D);Ol(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(n(x,v.sibling),v=l(v,S),v.return=x,x=v):(n(x,v),v=ls(S,x.mode,D),v.return=x,x=v),s(x)):n(x,v)}return ze}var qn=Ka(!0),Ya=Ka(!1),Dl=tn(null),Ml=null,bn=null,hi=null;function mi(){hi=bn=Ml=null}function vi(e){var t=Dl.current;Se(Dl),e._currentValue=t}function gi(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 er(e,t){Ml=e,hi=bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ot=!0),e.firstContext=null)}function gt(e){var t=e._currentValue;if(hi!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(Ml===null)throw Error(a(308));bn=e,Ml.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var Nn=null;function yi(e){Nn===null?Nn=[e]:Nn.push(e)}function Ja(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,yi(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ft(e,r)}function Ft(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 ln=!1;function xi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ga(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 Wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function on(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ft(e,n)}return l=r.interleaved,l===null?(t.next=t,yi(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ft(e,n)}function Il(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,Oo(e,n)}}function Xa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Fl(e,t,n,r){var l=e.updateQueue;ln=!1;var o=l.firstBaseUpdate,s=l.lastBaseUpdate,f=l.shared.pending;if(f!==null){l.shared.pending=null;var h=f,j=h.next;h.next=null,s===null?o=j:s.next=j,s=h;var L=e.alternate;L!==null&&(L=L.updateQueue,f=L.lastBaseUpdate,f!==s&&(f===null?L.firstBaseUpdate=j:f.next=j,L.lastBaseUpdate=h))}if(o!==null){var O=l.baseState;s=0,L=j=h=null,f=o;do{var z=f.lane,U=f.eventTime;if((r&z)===z){L!==null&&(L=L.next={eventTime:U,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var Q=e,Y=f;switch(z=t,U=n,Y.tag){case 1:if(Q=Y.payload,typeof Q=="function"){O=Q.call(U,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(U,O,z):Q,z==null)break e;O=W({},O,z);break e;case 2:ln=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,z=l.effects,z===null?l.effects=[f]:z.push(f))}else U={eventTime:U,lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},L===null?(j=L=U,h=O):L=L.next=U,s|=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&&(h=O),l.baseState=h,l.firstBaseUpdate=j,l.lastBaseUpdate=L,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Tn|=s,e.lanes=s,e.memoizedState=O}}function Za(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ci.transition;Ci.transition={};try{e(!1),t()}finally{ge=n,Ci.transition=r}}function vu(){return yt().memoizedState}function xf(e,t,n){var r=cn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gu(e))yu(t,n);else if(n=Ja(e,t,n,r),n!==null){var l=tt();Nt(n,e,r,l),xu(n,t,r)}}function kf(e,t,n){var r=cn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gu(e))yu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,f=o(s,n);if(l.hasEagerState=!0,l.eagerState=f,wt(f,s)){var h=t.interleaved;h===null?(l.next=l,yi(t)):(l.next=h.next,h.next=l),t.interleaved=l;return}}catch{}finally{}n=Ja(e,t,l,r),n!==null&&(l=tt(),Nt(n,e,r,l),xu(n,t,r))}}function gu(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function yu(e,t){Ur=Bl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Oo(e,n)}}var Vl={readContext:gt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},Sf={readContext:gt,useCallback:function(e,t){return zt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:au,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Al(4194308,4,du.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=zt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zt();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=xf.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=zt();return e={current:e},t.memoizedState=e},useState:iu,useDebugValue:zi,useDeferredValue:function(e){return zt().memoizedState=e},useTransition:function(){var e=iu(!1),t=e[0];return e=yf.bind(null,e[1]),zt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,l=zt();if(we){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),$e===null)throw Error(a(349));(Rn&30)!==0||tu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,au(ru.bind(null,r,o,e),[e]),r.flags|=2048,$r(9,nu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=zt(),t=$e.identifierPrefix;if(we){var n=It,r=Mt;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Br++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Rt]=t,e[Or]=r,Uu(e,t,!1,!1),t.stateNode=e;e:{switch(s=jo(n,r),n){case"dialog":ke("cancel",e),ke("close",e),l=r;break;case"iframe":case"object":case"embed":ke("load",e),l=r;break;case"video":case"audio":for(l=0;lor&&(t.flags|=128,r=!0,Vr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Wl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Vr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!we)return qe(t),null}else 2*Te()-o.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,Vr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Te(),t.sibling=null,n=Ee.current,ye(Ee,r?n&1|2:n&1),t):(qe(t),null);case 22:case 23:return ts(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ht&1073741824)!==0&&(qe(t),t.subtreeFlags&6&&(t.flags|=8192)):qe(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Rf(e,t){switch(ci(t),t.tag){case 1:return lt(t.type)&&Nl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tr(),Se(rt),Se(Xe),ji(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Si(t),null;case 13:if(Se(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Se(Ee),null;case 4:return tr(),null;case 10:return vi(t.type._context),null;case 22:case 23:return ts(),null;case 24:return null;default:return null}}var Yl=!1,be=!1,Tf=typeof WeakSet=="function"?WeakSet:Set,V=null;function rr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Re(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){Re(e,t,r)}}var $u=!1;function zf(e,t){if(ti=pl,e=ka(),Yo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,f=-1,h=-1,j=0,L=0,O=e,z=null;t:for(;;){for(var U;O!==n||l!==0&&O.nodeType!==3||(f=s+l),O!==o||r!==0&&O.nodeType!==3||(h=s+r),O.nodeType===3&&(s+=O.nodeValue.length),(U=O.firstChild)!==null;)z=O,O=U;for(;;){if(O===e)break t;if(z===n&&++j===l&&(f=s),z===o&&++L===r&&(h=s),(U=O.nextSibling)!==null)break;O=z,z=O.parentNode}O=U}n=f===-1||h===-1?null:{start:f,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(ni={focusedElem:e,selectionRange:n},pl=!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,ze=Q.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?Y:Ct(t.type,Y),ze);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(D){Re(t,t.return,D)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return Q=$u,$u=!1,Q}function Hr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Vi(t,n,o)}l=l.next}while(l!==r)}}function Jl(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 Hi(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 Vu(e){var t=e.alternate;t!==null&&(e.alternate=null,Vu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Rt],delete t[Or],delete t[ii],delete t[pf],delete t[hf])),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 Hu(e){return e.tag===5||e.tag===3||e.tag===4}function Qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hu(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 Qi(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=El));else if(r!==4&&(e=e.child,e!==null))for(Qi(e,t,n),e=e.sibling;e!==null;)Qi(e,t,n),e=e.sibling}function Ki(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(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}var Qe=null,Et=!1;function sn(e,t,n){for(n=n.child;n!==null;)Ku(e,t,n),n=n.sibling}function Ku(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(sl,n)}catch{}switch(n.tag){case 5:be||rr(n,t);case 6:var r=Qe,l=Et;Qe=null,sn(e,t,n),Qe=r,Et=l,Qe!==null&&(Et?(e=Qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qe.removeChild(n.stateNode));break;case 18:Qe!==null&&(Et?(e=Qe,n=n.stateNode,e.nodeType===8?oi(e.parentNode,n):e.nodeType===1&&oi(e,n),wr(e)):oi(Qe,n.stateNode));break;case 4:r=Qe,l=Et,Qe=n.stateNode.containerInfo,Et=!0,sn(e,t,n),Qe=r,Et=l;break;case 0:case 11:case 14:case 15:if(!be&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,s=o.destroy;o=o.tag,s!==void 0&&((o&2)!==0||(o&4)!==0)&&Vi(n,t,s),l=l.next}while(l!==r)}sn(e,t,n);break;case 1:if(!be&&(rr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Re(n,t,f)}sn(e,t,n);break;case 21:sn(e,t,n);break;case 22:n.mode&1?(be=(r=be)||n.memoizedState!==null,sn(e,t,n),be=r):sn(e,t,n);break;default:sn(e,t,n)}}function Yu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Tf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function _t(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~o}if(r=l,r=Te()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Of(r/1960))-r,10e?16:e,un===null)var r=!1;else{if(e=un,un=null,bl=0,(pe&6)!==0)throw Error(a(331));var l=pe;for(pe|=4,V=e.current;V!==null;){var o=V,s=o.child;if((V.flags&16)!==0){var f=o.deletions;if(f!==null){for(var h=0;hTe()-Gi?Ln(e,0):Ji|=n),st(e,t)}function ic(e,t){t===0&&((e.mode&1)===0?t=1:(t=ul,ul<<=1,(ul&130023424)===0&&(ul=4194304)));var n=tt();e=Ft(e,t),e!==null&&(gr(e,t,n),st(e,n))}function Uf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ic(e,n)}function Bf(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(a(314))}r!==null&&r.delete(t),ic(e,n)}var sc;sc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)ot=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ot=!1,Nf(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&Ba(t,zl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Kl(e,t),e=t.pendingProps;var l=Jn(t,Xe.current);er(t,n),l=_i(null,t,r,e,l,n);var o=Ni();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,lt(r)?(o=!0,Pl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,xi(t),l.updater=Hl,t.stateNode=l,l._reactInternals=t,Oi(t,r,e,n),t=Fi(null,t,r,!0,o,n)):(t.tag=0,we&&o&&ui(t),et(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Kl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=$f(r),e=Ct(r,e),l){case 0:t=Ii(null,t,r,e,n);break e;case 1:t=Ou(null,t,r,e,n);break e;case 11:t=Pu(null,t,r,e,n);break e;case 14:t=Ru(null,t,r,Ct(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ou(e,t,r,l,n);case 3:e:{if(Du(t),e===null)throw Error(a(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ga(e,t),Fl(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=nr(Error(a(423)),t),t=Mu(e,t,r,n,l);break e}else if(r!==l){l=nr(Error(a(424)),t),t=Mu(e,t,r,n,l);break e}else for(pt=en(t.stateNode.containerInfo.firstChild),ft=t,we=!0,jt=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zn(),r===l){t=Ut(e,t,n);break e}et(e,t,r,n)}t=t.child}return t;case 5:return qa(t),e===null&&fi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,ri(r,l)?s=null:o!==null&&ri(r,o)&&(t.flags|=32),Lu(e,t),et(e,t,s,n),t.child;case 6:return e===null&&fi(t),null;case 13:return Iu(e,t,n);case 4:return ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qn(t,null,r,n):et(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Pu(e,t,r,l,n);case 7:return et(e,t,t.pendingProps,n),t.child;case 8:return et(e,t,t.pendingProps.children,n),t.child;case 12:return et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,ye(Dl,r._currentValue),r._currentValue=s,o!==null)if(wt(o.value,s)){if(o.children===l.children&&!rt.current){t=Ut(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){s=o.child;for(var h=f.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Wt(-1,n&-n),h.tag=2;var j=o.updateQueue;if(j!==null){j=j.shared;var L=j.pending;L===null?h.next=h:(h.next=L.next,L.next=h),j.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),gi(o.return,n,t),f.lanes|=n;break}h=h.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(a(341));s.lanes|=n,f=s.alternate,f!==null&&(f.lanes|=n),gi(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}et(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,er(t,n),l=gt(l),r=r(l),t.flags|=1,et(e,t,r,n),t.child;case 14:return r=t.type,l=Ct(r,t.pendingProps),l=Ct(r.type,l),Ru(e,t,r,l,n);case 15:return Tu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Kl(e,t),t.tag=1,lt(r)?(e=!0,Pl(t)):e=!1,er(t,n),Su(t,r,l),Oi(t,r,l,n),Fi(null,t,r,!0,e,n);case 19:return Wu(e,t,n);case 22:return zu(e,t,n)}throw Error(a(156,t.tag))};function ac(e,t){return As(e,t)}function Af(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 kt(e,t,n,r){return new Af(e,t,n,r)}function rs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $f(e){if(typeof e=="function")return rs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===Ge)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=kt(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 ro(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")rs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case je:return Dn(n.children,l,o,t);case xe:s=8,l|=8;break;case Je:return e=kt(12,n,t,l|2),e.elementType=Je,e.lanes=o,e;case Pe:return e=kt(13,n,t,l),e.elementType=Pe,e.lanes=o,e;case We:return e=kt(19,n,t,l),e.elementType=We,e.lanes=o,e;case me:return lo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Me:s=10;break e;case He:s=9;break e;case Ce:s=11;break e;case Ge:s=14;break e;case Le:s=16,r=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=kt(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Dn(e,t,n,r){return e=kt(7,e,r,t),e.lanes=n,e}function lo(e,t,n,r){return e=kt(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function ls(e,t,n){return e=kt(6,e,null,t),e.lanes=n,e}function os(e,t,n){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vf(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=Lo(0),this.expirationTimes=Lo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function is(e,t,n,r,l,o,s,f,h){return e=new Vf(e,t,n,f,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=kt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xi(o),e}function Hf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(u){console.error(u)}}return i(),fs.exports=op(),fs.exports}var wc;function ip(){if(wc)return fo;wc=1;var i=Wc();return fo.createRoot=i.createRoot,fo.hydrateRoot=i.hydrateRoot,fo}var sp=ip();Wc();/** + * @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 br(){return br=Object.assign?Object.assign.bind():function(i){for(var u=1;u"u")throw new Error(u)}function Ns(i,u){if(!i){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function up(){return Math.random().toString(36).substr(2,8)}function Cc(i,u){return{usr:i.state,key:i.key,idx:u}}function Ss(i,u,a,d){return a===void 0&&(a=null),br({pathname:typeof i=="string"?i:i.pathname,search:"",hash:""},typeof u=="string"?cr(u):u,{state:a,key:u&&u.key||d||up()})}function vo(i){let{pathname:u="/",search:a="",hash:d=""}=i;return a&&a!=="?"&&(u+=a.charAt(0)==="?"?a:"?"+a),d&&d!=="#"&&(u+=d.charAt(0)==="#"?d:"#"+d),u}function cr(i){let u={};if(i){let a=i.indexOf("#");a>=0&&(u.hash=i.substr(a),i=i.substr(0,a));let d=i.indexOf("?");d>=0&&(u.search=i.substr(d),i=i.substr(0,d)),i&&(u.pathname=i)}return u}function cp(i,u,a,d){d===void 0&&(d={});let{window:p=document.defaultView,v5Compat:m=!1}=d,g=p.history,w=mn.Pop,k=null,_=P();_==null&&(_=0,g.replaceState(br({},g.state,{idx:_}),""));function P(){return(g.state||{idx:null}).idx}function N(){w=mn.Pop;let C=P(),A=C==null?null:C-_;_=C,k&&k({action:w,location:R.location,delta:A})}function M(C,A){w=mn.Push;let $=Ss(R.location,C,A);_=P()+1;let G=Cc($,_),B=R.createHref($);try{g.pushState(G,"",B)}catch(ue){if(ue instanceof DOMException&&ue.name==="DataCloneError")throw ue;p.location.assign(B)}m&&k&&k({action:w,location:R.location,delta:1})}function H(C,A){w=mn.Replace;let $=Ss(R.location,C,A);_=P();let G=Cc($,_),B=R.createHref($);g.replaceState(G,"",B),m&&k&&k({action:w,location:R.location,delta:0})}function K(C){let A=p.location.origin!=="null"?p.location.origin:p.location.href,$=typeof C=="string"?C:vo(C);return $=$.replace(/ $/,"%20"),Ne(A,"No window.location.(origin|href) available to create URL for href: "+$),new URL($,A)}let R={get action(){return w},get location(){return i(p,g)},listen(C){if(k)throw new Error("A history only accepts one active listener");return p.addEventListener(jc,N),k=C,()=>{p.removeEventListener(jc,N),k=null}},createHref(C){return u(p,C)},createURL:K,encodeLocation(C){let A=K(C);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:M,replace:H,go(C){return g.go(C)}};return R}var Ec;(function(i){i.data="data",i.deferred="deferred",i.redirect="redirect",i.error="error"})(Ec||(Ec={}));function dp(i,u,a){return a===void 0&&(a="/"),fp(i,u,a)}function fp(i,u,a,d){let p=typeof u=="string"?cr(u):u,m=ar(p.pathname||"/",a);if(m==null)return null;let g=Uc(i);pp(g);let w=null,k=Cp(m);for(let _=0;w==null&&_{let k={relativePath:w===void 0?m.path||"":w,caseSensitive:m.caseSensitive===!0,childrenIndex:g,route:m};k.relativePath.startsWith("/")&&(Ne(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 _=vn([d,k.relativePath]),P=a.concat(k);m.children&&m.children.length>0&&(Ne(m.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+_+'".')),Uc(m.children,u,P,_)),!(m.path==null&&!m.index)&&u.push({path:_,score:kp(_,m.index),routesMeta:P})};return i.forEach((m,g)=>{var w;if(m.path===""||!((w=m.path)!=null&&w.includes("?")))p(m,g);else for(let k of Bc(m.path))p(m,g,k)}),u}function Bc(i){let u=i.split("/");if(u.length===0)return[];let[a,...d]=u,p=a.endsWith("?"),m=a.replace(/\?$/,"");if(d.length===0)return p?[m,""]:[m];let g=Bc(d.join("/")),w=[];return w.push(...g.map(k=>k===""?m:[m,k].join("/"))),p&&w.push(...g),w.map(k=>i.startsWith("/")&&k===""?"/":k)}function pp(i){i.sort((u,a)=>u.score!==a.score?a.score-u.score:Sp(u.routesMeta.map(d=>d.childrenIndex),a.routesMeta.map(d=>d.childrenIndex)))}const hp=/^:[\w-]+$/,mp=3,vp=2,gp=1,yp=10,xp=-2,_c=i=>i==="*";function kp(i,u){let a=i.split("/"),d=a.length;return a.some(_c)&&(d+=xp),u&&(d+=vp),a.filter(p=>!_c(p)).reduce((p,m)=>p+(hp.test(m)?mp:m===""?gp:yp),d)}function Sp(i,u){return i.length===u.length&&i.slice(0,-1).every((d,p)=>d===u[p])?i[i.length-1]-u[u.length-1]:0}function wp(i,u,a){let{routesMeta:d}=i,p={},m="/",g=[];for(let w=0;w{let{paramName:M,isOptional:H}=P;if(M==="*"){let R=w[N]||"";g=m.slice(0,m.length-R.length).replace(/(.)\/+$/,"$1")}const K=w[N];return H&&!K?_[M]=void 0:_[M]=(K||"").replace(/%2F/g,"/"),_},{}),pathname:m,pathnameBase:g,pattern:i}}function jp(i,u,a){u===void 0&&(u=!1),a===void 0&&(a=!0),Ns(i==="*"||!i.endsWith("*")||i.endsWith("/*"),'Route path "'+i+'" will be treated as if it were '+('"'+i.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+i.replace(/\*$/,"/*")+'".'));let d=[],p="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(g,w,k)=>(d.push({paramName:w,isOptional:k!=null}),k?"/?([^\\/]+)?":"/([^\\/]+)"));return i.endsWith("*")?(d.push({paramName:"*"}),p+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?p+="\\/*$":i!==""&&i!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,u?void 0:"i"),d]}function Cp(i){try{return i.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return Ns(!1,'The URL path "'+i+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),i}}function ar(i,u){if(u==="/")return i;if(!i.toLowerCase().startsWith(u.toLowerCase()))return null;let a=u.endsWith("/")?u.length-1:u.length,d=i.charAt(a);return d&&d!=="/"?null:i.slice(a)||"/"}const Ep=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_p=i=>Ep.test(i);function Np(i,u){u===void 0&&(u="/");let{pathname:a,search:d="",hash:p=""}=typeof i=="string"?cr(i):i,m;if(a)if(_p(a))m=a;else{if(a.includes("//")){let g=a;a=Ac(a),Ns(!1,"Pathnames cannot have embedded double slashes - normalizing "+(g+" -> "+a))}a.startsWith("/")?m=Nc(a.substring(1),"/"):m=Nc(a,u)}else m=u;return{pathname:m,search:Tp(d),hash:zp(p)}}function Nc(i,u){let a=u.replace(/\/+$/,"").split("/");return i.split("/").forEach(p=>{p===".."?a.length>1&&a.pop():p!=="."&&a.push(p)}),a.length>1?a.join("/"):"/"}function ms(i,u,a,d){return"Cannot include a '"+i+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(d)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Pp(i){return i.filter((u,a)=>a===0||u.route.path&&u.route.path.length>0)}function Ps(i,u){let a=Pp(i);return u?a.map((d,p)=>p===a.length-1?d.pathname:d.pathnameBase):a.map(d=>d.pathnameBase)}function Rs(i,u,a,d){d===void 0&&(d=!1);let p;typeof i=="string"?p=cr(i):(p=br({},i),Ne(!p.pathname||!p.pathname.includes("?"),ms("?","pathname","search",p)),Ne(!p.pathname||!p.pathname.includes("#"),ms("#","pathname","hash",p)),Ne(!p.search||!p.search.includes("#"),ms("#","search","hash",p)));let m=i===""||p.pathname==="",g=m?"/":p.pathname,w;if(g==null)w=a;else{let N=u.length-1;if(!d&&g.startsWith("..")){let M=g.split("/");for(;M[0]==="..";)M.shift(),N-=1;p.pathname=M.join("/")}w=N>=0?u[N]:"/"}let k=Np(p,w),_=g&&g!=="/"&&g.endsWith("/"),P=(m||g===".")&&a.endsWith("/");return!k.pathname.endsWith("/")&&(_||P)&&(k.pathname+="/"),k}const Ac=i=>i.replace(/\/\/+/g,"/"),vn=i=>Ac(i.join("/")),Rp=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),Tp=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,zp=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i;function Lp(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}const $c=["post","put","patch","delete"];new Set($c);const Op=["get",...$c];new Set(Op);/** + * 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 el(){return el=Object.assign?Object.assign.bind():function(i){for(var u=1;u{w.current=!0}),E.useCallback(function(_,P){if(P===void 0&&(P={}),!w.current)return;if(typeof _=="number"){d.go(_);return}let N=Rs(_,JSON.parse(g),m,P.relative==="path");i==null&&u!=="/"&&(N.pathname=N.pathname==="/"?u:vn([u,N.pathname])),(P.replace?d.replace:d.push)(N,P.state,P)},[u,d,g,m,i])}function ko(i,u){let{relative:a}=u===void 0?{}:u,{future:d}=E.useContext(At),{matches:p}=E.useContext(gn),{pathname:m}=fr(),g=JSON.stringify(Ps(p,d.v7_relativeSplatPath));return E.useMemo(()=>Rs(i,JSON.parse(g),m,a==="path"),[i,g,m,a])}function Ip(i,u){return Fp(i,u)}function Fp(i,u,a,d){dr()||Ne(!1);let{navigator:p}=E.useContext(At),{matches:m}=E.useContext(gn),g=m[m.length-1],w=g?g.params:{};g&&g.pathname;let k=g?g.pathnameBase:"/";g&&g.route;let _=fr(),P;if(u){var N;let C=typeof u=="string"?cr(u):u;k==="/"||(N=C.pathname)!=null&&N.startsWith(k)||Ne(!1),P=C}else P=_;let M=P.pathname||"/",H=M;if(k!=="/"){let C=k.replace(/^\//,"").split("/");H="/"+M.replace(/^\//,"").split("/").slice(C.length).join("/")}let K=dp(i,{pathname:H}),R=$p(K&&K.map(C=>Object.assign({},C,{params:Object.assign({},w,C.params),pathname:vn([k,p.encodeLocation?p.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?k:vn([k,p.encodeLocation?p.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),m,a,d);return u&&R?E.createElement(xo.Provider,{value:{location:el({pathname:"/",search:"",hash:"",state:null,key:"default"},P),navigationType:mn.Pop}},R):R}function Wp(){let i=Kp(),u=Lp(i)?i.status+" "+i.statusText:i instanceof Error?i.message:JSON.stringify(i),a=i instanceof Error?i.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},u),a?E.createElement("pre",{style:p},a):null,null)}const Up=E.createElement(Wp,null);class Bp extends E.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,a){return a.location!==u.location||a.revalidation!=="idle"&&u.revalidation==="idle"?{error:u.error,location:u.location,revalidation:u.revalidation}:{error:u.error!==void 0?u.error:a.error,location:a.location,revalidation:u.revalidation||a.revalidation}}componentDidCatch(u,a){console.error("React Router caught the following error during render",u,a)}render(){return this.state.error!==void 0?E.createElement(gn.Provider,{value:this.props.routeContext},E.createElement(Hc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ap(i){let{routeContext:u,match:a,children:d}=i,p=E.useContext(yo);return p&&p.static&&p.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=a.route.id),E.createElement(gn.Provider,{value:u},d)}function $p(i,u,a,d){var p;if(u===void 0&&(u=[]),a===void 0&&(a=null),d===void 0&&(d=null),i==null){var m;if(!a)return null;if(a.errors)i=a.matches;else if((m=d)!=null&&m.v7_partialHydration&&u.length===0&&!a.initialized&&a.matches.length>0)i=a.matches;else return null}let g=i,w=(p=a)==null?void 0:p.errors;if(w!=null){let P=g.findIndex(N=>N.route.id&&(w==null?void 0:w[N.route.id])!==void 0);P>=0||Ne(!1),g=g.slice(0,Math.min(g.length,P+1))}let k=!1,_=-1;if(a&&d&&d.v7_partialHydration)for(let P=0;P=0?g=g.slice(0,_+1):g=[g[0]];break}}}return g.reduceRight((P,N,M)=>{let H,K=!1,R=null,C=null;a&&(H=w&&N.route.id?w[N.route.id]:void 0,R=N.route.errorElement||Up,k&&(_<0&&M===0?(Jp("route-fallback"),K=!0,C=null):_===M&&(K=!0,C=N.route.hydrateFallbackElement||null)));let A=u.concat(g.slice(0,M+1)),$=()=>{let G;return H?G=R:K?G=C:N.route.Component?G=E.createElement(N.route.Component,null):N.route.element?G=N.route.element:G=P,E.createElement(Ap,{match:N,routeContext:{outlet:P,matches:A,isDataRoute:a!=null},children:G})};return a&&(N.route.ErrorBoundary||N.route.errorElement||M===0)?E.createElement(Bp,{location:a.location,revalidation:a.revalidation,component:R,error:H,children:$(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):$()},null)}var Yc=(function(i){return i.UseBlocker="useBlocker",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i})(Yc||{}),Jc=(function(i){return i.UseBlocker="useBlocker",i.UseLoaderData="useLoaderData",i.UseActionData="useActionData",i.UseRouteError="useRouteError",i.UseNavigation="useNavigation",i.UseRouteLoaderData="useRouteLoaderData",i.UseMatches="useMatches",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i.UseRouteId="useRouteId",i})(Jc||{});function Vp(i){let u=E.useContext(yo);return u||Ne(!1),u}function Hp(i){let u=E.useContext(Vc);return u||Ne(!1),u}function Qp(i){let u=E.useContext(gn);return u||Ne(!1),u}function Gc(i){let u=Qp(),a=u.matches[u.matches.length-1];return a.route.id||Ne(!1),a.route.id}function Kp(){var i;let u=E.useContext(Hc),a=Hp(),d=Gc();return u!==void 0?u:(i=a.errors)==null?void 0:i[d]}function Yp(){let{router:i}=Vp(Yc.UseNavigateStable),u=Gc(Jc.UseNavigateStable),a=E.useRef(!1);return Qc(()=>{a.current=!0}),E.useCallback(function(p,m){m===void 0&&(m={}),a.current&&(typeof p=="number"?i.navigate(p):i.navigate(p,el({fromRouteId:u},m)))},[i,u])}const Pc={};function Jp(i,u,a){Pc[i]||(Pc[i]=!0)}function Gp(i,u){i==null||i.v7_startTransition,i==null||i.v7_relativeSplatPath}function vs(i){let{to:u,replace:a,state:d,relative:p}=i;dr()||Ne(!1);let{future:m,static:g}=E.useContext(At),{matches:w}=E.useContext(gn),{pathname:k}=fr(),_=Kc(),P=Rs(u,Ps(w,m.v7_relativeSplatPath),k,p==="path"),N=JSON.stringify(P);return E.useEffect(()=>_(JSON.parse(N),{replace:a,state:d,relative:p}),[_,N,p,a,d]),null}function Zr(i){Ne(!1)}function Xp(i){let{basename:u="/",children:a=null,location:d,navigationType:p=mn.Pop,navigator:m,static:g=!1,future:w}=i;dr()&&Ne(!1);let k=u.replace(/^\/*/,"/"),_=E.useMemo(()=>({basename:k,navigator:m,static:g,future:el({v7_relativeSplatPath:!1},w)}),[k,w,m,g]);typeof d=="string"&&(d=cr(d));let{pathname:P="/",search:N="",hash:M="",state:H=null,key:K="default"}=d,R=E.useMemo(()=>{let C=ar(P,k);return C==null?null:{location:{pathname:C,search:N,hash:M,state:H,key:K},navigationType:p}},[k,P,N,M,H,K,p]);return R==null?null:E.createElement(At.Provider,{value:_},E.createElement(xo.Provider,{children:a,value:R}))}function Zp(i){let{children:u,location:a}=i;return Ip(js(u),a)}new Promise(()=>{});function js(i,u){u===void 0&&(u=[]);let a=[];return E.Children.forEach(i,(d,p)=>{if(!E.isValidElement(d))return;let m=[...u,p];if(d.type===E.Fragment){a.push.apply(a,js(d.props.children,m));return}d.type!==Zr&&Ne(!1),!d.props.index||!d.props.children||Ne(!1);let g={id:d.props.id||m.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=js(d.props.children,m)),a.push(g)}),a}/** + * 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 go(){return go=Object.assign?Object.assign.bind():function(i){for(var u=1;u{_&&Rc?Rc(()=>k(N)):k(N)},[k,_]);return E.useLayoutEffect(()=>g.listen(P),[g,P]),E.useEffect(()=>Gp(d),[d]),E.createElement(Xp,{basename:u,children:a,location:w.location,navigationType:w.action,navigator:g,future:d})}const ih=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ah=E.forwardRef(function(u,a){let{onClick:d,relative:p,reloadDocument:m,replace:g,state:w,target:k,to:_,preventScrollReset:P,viewTransition:N}=u,M=Xc(u,eh),{basename:H}=E.useContext(At),K,R=!1;if(typeof _=="string"&&sh.test(_)&&(K=_,ih))try{let G=new URL(window.location.href),B=_.startsWith("//")?new URL(G.protocol+_):new URL(_),ue=ar(B.pathname,H);B.origin===G.origin&&ue!=null?_=ue+B.search+B.hash:R=!0}catch{}let C=Dp(_,{relative:p}),A=dh(_,{replace:g,state:w,target:k,preventScrollReset:P,relative:p,viewTransition:N});function $(G){d&&d(G),G.defaultPrevented||A(G)}return E.createElement("a",go({},M,{href:K||C,onClick:R||m?d:$,ref:a,target:k}))}),uh=E.forwardRef(function(u,a){let{"aria-current":d="page",caseSensitive:p=!1,className:m="",end:g=!1,style:w,to:k,viewTransition:_,children:P}=u,N=Xc(u,th),M=ko(k,{relative:N.relative}),H=fr(),K=E.useContext(Vc),{navigator:R,basename:C}=E.useContext(At),A=K!=null&&fh(M)&&_===!0,$=R.encodeLocation?R.encodeLocation(M).pathname:M.pathname,G=H.pathname,B=K&&K.navigation&&K.navigation.location?K.navigation.location.pathname:null;p||(G=G.toLowerCase(),B=B?B.toLowerCase():null,$=$.toLowerCase()),B&&C&&(B=ar(B,C)||B);const ue=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let de=G===$||!g&&G.startsWith($)&&G.charAt(ue)==="/",je=B!=null&&(B===$||!g&&B.startsWith($)&&B.charAt($.length)==="/"),xe={isActive:de,isPending:je,isTransitioning:A},Je=de?d:void 0,Me;typeof m=="function"?Me=m(xe):Me=[m,de?"active":null,je?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let He=typeof w=="function"?w(xe):w;return E.createElement(ah,go({},N,{"aria-current":Je,className:Me,ref:a,style:He,to:k,viewTransition:_}),typeof P=="function"?P(xe):P)});var Cs;(function(i){i.UseScrollRestoration="useScrollRestoration",i.UseSubmit="useSubmit",i.UseSubmitFetcher="useSubmitFetcher",i.UseFetcher="useFetcher",i.useViewTransitionState="useViewTransitionState"})(Cs||(Cs={}));var Tc;(function(i){i.UseFetcher="useFetcher",i.UseFetchers="useFetchers",i.UseScrollRestoration="useScrollRestoration"})(Tc||(Tc={}));function ch(i){let u=E.useContext(yo);return u||Ne(!1),u}function dh(i,u){let{target:a,replace:d,state:p,preventScrollReset:m,relative:g,viewTransition:w}=u===void 0?{}:u,k=Kc(),_=fr(),P=ko(i,{relative:g});return E.useCallback(N=>{if(bp(N,a)){N.preventDefault();let M=d!==void 0?d:vo(_)===vo(P);k(i,{replace:M,state:p,preventScrollReset:m,relative:g,viewTransition:w})}},[_,k,P,d,p,a,i,m,g,w])}function fh(i,u){u===void 0&&(u={});let a=E.useContext(rh);a==null&&Ne(!1);let{basename:d}=ch(Cs.useViewTransitionState),p=ko(i,{relative:u.relative});if(!a.isTransitioning)return!1;let m=ar(a.currentLocation.pathname,d)||a.currentLocation.pathname,g=ar(a.nextLocation.pathname,d)||a.nextLocation.pathname;return ws(p.pathname,g)!=null||ws(p.pathname,m)!=null}function ph(){if(window.matchMedia("(display-mode: standalone)").matches)return;const i=document.cookie.split(";").map(a=>a.trim()).find(a=>a.startsWith("hnf_inactivity_mins="));if(!i)return;const u=parseInt(i.split("=")[1]);return isNaN(u)||u<=0?void 0:u*60*1e3}const zc={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"},hh={background:"var(--hk-green)",color:"#fff",border:"none",borderRadius:"6px",padding:"0.625rem",fontSize:"1rem",fontWeight:600,marginTop:"0.25rem",width:"100%"};function mh({children:i}){const[u,a]=E.useState("checking"),[d,p]=E.useState(null),[m,g]=E.useState(""),[w,k]=E.useState(""),[_,P]=E.useState(""),[N,M]=E.useState(!1),H=E.useRef(null);E.useEffect(()=>{fetch("/api/auth/verify?app=hk-planner",{credentials:"include"}).then(async R=>{R.ok?(p(await R.json()),a("authed")):a("login")}).catch(()=>a("login"))},[]),E.useEffect(()=>{const R=ph();if(u!=="authed"||!R)return;async function C(){await fetch("/api/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),p(null),a("login")}function A(){H.current&&clearTimeout(H.current),H.current=setTimeout(C,R)}const $=["mousemove","keydown","click","touchstart"];return $.forEach(G=>window.addEventListener(G,A,{passive:!0})),A(),()=>{H.current&&clearTimeout(H.current),$.forEach(G=>window.removeEventListener(G,A))}},[u]);async function K(R){R.preventDefault(),M(!0),P("");try{if(!(await fetch("/api/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,password:w})})).ok){P("Invalid email or password");return}const A=await fetch("/api/auth/verify?app=hk-planner",{credentials:"include"});A.ok?(p(await A.json()),a("authed")):P("You don't have access to this app.")}catch{P("Connection error — please try again")}finally{M(!1)}}return u==="checking"?c.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100dvh"},children:c.jsx("div",{style:{color:"var(--text-muted)"},children:"Loading…"})}):u==="login"?c.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100dvh",padding:"1.5rem",background:"var(--navy-dark)"},children:c.jsxs("div",{style:{background:"var(--navy)",borderRadius:"var(--radius)",padding:"2rem",width:"100%",maxWidth:"360px",border:"1px solid var(--surface-2)"},children:[c.jsx("h1",{style:{fontSize:"1.4rem",marginBottom:"0.25rem",color:"#74c69d"},children:"HK Planner"}),c.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.875rem",marginBottom:"1.5rem"},children:void 0}),c.jsxs("form",{onSubmit:K,style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[c.jsx("input",{type:"email",value:m,onChange:R=>g(R.target.value),placeholder:"Email",required:!0,autoComplete:"email",style:zc}),c.jsx("input",{type:"password",value:w,onChange:R=>k(R.target.value),placeholder:"Password",required:!0,autoComplete:"current-password",style:zc}),_&&c.jsx("p",{style:{color:"#f87171",fontSize:"0.875rem"},children:_}),c.jsx("button",{type:"submit",disabled:N,style:hh,children:N?"Signing in…":"Sign in"})]})]})}):c.jsx(c.Fragment,{children:i(d)})}/** + * @license lucide-react v1.24.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zc=(...i)=>i.filter((u,a,d)=>!!u&&u.trim()!==""&&d.indexOf(u)===a).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 vh=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + * @license lucide-react v1.24.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gh=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,a,d)=>d?d.toUpperCase():a.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 Lc=i=>{const u=gh(i);return u.charAt(0).toUpperCase()+u.slice(1)};/** + * @license lucide-react v1.24.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var gs={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 yh=i=>{for(const u in i)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1},xh=E.createContext({}),kh=()=>E.useContext(xh),Sh=E.forwardRef(({color:i,size:u,strokeWidth:a,absoluteStrokeWidth:d,className:p="",children:m,iconNode:g,...w},k)=>{const{size:_=24,strokeWidth:P=2,absoluteStrokeWidth:N=!1,color:M="currentColor",className:H=""}=kh()??{},K=d??N?Number(a??P)*24/Number(u??_):a??P;return E.createElement("svg",{ref:k,...gs,width:u??_??gs.width,height:u??_??gs.height,stroke:i??M,strokeWidth:K,className:Zc("lucide",H,p),...!m&&!yh(w)&&{"aria-hidden":"true"},...w},[...g.map(([R,C])=>E.createElement(R,C)),...Array.isArray(m)?m:[m]])});/** + * @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 tl=(i,u)=>{const a=E.forwardRef(({className:d,...p},m)=>E.createElement(Sh,{ref:m,iconNode:u,className:Zc(`lucide-${vh(Lc(i))}`,`lucide-${i}`,d),...p}));return a.displayName=Lc(i),a};/** + * @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 wh=[["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"}]],Oc=tl("calendar-clock",wh);/** + * @license lucide-react v1.24.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jh=[["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"}]],Ch=tl("grip-vertical",jh);/** + * @license lucide-react v1.24.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Eh=[["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"}]],_h=tl("log-out",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 Nh=[["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"}]],Es=tl("refresh-cw",Nh);/** + * @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:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Rh=tl("settings",Ph);function Th({visible:i}){return i?c.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"var(--sidebar)",color:"var(--text-light)",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"10px 16px",fontSize:"14px",boxShadow:"0 -2px 8px rgba(0,0,0,0.3)"},children:[c.jsx("span",{children:"A new version is available."}),c.jsxs("button",{onClick:()=>window.location.reload(),style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--accent)",color:"var(--sidebar)",border:"none",borderRadius:"4px",padding:"6px 14px",fontWeight:600,cursor:"pointer",fontSize:"13px"},children:[c.jsx(Es,{size:14,strokeWidth:1.75}),"Reload"]})]}):null}const zh=120*1e3;function Lh(i){const[u,a]=E.useState(!1);return E.useEffect(()=>{let d=null;async function p(){try{const w=await fetch(i,{cache:"no-store"});if(!w.ok)return;const _=(await w.json()).version;if(!_)return;d===null?d=_:_!==d&&a(!0)}catch{}}p();const m=setInterval(p,zh);function g(){document.visibilityState==="visible"&&p()}return document.addEventListener("visibilitychange",g),()=>{clearInterval(m),document.removeEventListener("visibilitychange",g)}},[i]),u}function qc(i,u){return i.is_admin||i.caps.includes(u)}const Oh="width=1280",Dh="width=device-width, initial-scale=1.0";function Dc(i){const u=document.querySelector('meta[name="viewport"]');u&&(u.content=i)}function Mh(i){E.useEffect(()=>(Dc(Oh),window.parent.postMessage({type:"hnf:viewport",mode:i},"*"),()=>{Dc(Dh),window.parent.postMessage({type:"hnf:viewport",mode:"responsive"},"*")}),[i])}function Ih({user:i,children:u}){Mh("desktop");async function a(){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(Oc,{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(Mc,{to:"/planner",icon:Oc,label:"Planner"}),qc(i,"settings")&&c.jsx(Mc,{to:"/settings",icon:Rh,label:"Settings"})]}),c.jsxs("div",{style:{padding:"0.75rem 1rem",borderTop:"1px solid var(--surface-2)"},children:[c.jsxs("div",{style:{marginBottom:"0.5rem"},children:[c.jsx("div",{style:{color:"var(--text)",fontSize:"0.8rem",fontWeight:600},children:i.name}),c.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.72rem"},children:i.email})]}),c.jsxs("button",{onClick:a,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(_h,{size:14,strokeWidth:1.75}),"Sign out"]})]})]}),c.jsx("main",{style:{flex:1,overflow:"auto",background:"var(--body-bg)"},children:u})]})}function Mc({to:i,icon:u,label:a}){return c.jsxs(uh,{to:i,style:({isActive:d})=>({display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.625rem 1rem",textDecoration:"none",color:d?"#74c69d":"var(--text)",background:d?"var(--surface)":"transparent",borderLeft:d?"2px solid #74c69d":"2px solid transparent",fontSize:"0.875rem",transition:"background 0.15s"}),children:[c.jsx(u,{size:15,strokeWidth:1.75}),a]})}const Fh="/hk-planner/api";async function nt(i,u){const a=await fetch(Fh+i,{credentials:"include",...u});if(a.status===401)throw(window.top??window).location.href="/login",new Error("Unauthenticated");if(!a.ok){const d=await a.json().catch(()=>({}));throw new Error(d.error||`HTTP ${a.status}`)}return a.json()}function Wh(i,u,a=!1){const d=new URLSearchParams;return i&&d.set("week_start",i),u&&d.set("last_viewed",u),a&&d.set("force_refresh","1"),nt(`/bookings?${d}`)}function bc(){return nt("/config")}function Uh(i,u,a){return nt("/config/time-requirements",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cat:i,action:u,value:a})})}function Bh(i){return nt("/config/staff",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staff_data:i})})}function Ah(i){return nt("/config/pickup",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pickup_data:i})})}function $h(i){return nt("/config/general-tasks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({general_tasks:i})})}function Vh(i){return nt("/config/last-reviewed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:i})})}function Hh(){return nt("/categories")}function Qh(i,u){return nt("/categories",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:i,excluded:u})})}function Kh(){return nt("/newbook/test",{method:"POST"})}function Yh(){return nt("/workforce/departments")}function Jh(i){return nt("/config/workforce-departments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dept_ids:i})})}function Gh(i,u){return nt(`/workforce/sync?start=${i}&end=${u}`,{method:"POST"})}function Xh(){return nt("/workforce/staff")}function Zh(i){return nt("/config/adjustments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({adjustments:i})})}function po(){const i=new Date;return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function ys(i,u){const[a,d,p]=i.split("-").map(Number),m=new Date(a,d-1,p);return m.setDate(m.getDate()+u),`${m.getFullYear()}-${String(m.getMonth()+1).padStart(2,"0")}-${String(m.getDate()).padStart(2,"0")}`}function So(i){const u=new Date(i+"T00:00:00");return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()]+" "+u.getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][u.getMonth()]}function qh(i){const u=new Date(i+"T00:00:00");return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][(u.getDay()+6)%7]}function bh(i){const u=new Date(i+"T00:00:00");return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][u.getDay()]}function qr(i){const u=new Date(i+"T00:00:00").getDay();return u===0||u===6}function em(i,u){const a=u.pickup_hint??0,d=u.pickup_lead??0,p=a>0?`${a} room${a===1?"":"s"} picked up within ${d} day${d===1?"":"s"} of arrival`:"no late pickups";return`Last ${bh(i)}: ${u.prior_occ} occ (${u.prior_vac} vac) — ${p}`}function Ic(i){return new Date(i+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function Ye(i){return i.toFixed(2)+"h"}function ur(i,u,a,d,p){var _;const m=Math.max(0,p-d),g=(_=i[u])==null?void 0:_[a];if(!g||!g.count)return 0;const w=g.total-g.count,k=d>w?Math.max(0,g.total-d):g.count;return Math.min(k,m)}function tm(i,u,a,d,p){const m={};for(const g of i.dates){const w=qh(g),k=d.reduce((P,N)=>P+(N.hours[w]||0)/60,0),_=p.reduce((P,N)=>P+(N.hours[g]||0),0);m[g]={booked:0,pickup:0,general:k,adjustments:_,total:k+_,by_cat:{},pickup_by_cat:{}}}for(const g of i.categories){const w=u[g.id]||{depart:0,stay:0,arrive:0};i.dates.forEach((k,_)=>{const P=g.days[k],N=P.stays+P.arrivals,M=ur(a,g.id,k,N,g.total_rooms),H=(P.departs*(w.depart||0)+P.stays*(w.stay||0)+P.arrivals*(w.arrive||0))/60,K=M*(w.arrive||0)/60;m[k].by_cat[g.id]=H,m[k].pickup_by_cat[g.id]=(m[k].pickup_by_cat[g.id]||0)+K,m[k].booked+=H,m[k].pickup+=K,m[k].total+=H+K;const R=i.dates[_+1];if(R&&M>0){const C=M*(w.depart||0)/60;m[R].pickup_by_cat[g.id]=(m[R].pickup_by_cat[g.id]||0)+C,m[R].pickup+=C,m[R].total+=C}})}return m}function nm(){const[i,u]=E.useState(null),[a,d]=E.useState({}),[p,m]=E.useState([]),[g,w]=E.useState({}),[k,_]=E.useState([]),[P,N]=E.useState([]),[M,H]=E.useState(4),[K,R]=E.useState(1),[C,A]=E.useState(1),[$,G]=E.useState(2),[B,ue]=E.useState(null),[de,je]=E.useState([]),[xe,Je]=E.useState(!1),[Me,He]=E.useState(null),[Ce,Pe]=E.useState(""),[We,Ge]=E.useState(""),[Le,me]=E.useState(!0),[F,X]=E.useState(""),[W,y]=E.useState(null),T=E.useRef({}),ne=E.useRef(null),le=E.useRef(!1),oe=E.useRef(null);oe.current=Me;function ie(b,ve,ut=400){clearTimeout(T.current[b]),T.current[b]=setTimeout(ve,ut)}function ce(b,ve=!1){ne.current&&clearTimeout(ne.current),y({text:b,err:ve}),ne.current=setTimeout(()=>y(null),ve?5e3:2500)}function se(){const b=po();b!==We&&(Ge(b),Vh(b).catch(()=>{}))}const fe=E.useCallback(async(b=!1,ve)=>{me(!0),X("");const ut=po(),Qt=oe.current||ut,Kt=ve!==void 0?ve||ys(ut,-1):Ce||We||ys(ut,-1);try{const[ct,Be]=await Promise.all([Wh(Qt,Kt,b),bc()]);u(ct),d(Be.time_requirements||{}),m(Be.staff_data||[]),w(Be.pickup_data||{}),_(Be.general_tasks||[]),N(Be.adjustments||[]),H(Be.warn_over_red_hrs??4),R(Be.warn_over_amber_hrs??1),A(Be.warn_under_amber_hrs??1),G(Be.warn_under_red_hrs??2),ue(Be.workforce_rota||null),Be.last_reviewed&&(Ge(Be.last_reviewed),Ce||Pe(Be.last_reviewed))}catch(ct){X(ct instanceof Error?ct.message:"Failed to load data")}finally{me(!1)}},[Ce,We]);E.useEffect(()=>{fe(!1)},[]),E.useEffect(()=>{B&&!le.current&&(le.current=!0,Xh().then(je).catch(()=>{}))},[B]),E.useEffect(()=>{function b(){p.length&&navigator.sendBeacon("/hk-planner/api/config/staff",JSON.stringify({staff_data:p})),Object.keys(g).length&&navigator.sendBeacon("/hk-planner/api/config/pickup",JSON.stringify({pickup_data:g})),P.length&&navigator.sendBeacon("/hk-planner/api/config/adjustments",JSON.stringify({adjustments:P}))}return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[p,g,P]);function Ue(b){const ve=po(),ut=ys(oe.current||ve,b);oe.current=ut,He(ut),se(),fe(!0)}function $t(){oe.current=null,He(null),se(),fe(!0)}function Mn(){se(),fe(!0)}function Vt(b,ve,ut,Qt){const Kt=Qt.days[ve],ct=Kt.stays+Kt.arrivals,Be=Math.max(0,Qt.total_rooms-ct),Sn=ur(g,b,ve,ct,Qt.total_rooms),Yt=Math.max(0,Math.min(Sn+ut,Be)),nl={...g,[b]:{...g[b]||{},[ve]:{count:Yt,total:ct+Yt}}};w(nl),se(),ie("pickup",()=>Ah(nl).then(()=>ce("Pickup saved")).catch(rl=>ce(rl.message,!0)))}function Ht(b){N(b),ie("adjustments",()=>Zh(b).then(()=>ce("Adjustments saved")).catch(ve=>ce(ve.message,!0)))}function In(){Ht([...P,{label:"",hours:{}}])}function yn(b){m(b),se(),ie("staff",()=>Bh(b).then(()=>ce("Staff hours saved")).catch(ve=>ce(ve.message,!0)))}function xn(){yn([...p,{name:"",hours:{}}])}async function kn(){if(i){Je(!0);try{const b=await Gh(i.dates[0],i.dates[i.dates.length-1]);ue(b),ce("Rota synced from Workforce")}catch(b){ce(b instanceof Error?b.message:"Sync failed",!0)}finally{Je(!1)}}}function I(){if(!B)return"Never synced";const b=new Date(B.last_sync).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"});return i&&B.dates[0]===i.dates[0]&&B.dates[1]===i.dates[i.dates.length-1]?`Synced ${b}`:`Synced ${b} — different week`}const ee=i?tm(i,a,g,k,P):null,re=po(),Oe=Me||re;return c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"1600px"},children:[c.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.75rem",marginBottom:"1.25rem"},children:[c.jsxs("div",{children:[c.jsx("h1",{style:{fontSize:"1.15rem",fontWeight:700,color:"var(--text-dark)"},children:"Housekeeping Planner"}),i&&c.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-mid)",marginTop:"0.1rem"},children:[Ic(i.dates[0])," – ",Ic(i.dates[i.dates.length-1])]})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginLeft:"auto",flexWrap:"wrap"},children:[c.jsx(sr,{onClick:()=>Ue(-7),children:"‹ Prev"}),c.jsx(sr,{onClick:$t,primary:!0,children:"Today"}),c.jsx(sr,{onClick:()=>Ue(7),children:"Next ›"}),c.jsx("input",{type:"date",value:Oe,onChange:b=>{if(b.target.value){const ve=b.target.value;oe.current=ve,He(ve),se(),ie("weekStart",()=>fe(!0),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.35rem 0.5rem",fontSize:"0.82rem",color:"var(--text-dark)"}}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsxs("label",{style:{fontSize:"0.78rem",color:"var(--text-mid)",display:"flex",alignItems:"center",gap:"0.3rem"},children:[c.jsx("span",{children:"Since"}),c.jsx("input",{type:"date",value:Ce,onChange:b=>{if(b.target.value){const ve=b.target.value;Pe(ve),ie("lastViewed",()=>fe(!0,ve),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.5rem",fontSize:"0.78rem",color:"var(--text-dark)"}})]}),c.jsx(sr,{onClick:()=>{se(),fe(!0)},children:"Update to now"}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsx("button",{onClick:Mn,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(Es,{size:13,strokeWidth:1.75,style:{animation:Le?"spin 1s linear infinite":"none"}})})]})]}),c.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),W&&c.jsx("div",{style:{display:"inline-block",marginBottom:"0.75rem",padding:"0.35rem 0.75rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:500,background:W.err?"#fee2e2":"#dcfce7",color:W.err?"var(--danger)":"var(--success)"},children:W.text}),F&&c.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"#fee2e2",color:"var(--danger)",fontSize:"0.875rem"},children:["Error: ",F]}),Le&&!i&&c.jsx("div",{style:{color:"var(--text-mid)",padding:"2rem 0",textAlign:"center"},children:"Loading bookings…"}),i&&ee&&c.jsxs(c.Fragment,{children:[c.jsx(ho,{title:"7-Day Occupancy",children:c.jsx("div",{className:"table-scroll",children:c.jsx(rm,{bookings:i,pickup:g,onPickupChange:Vt})})}),c.jsx(ho,{title:"Required Hours",children:c.jsx("div",{className:"table-scroll",children:c.jsx(im,{bookings:i,required:ee})})}),c.jsx(ho,{title:"Adjustments",action:c.jsx(sr,{onClick:In,children:"+ Add adjustment"}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(um,{bookings:i,adjustments:P,onChange:Ht})})}),c.jsx(ho,{title:"Staff Rota",action:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[c.jsxs("button",{onClick:kn,disabled:xe,style:{display:"flex",alignItems:"center",gap:"0.3rem",background:"var(--card-bg)",color:"var(--text-dark)",border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.65rem",fontSize:"0.78rem",fontWeight:600},children:[c.jsx(Es,{size:11,strokeWidth:1.75,style:{animation:xe?"spin 1s linear infinite":"none"}}),xe?"Syncing…":"Sync from Workforce"]}),c.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:I()}),c.jsx(sr,{onClick:xn,children:"+ Add staff"})]}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(sm,{bookings:i,staff:p,required:ee,warnOverRed:M,warnOverAmber:K,warnUnderAmber:C,warnUnderRed:$,onChange:yn,workforceRota:B,wfStaff:de})})})]})]})}function ho({title:i,children:u,action:a}){return c.jsxs("div",{style:{marginBottom:"1.5rem"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[c.jsx("h2",{style:{fontSize:"0.72rem",fontWeight:700,color:"var(--text-mid)",textTransform:"uppercase",letterSpacing:"0.08em"},children:i}),a]}),u]})}function sr({children:i,onClick:u,primary:a}){return c.jsx("button",{onClick:u,style:{background:a?"var(--hk-green)":"var(--card-bg)",color:a?"#fff":"var(--text-dark)",border:`1px solid ${a?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.35rem 0.75rem",fontSize:"0.82rem",fontWeight:600},children:i})}function rm({bookings:i,pickup:u,onPickupChange:a}){const{dates:d,categories:p}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsxs("thead",{children:[c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",rowSpan:2,children:"Category"}),d.map(m=>c.jsx("th",{colSpan:2,style:{borderLeft:"2px solid rgba(255,255,255,0.3)",...qr(m)?{background:"#253555"}:{}},children:So(m)},m))]}),c.jsx("tr",{children:d.map(m=>c.jsxs(c.Fragment,{children:[c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"72px",background:qr(m)?"#2a3d5e":"#1e2d42",borderLeft:"2px solid rgba(255,255,255,0.3)"},children:"Rooms"},m+"-r"),c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"56px",textAlign:"center",background:qr(m)?"#2a3d5e":"#1e2d42",borderLeft:"1px solid rgba(255,255,255,0.1)"},children:"D / S / A"},m+"-d")]}))})]}),c.jsx("tbody",{children:p.map((m,g)=>{const w=g===p.length-1;return c.jsx(lm,{cat:m,dates:d,pickup:u,onPickupChange:(k,_)=>a(m.id,k,_,m),isLast:w},m.id)})}),c.jsx("tfoot",{children:c.jsx(om,{dates:d,cats:p,pickup:u})})]})}function lm({cat:i,dates:u,pickup:a,onPickupChange:d,isLast:p}){const m=p?"2px solid var(--card-border)":void 0;return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{borderBottom:m},children:i.name}),u.map((g,w)=>{var ue;const k=i.days[g],_=k.stays+k.arrivals,P=Math.max(0,i.total_rooms-_),N=ur(a,i.id,g,_,i.total_rooms),M=u[w-1],H=M?i.days[M].stays+i.days[M].arrivals:0,K=M?ur(a,i.id,M,H,i.total_rooms):0,R=k.delta_new||0,C=k.delta_cancelled||0,A=qr(g),$=(ue=a[i.id])==null?void 0:ue[g],G=em(g,k);let B="";if($&&$.count){const de=$.total-$.count,je=_>de?"changed":"unchanged",xe=_>de?"decreased":"remains";B=`+${$.count} pickup set when booked was ${de} (target ${$.total}). Booked ${je}, so pickup ${xe}.`}return B=(B?B+" | ":"")+G,c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",borderBottom:m,padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[(R>0||C>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[R>0&&c.jsxs("span",{className:"delta-new",children:["▲",R]}),C>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",C]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},title:B,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:m,padding:"0.4rem 0.3rem",textAlign:"center",...A?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[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 om({dates:i,cats:u,pickup:a}){return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontStyle:"italic"},children:"Total"}),i.map((d,p)=>{let m=0,g=0,w=0,k=0,_=0,P=0,N=0,M=0,H=0;for(const R of u){const C=R.days[d],A=C.stays+C.arrivals,$=Math.max(0,R.total_rooms-A),G=ur(a,R.id,d,A,R.total_rooms),B=i[p-1],ue=B?R.days[B].stays+R.days[B].arrivals:0,de=B?ur(a,R.id,B,ue,R.total_rooms):0;m+=A,g+=$,w+=G,k+=de,_+=C.departs,P+=C.stays,N+=C.arrivals,M+=C.delta_new||0,H+=C.delta_cancelled||0}const K=qr(d);return c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...K?{background:"rgba(100,120,160,0.07)"}:{}},children:[(M>0||H>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[M>0&&c.jsxs("span",{className:"delta-new",children:["▲",M]}),H>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",H]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},children:[m,w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:[g," vac",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",g-w,")"]})]})]},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",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]})]},d+"-dsa")]})})]})}function im({bookings:i,required:u}){const{dates:a,categories:d}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),a.map(p=>c.jsx("th",{children:So(p)},p))]})}),c.jsx("tbody",{children:d.map(p=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:p.name}),a.map(m=>{const g=u[m].by_cat[p.id]||0,w=u[m].pickup_by_cat[p.id]||0;return c.jsxs("td",{children:[g===0&&w===0?"—":Ye(g),w>.001&&c.jsxs("span",{className:"pickup-tag",children:[" (+",Ye(w),")"]})]},m)})]},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"}),a.map(p=>c.jsx("td",{children:Ye(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"}),a.map(p=>c.jsx("td",{children:u[p].pickup>.001?Ye(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"}),a.map(p=>c.jsx("td",{children:u[p].general>.001?Ye(u[p].general):"—"},p))]}),a.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"}),a.map(p=>{const m=u[p].adjustments;return c.jsx("td",{style:{color:m<0?"var(--danger)":m>0?"#1a7a4a":"var(--text-mid)"},children:m===0?"—":(m>0?"+":"")+Ye(m)},p)})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",children:"Total Required"}),a.map(p=>c.jsxs("td",{style:{fontWeight:700},children:[Ye(u[p].total),u[p].pickup>.001&&c.jsxs("span",{className:"pickup-tag",style:{display:"block",fontSize:"0.7rem"},children:["inc ",Ye(u[p].pickup)," pickup"]})]},p))]})]})]})}function sm({bookings:i,staff:u,required:a,warnOverRed:d,warnOverAmber:p,warnUnderAmber:m,warnUnderRed:g,onChange:w,workforceRota:k,wfStaff:_}){const{dates:P}=i;function N(R,C){const A=u.map(($,G)=>G===R?{...$,name:C}:$);w(A)}function M(R,C,A){const $=parseFloat(A),G=u.map((B,ue)=>{if(ue!==R)return B;const de={...B.hours};return!isNaN($)&&$>=0?de[C]=$:delete de[C],{...B,hours:de}});w(G)}function H(R){w(u.filter((C,A)=>A!==R))}const K=(k==null?void 0:k.staff)??[];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(R=>c.jsx("th",{children:So(R)},R)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[K.map(R=>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"}),R.name]}),P.map(C=>{const A=R.days[C];return c.jsx("td",{style:{textAlign:"center",padding:"0.3rem 0.4rem",verticalAlign:"middle"},children:A?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:"0.68rem",color:"var(--text-mid)",lineHeight:1.25},children:A.times}),c.jsx("div",{style:{fontWeight:600},children:Ye(A.hours)})]}):c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"})},C)}),c.jsx("td",{})]},"wf-"+R.id)),_.length>0&&c.jsx("datalist",{id:"wf-staff-datalist",children:_.map(R=>c.jsx("option",{value:R.name},R.id))}),u.map((R,C)=>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:R.name,placeholder:"Staff name",list:_.length>0?"wf-staff-datalist":void 0,onChange:A=>N(C,A.target.value)})}),P.map(A=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:24,step:.5,value:R.hours[A]??"",placeholder:"0",onChange:$=>M(C,A,$.target.value)})},A)),c.jsx("td",{children:c.jsx("button",{onClick:()=>H(C),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},C))]}),c.jsx("tfoot",{children:(()=>{const R={};for(const C of P){const A=K.reduce((G,B)=>{var ue;return G+(((ue=B.days[C])==null?void 0:ue.hours)||0)},0),$=u.reduce((G,B)=>G+(B.hours[C]||0),0);R[C]=A+$}return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total Available"}),P.map(C=>c.jsx("td",{children:Ye(R[C])},C)),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(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked})},C)),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(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked+a[C].general})},C)),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(C=>c.jsx("td",{children:c.jsx(xs,{available:R[C],required:a[C].booked+a[C].general+a[C].pickup})},C)),c.jsx("td",{})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",style:{fontWeight:700},children:"with Adjustments"}),P.map(C=>c.jsx("td",{children:c.jsx(am,{available:R[C],required:a[C].total,warnOverRed:d,warnOverAmber:p,warnUnderAmber:m,warnUnderRed:g})},C)),c.jsx("td",{})]})]})})()})]})}function xs({available:i,required:u}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const a=i-u;return c.jsxs("span",{style:{color:"var(--text-mid)",fontSize:"0.82rem"},children:[a>=0?"+":"",Ye(a)]})}function am({available:i,required:u,warnOverRed:a,warnOverAmber:d,warnUnderAmber:p,warnUnderRed:m}){if(i===0&&u===0)return c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"});const g=i-u;return g>a?c.jsxs("span",{className:"diff-over-red",children:["⚠ ",Ye(g)," spare"]}):g>d?c.jsxs("span",{className:"diff-over",children:["⚠ ",Ye(g)," spare"]}):g<-m?c.jsxs("span",{className:"diff-under",children:["✗ ",Ye(Math.abs(g))," short"]}):g<-p?c.jsxs("span",{className:"diff-under-amber",children:["✗ ",Ye(Math.abs(g))," short"]}):c.jsxs("span",{className:"diff-ok",children:["✓ ",g>=0?"+":"",Ye(g)]})}function um({bookings:i,adjustments:u,onChange:a}){const{dates:d}=i;function p(w,k){a(u.map((_,P)=>P===w?{..._,label:k}:_))}function m(w,k,_){const P=parseFloat(_);a(u.map((N,M)=>{if(M!==w)return N;const H={...N.hours};return isNaN(P)?delete H[k]:H[k]=P,{...N,hours:H}}))}function g(w){a(u.filter((k,_)=>_!==w))}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(w=>c.jsx("th",{children:So(w)},w)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsx("tbody",{children:u.map((w,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:w.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:w.hours[_]??"",placeholder:"0",onChange:P=>m(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(w=>{const k=u.reduce((_,P)=>_+(P.hours[w]||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?"+":"")+Ye(k)},w)}),c.jsx("td",{})]})})]})}const Fc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function cm(){const[i,u]=E.useState([]),[a,d]=E.useState(!0),[p,m]=E.useState(!1),[g,w]=E.useState(!1),[k,_]=E.useState(""),[P,N]=E.useState(""),[M,H]=E.useState(null),[K,R]=E.useState([]),[C,A]=E.useState([]),[$,G]=E.useState(!0),[B,ue]=E.useState(""),[de,je]=E.useState(!1),[xe,Je]=E.useState(!1),[Me,He]=E.useState(""),[Ce,Pe]=E.useState([]),[We,Ge]=E.useState(!1),[Le,me]=E.useState(""),[F,X]=E.useState(""),[W,y]=E.useState({}),[T,ne]=E.useState(""),[le,oe]=E.useState("");E.useEffect(()=>{Promise.all([Hh(),bc(),Yh().catch(I=>(I.message.includes("503")||I.message.toLowerCase().includes("not configured")?je(!0):ue(I.message),null))]).then(([I,ee,re])=>{u(I.categories),Pe(ee.general_tasks||[]),y(ee.time_requirements||{}),A(ee.workforce_departments||[]),re&&R(re),d(!1),G(!1)}).catch(I=>{_(I.message),d(!1),G(!1)})},[]);function ie(I){u(i.map((ee,re)=>re===I?{...ee,excluded:!ee.excluded}:ee))}function ce(I,ee){H(ee),I.dataTransfer.effectAllowed="move"}function se(I,ee){if(I.preventDefault(),M===null||M===ee)return;const re=[...i],[Oe]=re.splice(M,1);re.splice(ee,0,Oe),u(re),H(ee)}function fe(){H(null)}async function Ue(){m(!0),_(""),N("");try{await Qh(i.map(I=>I.id),i.filter(I=>I.excluded).map(I=>I.id)),N("Saved"),setTimeout(()=>N(""),2500)}catch(I){_(I instanceof Error?I.message:"Save failed")}finally{m(!1)}}async function $t(){w(!0),_(""),N("");try{const I=await Kh();N(I.ok?`Connection OK: ${I.message||""}`:`Failed: ${I.error||"unknown"}`)}catch(I){_(I instanceof Error?I.message:"Test failed")}finally{w(!1)}}function Mn(I){A(ee=>ee.includes(I)?ee.filter(re=>re!==I):[...ee,I])}async function Vt(){Je(!0),ue(""),He("");try{await Jh(C),He("Departments saved"),setTimeout(()=>He(""),2500)}catch(I){ue(I instanceof Error?I.message:"Save failed")}finally{Je(!1)}}function Ht(I,ee){Pe(Ce.map((re,Oe)=>Oe===I?{...re,name:ee}:re))}function In(I,ee,re){const Oe=parseInt(re,10);Pe(Ce.map((b,ve)=>ve!==I?b:{...b,hours:{...b.hours,[ee]:isNaN(Oe)?0:Math.max(0,Oe)}}))}function yn(I){Pe(Ce.filter((ee,re)=>re!==I))}async function xn(){Ge(!0),X(""),me("");try{await $h(Ce),me("Saved"),setTimeout(()=>me(""),2500)}catch(I){X(I instanceof Error?I.message:"Save failed")}finally{Ge(!1)}}async function kn(I,ee,re){const Oe={...W,[I]:{...W[I]||{depart:0,stay:0,arrive:0},[ee]:re}};y(Oe);try{await Uh(I,ee,re),ne("Saved"),setTimeout(()=>ne(""),1500)}catch(b){oe(b instanceof Error?b.message:"Save failed")}}return a?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(mo,{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(hn,{type:"error",children:k}),P&&c.jsx(hn,{type:"ok",children:P}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:i.map((I,ee)=>c.jsxs("div",{draggable:!0,onDragStart:re=>ce(re,ee),onDragOver:re=>se(re,ee),onDragEnd:fe,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 0.875rem",border:"1px solid var(--card-border)",borderRadius:"8px",background:I.excluded?"#f8fafc":"var(--card-bg)",opacity:M===ee?.5:1},children:[c.jsx(Ch,{size:16,color:"var(--text-mid)",style:{cursor:"grab",flexShrink:0}}),c.jsx("span",{style:{flex:1,fontSize:"0.9rem",color:I.excluded?"var(--text-mid)":"var(--text-dark)",textDecoration:I.excluded?"line-through":"none"},children:I.name}),c.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",marginRight:"0.5rem"},children:[I.room_count," rooms"]}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8rem",color:"var(--text-mid)"},children:[c.jsx("input",{type:"checkbox",checked:!I.excluded,onChange:()=>ie(ee)}),"Active"]})]},I.id))}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(Xr,{onClick:Ue,disabled:p,primary:!0,children:p?"Saving…":"Save Order & Visibility"}),c.jsx(Xr,{onClick:$t,disabled:g,children:g?"Testing…":"Test Newbook Connection"})]}),c.jsx(ks,{}),c.jsx(mo,{title:"Workforce Departments"}),c.jsx("p",{style:{fontSize:"0.82rem",color:"var(--text-mid)",marginBottom:"1rem"},children:"Select the department(s) whose shifts should appear in the HK staff rota."}),de&&c.jsxs("div",{style:{padding:"0.75rem",borderRadius:"8px",background:"#f8fafc",border:"1px solid var(--card-border)",color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:["Workforce integration not configured — add the bearer token in ",c.jsx("strong",{children:"Settings → Integrations → Workforce"}),"."]}),!de&&$&&c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:"Loading departments…"}),!de&&!$&&c.jsxs("div",{style:{marginBottom:"2.5rem"},children:[B&&c.jsx(hn,{type:"error",children:B}),Me&&c.jsx(hn,{type:"ok",children:Me}),K.length===0?c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"1rem"},children:"No departments found for this location."}):c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem",marginBottom:"1rem"},children:K.map(I=>c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.5rem 0.75rem",border:"1px solid var(--card-border)",borderRadius:"7px",background:C.includes(I.id)?"rgba(42,100,72,0.05)":"var(--card-bg)",cursor:"pointer",fontSize:"0.9rem",color:"var(--text-dark)"},children:[c.jsx("input",{type:"checkbox",checked:C.includes(I.id),onChange:()=>Mn(I.id)}),I.name]},I.id))}),C.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(Xr,{onClick:Vt,disabled:xe,primary:!0,children:xe?"Saving…":"Save Departments"})]}),c.jsx(ks,{}),c.jsx(mo,{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."}),F&&c.jsx(hn,{type:"error",children:F}),Le&&c.jsx(hn,{type:"ok",children:Le}),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"}),Fc.map(I=>c.jsx("th",{children:I},I)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[Ce.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:9,style:{color:"var(--text-mid)",textAlign:"center",padding:"1rem"},children:"No tasks yet"})}),Ce.map((I,ee)=>c.jsxs("tr",{children:[c.jsx("td",{style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:I.name,placeholder:"Task name",onChange:re=>Ht(ee,re.target.value)})}),Fc.map(re=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:I.hours[re]||"",placeholder:"0",onChange:Oe=>In(ee,re,Oe.target.value)})},re)),c.jsx("td",{children:c.jsx("button",{onClick:()=>yn(ee),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},ee))]})]})}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(Xr,{onClick:()=>Pe([...Ce,{name:"",hours:{}}]),children:"+ Add task"}),c.jsx(Xr,{onClick:xn,disabled:We,primary:!0,children:We?"Saving…":"Save Tasks"})]}),c.jsx(ks,{}),c.jsx(mo,{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."}),le&&c.jsx(hn,{type:"error",children:le}),T&&c.jsx(hn,{type:"ok",children:T}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"2rem"},children:c.jsxs("table",{className:"hk-table",style:{maxWidth:"500px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),c.jsx("th",{children:"Depart (mins)"}),c.jsx("th",{children:"Stay (mins)"}),c.jsx("th",{children:"Arrive (mins)"})]})}),c.jsx("tbody",{children:i.filter(I=>!I.excluded).map(I=>{const ee=W[I.id]||{depart:0,stay:0,arrive:0};return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:I.name}),["depart","stay","arrive"].map(re=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:ee[re]||"",placeholder:"0",onChange:Oe=>kn(I.id,re,parseInt(Oe.target.value,10)||0),onBlur:Oe=>kn(I.id,re,parseInt(Oe.target.value,10)||0)})},re))]},I.id)})})]})})]})}function mo({title:i}){return c.jsx("h2",{style:{fontSize:"0.95rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"0.25rem"},children:i})}function ks(){return c.jsx("div",{style:{height:"1px",background:"var(--card-border)",margin:"0.5rem 0 2rem"}})}function hn({type:i,children:u}){return c.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.75rem",borderRadius:"8px",fontSize:"0.875rem",background:i==="ok"?"#dcfce7":"#fee2e2",color:i==="ok"?"var(--success)":"var(--danger)"},children:u})}function Xr({children:i,onClick:u,disabled:a,primary:d}){return c.jsx("button",{onClick:u,disabled:a,style:{background:d?"var(--hk-green)":"var(--card-bg)",color:d?"#fff":"var(--text-dark)",border:`1px solid ${d?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.5rem 1.25rem",fontSize:"0.875rem",fontWeight:600},children:i})}function dm({user:i}){return c.jsx(Ih,{user:i,children:c.jsxs(Zp,{children:[c.jsx(Zr,{path:"/",element:c.jsx(vs,{to:"/planner",replace:!0})}),c.jsx(Zr,{path:"/planner",element:c.jsx(nm,{})}),c.jsx(Zr,{path:"/settings",element:qc(i,"settings")?c.jsx(cm,{}):c.jsx(vs,{to:"/planner",replace:!0})}),c.jsx(Zr,{path:"*",element:c.jsx(vs,{to:"/planner",replace:!0})})]})})}function fm(){const i=Lh("/hk-planner/health");return c.jsxs(c.Fragment,{children:[c.jsx(oh,{basename:"/hk-planner",children:c.jsx(mh,{children:u=>c.jsx(dm,{user:u})})}),c.jsx(Th,{visible:i})]})}new URLSearchParams(window.location.search).has("install")&&window.addEventListener("beforeinstallprompt",i=>{i.preventDefault(),i.prompt()},{once:!0});sp.createRoot(document.getElementById("root")).render(c.jsx(E.StrictMode,{children:c.jsx(fm,{})})); diff --git a/frontend/dist/assets/index-IImb5HHO.js b/frontend/dist/assets/index-IImb5HHO.js deleted file mode 100644 index 641bb1c..0000000 --- a/frontend/dist/assets/index-IImb5HHO.js +++ /dev/null @@ -1,127 +0,0 @@ -function Xf(i,u){for(var a=0;ad[p]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))d(p);new MutationObserver(p=>{for(const m of p)if(m.type==="childList")for(const y of m.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&d(y)}).observe(document,{childList:!0,subtree:!0});function a(p){const m={};return p.integrity&&(m.integrity=p.integrity),p.referrerPolicy&&(m.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?m.credentials="include":p.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function d(p){if(p.ep)return;p.ep=!0;const m=a(p);fetch(p.href,m)}})();function Zf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ss={exports:{}},Qr={},as={exports:{}},oe={};/** - * @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 fc;function qf(){if(fc)return oe;fc=1;var i=Symbol.for("react.element"),u=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),y=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),E=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),_=Symbol.iterator;function D(g){return g===null||typeof g!="object"?null:(g=_&&g[_]||g["@@iterator"],typeof g=="function"?g:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},W=Object.assign,P={};function N(g,T,ne){this.props=g,this.context=T,this.refs=P,this.updater=ne||O}N.prototype.isReactComponent={},N.prototype.setState=function(g,T){if(typeof g!="object"&&typeof g!="function"&&g!=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,g,T,"setState")},N.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function V(){}V.prototype=N.prototype;function A(g,T,ne){this.props=g,this.context=T,this.refs=P,this.updater=ne||O}var X=A.prototype=new V;X.constructor=A,W(X,N.prototype),X.isPureReactComponent=!0;var K=Array.isArray,ue=Object.prototype.hasOwnProperty,ae={current:null},je={key:!0,ref:!0,__self:!0,__source:!0};function xe(g,T,ne){var le,ie={},se=null,pe=null;if(T!=null)for(le in T.ref!==void 0&&(pe=T.ref),T.key!==void 0&&(se=""+T.key),T)ue.call(T,le)&&!je.hasOwnProperty(le)&&(ie[le]=T[le]);var ce=arguments.length-2;if(ce===1)ie.children=ne;else if(1>>1,T=U[g];if(0>>1;gp(ie,B))sep(pe,ie)?(U[g]=pe,U[se]=B,g=se):(U[g]=ie,U[le]=B,g=le);else if(sep(pe,B))U[g]=pe,U[se]=B,g=se;else break e}}return G}function p(U,G){var B=U.sortIndex-G.sortIndex;return B!==0?B:U.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var y=Date,w=y.now();i.unstable_now=function(){return y.now()-w}}var k=[],E=[],R=1,_=null,D=3,O=!1,W=!1,P=!1,N=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function X(U){for(var G=a(E);G!==null;){if(G.callback===null)d(E);else if(G.startTime<=U)d(E),G.sortIndex=G.expirationTime,u(k,G);else break;G=a(E)}}function K(U){if(P=!1,X(U),!W)if(a(k)!==null)W=!0,De(ue);else{var G=a(E);G!==null&&he(K,G.startTime-U)}}function ue(U,G){W=!1,P&&(P=!1,V(xe),xe=-1),O=!0;var B=D;try{for(X(G),_=a(k);_!==null&&(!(_.expirationTime>G)||U&&!Ye());){var g=_.callback;if(typeof g=="function"){_.callback=null,D=_.priorityLevel;var T=g(_.expirationTime<=G);G=i.unstable_now(),typeof T=="function"?_.callback=T:_===a(k)&&d(k),X(G)}else d(k);_=a(k)}if(_!==null)var ne=!0;else{var le=a(E);le!==null&&he(K,le.startTime-G),ne=!1}return ne}finally{_=null,D=B,O=!1}}var ae=!1,je=null,xe=-1,Ke=5,Ie=-1;function Ye(){return!(i.unstable_now()-IeU||125g?(U.sortIndex=B,u(E,U),a(k)===null&&U===a(E)&&(P?(V(xe),xe=-1):P=!0,he(K,B-g))):(U.sortIndex=T,u(k,U),W||O||(W=!0,De(ue))),U},i.unstable_shouldYield=Ye,i.unstable_wrapCallback=function(U){var G=D;return function(){var B=D;D=G;try{return U.apply(this,arguments)}finally{D=B}}}})(ds)),ds}var gc;function lp(){return gc||(gc=1,cs.exports=rp()),cs.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 yc;function op(){if(yc)return at;yc=1;var i=ws(),u=lp();function a(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,E=/^[: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]*$/,R={},_={};function D(e){return k.call(_,e)?!0:k.call(R,e)?!1:E.test(e)?_[e]=!0:(R[e]=!0,!1)}function O(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 W(e,t,n,r){if(t===null||typeof t>"u"||O(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 P(e,t,n,r,l,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new P(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];N[t]=new P(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new P(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){N[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new P(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new P(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new P(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)});var V=/[\-:]([a-z])/g;function A(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(V,A);N[t]=new P(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(V,A);N[t]=new P(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(V,A);N[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)});function X(e,t,n,r){var l=N.hasOwnProperty(t)?N[t]:null;(l!==null?l.type!==0:r||!(2f||l[s]!==o[f]){var h=` -`+l[s].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=s&&0<=f);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function ie(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function se(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 je:return"Fragment";case ae:return"Portal";case Ke:return"Profiler";case xe:return"StrictMode";case Pe:return"Suspense";case Fe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ye:return(e.displayName||"Context")+".Consumer";case Ie:return(e._context.displayName||"Context")+".Provider";case ze:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Je:return t=e.displayName||null,t!==null?t:se(e.type)||"Memo";case De:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}function pe(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 se(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 ce(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ve(e){var t=ve(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $t(e){e._valueTracker||(e._valueTracker=Ve(e))}function Pn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ve(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Nt(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 pn(e,t){var n=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Tn(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ce(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 re(e,t){t=t.checked,t!=null&&X(e,"checked",t,!1)}function me(e,t){re(e,t);var n=ce(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")?I(e,t.type,n):t.hasOwnProperty("defaultValue")&&I(e,t.type,ce(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function be(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 I(e,t,n){(t!=="number"||Nt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var b=Array.isArray;function ee(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=br.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function sr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ar={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},bc=["Webkit","ms","Moz","O"];Object.keys(ar).forEach(function(e){bc.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ar[t]=ar[e]})});function Ns(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ar.hasOwnProperty(e)&&ar[e]?(""+t).trim():t+"px"}function Ps(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ns(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ed=B({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 xo(e,t){if(t){if(ed[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function ko(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 So=null;function wo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var jo=null,Rn=null,zn=null;function Ts(e){if(e=Rr(e)){if(typeof jo!="function")throw Error(a(280));var t=e.stateNode;t&&(t=wl(t),jo(e.stateNode,e.type,t))}}function Rs(e){Rn?zn?zn.push(e):zn=[e]:Rn=e}function zs(){if(Rn){var e=Rn,t=zn;if(zn=Rn=null,Ts(e),t)for(e=0;e>>=0,e===0?32:31-(dd(e)/fd|0)|0}var ll=64,ol=4194304;function fr(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 il(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var f=s&~l;f!==0?r=fr(f):(o&=s,o!==0&&(r=fr(o)))}else s=n&~l,s!==0?r=fr(s):o!==0&&(r=fr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function pr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-kt(t),e[t]=n}function vd(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=Sr),oa=" ",ia=!1;function sa(e,t){switch(e){case"keyup":return Hd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dn=!1;function Kd(e,t){switch(e){case"compositionend":return aa(t);case"keypress":return t.which!==32?null:(ia=!0,oa);case"textInput":return e=t.data,e===oa&&ia?null:e;default:return null}}function Yd(e,t){if(Dn)return e==="compositionend"||!Ao&&sa(e,t)?(e=bs(),dl=Mo=Yt=null,Dn=!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=ma(n)}}function ga(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ga(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ya(){for(var e=window,t=Nt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Ho(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 nf(e){var t=ya(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ga(n.ownerDocument.documentElement,n)){if(r!==null&&Ho(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=va(n,o);var s=va(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,Mn=null,Qo=null,Er=null,Ko=!1;function xa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ko||Mn==null||Mn!==Nt(r)||(r=Mn,"selectionStart"in r&&Ho(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}),Er&&Cr(Er,r)||(Er=r,r=xl(Qo,"onSelect"),0Bn||(e.current=li[Bn],li[Bn]=null,Bn--)}function ye(e,t){Bn++,li[Bn]=e.current,e.current=t}var Zt={},Ge=Xt(Zt),rt=Xt(!1),gn=Zt;function An(e,t){var n=e.type.contextTypes;if(!n)return Zt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function lt(e){return e=e.childContextTypes,e!=null}function jl(){we(rt),we(Ge)}function Da(e,t,n){if(Ge.current!==Zt)throw Error(a(168));ye(Ge,t),ye(rt,n)}function Ma(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(a(108,pe(e)||"Unknown",l));return B({},n,r)}function Cl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zt,gn=Ge.current,ye(Ge,e),ye(rt,rt.current),!0}function Ia(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=Ma(e,t,gn),r.__reactInternalMemoizedMergedChildContext=e,we(rt),we(Ge),ye(Ge,e)):we(rt),ye(rt,n)}var Dt=null,El=!1,oi=!1;function Fa(e){Dt===null?Dt=[e]:Dt.push(e)}function mf(e){El=!0,Fa(e)}function qt(){if(!oi&&Dt!==null){oi=!0;var e=0,t=ge;try{var n=Dt;for(ge=1;e>=s,l-=s,Mt=1<<32-kt(t)+l|n<te?($e=q,q=null):$e=q.sibling;var fe=z(x,q,S[te],F);if(fe===null){q===null&&(q=$e);break}e&&q&&fe.alternate===null&&t(x,q),v=o(fe,v,te),Z===null?J=fe:Z.sibling=fe,Z=fe,q=$e}if(te===S.length)return n(x,q),Ce&&xn(x,te),J;if(q===null){for(;tete?($e=q,q=null):$e=q.sibling;var an=z(x,q,fe.value,F);if(an===null){q===null&&(q=$e);break}e&&q&&an.alternate===null&&t(x,q),v=o(an,v,te),Z===null?J=an:Z.sibling=an,Z=an,q=$e}if(fe.done)return n(x,q),Ce&&xn(x,te),J;if(q===null){for(;!fe.done;te++,fe=S.next())fe=M(x,fe.value,F),fe!==null&&(v=o(fe,v,te),Z===null?J=fe:Z.sibling=fe,Z=fe);return Ce&&xn(x,te),J}for(q=r(x,q);!fe.done;te++,fe=S.next())fe=$(q,x,te,fe.value,F),fe!==null&&(e&&fe.alternate!==null&&q.delete(fe.key===null?te:fe.key),v=o(fe,v,te),Z===null?J=fe:Z.sibling=fe,Z=fe);return e&&q.forEach(function(Gf){return t(x,Gf)}),Ce&&xn(x,te),J}function Oe(x,v,S,F){if(typeof S=="object"&&S!==null&&S.type===je&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case ue:e:{for(var J=S.key,Z=v;Z!==null;){if(Z.key===J){if(J=S.type,J===je){if(Z.tag===7){n(x,Z.sibling),v=l(Z,S.props.children),v.return=x,x=v;break e}}else if(Z.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===De&&Va(J)===Z.type){n(x,Z.sibling),v=l(Z,S.props),v.ref=zr(x,Z,S),v.return=x,x=v;break e}n(x,Z);break}else t(x,Z);Z=Z.sibling}S.type===je?(v=Nn(S.props.children,x.mode,F,S.key),v.return=x,x=v):(F=bl(S.type,S.key,S.props,null,x.mode,F),F.ref=zr(x,v,S),F.return=x,x=F)}return s(x);case ae:e:{for(Z=S.key;v!==null;){if(v.key===Z)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){n(x,v.sibling),v=l(v,S.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=ns(S,x.mode,F),v.return=x,x=v}return s(x);case De:return Z=S._init,Oe(x,v,Z(S._payload),F)}if(b(S))return Q(x,v,S,F);if(G(S))return Y(x,v,S,F);Tl(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(n(x,v.sibling),v=l(v,S),v.return=x,x=v):(n(x,v),v=ts(S,x.mode,F),v.return=x,x=v),s(x)):n(x,v)}return Oe}var Qn=Ha(!0),Qa=Ha(!1),Rl=Xt(null),zl=null,Kn=null,di=null;function fi(){di=Kn=zl=null}function pi(e){var t=Rl.current;we(Rl),e._currentValue=t}function hi(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 Yn(e,t){zl=e,di=Kn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ot=!0),e.firstContext=null)}function vt(e){var t=e._currentValue;if(di!==e)if(e={context:e,memoizedValue:t,next:null},Kn===null){if(zl===null)throw Error(a(308));Kn=e,zl.dependencies={lanes:0,firstContext:e}}else Kn=Kn.next=e;return t}var kn=null;function mi(e){kn===null?kn=[e]:kn.push(e)}function Ka(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,mi(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ft(e,r)}function Ft(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 bt=!1;function vi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ya(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 Wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(de&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ft(e,n)}return l=r.interleaved,l===null?(t.next=t,mi(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ft(e,n)}function Ll(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,Ro(e,n)}}function Ja(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ol(e,t,n,r){var l=e.updateQueue;bt=!1;var o=l.firstBaseUpdate,s=l.lastBaseUpdate,f=l.shared.pending;if(f!==null){l.shared.pending=null;var h=f,j=h.next;h.next=null,s===null?o=j:s.next=j,s=h;var L=e.alternate;L!==null&&(L=L.updateQueue,f=L.lastBaseUpdate,f!==s&&(f===null?L.firstBaseUpdate=j:f.next=j,L.lastBaseUpdate=h))}if(o!==null){var M=l.baseState;s=0,L=j=h=null,f=o;do{var z=f.lane,$=f.eventTime;if((r&z)===z){L!==null&&(L=L.next={eventTime:$,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var Q=e,Y=f;switch(z=t,$=n,Y.tag){case 1:if(Q=Y.payload,typeof Q=="function"){M=Q.call($,M,z);break e}M=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=Y.payload,z=typeof Q=="function"?Q.call($,M,z):Q,z==null)break e;M=B({},M,z);break e;case 2:bt=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,z=l.effects,z===null?l.effects=[f]:z.push(f))}else $={eventTime:$,lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},L===null?(j=L=$,h=M):L=L.next=$,s|=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&&(h=M),l.baseState=h,l.firstBaseUpdate=j,l.lastBaseUpdate=L,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);jn|=s,e.lanes=s,e.memoizedState=M}}function Ga(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Si.transition;Si.transition={};try{e(!1),t()}finally{ge=n,Si.transition=r}}function hu(){return gt().memoizedState}function xf(e,t,n){var r=ln(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},mu(e))vu(t,n);else if(n=Ka(e,t,n,r),n!==null){var l=tt();_t(n,e,r,l),gu(n,t,r)}}function kf(e,t,n){var r=ln(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(mu(e))vu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,f=o(s,n);if(l.hasEagerState=!0,l.eagerState=f,St(f,s)){var h=t.interleaved;h===null?(l.next=l,mi(t)):(l.next=h.next,h.next=l),t.interleaved=l;return}}catch{}finally{}n=Ka(e,t,l,r),n!==null&&(l=tt(),_t(n,e,r,l),gu(n,t,r))}}function mu(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function vu(e,t){Mr=Il=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ro(e,n)}}var Ul={readContext:vt,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useInsertionEffect:Xe,useLayoutEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useMutableSource:Xe,useSyncExternalStore:Xe,useId:Xe,unstable_isNewReconciler:!1},Sf={readContext:vt,useCallback:function(e,t){return zt().memoizedState=[e,t===void 0?null:t],e},useContext:vt,useEffect:iu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Fl(4194308,4,uu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Fl(4,2,e,t)},useMemo:function(e,t){var n=zt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zt();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=xf.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=zt();return e={current:e},t.memoizedState=e},useState:lu,useDebugValue:Pi,useDeferredValue:function(e){return zt().memoizedState=e},useTransition:function(){var e=lu(!1),t=e[0];return e=yf.bind(null,e[1]),zt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,l=zt();if(Ce){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Ae===null)throw Error(a(349));(wn&30)!==0||ba(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,iu(tu.bind(null,r,o,e),[e]),r.flags|=2048,Wr(9,eu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=zt(),t=Ae.identifierPrefix;if(Ce){var n=It,r=Mt;n=(r&~(1<<32-kt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Tt]=t,e[Tr]=r,Fu(e,t,!1,!1),t.stateNode=e;e:{switch(s=ko(n,r),n){case"dialog":Se("cancel",e),Se("close",e),l=r;break;case"iframe":case"object":case"embed":Se("load",e),l=r;break;case"video":case"audio":for(l=0;l<_r.length;l++)Se(_r[l],e);l=r;break;case"source":Se("error",e),l=r;break;case"img":case"image":case"link":Se("error",e),Se("load",e),l=r;break;case"details":Se("toggle",e),l=r;break;case"input":Tn(e,r),l=pn(e,r),Se("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=B({},r,{value:void 0}),Se("invalid",e);break;case"textarea":Te(e,r),l=ke(e,r),Se("invalid",e);break;default:l=r}xo(n,l),f=l;for(o in f)if(f.hasOwnProperty(o)){var h=f[o];o==="style"?Ps(e,h):o==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&_s(e,h)):o==="children"?typeof h=="string"?(n!=="textarea"||h!=="")&&sr(e,h):typeof h=="number"&&sr(e,""+h):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(p.hasOwnProperty(o)?h!=null&&o==="onScroll"&&Se("scroll",e):h!=null&&X(e,o,h,s))}switch(n){case"input":$t(e),be(e,r,!1);break;case"textarea":$t(e),ir(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ce(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?ee(e,!!r.multiple,o,!1):r.defaultValue!=null&&ee(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Sl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ze(t),null;case 6:if(e&&t.stateNode!=null)Uu(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(a(166));if(n=Sn(Dr.current),Sn(Rt.current),Pl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Tt]=t,(o=r.nodeValue!==n)&&(e=dt,e!==null))switch(e.tag){case 3:kl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&kl(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Tt]=t,t.stateNode=r}return Ze(t),null;case 13:if(we(Ee),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ce&&ft!==null&&(t.mode&1)!==0&&(t.flags&128)===0)$a(),Hn(),t.flags|=98560,o=!1;else if(o=Pl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(a(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));o[Tt]=t}else Hn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),o=!1}else wt!==null&&(Xi(wt),wt=null),o=!0;if(!o)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Ee.current&1)!==0?Ue===0&&(Ue=3):bi())),t.updateQueue!==null&&(t.flags|=4),Ze(t),null);case 4:return Jn(),Ui(e,t),e===null&&Nr(t.stateNode.containerInfo),Ze(t),null;case 10:return pi(t.type._context),Ze(t),null;case 17:return lt(t.type)&&jl(),Ze(t),null;case 19:if(we(Ee),o=t.memoizedState,o===null)return Ze(t),null;if(r=(t.flags&128)!==0,s=o.rendering,s===null)if(r)Ur(o,!1);else{if(Ue!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Dl(e),s!==null){for(t.flags|=128,Ur(o,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,e=s.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ye(Ee,Ee.current&1|2),t.child}e=e.sibling}o.tail!==null&&Le()>qn&&(t.flags|=128,r=!0,Ur(o,!1),t.lanes=4194304)}else{if(!r)if(e=Dl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ur(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Ce)return Ze(t),null}else 2*Le()-o.renderingStartTime>qn&&n!==1073741824&&(t.flags|=128,r=!0,Ur(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Le(),t.sibling=null,n=Ee.current,ye(Ee,r?n&1|2:n&1),t):(Ze(t),null);case 22:case 23:return qi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(pt&1073741824)!==0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Tf(e,t){switch(si(t),t.tag){case 1:return lt(t.type)&&jl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jn(),we(rt),we(Ge),ki(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return yi(t),null;case 13:if(we(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Hn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(Ee),null;case 4:return Jn(),null;case 10:return pi(t.type._context),null;case 22:case 23:return qi(),null;case 24:return null;default:return null}}var Vl=!1,qe=!1,Rf=typeof WeakSet=="function"?WeakSet:Set,H=null;function Xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Re(e,t,r)}else n.current=null}function Bi(e,t,n){try{n()}catch(r){Re(e,t,r)}}var Bu=!1;function zf(e,t){if(qo=ul,e=ya(),Ho(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,f=-1,h=-1,j=0,L=0,M=e,z=null;t:for(;;){for(var $;M!==n||l!==0&&M.nodeType!==3||(f=s+l),M!==o||r!==0&&M.nodeType!==3||(h=s+r),M.nodeType===3&&(s+=M.nodeValue.length),($=M.firstChild)!==null;)z=M,M=$;for(;;){if(M===e)break t;if(z===n&&++j===l&&(f=s),z===o&&++L===r&&(h=s),($=M.nextSibling)!==null)break;M=z,z=M.parentNode}M=$}n=f===-1||h===-1?null:{start:f,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(bo={focusedElem:e,selectionRange:n},ul=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;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,Oe=Q.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?Y:jt(t.type,Y),Oe);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(F){Re(t,t.return,F)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return Q=Bu,Bu=!1,Q}function Br(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Bi(t,n,o)}l=l.next}while(l!==r)}}function Hl(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 Ai(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 Au(e){var t=e.alternate;t!==null&&(e.alternate=null,Au(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[Tr],delete t[ri],delete t[pf],delete t[hf])),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 $u(e){return e.tag===5||e.tag===3||e.tag===4}function Vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$u(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 $i(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=Sl));else if(r!==4&&(e=e.child,e!==null))for($i(e,t,n),e=e.sibling;e!==null;)$i(e,t,n),e=e.sibling}function Vi(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(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}var He=null,Ct=!1;function tn(e,t,n){for(n=n.child;n!==null;)Hu(e,t,n),n=n.sibling}function Hu(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(rl,n)}catch{}switch(n.tag){case 5:qe||Xn(n,t);case 6:var r=He,l=Ct;He=null,tn(e,t,n),He=r,Ct=l,He!==null&&(Ct?(e=He,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):He.removeChild(n.stateNode));break;case 18:He!==null&&(Ct?(e=He,n=n.stateNode,e.nodeType===8?ni(e.parentNode,n):e.nodeType===1&&ni(e,n),yr(e)):ni(He,n.stateNode));break;case 4:r=He,l=Ct,He=n.stateNode.containerInfo,Ct=!0,tn(e,t,n),He=r,Ct=l;break;case 0:case 11:case 14:case 15:if(!qe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,s=o.destroy;o=o.tag,s!==void 0&&((o&2)!==0||(o&4)!==0)&&Bi(n,t,s),l=l.next}while(l!==r)}tn(e,t,n);break;case 1:if(!qe&&(Xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Re(n,t,f)}tn(e,t,n);break;case 21:tn(e,t,n);break;case 22:n.mode&1?(qe=(r=qe)||n.memoizedState!==null,tn(e,t,n),qe=r):tn(e,t,n);break;default:tn(e,t,n)}}function Qu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Et(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~o}if(r=l,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Of(r/1960))-r,10e?16:e,rn===null)var r=!1;else{if(e=rn,rn=null,Gl=0,(de&6)!==0)throw Error(a(331));var l=de;for(de|=4,H=e.current;H!==null;){var o=H,s=o.child;if((H.flags&16)!==0){var f=o.deletions;if(f!==null){for(var h=0;hLe()-Ki?En(e,0):Qi|=n),st(e,t)}function lc(e,t){t===0&&((e.mode&1)===0?t=1:(t=ol,ol<<=1,(ol&130023424)===0&&(ol=4194304)));var n=tt();e=Ft(e,t),e!==null&&(pr(e,t,n),st(e,n))}function Uf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),lc(e,n)}function Bf(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(a(314))}r!==null&&r.delete(t),lc(e,n)}var oc;oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)ot=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ot=!1,Nf(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,Ce&&(t.flags&1048576)!==0&&Wa(t,Nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$l(e,t),e=t.pendingProps;var l=An(t,Ge.current);Yn(t,n),l=ji(null,t,r,e,l,n);var o=Ci();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,lt(r)?(o=!0,Cl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,vi(t),l.updater=Bl,t.stateNode=l,l._reactInternals=t,Ri(t,r,e,n),t=Di(null,t,r,!0,o,n)):(t.tag=0,Ce&&o&&ii(t),et(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch($l(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=$f(r),e=jt(r,e),l){case 0:t=Oi(null,t,r,e,n);break e;case 1:t=zu(null,t,r,e,n);break e;case 11:t=_u(null,t,r,e,n);break e;case 14:t=Nu(null,t,r,jt(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),Oi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),zu(e,t,r,l,n);case 3:e:{if(Lu(t),e===null)throw Error(a(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ya(e,t),Ol(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Gn(Error(a(423)),t),t=Ou(e,t,r,n,l);break e}else if(r!==l){l=Gn(Error(a(424)),t),t=Ou(e,t,r,n,l);break e}else for(ft=Gt(t.stateNode.containerInfo.firstChild),dt=t,Ce=!0,wt=null,n=Qa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Hn(),r===l){t=Ut(e,t,n);break e}et(e,t,r,n)}t=t.child}return t;case 5:return Xa(t),e===null&&ui(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,ei(r,l)?s=null:o!==null&&ei(r,o)&&(t.flags|=32),Ru(e,t),et(e,t,s,n),t.child;case 6:return e===null&&ui(t),null;case 13:return Du(e,t,n);case 4:return gi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qn(t,null,r,n):et(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),_u(e,t,r,l,n);case 7:return et(e,t,t.pendingProps,n),t.child;case 8:return et(e,t,t.pendingProps.children,n),t.child;case 12:return et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,ye(Rl,r._currentValue),r._currentValue=s,o!==null)if(St(o.value,s)){if(o.children===l.children&&!rt.current){t=Ut(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){s=o.child;for(var h=f.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Wt(-1,n&-n),h.tag=2;var j=o.updateQueue;if(j!==null){j=j.shared;var L=j.pending;L===null?h.next=h:(h.next=L.next,L.next=h),j.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),hi(o.return,n,t),f.lanes|=n;break}h=h.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(a(341));s.lanes|=n,f=s.alternate,f!==null&&(f.lanes|=n),hi(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}et(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Yn(t,n),l=vt(l),r=r(l),t.flags|=1,et(e,t,r,n),t.child;case 14:return r=t.type,l=jt(r,t.pendingProps),l=jt(r.type,l),Nu(e,t,r,l,n);case 15:return Pu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),$l(e,t),t.tag=1,lt(r)?(e=!0,Cl(t)):e=!1,Yn(t,n),xu(t,r,l),Ri(t,r,l,n),Di(null,t,r,!0,e,n);case 19:return Iu(e,t,n);case 22:return Tu(e,t,n)}throw Error(a(156,t.tag))};function ic(e,t){return Us(e,t)}function Af(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 xt(e,t,n,r){return new Af(e,t,n,r)}function es(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $f(e){if(typeof e=="function")return es(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ze)return 11;if(e===Je)return 14}return 2}function sn(e,t){var n=e.alternate;return n===null?(n=xt(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 bl(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")es(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case je:return Nn(n.children,l,o,t);case xe:s=8,l|=8;break;case Ke:return e=xt(12,n,t,l|2),e.elementType=Ke,e.lanes=o,e;case Pe:return e=xt(13,n,t,l),e.elementType=Pe,e.lanes=o,e;case Fe:return e=xt(19,n,t,l),e.elementType=Fe,e.lanes=o,e;case he:return eo(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ie:s=10;break e;case Ye:s=9;break e;case ze:s=11;break e;case Je:s=14;break e;case De:s=16,r=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=xt(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Nn(e,t,n,r){return e=xt(7,e,r,t),e.lanes=n,e}function eo(e,t,n,r){return e=xt(22,e,r,t),e.elementType=he,e.lanes=n,e.stateNode={isHidden:!1},e}function ts(e,t,n){return e=xt(6,e,null,t),e.lanes=n,e}function ns(e,t,n){return t=xt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vf(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=To(0),this.expirationTimes=To(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=To(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function rs(e,t,n,r,l,o,s,f,h){return e=new Vf(e,t,n,f,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=xt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vi(o),e}function Hf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(u){console.error(u)}}return i(),us.exports=op(),us.exports}var kc;function ip(){if(kc)return so;kc=1;var i=Fc();return so.createRoot=i.createRoot,so.hydrateRoot=i.hydrateRoot,so}var sp=ip();Fc();/** - * @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 Gr(){return Gr=Object.assign?Object.assign.bind():function(i){for(var u=1;u"u")throw new Error(u)}function js(i,u){if(!i){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function up(){return Math.random().toString(36).substr(2,8)}function wc(i,u){return{usr:i.state,key:i.key,idx:u}}function gs(i,u,a,d){return a===void 0&&(a=null),Gr({pathname:typeof i=="string"?i:i.pathname,search:"",hash:""},typeof u=="string"?rr(u):u,{state:a,key:u&&u.key||d||up()})}function fo(i){let{pathname:u="/",search:a="",hash:d=""}=i;return a&&a!=="?"&&(u+=a.charAt(0)==="?"?a:"?"+a),d&&d!=="#"&&(u+=d.charAt(0)==="#"?d:"#"+d),u}function rr(i){let u={};if(i){let a=i.indexOf("#");a>=0&&(u.hash=i.substr(a),i=i.substr(0,a));let d=i.indexOf("?");d>=0&&(u.search=i.substr(d),i=i.substr(0,d)),i&&(u.pathname=i)}return u}function cp(i,u,a,d){d===void 0&&(d={});let{window:p=document.defaultView,v5Compat:m=!1}=d,y=p.history,w=cn.Pop,k=null,E=R();E==null&&(E=0,y.replaceState(Gr({},y.state,{idx:E}),""));function R(){return(y.state||{idx:null}).idx}function _(){w=cn.Pop;let N=R(),V=N==null?null:N-E;E=N,k&&k({action:w,location:P.location,delta:V})}function D(N,V){w=cn.Push;let A=gs(P.location,N,V);E=R()+1;let X=wc(A,E),K=P.createHref(A);try{y.pushState(X,"",K)}catch(ue){if(ue instanceof DOMException&&ue.name==="DataCloneError")throw ue;p.location.assign(K)}m&&k&&k({action:w,location:P.location,delta:1})}function O(N,V){w=cn.Replace;let A=gs(P.location,N,V);E=R();let X=wc(A,E),K=P.createHref(A);y.replaceState(X,"",K),m&&k&&k({action:w,location:P.location,delta:0})}function W(N){let V=p.location.origin!=="null"?p.location.origin:p.location.href,A=typeof N=="string"?N:fo(N);return A=A.replace(/ $/,"%20"),Ne(V,"No window.location.(origin|href) available to create URL for href: "+A),new URL(A,V)}let P={get action(){return w},get location(){return i(p,y)},listen(N){if(k)throw new Error("A history only accepts one active listener");return p.addEventListener(Sc,_),k=N,()=>{p.removeEventListener(Sc,_),k=null}},createHref(N){return u(p,N)},createURL:W,encodeLocation(N){let V=W(N);return{pathname:V.pathname,search:V.search,hash:V.hash}},push:D,replace:O,go(N){return y.go(N)}};return P}var jc;(function(i){i.data="data",i.deferred="deferred",i.redirect="redirect",i.error="error"})(jc||(jc={}));function dp(i,u,a){return a===void 0&&(a="/"),fp(i,u,a)}function fp(i,u,a,d){let p=typeof u=="string"?rr(u):u,m=tr(p.pathname||"/",a);if(m==null)return null;let y=Wc(i);pp(y);let w=null,k=Cp(m);for(let E=0;w==null&&E{let k={relativePath:w===void 0?m.path||"":w,caseSensitive:m.caseSensitive===!0,childrenIndex:y,route:m};k.relativePath.startsWith("/")&&(Ne(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 E=dn([d,k.relativePath]),R=a.concat(k);m.children&&m.children.length>0&&(Ne(m.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+E+'".')),Wc(m.children,u,R,E)),!(m.path==null&&!m.index)&&u.push({path:E,score:kp(E,m.index),routesMeta:R})};return i.forEach((m,y)=>{var w;if(m.path===""||!((w=m.path)!=null&&w.includes("?")))p(m,y);else for(let k of Uc(m.path))p(m,y,k)}),u}function Uc(i){let u=i.split("/");if(u.length===0)return[];let[a,...d]=u,p=a.endsWith("?"),m=a.replace(/\?$/,"");if(d.length===0)return p?[m,""]:[m];let y=Uc(d.join("/")),w=[];return w.push(...y.map(k=>k===""?m:[m,k].join("/"))),p&&w.push(...y),w.map(k=>i.startsWith("/")&&k===""?"/":k)}function pp(i){i.sort((u,a)=>u.score!==a.score?a.score-u.score:Sp(u.routesMeta.map(d=>d.childrenIndex),a.routesMeta.map(d=>d.childrenIndex)))}const hp=/^:[\w-]+$/,mp=3,vp=2,gp=1,yp=10,xp=-2,Cc=i=>i==="*";function kp(i,u){let a=i.split("/"),d=a.length;return a.some(Cc)&&(d+=xp),u&&(d+=vp),a.filter(p=>!Cc(p)).reduce((p,m)=>p+(hp.test(m)?mp:m===""?gp:yp),d)}function Sp(i,u){return i.length===u.length&&i.slice(0,-1).every((d,p)=>d===u[p])?i[i.length-1]-u[u.length-1]:0}function wp(i,u,a){let{routesMeta:d}=i,p={},m="/",y=[];for(let w=0;w{let{paramName:D,isOptional:O}=R;if(D==="*"){let P=w[_]||"";y=m.slice(0,m.length-P.length).replace(/(.)\/+$/,"$1")}const W=w[_];return O&&!W?E[D]=void 0:E[D]=(W||"").replace(/%2F/g,"/"),E},{}),pathname:m,pathnameBase:y,pattern:i}}function jp(i,u,a){u===void 0&&(u=!1),a===void 0&&(a=!0),js(i==="*"||!i.endsWith("*")||i.endsWith("/*"),'Route path "'+i+'" will be treated as if it were '+('"'+i.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+i.replace(/\*$/,"/*")+'".'));let d=[],p="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(y,w,k)=>(d.push({paramName:w,isOptional:k!=null}),k?"/?([^\\/]+)?":"/([^\\/]+)"));return i.endsWith("*")?(d.push({paramName:"*"}),p+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?p+="\\/*$":i!==""&&i!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,u?void 0:"i"),d]}function Cp(i){try{return i.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return js(!1,'The URL path "'+i+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),i}}function tr(i,u){if(u==="/")return i;if(!i.toLowerCase().startsWith(u.toLowerCase()))return null;let a=u.endsWith("/")?u.length-1:u.length,d=i.charAt(a);return d&&d!=="/"?null:i.slice(a)||"/"}const Ep=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_p=i=>Ep.test(i);function Np(i,u){u===void 0&&(u="/");let{pathname:a,search:d="",hash:p=""}=typeof i=="string"?rr(i):i,m;if(a)if(_p(a))m=a;else{if(a.includes("//")){let y=a;a=Bc(a),js(!1,"Pathnames cannot have embedded double slashes - normalizing "+(y+" -> "+a))}a.startsWith("/")?m=Ec(a.substring(1),"/"):m=Ec(a,u)}else m=u;return{pathname:m,search:Rp(d),hash:zp(p)}}function Ec(i,u){let a=u.replace(/\/+$/,"").split("/");return i.split("/").forEach(p=>{p===".."?a.length>1&&a.pop():p!=="."&&a.push(p)}),a.length>1?a.join("/"):"/"}function fs(i,u,a,d){return"Cannot include a '"+i+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(d)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Pp(i){return i.filter((u,a)=>a===0||u.route.path&&u.route.path.length>0)}function Cs(i,u){let a=Pp(i);return u?a.map((d,p)=>p===a.length-1?d.pathname:d.pathnameBase):a.map(d=>d.pathnameBase)}function Es(i,u,a,d){d===void 0&&(d=!1);let p;typeof i=="string"?p=rr(i):(p=Gr({},i),Ne(!p.pathname||!p.pathname.includes("?"),fs("?","pathname","search",p)),Ne(!p.pathname||!p.pathname.includes("#"),fs("#","pathname","hash",p)),Ne(!p.search||!p.search.includes("#"),fs("#","search","hash",p)));let m=i===""||p.pathname==="",y=m?"/":p.pathname,w;if(y==null)w=a;else{let _=u.length-1;if(!d&&y.startsWith("..")){let D=y.split("/");for(;D[0]==="..";)D.shift(),_-=1;p.pathname=D.join("/")}w=_>=0?u[_]:"/"}let k=Np(p,w),E=y&&y!=="/"&&y.endsWith("/"),R=(m||y===".")&&a.endsWith("/");return!k.pathname.endsWith("/")&&(E||R)&&(k.pathname+="/"),k}const Bc=i=>i.replace(/\/\/+/g,"/"),dn=i=>Bc(i.join("/")),Tp=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),Rp=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,zp=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i;function Lp(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}const Ac=["post","put","patch","delete"];new Set(Ac);const Op=["get",...Ac];new Set(Op);/** - * 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 Xr(){return Xr=Object.assign?Object.assign.bind():function(i){for(var u=1;u{w.current=!0}),C.useCallback(function(E,R){if(R===void 0&&(R={}),!w.current)return;if(typeof E=="number"){d.go(E);return}let _=Es(E,JSON.parse(y),m,R.relative==="path");i==null&&u!=="/"&&(_.pathname=_.pathname==="/"?u:dn([u,_.pathname])),(R.replace?d.replace:d.push)(_,R.state,R)},[u,d,y,m,i])}function vo(i,u){let{relative:a}=u===void 0?{}:u,{future:d}=C.useContext(At),{matches:p}=C.useContext(fn),{pathname:m}=or(),y=JSON.stringify(Cs(p,d.v7_relativeSplatPath));return C.useMemo(()=>Es(i,JSON.parse(y),m,a==="path"),[i,y,m,a])}function Ip(i,u){return Fp(i,u)}function Fp(i,u,a,d){lr()||Ne(!1);let{navigator:p}=C.useContext(At),{matches:m}=C.useContext(fn),y=m[m.length-1],w=y?y.params:{};y&&y.pathname;let k=y?y.pathnameBase:"/";y&&y.route;let E=or(),R;if(u){var _;let N=typeof u=="string"?rr(u):u;k==="/"||(_=N.pathname)!=null&&_.startsWith(k)||Ne(!1),R=N}else R=E;let D=R.pathname||"/",O=D;if(k!=="/"){let N=k.replace(/^\//,"").split("/");O="/"+D.replace(/^\//,"").split("/").slice(N.length).join("/")}let W=dp(i,{pathname:O}),P=$p(W&&W.map(N=>Object.assign({},N,{params:Object.assign({},w,N.params),pathname:dn([k,p.encodeLocation?p.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?k:dn([k,p.encodeLocation?p.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),m,a,d);return u&&P?C.createElement(mo.Provider,{value:{location:Xr({pathname:"/",search:"",hash:"",state:null,key:"default"},R),navigationType:cn.Pop}},P):P}function Wp(){let i=Kp(),u=Lp(i)?i.status+" "+i.statusText:i instanceof Error?i.message:JSON.stringify(i),a=i instanceof Error?i.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},u),a?C.createElement("pre",{style:p},a):null,null)}const Up=C.createElement(Wp,null);class Bp extends C.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,a){return a.location!==u.location||a.revalidation!=="idle"&&u.revalidation==="idle"?{error:u.error,location:u.location,revalidation:u.revalidation}:{error:u.error!==void 0?u.error:a.error,location:a.location,revalidation:u.revalidation||a.revalidation}}componentDidCatch(u,a){console.error("React Router caught the following error during render",u,a)}render(){return this.state.error!==void 0?C.createElement(fn.Provider,{value:this.props.routeContext},C.createElement(Vc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ap(i){let{routeContext:u,match:a,children:d}=i,p=C.useContext(ho);return p&&p.static&&p.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=a.route.id),C.createElement(fn.Provider,{value:u},d)}function $p(i,u,a,d){var p;if(u===void 0&&(u=[]),a===void 0&&(a=null),d===void 0&&(d=null),i==null){var m;if(!a)return null;if(a.errors)i=a.matches;else if((m=d)!=null&&m.v7_partialHydration&&u.length===0&&!a.initialized&&a.matches.length>0)i=a.matches;else return null}let y=i,w=(p=a)==null?void 0:p.errors;if(w!=null){let R=y.findIndex(_=>_.route.id&&(w==null?void 0:w[_.route.id])!==void 0);R>=0||Ne(!1),y=y.slice(0,Math.min(y.length,R+1))}let k=!1,E=-1;if(a&&d&&d.v7_partialHydration)for(let R=0;R=0?y=y.slice(0,E+1):y=[y[0]];break}}}return y.reduceRight((R,_,D)=>{let O,W=!1,P=null,N=null;a&&(O=w&&_.route.id?w[_.route.id]:void 0,P=_.route.errorElement||Up,k&&(E<0&&D===0?(Jp("route-fallback"),W=!0,N=null):E===D&&(W=!0,N=_.route.hydrateFallbackElement||null)));let V=u.concat(y.slice(0,D+1)),A=()=>{let X;return O?X=P:W?X=N:_.route.Component?X=C.createElement(_.route.Component,null):_.route.element?X=_.route.element:X=R,C.createElement(Ap,{match:_,routeContext:{outlet:R,matches:V,isDataRoute:a!=null},children:X})};return a&&(_.route.ErrorBoundary||_.route.errorElement||D===0)?C.createElement(Bp,{location:a.location,revalidation:a.revalidation,component:P,error:O,children:A(),routeContext:{outlet:null,matches:V,isDataRoute:!0}}):A()},null)}var Kc=(function(i){return i.UseBlocker="useBlocker",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i})(Kc||{}),Yc=(function(i){return i.UseBlocker="useBlocker",i.UseLoaderData="useLoaderData",i.UseActionData="useActionData",i.UseRouteError="useRouteError",i.UseNavigation="useNavigation",i.UseRouteLoaderData="useRouteLoaderData",i.UseMatches="useMatches",i.UseRevalidator="useRevalidator",i.UseNavigateStable="useNavigate",i.UseRouteId="useRouteId",i})(Yc||{});function Vp(i){let u=C.useContext(ho);return u||Ne(!1),u}function Hp(i){let u=C.useContext($c);return u||Ne(!1),u}function Qp(i){let u=C.useContext(fn);return u||Ne(!1),u}function Jc(i){let u=Qp(),a=u.matches[u.matches.length-1];return a.route.id||Ne(!1),a.route.id}function Kp(){var i;let u=C.useContext(Vc),a=Hp(),d=Jc();return u!==void 0?u:(i=a.errors)==null?void 0:i[d]}function Yp(){let{router:i}=Vp(Kc.UseNavigateStable),u=Jc(Yc.UseNavigateStable),a=C.useRef(!1);return Hc(()=>{a.current=!0}),C.useCallback(function(p,m){m===void 0&&(m={}),a.current&&(typeof p=="number"?i.navigate(p):i.navigate(p,Xr({fromRouteId:u},m)))},[i,u])}const _c={};function Jp(i,u,a){_c[i]||(_c[i]=!0)}function Gp(i,u){i==null||i.v7_startTransition,i==null||i.v7_relativeSplatPath}function ps(i){let{to:u,replace:a,state:d,relative:p}=i;lr()||Ne(!1);let{future:m,static:y}=C.useContext(At),{matches:w}=C.useContext(fn),{pathname:k}=or(),E=Qc(),R=Es(u,Cs(w,m.v7_relativeSplatPath),k,p==="path"),_=JSON.stringify(R);return C.useEffect(()=>E(JSON.parse(_),{replace:a,state:d,relative:p}),[E,_,p,a,d]),null}function Yr(i){Ne(!1)}function Xp(i){let{basename:u="/",children:a=null,location:d,navigationType:p=cn.Pop,navigator:m,static:y=!1,future:w}=i;lr()&&Ne(!1);let k=u.replace(/^\/*/,"/"),E=C.useMemo(()=>({basename:k,navigator:m,static:y,future:Xr({v7_relativeSplatPath:!1},w)}),[k,w,m,y]);typeof d=="string"&&(d=rr(d));let{pathname:R="/",search:_="",hash:D="",state:O=null,key:W="default"}=d,P=C.useMemo(()=>{let N=tr(R,k);return N==null?null:{location:{pathname:N,search:_,hash:D,state:O,key:W},navigationType:p}},[k,R,_,D,O,W,p]);return P==null?null:C.createElement(At.Provider,{value:E},C.createElement(mo.Provider,{children:a,value:P}))}function Zp(i){let{children:u,location:a}=i;return Ip(xs(u),a)}new Promise(()=>{});function xs(i,u){u===void 0&&(u=[]);let a=[];return C.Children.forEach(i,(d,p)=>{if(!C.isValidElement(d))return;let m=[...u,p];if(d.type===C.Fragment){a.push.apply(a,xs(d.props.children,m));return}d.type!==Yr&&Ne(!1),!d.props.index||!d.props.children||Ne(!1);let y={id:d.props.id||m.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&&(y.children=xs(d.props.children,m)),a.push(y)}),a}/** - * 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 po(){return po=Object.assign?Object.assign.bind():function(i){for(var u=1;u{E&&Nc?Nc(()=>k(_)):k(_)},[k,E]);return C.useLayoutEffect(()=>y.listen(R),[y,R]),C.useEffect(()=>Gp(d),[d]),C.createElement(Xp,{basename:u,children:a,location:w.location,navigationType:w.action,navigator:y,future:d})}const ih=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ah=C.forwardRef(function(u,a){let{onClick:d,relative:p,reloadDocument:m,replace:y,state:w,target:k,to:E,preventScrollReset:R,viewTransition:_}=u,D=Gc(u,eh),{basename:O}=C.useContext(At),W,P=!1;if(typeof E=="string"&&sh.test(E)&&(W=E,ih))try{let X=new URL(window.location.href),K=E.startsWith("//")?new URL(X.protocol+E):new URL(E),ue=tr(K.pathname,O);K.origin===X.origin&&ue!=null?E=ue+K.search+K.hash:P=!0}catch{}let N=Dp(E,{relative:p}),V=dh(E,{replace:y,state:w,target:k,preventScrollReset:R,relative:p,viewTransition:_});function A(X){d&&d(X),X.defaultPrevented||V(X)}return C.createElement("a",po({},D,{href:W||N,onClick:P||m?d:A,ref:a,target:k}))}),uh=C.forwardRef(function(u,a){let{"aria-current":d="page",caseSensitive:p=!1,className:m="",end:y=!1,style:w,to:k,viewTransition:E,children:R}=u,_=Gc(u,th),D=vo(k,{relative:_.relative}),O=or(),W=C.useContext($c),{navigator:P,basename:N}=C.useContext(At),V=W!=null&&fh(D)&&E===!0,A=P.encodeLocation?P.encodeLocation(D).pathname:D.pathname,X=O.pathname,K=W&&W.navigation&&W.navigation.location?W.navigation.location.pathname:null;p||(X=X.toLowerCase(),K=K?K.toLowerCase():null,A=A.toLowerCase()),K&&N&&(K=tr(K,N)||K);const ue=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let ae=X===A||!y&&X.startsWith(A)&&X.charAt(ue)==="/",je=K!=null&&(K===A||!y&&K.startsWith(A)&&K.charAt(A.length)==="/"),xe={isActive:ae,isPending:je,isTransitioning:V},Ke=ae?d:void 0,Ie;typeof m=="function"?Ie=m(xe):Ie=[m,ae?"active":null,je?"pending":null,V?"transitioning":null].filter(Boolean).join(" ");let Ye=typeof w=="function"?w(xe):w;return C.createElement(ah,po({},_,{"aria-current":Ke,className:Ie,ref:a,style:Ye,to:k,viewTransition:E}),typeof R=="function"?R(xe):R)});var ks;(function(i){i.UseScrollRestoration="useScrollRestoration",i.UseSubmit="useSubmit",i.UseSubmitFetcher="useSubmitFetcher",i.UseFetcher="useFetcher",i.useViewTransitionState="useViewTransitionState"})(ks||(ks={}));var Pc;(function(i){i.UseFetcher="useFetcher",i.UseFetchers="useFetchers",i.UseScrollRestoration="useScrollRestoration"})(Pc||(Pc={}));function ch(i){let u=C.useContext(ho);return u||Ne(!1),u}function dh(i,u){let{target:a,replace:d,state:p,preventScrollReset:m,relative:y,viewTransition:w}=u===void 0?{}:u,k=Qc(),E=or(),R=vo(i,{relative:y});return C.useCallback(_=>{if(bp(_,a)){_.preventDefault();let D=d!==void 0?d:fo(E)===fo(R);k(i,{replace:D,state:p,preventScrollReset:m,relative:y,viewTransition:w})}},[E,k,R,d,p,a,i,m,y,w])}function fh(i,u){u===void 0&&(u={});let a=C.useContext(rh);a==null&&Ne(!1);let{basename:d}=ch(ks.useViewTransitionState),p=vo(i,{relative:u.relative});if(!a.isTransitioning)return!1;let m=tr(a.currentLocation.pathname,d)||a.currentLocation.pathname,y=tr(a.nextLocation.pathname,d)||a.nextLocation.pathname;return ys(p.pathname,y)!=null||ys(p.pathname,m)!=null}function ph(){if(window.matchMedia("(display-mode: standalone)").matches)return;const i=document.cookie.split(";").map(a=>a.trim()).find(a=>a.startsWith("hnf_inactivity_mins="));if(!i)return;const u=parseInt(i.split("=")[1]);return isNaN(u)||u<=0?void 0:u*60*1e3}const Tc={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"},hh={background:"var(--hk-green)",color:"#fff",border:"none",borderRadius:"6px",padding:"0.625rem",fontSize:"1rem",fontWeight:600,marginTop:"0.25rem",width:"100%"};function mh({children:i}){const[u,a]=C.useState("checking"),[d,p]=C.useState(null),[m,y]=C.useState(""),[w,k]=C.useState(""),[E,R]=C.useState(""),[_,D]=C.useState(!1),O=C.useRef(null);C.useEffect(()=>{fetch("/api/auth/verify?app=hk-planner",{credentials:"include"}).then(async P=>{P.ok?(p(await P.json()),a("authed")):a("login")}).catch(()=>a("login"))},[]),C.useEffect(()=>{const P=ph();if(u!=="authed"||!P)return;async function N(){await fetch("/api/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),p(null),a("login")}function V(){O.current&&clearTimeout(O.current),O.current=setTimeout(N,P)}const A=["mousemove","keydown","click","touchstart"];return A.forEach(X=>window.addEventListener(X,V,{passive:!0})),V(),()=>{O.current&&clearTimeout(O.current),A.forEach(X=>window.removeEventListener(X,V))}},[u]);async function W(P){P.preventDefault(),D(!0),R("");try{if(!(await fetch("/api/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:m,password:w})})).ok){R("Invalid email or password");return}const V=await fetch("/api/auth/verify?app=hk-planner",{credentials:"include"});V.ok?(p(await V.json()),a("authed")):R("You don't have access to this app.")}catch{R("Connection error — please try again")}finally{D(!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:W,style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[c.jsx("input",{type:"email",value:m,onChange:P=>y(P.target.value),placeholder:"Email",required:!0,autoComplete:"email",style:Tc}),c.jsx("input",{type:"password",value:w,onChange:P=>k(P.target.value),placeholder:"Password",required:!0,autoComplete:"current-password",style:Tc}),E&&c.jsx("p",{style:{color:"#f87171",fontSize:"0.875rem"},children:E}),c.jsx("button",{type:"submit",disabled:_,style:hh,children:_?"Signing in…":"Sign in"})]})]})}):c.jsx(c.Fragment,{children:i(d)})}/** - * @license lucide-react v1.24.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xc=(...i)=>i.filter((u,a,d)=>!!u&&u.trim()!==""&&d.indexOf(u)===a).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 vh=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v1.24.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gh=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,a,d)=>d?d.toUpperCase():a.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 Rc=i=>{const u=gh(i);return u.charAt(0).toUpperCase()+u.slice(1)};/** - * @license lucide-react v1.24.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var hs={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 yh=i=>{for(const u in i)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1},xh=C.createContext({}),kh=()=>C.useContext(xh),Sh=C.forwardRef(({color:i,size:u,strokeWidth:a,absoluteStrokeWidth:d,className:p="",children:m,iconNode:y,...w},k)=>{const{size:E=24,strokeWidth:R=2,absoluteStrokeWidth:_=!1,color:D="currentColor",className:O=""}=kh()??{},W=d??_?Number(a??R)*24/Number(u??E):a??R;return C.createElement("svg",{ref:k,...hs,width:u??E??hs.width,height:u??E??hs.height,stroke:i??D,strokeWidth:W,className:Xc("lucide",O,p),...!m&&!yh(w)&&{"aria-hidden":"true"},...w},[...y.map(([P,N])=>C.createElement(P,N)),...Array.isArray(m)?m:[m]])});/** - * @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 Zr=(i,u)=>{const a=C.forwardRef(({className:d,...p},m)=>C.createElement(Sh,{ref:m,iconNode:u,className:Xc(`lucide-${vh(Rc(i))}`,`lucide-${i}`,d),...p}));return a.displayName=Rc(i),a};/** - * @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 wh=[["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"}]],zc=Zr("calendar-clock",wh);/** - * @license lucide-react v1.24.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jh=[["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"}]],Ch=Zr("grip-vertical",jh);/** - * @license lucide-react v1.24.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eh=[["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"}]],_h=Zr("log-out",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 Nh=[["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"}]],Ss=Zr("refresh-cw",Nh);/** - * @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:"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"}]],Th=Zr("settings",Ph);function Rh({visible:i}){return i?c.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"var(--sidebar)",color:"var(--text-light)",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"10px 16px",fontSize:"14px",boxShadow:"0 -2px 8px rgba(0,0,0,0.3)"},children:[c.jsx("span",{children:"A new version is available."}),c.jsxs("button",{onClick:()=>window.location.reload(),style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--accent)",color:"var(--sidebar)",border:"none",borderRadius:"4px",padding:"6px 14px",fontWeight:600,cursor:"pointer",fontSize:"13px"},children:[c.jsx(Ss,{size:14,strokeWidth:1.75}),"Reload"]})]}):null}const zh=120*1e3;function Lh(i){const[u,a]=C.useState(!1);return C.useEffect(()=>{let d=null;async function p(){try{const w=await fetch(i,{cache:"no-store"});if(!w.ok)return;const E=(await w.json()).version;if(!E)return;d===null?d=E:E!==d&&a(!0)}catch{}}p();const m=setInterval(p,zh);function y(){document.visibilityState==="visible"&&p()}return document.addEventListener("visibilitychange",y),()=>{clearInterval(m),document.removeEventListener("visibilitychange",y)}},[i]),u}function Zc(i,u){return i.is_admin||i.caps.includes(u)}const Oh="width=1280",Dh="width=device-width, initial-scale=1.0";function Lc(i){const u=document.querySelector('meta[name="viewport"]');u&&(u.content=i)}function Mh(i){C.useEffect(()=>(Lc(Oh),window.parent.postMessage({type:"hnf:viewport",mode:i},"*"),()=>{Lc(Dh),window.parent.postMessage({type:"hnf:viewport",mode:"responsive"},"*")}),[i])}function Ih({user:i,children:u}){Mh("desktop");async function a(){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(zc,{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(Oc,{to:"/planner",icon:zc,label:"Planner"}),Zc(i,"settings")&&c.jsx(Oc,{to:"/settings",icon:Th,label:"Settings"})]}),c.jsxs("div",{style:{padding:"0.75rem 1rem",borderTop:"1px solid var(--surface-2)"},children:[c.jsxs("div",{style:{marginBottom:"0.5rem"},children:[c.jsx("div",{style:{color:"var(--text)",fontSize:"0.8rem",fontWeight:600},children:i.name}),c.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.72rem"},children:i.email})]}),c.jsxs("button",{onClick:a,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(_h,{size:14,strokeWidth:1.75}),"Sign out"]})]})]}),c.jsx("main",{style:{flex:1,overflow:"auto",background:"var(--body-bg)"},children:u})]})}function Oc({to:i,icon:u,label:a}){return c.jsxs(uh,{to:i,style:({isActive:d})=>({display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.625rem 1rem",textDecoration:"none",color:d?"#74c69d":"var(--text)",background:d?"var(--surface)":"transparent",borderLeft:d?"2px solid #74c69d":"2px solid transparent",fontSize:"0.875rem",transition:"background 0.15s"}),children:[c.jsx(u,{size:15,strokeWidth:1.75}),a]})}const Fh="/hk-planner/api";async function nt(i,u){const a=await fetch(Fh+i,{credentials:"include",...u});if(a.status===401)throw(window.top??window).location.href="/login",new Error("Unauthenticated");if(!a.ok){const d=await a.json().catch(()=>({}));throw new Error(d.error||`HTTP ${a.status}`)}return a.json()}function Wh(i,u,a=!1){const d=new URLSearchParams;return i&&d.set("week_start",i),u&&d.set("last_viewed",u),a&&d.set("force_refresh","1"),nt(`/bookings?${d}`)}function qc(){return nt("/config")}function Uh(i,u,a){return nt("/config/time-requirements",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cat:i,action:u,value:a})})}function Bh(i){return nt("/config/staff",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staff_data:i})})}function Ah(i){return nt("/config/pickup",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pickup_data:i})})}function $h(i){return nt("/config/general-tasks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({general_tasks:i})})}function Vh(i){return nt("/config/last-reviewed",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:i})})}function Hh(){return nt("/categories")}function Qh(i,u){return nt("/categories",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:i,excluded:u})})}function Kh(){return nt("/newbook/test",{method:"POST"})}function Yh(){return nt("/workforce/departments")}function Jh(i){return nt("/config/workforce-departments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dept_ids:i})})}function Gh(i,u){return nt(`/workforce/sync?start=${i}&end=${u}`,{method:"POST"})}function Xh(){return nt("/workforce/staff")}function Zh(i){return nt("/config/adjustments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({adjustments:i})})}function ao(){const i=new Date;return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function ms(i,u){const[a,d,p]=i.split("-").map(Number),m=new Date(a,d-1,p);return m.setDate(m.getDate()+u),`${m.getFullYear()}-${String(m.getMonth()+1).padStart(2,"0")}-${String(m.getDate()).padStart(2,"0")}`}function go(i){const u=new Date(i+"T00:00:00");return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()]+" "+u.getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][u.getMonth()]}function qh(i){const u=new Date(i+"T00:00:00");return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][(u.getDay()+6)%7]}function bh(i){const u=new Date(i+"T00:00:00");return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][u.getDay()]}function Jr(i){const u=new Date(i+"T00:00:00").getDay();return u===0||u===6}function em(i,u){const a=u.pickup_hint??0,d=u.pickup_lead??0,p=a>0?`${a} room${a===1?"":"s"} picked up within ${d} day${d===1?"":"s"} of arrival`:"no late pickups";return`Last ${bh(i)}: ${u.prior_occ} occ (${u.prior_vac} vac) — ${p}`}function Dc(i){return new Date(i+"T00:00:00").toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function ut(i){return i.toFixed(2)+"h"}function nr(i,u,a,d,p){var E;const m=Math.max(0,p-d),y=(E=i[u])==null?void 0:E[a];if(!y||!y.count)return 0;const w=y.total-y.count,k=d>w?Math.max(0,y.total-d):y.count;return Math.min(k,m)}function tm(i,u,a,d,p){const m={};for(const y of i.dates){const w=qh(y),k=d.reduce((R,_)=>R+(_.hours[w]||0)/60,0),E=p.reduce((R,_)=>R+(_.hours[y]||0),0);m[y]={booked:0,pickup:0,general:k,adjustments:E,total:k+E,by_cat:{},pickup_by_cat:{}}}for(const y of i.categories){const w=u[y.id]||{depart:0,stay:0,arrive:0};i.dates.forEach((k,E)=>{const R=y.days[k],_=R.stays+R.arrivals,D=nr(a,y.id,k,_,y.total_rooms),O=(R.departs*(w.depart||0)+R.stays*(w.stay||0)+R.arrivals*(w.arrive||0))/60,W=D*(w.arrive||0)/60;m[k].by_cat[y.id]=O,m[k].pickup_by_cat[y.id]=(m[k].pickup_by_cat[y.id]||0)+W,m[k].booked+=O,m[k].pickup+=W,m[k].total+=O+W;const P=i.dates[E+1];if(P&&D>0){const N=D*(w.depart||0)/60;m[P].pickup_by_cat[y.id]=(m[P].pickup_by_cat[y.id]||0)+N,m[P].pickup+=N,m[P].total+=N}})}return m}function nm(){const[i,u]=C.useState(null),[a,d]=C.useState({}),[p,m]=C.useState([]),[y,w]=C.useState({}),[k,E]=C.useState([]),[R,_]=C.useState(30),[D,O]=C.useState([]),[W,P]=C.useState(null),[N,V]=C.useState([]),[A,X]=C.useState(!1),[K,ue]=C.useState(null),[ae,je]=C.useState(""),[xe,Ke]=C.useState(""),[Ie,Ye]=C.useState(!0),[ze,Pe]=C.useState(""),[Fe,Je]=C.useState(null),De=C.useRef({}),he=C.useRef(null),U=C.useRef(!1);function G(re,me,be=400){clearTimeout(De.current[re]),De.current[re]=setTimeout(me,be)}function B(re,me=!1){he.current&&clearTimeout(he.current),Je({text:re,err:me}),he.current=setTimeout(()=>Je(null),me?5e3:2500)}function g(){const re=ao();re!==xe&&(Ke(re),Vh(re).catch(()=>{}))}const T=C.useCallback(async(re=!1,me,be)=>{Ye(!0),Pe("");const I=ao(),b=me!==void 0?me??I:K||I,ee=be!==void 0?be||ms(I,-1):ae||xe||ms(I,-1);try{const[ke,Te]=await Promise.all([Wh(b,ee,re),qc()]);u(ke),d(Te.time_requirements||{}),m(Te.staff_data||[]),w(Te.pickup_data||{}),E(Te.general_tasks||[]),_(Te.tolerance_minutes??30),O(Te.adjustments||[]),P(Te.workforce_rota||null),Te.last_reviewed&&(Ke(Te.last_reviewed),ae||je(Te.last_reviewed))}catch(ke){Pe(ke instanceof Error?ke.message:"Failed to load data")}finally{Ye(!1)}},[K,ae,xe]);C.useEffect(()=>{T(!1)},[]),C.useEffect(()=>{W&&!U.current&&(U.current=!0,Xh().then(V).catch(()=>{}))},[W]),C.useEffect(()=>{function re(){p.length&&navigator.sendBeacon("/hk-planner/api/config/staff",JSON.stringify({staff_data:p})),Object.keys(y).length&&navigator.sendBeacon("/hk-planner/api/config/pickup",JSON.stringify({pickup_data:y})),D.length&&navigator.sendBeacon("/hk-planner/api/config/adjustments",JSON.stringify({adjustments:D}))}return window.addEventListener("beforeunload",re),()=>window.removeEventListener("beforeunload",re)},[p,y,D]);function ne(re){const me=ao(),be=ms(K||me,re);ue(be),g(),T(!0,be)}function le(){ue(null),g(),T(!0,null)}function ie(){g(),T(!0)}function se(re,me,be,I){const b=I.days[me],ee=b.stays+b.arrivals,ke=Math.max(0,I.total_rooms-ee),Te=nr(y,re,me,ee,I.total_rooms),hn=Math.max(0,Math.min(Te+be,ke)),ir={...y,[re]:{...y[re]||{},[me]:{count:hn,total:ee+hn}}};w(ir),g(),G("pickup",()=>Ah(ir).then(()=>B("Pickup saved")).catch(qr=>B(qr.message,!0)))}function pe(re){O(re),G("adjustments",()=>Zh(re).then(()=>B("Adjustments saved")).catch(me=>B(me.message,!0)))}function ce(){pe([...D,{label:"",hours:{}}])}function ve(re){m(re),g(),G("staff",()=>Bh(re).then(()=>B("Staff hours saved")).catch(me=>B(me.message,!0)))}function Ve(){ve([...p,{name:"",hours:{}}])}async function $t(){if(i){X(!0);try{const re=await Gh(i.dates[0],i.dates[i.dates.length-1]);P(re),B("Rota synced from Workforce")}catch(re){B(re instanceof Error?re.message:"Sync failed",!0)}finally{X(!1)}}}function Pn(){if(!W)return"Never synced";const re=new Date(W.last_sync).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"});return i&&W.dates[0]===i.dates[0]&&W.dates[1]===i.dates[i.dates.length-1]?`Synced ${re}`:`Synced ${re} — different week`}const Nt=i?tm(i,a,y,k,D):null,pn=ao(),Tn=K||pn;return c.jsxs("div",{style:{padding:"1.5rem",maxWidth:"1600px"},children:[c.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.75rem",marginBottom:"1.25rem"},children:[c.jsxs("div",{children:[c.jsx("h1",{style:{fontSize:"1.15rem",fontWeight:700,color:"var(--text-dark)"},children:"Housekeeping Planner"}),i&&c.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-mid)",marginTop:"0.1rem"},children:[Dc(i.dates[0])," – ",Dc(i.dates[i.dates.length-1])]})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginLeft:"auto",flexWrap:"wrap"},children:[c.jsx(er,{onClick:()=>ne(-7),children:"‹ Prev"}),c.jsx(er,{onClick:le,primary:!0,children:"Today"}),c.jsx(er,{onClick:()=>ne(7),children:"Next ›"}),c.jsx("input",{type:"date",value:Tn,onChange:re=>{if(re.target.value){const me=re.target.value;ue(me),g(),G("weekStart",()=>T(!0,me),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:ae,onChange:re=>{if(re.target.value){const me=re.target.value;je(me),G("lastViewed",()=>T(!0,void 0,me),600)}},style:{border:"1px solid var(--card-border)",borderRadius:"6px",padding:"0.3rem 0.5rem",fontSize:"0.78rem",color:"var(--text-dark)"}})]}),c.jsx(er,{onClick:()=>{g(),T(!0)},children:"Update to now"}),c.jsx("div",{style:{width:"1px",height:"24px",background:"var(--card-border)"}}),c.jsx("button",{onClick:ie,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(Ss,{size:13,strokeWidth:1.75,style:{animation:Ie?"spin 1s linear infinite":"none"}})})]})]}),c.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"}),Fe&&c.jsx("div",{style:{display:"inline-block",marginBottom:"0.75rem",padding:"0.35rem 0.75rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:500,background:Fe.err?"#fee2e2":"#dcfce7",color:Fe.err?"var(--danger)":"var(--success)"},children:Fe.text}),ze&&c.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"#fee2e2",color:"var(--danger)",fontSize:"0.875rem"},children:["Error: ",ze]}),Ie&&!i&&c.jsx("div",{style:{color:"var(--text-mid)",padding:"2rem 0",textAlign:"center"},children:"Loading bookings…"}),i&&Nt&&c.jsxs(c.Fragment,{children:[c.jsx(uo,{title:"7-Day Occupancy",children:c.jsx("div",{className:"table-scroll",children:c.jsx(rm,{bookings:i,pickup:y,onPickupChange:se})})}),c.jsx(uo,{title:"Required Hours",children:c.jsx("div",{className:"table-scroll",children:c.jsx(im,{bookings:i,required:Nt})})}),c.jsx(uo,{title:"Adjustments",action:c.jsx(er,{onClick:ce,children:"+ Add adjustment"}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(am,{bookings:i,adjustments:D,onChange:pe})})}),c.jsx(uo,{title:"Staff Rota",action:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[c.jsxs("button",{onClick:$t,disabled:A,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(Ss,{size:11,strokeWidth:1.75,style:{animation:A?"spin 1s linear infinite":"none"}}),A?"Syncing…":"Sync from Workforce"]}),c.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:Pn()}),c.jsx(er,{onClick:Ve,children:"+ Add staff"})]}),children:c.jsx("div",{className:"table-scroll",children:c.jsx(sm,{bookings:i,staff:p,required:Nt,tolerance:R,onChange:ve,workforceRota:W,wfStaff:N})})})]})]})}function uo({title:i,children:u,action:a}){return c.jsxs("div",{style:{marginBottom:"1.5rem"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[c.jsx("h2",{style:{fontSize:"0.72rem",fontWeight:700,color:"var(--text-mid)",textTransform:"uppercase",letterSpacing:"0.08em"},children:i}),a]}),u]})}function er({children:i,onClick:u,primary:a}){return c.jsx("button",{onClick:u,style:{background:a?"var(--hk-green)":"var(--card-bg)",color:a?"#fff":"var(--text-dark)",border:`1px solid ${a?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.35rem 0.75rem",fontSize:"0.82rem",fontWeight:600},children:i})}function rm({bookings:i,pickup:u,onPickupChange:a}){const{dates:d,categories:p}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsxs("thead",{children:[c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",rowSpan:2,children:"Category"}),d.map(m=>c.jsx("th",{colSpan:2,style:{borderLeft:"2px solid rgba(255,255,255,0.3)",...Jr(m)?{background:"#253555"}:{}},children:go(m)},m))]}),c.jsx("tr",{children:d.map(m=>c.jsxs(c.Fragment,{children:[c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"72px",background:Jr(m)?"#2a3d5e":"#1e2d42",borderLeft:"2px solid rgba(255,255,255,0.3)"},children:"Rooms"},m+"-r"),c.jsx("th",{style:{fontSize:"0.72rem",fontWeight:400,minWidth:"56px",textAlign:"center",background:Jr(m)?"#2a3d5e":"#1e2d42",borderLeft:"1px solid rgba(255,255,255,0.1)"},children:"D / S / A"},m+"-d")]}))})]}),c.jsx("tbody",{children:p.map((m,y)=>{const w=y===p.length-1;return c.jsx(lm,{cat:m,dates:d,pickup:u,onPickupChange:(k,E)=>a(m.id,k,E,m),isLast:w},m.id)})}),c.jsx("tfoot",{children:c.jsx(om,{dates:d,cats:p,pickup:u})})]})}function lm({cat:i,dates:u,pickup:a,onPickupChange:d,isLast:p}){const m=p?"2px solid var(--card-border)":void 0;return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{borderBottom:m},children:i.name}),u.map((y,w)=>{var ue;const k=i.days[y],E=k.stays+k.arrivals,R=Math.max(0,i.total_rooms-E),_=nr(a,i.id,y,E,i.total_rooms),D=u[w-1],O=D?i.days[D].stays+i.days[D].arrivals:0,W=D?nr(a,i.id,D,O,i.total_rooms):0,P=k.delta_new||0,N=k.delta_cancelled||0,V=Jr(y),A=(ue=a[i.id])==null?void 0:ue[y],X=em(y,k);let K="";if(A&&A.count){const ae=A.total-A.count,je=E>ae?"changed":"unchanged",xe=E>ae?"decreased":"remains";K=`+${A.count} pickup set when booked was ${ae} (target ${A.total}). Booked ${je}, so pickup ${xe}.`}return K=(K?K+" | ":"")+X,c.jsxs(c.Fragment,{children:[c.jsxs("td",{style:{textAlign:"center",verticalAlign:"middle",borderBottom:m,padding:"0.4rem 0.3rem",borderLeft:"2px solid var(--card-border)",...V?{background:"rgba(100,120,160,0.07)"}:{}},children:[(P>0||N>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[P>0&&c.jsxs("span",{className:"delta-new",children:["▲",P]}),N>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",N]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},title:K,children:[E,_>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",_]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)",marginBottom:"4px"},children:[R," vac",_>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",R-_,")"]})]}),c.jsxs("div",{className:"pickup-ctrl",children:[c.jsx("button",{className:"pickup-btn",disabled:_<=0,onClick:()=>d(y,-1),children:"−"}),c.jsx("span",{className:"pickup-num",children:_}),c.jsx("button",{className:"pickup-btn",disabled:_>=R,title:X,onClick:()=>d(y,1),children:"+"})]})]},y+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",borderBottom:m,padding:"0.4rem 0.3rem",textAlign:"center",...V?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[k.departs,"d",W>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",W]})]}),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",_>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",_]})]})]},y+"-dsa")]})})]})}function om({dates:i,cats:u,pickup:a}){return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontStyle:"italic"},children:"Total"}),i.map((d,p)=>{let m=0,y=0,w=0,k=0,E=0,R=0,_=0,D=0,O=0;for(const P of u){const N=P.days[d],V=N.stays+N.arrivals,A=Math.max(0,P.total_rooms-V),X=nr(a,P.id,d,V,P.total_rooms),K=i[p-1],ue=K?P.days[K].stays+P.days[K].arrivals:0,ae=K?nr(a,P.id,K,ue,P.total_rooms):0;m+=V,y+=A,w+=X,k+=ae,E+=N.departs,R+=N.stays,_+=N.arrivals,D+=N.delta_new||0,O+=N.delta_cancelled||0}const W=Jr(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)",...W?{background:"rgba(100,120,160,0.07)"}:{}},children:[(D>0||O>0)&&c.jsxs("div",{style:{marginBottom:"2px",fontSize:"0.72rem"},children:[D>0&&c.jsxs("span",{className:"delta-new",children:["▲",D]}),O>0&&c.jsxs("span",{className:"delta-canc",children:[" ▼",O]})]}),c.jsxs("div",{style:{fontWeight:700,fontSize:"1.1rem"},children:[m,w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]}),c.jsxs("div",{style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:[y," vac",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" (",y-w,")"]})]})]},d+"-r"),c.jsxs("td",{style:{verticalAlign:"middle",borderLeft:"1px solid var(--card-border)",padding:"0.4rem 0.3rem",textAlign:"center",...W?{background:"rgba(100,120,160,0.07)"}:{}},children:[c.jsxs("div",{style:{fontSize:"0.8rem",color:"#c2502e",fontWeight:600},children:[E,"d",k>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",k]})]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1d6fb8",fontWeight:600},children:[R,"s"]}),c.jsxs("div",{style:{fontSize:"0.8rem",color:"#1a7a4a",fontWeight:600},children:[_,"a",w>0&&c.jsxs("span",{className:"pickup-tag",children:[" +",w]})]})]},d+"-dsa")]})})]})}function im({bookings:i,required:u}){const{dates:a,categories:d}=i;return c.jsxs("table",{className:"hk-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),a.map(p=>c.jsx("th",{children:go(p)},p))]})}),c.jsx("tbody",{children:d.map(p=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:p.name}),a.map(m=>{const y=u[m].by_cat[p.id]||0,w=u[m].pickup_by_cat[p.id]||0;return c.jsxs("td",{children:[y===0&&w===0?"—":ut(y),w>.001&&c.jsxs("span",{className:"pickup-tag",children:[" (+",ut(w),")"]})]},m)})]},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"}),a.map(p=>c.jsx("td",{children:ut(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"}),a.map(p=>c.jsx("td",{children:u[p].pickup>.001?ut(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"}),a.map(p=>c.jsx("td",{children:u[p].general>.001?ut(u[p].general):"—"},p))]}),a.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"}),a.map(p=>{const m=u[p].adjustments;return c.jsx("td",{style:{color:m<0?"var(--danger)":m>0?"#1a7a4a":"var(--text-mid)"},children:m===0?"—":(m>0?"+":"")+ut(m)},p)})]}),c.jsxs("tr",{style:{background:"#e2e8f0"},children:[c.jsx("td",{className:"col-label",children:"Total Required"}),a.map(p=>c.jsxs("td",{style:{fontWeight:700},children:[ut(u[p].total),u[p].pickup>.001&&c.jsxs("span",{className:"pickup-tag",style:{display:"block",fontSize:"0.7rem"},children:["inc ",ut(u[p].pickup)," pickup"]})]},p))]})]})]})}function sm({bookings:i,staff:u,required:a,tolerance:d,onChange:p,workforceRota:m,wfStaff:y}){const{dates:w}=i,k=d/60;function E(O,W){const P=u.map((N,V)=>V===O?{...N,name:W}:N);p(P)}function R(O,W,P){const N=parseFloat(P),V=u.map((A,X)=>{if(X!==O)return A;const K={...A.hours};return!isNaN(N)&&N>=0?K[W]=N:delete K[W],{...A,hours:K}});p(V)}function _(O){p(u.filter((W,P)=>P!==O))}const D=(m==null?void 0:m.staff)??[];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"}),w.map(O=>c.jsx("th",{children:go(O)},O)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[D.map(O=>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"}),O.name]}),w.map(W=>{const P=O.days[W];return c.jsx("td",{style:{textAlign:"center",padding:"0.3rem 0.4rem",verticalAlign:"middle"},children:P?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:"0.68rem",color:"var(--text-mid)",lineHeight:1.25},children:P.times}),c.jsx("div",{style:{fontWeight:600},children:ut(P.hours)})]}):c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"})},W)}),c.jsx("td",{})]},"wf-"+O.id)),y.length>0&&c.jsx("datalist",{id:"wf-staff-datalist",children:y.map(O=>c.jsx("option",{value:O.name},O.id))}),u.map((O,W)=>c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:O.name,placeholder:"Staff name",list:y.length>0?"wf-staff-datalist":void 0,onChange:P=>E(W,P.target.value)})}),w.map(P=>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:O.hours[P]??"",placeholder:"0",onChange:N=>R(W,P,N.target.value)})},P)),c.jsx("td",{children:c.jsx("button",{onClick:()=>_(W),style:{background:"none",border:"none",color:"var(--text-mid)",fontSize:"1rem",padding:"0.2rem 0.4rem"},children:"×"})})]},W))]}),c.jsxs("tfoot",{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.78rem",color:"var(--text-mid)"},children:"Total Available"}),w.map(O=>{const W=D.reduce((N,V)=>{var A;return N+(((A=V.days[O])==null?void 0:A.hours)||0)},0),P=u.reduce((N,V)=>N+(V.hours[O]||0),0);return c.jsx("td",{children:ut(W+P)},O)}),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"vs Booked"}),w.map(O=>{const W=D.reduce((V,A)=>{var X;return V+(((X=A.days[O])==null?void 0:X.hours)||0)},0),P=u.reduce((V,A)=>V+(A.hours[O]||0),0),N=a[O].booked+a[O].general;return c.jsx("td",{children:c.jsx(Mc,{available:W+P,required:N,tolerance:k})},O)}),c.jsx("td",{})]}),c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",style:{fontSize:"0.72rem",color:"var(--text-mid)"},children:"vs with Pickup"}),w.map(O=>{const W=D.reduce((N,V)=>{var A;return N+(((A=V.days[O])==null?void 0:A.hours)||0)},0),P=u.reduce((N,V)=>N+(V.hours[O]||0),0);return c.jsx("td",{children:c.jsx(Mc,{available:W+P,required:a[O].total,tolerance:k})},O)}),c.jsx("td",{})]})]})]})}function Mc({available:i,required:u,tolerance:a}){const d=i-u;return u===0&&i===0?c.jsx("span",{style:{color:"var(--text-mid)"},children:"—"}):d<-a?c.jsxs("span",{className:"diff-under",children:["✗ ",ut(Math.abs(d))," short"]}):d>a?c.jsxs("span",{className:"diff-over",children:["⚠ ",ut(d)," spare"]}):c.jsxs("span",{className:"diff-ok",children:["✓ ",d>=0?"+":"",ut(d)]})}function am({bookings:i,adjustments:u,onChange:a}){const{dates:d}=i;function p(w,k){a(u.map((E,R)=>R===w?{...E,label:k}:E))}function m(w,k,E){const R=parseFloat(E);a(u.map((_,D)=>{if(D!==w)return _;const O={..._.hours};return isNaN(R)?delete O[k]:O[k]=R,{..._,hours:O}}))}function y(w){a(u.filter((k,E)=>E!==w))}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(w=>c.jsx("th",{children:go(w)},w)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsx("tbody",{children:u.map((w,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:w.label,placeholder:"e.g. Rooms from Sunday",onChange:E=>p(k,E.target.value)})}),d.map(E=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",step:.25,value:w.hours[E]??"",placeholder:"0",onChange:R=>m(k,E,R.target.value)})},E)),c.jsx("td",{children:c.jsx("button",{onClick:()=>y(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(w=>{const k=u.reduce((E,R)=>E+(R.hours[w]||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?"+":"")+ut(k)},w)}),c.jsx("td",{})]})})]})}const Ic=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function um(){const[i,u]=C.useState([]),[a,d]=C.useState(!0),[p,m]=C.useState(!1),[y,w]=C.useState(!1),[k,E]=C.useState(""),[R,_]=C.useState(""),[D,O]=C.useState(null),[W,P]=C.useState([]),[N,V]=C.useState([]),[A,X]=C.useState(!0),[K,ue]=C.useState(""),[ae,je]=C.useState(!1),[xe,Ke]=C.useState(!1),[Ie,Ye]=C.useState(""),[ze,Pe]=C.useState([]),[Fe,Je]=C.useState(!1),[De,he]=C.useState(""),[U,G]=C.useState(""),[B,g]=C.useState({}),[T,ne]=C.useState(""),[le,ie]=C.useState("");C.useEffect(()=>{Promise.all([Hh(),qc(),Yh().catch(I=>(I.message.includes("503")||I.message.toLowerCase().includes("not configured")?je(!0):ue(I.message),null))]).then(([I,b,ee])=>{u(I.categories),Pe(b.general_tasks||[]),g(b.time_requirements||{}),V(b.workforce_departments||[]),ee&&P(ee),d(!1),X(!1)}).catch(I=>{E(I.message),d(!1),X(!1)})},[]);function se(I){u(i.map((b,ee)=>ee===I?{...b,excluded:!b.excluded}:b))}function pe(I,b){O(b),I.dataTransfer.effectAllowed="move"}function ce(I,b){if(I.preventDefault(),D===null||D===b)return;const ee=[...i],[ke]=ee.splice(D,1);ee.splice(b,0,ke),u(ee),O(b)}function ve(){O(null)}async function Ve(){m(!0),E(""),_("");try{await Qh(i.map(I=>I.id),i.filter(I=>I.excluded).map(I=>I.id)),_("Saved"),setTimeout(()=>_(""),2500)}catch(I){E(I instanceof Error?I.message:"Save failed")}finally{m(!1)}}async function $t(){w(!0),E(""),_("");try{const I=await Kh();_(I.ok?`Connection OK: ${I.message||""}`:`Failed: ${I.error||"unknown"}`)}catch(I){E(I instanceof Error?I.message:"Test failed")}finally{w(!1)}}function Pn(I){V(b=>b.includes(I)?b.filter(ee=>ee!==I):[...b,I])}async function Nt(){Ke(!0),ue(""),Ye("");try{await Jh(N),Ye("Departments saved"),setTimeout(()=>Ye(""),2500)}catch(I){ue(I instanceof Error?I.message:"Save failed")}finally{Ke(!1)}}function pn(I,b){Pe(ze.map((ee,ke)=>ke===I?{...ee,name:b}:ee))}function Tn(I,b,ee){const ke=parseInt(ee,10);Pe(ze.map((Te,hn)=>hn!==I?Te:{...Te,hours:{...Te.hours,[b]:isNaN(ke)?0:Math.max(0,ke)}}))}function re(I){Pe(ze.filter((b,ee)=>ee!==I))}async function me(){Je(!0),G(""),he("");try{await $h(ze),he("Saved"),setTimeout(()=>he(""),2500)}catch(I){G(I instanceof Error?I.message:"Save failed")}finally{Je(!1)}}async function be(I,b,ee){const ke={...B,[I]:{...B[I]||{depart:0,stay:0,arrive:0},[b]:ee}};g(ke);try{await Uh(I,b,ee),ne("Saved"),setTimeout(()=>ne(""),1500)}catch(Te){ie(Te instanceof Error?Te.message:"Save failed")}}return a?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(co,{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(un,{type:"error",children:k}),R&&c.jsx(un,{type:"ok",children:R}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:i.map((I,b)=>c.jsxs("div",{draggable:!0,onDragStart:ee=>pe(ee,b),onDragOver:ee=>ce(ee,b),onDragEnd:ve,style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 0.875rem",border:"1px solid var(--card-border)",borderRadius:"8px",background:I.excluded?"#f8fafc":"var(--card-bg)",opacity:D===b?.5:1},children:[c.jsx(Ch,{size:16,color:"var(--text-mid)",style:{cursor:"grab",flexShrink:0}}),c.jsx("span",{style:{flex:1,fontSize:"0.9rem",color:I.excluded?"var(--text-mid)":"var(--text-dark)",textDecoration:I.excluded?"line-through":"none"},children:I.name}),c.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-mid)",marginRight:"0.5rem"},children:[I.room_count," rooms"]}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8rem",color:"var(--text-mid)"},children:[c.jsx("input",{type:"checkbox",checked:!I.excluded,onChange:()=>se(b)}),"Active"]})]},I.id))}),c.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"2.5rem"},children:[c.jsx(Kr,{onClick:Ve,disabled:p,primary:!0,children:p?"Saving…":"Save Order & Visibility"}),c.jsx(Kr,{onClick:$t,disabled:y,children:y?"Testing…":"Test Newbook Connection"})]}),c.jsx(vs,{}),c.jsx(co,{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."}),ae&&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"}),"."]}),!ae&&A&&c.jsx("div",{style:{color:"var(--text-mid)",fontSize:"0.85rem",marginBottom:"2rem"},children:"Loading departments…"}),!ae&&!A&&c.jsxs("div",{style:{marginBottom:"2.5rem"},children:[K&&c.jsx(un,{type:"error",children:K}),Ie&&c.jsx(un,{type:"ok",children:Ie}),W.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:W.map(I=>c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.5rem 0.75rem",border:"1px solid var(--card-border)",borderRadius:"7px",background:N.includes(I.id)?"rgba(42,100,72,0.05)":"var(--card-bg)",cursor:"pointer",fontSize:"0.9rem",color:"var(--text-dark)"},children:[c.jsx("input",{type:"checkbox",checked:N.includes(I.id),onChange:()=>Pn(I.id)}),I.name]},I.id))}),N.length===0&&W.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(Kr,{onClick:Nt,disabled:xe,primary:!0,children:xe?"Saving…":"Save Departments"})]}),c.jsx(vs,{}),c.jsx(co,{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."}),U&&c.jsx(un,{type:"error",children:U}),De&&c.jsx(un,{type:"ok",children:De}),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"}),Ic.map(I=>c.jsx("th",{children:I},I)),c.jsx("th",{style:{width:"32px"}})]})}),c.jsxs("tbody",{children:[ze.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:9,style:{color:"var(--text-mid)",textAlign:"center",padding:"1rem"},children:"No tasks yet"})}),ze.map((I,b)=>c.jsxs("tr",{children:[c.jsx("td",{style:{padding:"0.3rem 0.5rem"},children:c.jsx("input",{className:"hk-text-input",value:I.name,placeholder:"Task name",onChange:ee=>pn(b,ee.target.value)})}),Ic.map(ee=>c.jsx("td",{style:{padding:"0.3rem 0.4rem"},children:c.jsx("input",{type:"number",className:"hk-num-input",min:0,max:999,value:I.hours[ee]||"",placeholder:"0",onChange:ke=>Tn(b,ee,ke.target.value)})},ee)),c.jsx("td",{children:c.jsx("button",{onClick:()=>re(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(Kr,{onClick:()=>Pe([...ze,{name:"",hours:{}}]),children:"+ Add task"}),c.jsx(Kr,{onClick:me,disabled:Fe,primary:!0,children:Fe?"Saving…":"Save Tasks"})]}),c.jsx(vs,{}),c.jsx(co,{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."}),le&&c.jsx(un,{type:"error",children:le}),T&&c.jsx(un,{type:"ok",children:T}),c.jsx("div",{style:{overflowX:"auto",marginBottom:"2rem"},children:c.jsxs("table",{className:"hk-table",style:{maxWidth:"500px"},children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"col-label",children:"Category"}),c.jsx("th",{children:"Depart (mins)"}),c.jsx("th",{children:"Stay (mins)"}),c.jsx("th",{children:"Arrive (mins)"})]})}),c.jsx("tbody",{children:i.filter(I=>!I.excluded).map(I=>{const b=B[I.id]||{depart:0,stay:0,arrive:0};return c.jsxs("tr",{children:[c.jsx("td",{className:"col-label",children:I.name}),["depart","stay","arrive"].map(ee=>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[ee]||"",placeholder:"0",onChange:ke=>be(I.id,ee,parseInt(ke.target.value,10)||0),onBlur:ke=>be(I.id,ee,parseInt(ke.target.value,10)||0)})},ee))]},I.id)})})]})})]})}function co({title:i}){return c.jsx("h2",{style:{fontSize:"0.95rem",fontWeight:700,color:"var(--text-dark)",marginBottom:"0.25rem"},children:i})}function vs(){return c.jsx("div",{style:{height:"1px",background:"var(--card-border)",margin:"0.5rem 0 2rem"}})}function un({type:i,children:u}){return c.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.75rem",borderRadius:"8px",fontSize:"0.875rem",background:i==="ok"?"#dcfce7":"#fee2e2",color:i==="ok"?"var(--success)":"var(--danger)"},children:u})}function Kr({children:i,onClick:u,disabled:a,primary:d}){return c.jsx("button",{onClick:u,disabled:a,style:{background:d?"var(--hk-green)":"var(--card-bg)",color:d?"#fff":"var(--text-dark)",border:`1px solid ${d?"var(--hk-green)":"var(--card-border)"}`,borderRadius:"6px",padding:"0.5rem 1.25rem",fontSize:"0.875rem",fontWeight:600},children:i})}function cm({user:i}){return c.jsx(Ih,{user:i,children:c.jsxs(Zp,{children:[c.jsx(Yr,{path:"/",element:c.jsx(ps,{to:"/planner",replace:!0})}),c.jsx(Yr,{path:"/planner",element:c.jsx(nm,{})}),c.jsx(Yr,{path:"/settings",element:Zc(i,"settings")?c.jsx(um,{}):c.jsx(ps,{to:"/planner",replace:!0})}),c.jsx(Yr,{path:"*",element:c.jsx(ps,{to:"/planner",replace:!0})})]})})}function dm(){const i=Lh("/hk-planner/health");return c.jsxs(c.Fragment,{children:[c.jsx(oh,{basename:"/hk-planner",children:c.jsx(mh,{children:u=>c.jsx(cm,{user:u})})}),c.jsx(Rh,{visible:i})]})}new URLSearchParams(window.location.search).has("install")&&window.addEventListener("beforeinstallprompt",i=>{i.preventDefault(),i.prompt()},{once:!0});sp.createRoot(document.getElementById("root")).render(c.jsx(C.StrictMode,{children:c.jsx(dm,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index e5e5961..77ff1ef 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -5,8 +5,8 @@ HK Planner - - + +
diff --git a/frontend/dist/sw.js b/frontend/dist/sw.js index 17a2114..bb81937 100644 --- a/frontend/dist/sw.js +++ b/frontend/dist/sw.js @@ -1 +1 @@ -if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(i[o])return;let t={};const d=e=>n(e,o),c={module:{uri:o},exports:t,require:d};i[o]=Promise.all(s.map(e=>c[e]||d(e))).then(e=>(r(...e),t))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"a2c395d8c225f1b3ea12388f15189bce"},{url:"index.html",revision:"c559453bdaf3e95d6d3ad0625d673085"},{url:"icons/icon-512.png",revision:"c32202b9deed67ef38331f63dec9d1c8"},{url:"icons/icon-192.png",revision:"46ece317d50d10b8f5e225e073b3221d"},{url:"assets/index-IImb5HHO.js",revision:null},{url:"assets/index-BY6qKqNq.css",revision:null},{url:"manifest.webmanifest",revision:"c2510de876adb84db0c4b300b71216fa"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/hk-planner/index.html"),{denylist:[/\/api\//]}))}); +if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(i[o])return;let t={};const d=e=>n(e,o),c={module:{uri:o},exports:t,require:d};i[o]=Promise.all(s.map(e=>c[e]||d(e))).then(e=>(r(...e),t))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"a2c395d8c225f1b3ea12388f15189bce"},{url:"index.html",revision:"efb9dd576a766e55ff7952115f902789"},{url:"icons/icon-512.png",revision:"c32202b9deed67ef38331f63dec9d1c8"},{url:"icons/icon-192.png",revision:"46ece317d50d10b8f5e225e073b3221d"},{url:"assets/index-CG3D4SXd.js",revision:null},{url:"assets/index-B7_UXJgZ.css",revision:null},{url:"manifest.webmanifest",revision:"c2510de876adb84db0c4b300b71216fa"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/hk-planner/index.html"),{denylist:[/\/api\//]}))}); diff --git a/frontend/src/pages/Planner.tsx b/frontend/src/pages/Planner.tsx index 922e666..9ebb597 100644 --- a/frontend/src/pages/Planner.tsx +++ b/frontend/src/pages/Planner.tsx @@ -128,8 +128,11 @@ export function Planner() { const [staff, setStaff] = useState([]) const [pickup, setPickup] = useState({}) const [generalTasks, setGeneralTasks] = useState([]) - const [tolerance, setTolerance] = useState(30) const [adjustments, setAdjustments] = useState([]) + const [warnOverRed, setWarnOverRed] = useState(4) + const [warnOverAmber, setWarnOverAmber] = useState(1) + const [warnUnderAmber, setWarnUnderAmber] = useState(1) + const [warnUnderRed, setWarnUnderRed] = useState(2) const [workforceRota, setWorkforceRota] = useState(null) const [wfStaff, setWfStaff] = useState<{ id: string; name: string }[]>([]) const [syncing, setSyncing] = useState(false) @@ -143,6 +146,8 @@ export function Planner() { const timers = useRef>>({}) const saveMsgTimer = useRef | null>(null) const wfStaffLoaded = useRef(false) + const weekStartRef = useRef(null) + weekStartRef.current = weekStart // always current, updated every render function debounce(key: string, fn: () => void, delay = 400) { clearTimeout(timers.current[key]) @@ -162,11 +167,11 @@ export function Planner() { putLastReviewed(today).catch(() => {}) } - const loadAll = useCallback(async (force = false, wsArg?: string | null, lvArg?: string) => { + const loadAll = useCallback(async (force = false, lvArg?: string) => { setLoading(true) setError('') const today = todayStr() - const ws = wsArg !== undefined ? (wsArg ?? today) : (weekStart || today) + const ws = weekStartRef.current || today const lv = lvArg !== undefined ? (lvArg || offsetDate(today, -1)) : (lastViewed || savedLastReviewed || offsetDate(today, -1)) try { const [b, cfg] = await Promise.all([getBookings(ws, lv, force), getConfig()]) @@ -175,8 +180,11 @@ export function Planner() { setStaff(cfg.staff_data || []) setPickup(cfg.pickup_data || {}) setGeneralTasks(cfg.general_tasks || []) - setTolerance(cfg.tolerance_minutes ?? 30) setAdjustments(cfg.adjustments || []) + setWarnOverRed(cfg.warn_over_red_hrs ?? 4) + setWarnOverAmber(cfg.warn_over_amber_hrs ?? 1) + setWarnUnderAmber(cfg.warn_under_amber_hrs ?? 1) + setWarnUnderRed(cfg.warn_under_red_hrs ?? 2) setWorkforceRota(cfg.workforce_rota || null) if (cfg.last_reviewed) { setSavedLastReviewed(cfg.last_reviewed) @@ -187,7 +195,7 @@ export function Planner() { } finally { setLoading(false) } - }, [weekStart, lastViewed, savedLastReviewed]) + }, [lastViewed, savedLastReviewed]) useEffect(() => { loadAll(false) }, []) // eslint-disable-line react-hooks/exhaustive-deps @@ -218,16 +226,18 @@ export function Planner() { function handleWeekOffset(days: number) { const today = todayStr() - const newStart = offsetDate(weekStart || today, days) + const newStart = offsetDate(weekStartRef.current || today, days) + weekStartRef.current = newStart setWeekStart(newStart) stampLastReviewed() - loadAll(true, newStart) + loadAll(true) } function handleWeekToday() { + weekStartRef.current = null setWeekStart(null) stampLastReviewed() - loadAll(true, null) + loadAll(true) } function handleRefresh() { @@ -338,7 +348,7 @@ export function Planner() { { if (e.target.value) { const v = e.target.value; setWeekStart(v); stampLastReviewed(); debounce('weekStart', () => loadAll(true, v), 600) } }} + onChange={e => { if (e.target.value) { const v = e.target.value; weekStartRef.current = v; setWeekStart(v); stampLastReviewed(); debounce('weekStart', () => loadAll(true), 600) } }} style={{ border: '1px solid var(--card-border)', borderRadius: '6px', padding: '0.35rem 0.5rem', fontSize: '0.82rem', color: 'var(--text-dark)' }} />
@@ -348,7 +358,7 @@ export function Planner() { { if (e.target.value) { const v = e.target.value; setLastViewed(v); debounce('lastViewed', () => loadAll(true, undefined, v), 600) } }} + onChange={e => { if (e.target.value) { const v = e.target.value; setLastViewed(v); debounce('lastViewed', () => loadAll(true, v), 600) } }} style={{ border: '1px solid var(--card-border)', borderRadius: '6px', padding: '0.3rem 0.5rem', fontSize: '0.78rem', color: 'var(--text-dark)' }} /> @@ -447,7 +457,10 @@ export function Planner() { bookings={bookings} staff={staff} required={required} - tolerance={tolerance} + warnOverRed={warnOverRed} + warnOverAmber={warnOverAmber} + warnUnderAmber={warnUnderAmber} + warnUnderRed={warnUnderRed} onChange={handleStaffChange} workforceRota={workforceRota} wfStaff={wfStaff} @@ -773,17 +786,19 @@ function RequiredTable({ bookings, required }: { bookings: BookingsData; require // ── Staff Table ─────────────────────────────────────────────────────────────── -function StaffTable({ bookings, staff, required, tolerance, onChange, workforceRota, wfStaff }: { +function StaffTable({ bookings, staff, required, warnOverRed, warnOverAmber, warnUnderAmber, warnUnderRed, onChange, workforceRota, wfStaff }: { bookings: BookingsData staff: StaffMember[] required: Record - tolerance: number + warnOverRed: number + warnOverAmber: number + warnUnderAmber: number + warnUnderRed: number onChange: (next: StaffMember[]) => void workforceRota: WorkforceRota | null wfStaff: { id: string; name: string }[] }) { const { dates } = bookings - const tolHrs = tolerance / 60 function setMemberName(i: number, name: string) { const next = staff.map((m, idx) => idx === i ? { ...m, name } : m) @@ -883,44 +898,72 @@ function StaffTable({ bookings, staff, required, tolerance, onChange, workforceR ))} - - Total Available - {dates.map(date => { - const rotaHrs = rotaMembers.reduce((s, m) => s + (m.days[date]?.hours || 0), 0) + {(() => { + const avail: Record = {} + for (const date of dates) { + const rotaHrs = rotaMembers.reduce((s, m) => s + (m.days[date]?.hours || 0), 0) const manualHrs = staff.reduce((s, m) => s + (m.hours[date] || 0), 0) - return {fmtH(rotaHrs + manualHrs)} - })} - - - - vs Booked - {dates.map(date => { - const rotaHrs = rotaMembers.reduce((s, m) => s + (m.days[date]?.hours || 0), 0) - const manualHrs = staff.reduce((s, m) => s + (m.hours[date] || 0), 0) - const reqHrs = required[date].booked + required[date].general - return - })} - - - - vs with Pickup - {dates.map(date => { - const rotaHrs = rotaMembers.reduce((s, m) => s + (m.days[date]?.hours || 0), 0) - const manualHrs = staff.reduce((s, m) => s + (m.hours[date] || 0), 0) - return - })} - - + avail[date] = rotaHrs + manualHrs + } + return ( + <> + + Total Available + {dates.map(date => {fmtH(avail[date])})} + + + + vs Booked + {dates.map(date => ( + + ))} + + + + with Recurring Tasks + {dates.map(date => ( + + ))} + + + + with Pickup + {dates.map(date => ( + + ))} + + + + with Adjustments + {dates.map(date => ( + + ))} + + + + ) + })()} ) } -function DiffCell({ available, required, tolerance }: { available: number; required: number; tolerance: number }) { +function PlainDiffCell({ available, required }: { available: number; required: number }) { + if (available === 0 && required === 0) return const diff = available - required - if (required === 0 && available === 0) return - if (diff < -tolerance) return ✗ {fmtH(Math.abs(diff))} short - if (diff > tolerance) return ⚠ {fmtH(diff)} spare + return {diff >= 0 ? '+' : ''}{fmtH(diff)} +} + +function DiffCell({ available, required, warnOverRed, warnOverAmber, warnUnderAmber, warnUnderRed }: { + available: number; required: number + warnOverRed: number; warnOverAmber: number; warnUnderAmber: number; warnUnderRed: number +}) { + if (available === 0 && required === 0) return + const diff = available - required + if (diff > warnOverRed) return ⚠ {fmtH(diff)} spare + if (diff > warnOverAmber) return ⚠ {fmtH(diff)} spare + if (diff < -warnUnderRed) return ✗ {fmtH(Math.abs(diff))} short + if (diff < -warnUnderAmber) return ✗ {fmtH(Math.abs(diff))} short return ✓ {diff >= 0 ? '+' : ''}{fmtH(diff)} }