Files
vip-coordinator/frontend-old-20260125/dist/assets/index-b3227753.js
kyle 868f7efc23
Some checks failed
CI/CD Pipeline / Backend Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Tests (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
Major Enhancement: NestJS Migration + CASL Authorization + Error Handling
Complete rewrite from Express to NestJS with enterprise-grade features:

## Backend Improvements
- Migrated from Express to NestJS 11.0.1 with TypeScript
- Implemented Prisma ORM 7.3.0 for type-safe database access
- Added CASL authorization system replacing role-based guards
- Created global exception filters with structured logging
- Implemented Auth0 JWT authentication with Passport.js
- Added vehicle management with conflict detection
- Enhanced event scheduling with driver/vehicle assignment
- Comprehensive error handling and logging

## Frontend Improvements
- Upgraded to React 19.2.0 with Vite 7.2.4
- Implemented CASL-based permission system
- Added AbilityContext for declarative permissions
- Created ErrorHandler utility for consistent error messages
- Enhanced API client with request/response logging
- Added War Room (Command Center) dashboard
- Created VIP Schedule view with complete itineraries
- Implemented Vehicle Management UI
- Added mock data generators for testing (288 events across 20 VIPs)

## New Features
- Vehicle fleet management (types, capacity, status tracking)
- Complete 3-day Jamboree schedule generation
- Individual VIP schedule pages with PDF export (planned)
- Real-time War Room dashboard with auto-refresh
- Permission-based navigation filtering
- First user auto-approval as administrator

## Documentation
- Created CASL_AUTHORIZATION.md (comprehensive guide)
- Created ERROR_HANDLING.md (error handling patterns)
- Updated CLAUDE.md with new architecture
- Added migration guides and best practices

## Technical Debt Resolved
- Removed custom authentication in favor of Auth0
- Replaced role checks with CASL abilities
- Standardized error responses across API
- Implemented proper TypeScript typing
- Added comprehensive logging

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-31 08:50:25 +01:00

652 lines
393 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function vh(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function yh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _c={exports:{}},Ks={},Dc={exports:{}},R={};/**
* @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 zr=Symbol.for("react.element"),wh=Symbol.for("react.portal"),bh=Symbol.for("react.fragment"),jh=Symbol.for("react.strict_mode"),Nh=Symbol.for("react.profiler"),kh=Symbol.for("react.provider"),Sh=Symbol.for("react.context"),Ch=Symbol.for("react.forward_ref"),Eh=Symbol.for("react.suspense"),Th=Symbol.for("react.memo"),Ph=Symbol.for("react.lazy"),Ja=Symbol.iterator;function _h(e){return e===null||typeof e!="object"?null:(e=Ja&&e[Ja]||e["@@iterator"],typeof e=="function"?e:null)}var Ic={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ac=Object.assign,zc={};function $n(e,t,n){this.props=e,this.context=t,this.refs=zc,this.updater=n||Ic}$n.prototype.isReactComponent={};$n.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};$n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Oc(){}Oc.prototype=$n.prototype;function Bo(e,t,n){this.props=e,this.context=t,this.refs=zc,this.updater=n||Ic}var Ko=Bo.prototype=new Oc;Ko.constructor=Bo;Ac(Ko,$n.prototype);Ko.isPureReactComponent=!0;var Xa=Array.isArray,Lc=Object.prototype.hasOwnProperty,Ho={current:null},Rc={key:!0,ref:!0,__self:!0,__source:!0};function $c(e,t,n){var r,s={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)Lc.call(t,r)&&!Rc.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:zr,type:e,key:o,ref:a,props:s,_owner:Ho.current}}function Dh(e,t){return{$$typeof:zr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Go(e){return typeof e=="object"&&e!==null&&e.$$typeof===zr}function Ih(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ya=/\/+/g;function hi(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ih(""+e.key):t.toString(36)}function ss(e,t,n,r,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case zr:case wh:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+hi(a,0):r,Xa(s)?(n="",e!=null&&(n=e.replace(Ya,"$&/")+"/"),ss(s,t,n,"",function(d){return d})):s!=null&&(Go(s)&&(s=Dh(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(Ya,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",Xa(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+hi(o,l);a+=ss(o,t,n,c,s)}else if(c=_h(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+hi(o,l++),a+=ss(o,t,n,c,s);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Vr(e,t,n){if(e==null)return e;var r=[],s=0;return ss(e,r,"","",function(o){return t.call(n,o,s++)}),r}function Ah(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var je={current:null},is={transition:null},zh={ReactCurrentDispatcher:je,ReactCurrentBatchConfig:is,ReactCurrentOwner:Ho};function Fc(){throw Error("act(...) is not supported in production builds of React.")}R.Children={map:Vr,forEach:function(e,t,n){Vr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vr(e,function(){t++}),t},toArray:function(e){return Vr(e,function(t){return t})||[]},only:function(e){if(!Go(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};R.Component=$n;R.Fragment=bh;R.Profiler=Nh;R.PureComponent=Bo;R.StrictMode=jh;R.Suspense=Eh;R.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=zh;R.act=Fc;R.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ac({},e.props),s=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=Ho.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Lc.call(t,c)&&!Rc.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:zr,type:e.type,key:s,ref:o,props:r,_owner:a}};R.createContext=function(e){return e={$$typeof:Sh,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:kh,_context:e},e.Consumer=e};R.createElement=$c;R.createFactory=function(e){var t=$c.bind(null,e);return t.type=e,t};R.createRef=function(){return{current:null}};R.forwardRef=function(e){return{$$typeof:Ch,render:e}};R.isValidElement=Go;R.lazy=function(e){return{$$typeof:Ph,_payload:{_status:-1,_result:e},_init:Ah}};R.memo=function(e,t){return{$$typeof:Th,type:e,compare:t===void 0?null:t}};R.startTransition=function(e){var t=is.transition;is.transition={};try{e()}finally{is.transition=t}};R.unstable_act=Fc;R.useCallback=function(e,t){return je.current.useCallback(e,t)};R.useContext=function(e){return je.current.useContext(e)};R.useDebugValue=function(){};R.useDeferredValue=function(e){return je.current.useDeferredValue(e)};R.useEffect=function(e,t){return je.current.useEffect(e,t)};R.useId=function(){return je.current.useId()};R.useImperativeHandle=function(e,t,n){return je.current.useImperativeHandle(e,t,n)};R.useInsertionEffect=function(e,t){return je.current.useInsertionEffect(e,t)};R.useLayoutEffect=function(e,t){return je.current.useLayoutEffect(e,t)};R.useMemo=function(e,t){return je.current.useMemo(e,t)};R.useReducer=function(e,t,n){return je.current.useReducer(e,t,n)};R.useRef=function(e){return je.current.useRef(e)};R.useState=function(e){return je.current.useState(e)};R.useSyncExternalStore=function(e,t,n){return je.current.useSyncExternalStore(e,t,n)};R.useTransition=function(){return je.current.useTransition()};R.version="18.3.1";Dc.exports=R;var S=Dc.exports;const Zo=yh(S),Oh=vh({__proto__:null,default:Zo},[S]);/**
* @license React
* react-jsx-runtime.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 Lh=S,Rh=Symbol.for("react.element"),$h=Symbol.for("react.fragment"),Fh=Object.prototype.hasOwnProperty,Vh=Lh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Mh={key:!0,ref:!0,__self:!0,__source:!0};function Vc(e,t,n){var r,s={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Fh.call(t,r)&&!Mh.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:Rh,type:e,key:o,ref:a,props:s,_owner:Vh.current}}Ks.Fragment=$h;Ks.jsx=Vc;Ks.jsxs=Vc;_c.exports=Ks;var i=_c.exports,Bi={},Mc={exports:{}},ze={},Uc={exports:{}},Wc={};/**
* @license React
* scheduler.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.
*/(function(e){function t(E,D){var O=E.length;E.push(D);e:for(;0<O;){var $=O-1>>>1,F=E[$];if(0<s(F,D))E[$]=D,E[O]=F,O=$;else break e}}function n(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var D=E[0],O=E.pop();if(O!==D){E[0]=O;e:for(var $=0,F=E.length,ie=F>>>1;$<ie;){var ue=2*($+1)-1,Le=E[ue],We=ue+1,Vt=E[We];if(0>s(Le,O))We<F&&0>s(Vt,Le)?(E[$]=Vt,E[We]=O,$=We):(E[$]=Le,E[ue]=O,$=ue);else if(We<F&&0>s(Vt,O))E[$]=Vt,E[We]=O,$=We;else break e}}return D}function s(E,D){var O=E.sortIndex-D.sortIndex;return O!==0?O:E.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],d=[],m=1,p=null,f=3,g=!1,b=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,u=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(E){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=E)r(d),D.sortIndex=D.expirationTime,t(c,D);else break;D=n(d)}}function y(E){if(w=!1,h(E),!b)if(n(c)!==null)b=!0,P(v);else{var D=n(d);D!==null&&L(y,D.startTime-E)}}function v(E,D){b=!1,w&&(w=!1,x(C),C=-1),g=!0;var O=f;try{for(h(D),p=n(c);p!==null&&(!(p.expirationTime>D)||E&&!I());){var $=p.callback;if(typeof $=="function"){p.callback=null,f=p.priorityLevel;var F=$(p.expirationTime<=D);D=e.unstable_now(),typeof F=="function"?p.callback=F:p===n(c)&&r(c),h(D)}else r(c);p=n(c)}if(p!==null)var ie=!0;else{var ue=n(d);ue!==null&&L(y,ue.startTime-D),ie=!1}return ie}finally{p=null,f=O,g=!1}}var N=!1,k=null,C=-1,z=5,A=-1;function I(){return!(e.unstable_now()-A<z)}function M(){if(k!==null){var E=e.unstable_now();A=E;var D=!0;try{D=k(!0,E)}finally{D?W():(N=!1,k=null)}}else N=!1}var W;if(typeof u=="function")W=function(){u(M)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,K=G.port2;G.port1.onmessage=M,W=function(){K.postMessage(null)}}else W=function(){j(M,0)};function P(E){k=E,N||(N=!0,W())}function L(E,D){C=j(function(){E(e.unstable_now())},D)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_continueExecution=function(){b||g||(b=!0,P(v))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(E){switch(f){case 1:case 2:case 3:var D=3;break;default:D=f}var O=f;f=D;try{return E()}finally{f=O}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,D){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var O=f;f=E;try{return D()}finally{f=O}},e.unstable_scheduleCallback=function(E,D,O){var $=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?$+O:$):O=$,E){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=O+F,E={id:m++,callback:D,priorityLevel:E,startTime:O,expirationTime:F,sortIndex:-1},O>$?(E.sortIndex=O,t(d,E),n(c)===null&&E===n(d)&&(w?(x(C),C=-1):w=!0,L(y,O-$))):(E.sortIndex=F,t(c,E),b||g||(b=!0,P(v))),E},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(E){var D=f;return function(){var O=f;f=D;try{return E.apply(this,arguments)}finally{f=O}}}})(Wc);Uc.exports=Wc;var Uh=Uc.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 Wh=S,Ae=Uh;function T(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Bc=new Set,pr={};function sn(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(pr[e]=t,e=0;e<t.length;e++)Bc.add(t[e])}var ct=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ki=Object.prototype.hasOwnProperty,Bh=/^[: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]*$/,Qa={},qa={};function Kh(e){return Ki.call(qa,e)?!0:Ki.call(Qa,e)?!1:Bh.test(e)?qa[e]=!0:(Qa[e]=!0,!1)}function Hh(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 Gh(e,t,n,r){if(t===null||typeof t>"u"||Hh(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 Ne(e,t,n,r,s,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){pe[e]=new Ne(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];pe[t]=new Ne(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){pe[e]=new Ne(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){pe[e]=new Ne(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){pe[e]=new Ne(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){pe[e]=new Ne(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){pe[e]=new Ne(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){pe[e]=new Ne(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){pe[e]=new Ne(e,5,!1,e.toLowerCase(),null,!1,!1)});var Jo=/[\-:]([a-z])/g;function Xo(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(Jo,Xo);pe[t]=new Ne(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(Jo,Xo);pe[t]=new Ne(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(Jo,Xo);pe[t]=new Ne(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){pe[e]=new Ne(e,1,!1,e.toLowerCase(),null,!1,!1)});pe.xlinkHref=new Ne("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){pe[e]=new Ne(e,1,!1,e.toLowerCase(),null,!0,!0)});function Yo(e,t,n,r){var s=pe.hasOwnProperty(t)?pe[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Gh(t,n,s,r)&&(n=null),r||s===null?Kh(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var mt=Wh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Mr=Symbol.for("react.element"),hn=Symbol.for("react.portal"),mn=Symbol.for("react.fragment"),Qo=Symbol.for("react.strict_mode"),Hi=Symbol.for("react.profiler"),Kc=Symbol.for("react.provider"),Hc=Symbol.for("react.context"),qo=Symbol.for("react.forward_ref"),Gi=Symbol.for("react.suspense"),Zi=Symbol.for("react.suspense_list"),ea=Symbol.for("react.memo"),gt=Symbol.for("react.lazy"),Gc=Symbol.for("react.offscreen"),el=Symbol.iterator;function Un(e){return e===null||typeof e!="object"?null:(e=el&&e[el]||e["@@iterator"],typeof e=="function"?e:null)}var q=Object.assign,mi;function qn(e){if(mi===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mi=t&&t[1]||""}return`
`+mi+e}var pi=!1;function fi(e,t){if(!e||pi)return"";pi=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
`),o=r.stack.split(`
`),a=s.length-1,l=o.length-1;1<=a&&0<=l&&s[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==o[l]){var c=`
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{pi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qn(e):""}function Zh(e){switch(e.tag){case 5:return qn(e.type);case 16:return qn("Lazy");case 13:return qn("Suspense");case 19:return qn("SuspenseList");case 0:case 2:case 15:return e=fi(e.type,!1),e;case 11:return e=fi(e.type.render,!1),e;case 1:return e=fi(e.type,!0),e;default:return""}}function Ji(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 mn:return"Fragment";case hn:return"Portal";case Hi:return"Profiler";case Qo:return"StrictMode";case Gi:return"Suspense";case Zi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hc:return(e.displayName||"Context")+".Consumer";case Kc:return(e._context.displayName||"Context")+".Provider";case qo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ea:return t=e.displayName||null,t!==null?t:Ji(e.type)||"Memo";case gt:t=e._payload,e=e._init;try{return Ji(e(t))}catch{}}return null}function Jh(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 Ji(t);case 8:return t===Qo?"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 zt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xh(e){var t=Zc(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 s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ur(e){e._valueTracker||(e._valueTracker=Xh(e))}function Jc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Zc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function gs(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 Xi(e,t){var n=t.checked;return q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function tl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zt(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 Xc(e,t){t=t.checked,t!=null&&Yo(e,"checked",t,!1)}function Yi(e,t){Xc(e,t);var n=zt(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")?Qi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qi(e,t.type,zt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function nl(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 Qi(e,t,n){(t!=="number"||gs(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var er=Array.isArray;function Sn(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+zt(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function qi(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(T(91));return q({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function rl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(T(92));if(er(n)){if(1<n.length)throw Error(T(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zt(n)}}function Yc(e,t){var n=zt(t.value),r=zt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function sl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Qc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function eo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Qc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Wr,qc=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Wr=Wr||document.createElement("div"),Wr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var rr={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},Yh=["Webkit","ms","Moz","O"];Object.keys(rr).forEach(function(e){Yh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rr[t]=rr[e]})});function ed(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||rr.hasOwnProperty(e)&&rr[e]?(""+t).trim():t+"px"}function td(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=ed(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Qh=q({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 to(e,t){if(t){if(Qh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(T(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(T(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(T(61))}if(t.style!=null&&typeof t.style!="object")throw Error(T(62))}}function no(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 ro=null;function ta(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var so=null,Cn=null,En=null;function il(e){if(e=Rr(e)){if(typeof so!="function")throw Error(T(280));var t=e.stateNode;t&&(t=Xs(t),so(e.stateNode,e.type,t))}}function nd(e){Cn?En?En.push(e):En=[e]:Cn=e}function rd(){if(Cn){var e=Cn,t=En;if(En=Cn=null,il(e),t)for(e=0;e<t.length;e++)il(t[e])}}function sd(e,t){return e(t)}function id(){}var gi=!1;function od(e,t,n){if(gi)return e(t,n);gi=!0;try{return sd(e,t,n)}finally{gi=!1,(Cn!==null||En!==null)&&(id(),rd())}}function gr(e,t){var n=e.stateNode;if(n===null)return null;var r=Xs(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(T(231,t,typeof n));return n}var io=!1;if(ct)try{var Wn={};Object.defineProperty(Wn,"passive",{get:function(){io=!0}}),window.addEventListener("test",Wn,Wn),window.removeEventListener("test",Wn,Wn)}catch{io=!1}function qh(e,t,n,r,s,o,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(m){this.onError(m)}}var sr=!1,xs=null,vs=!1,oo=null,em={onError:function(e){sr=!0,xs=e}};function tm(e,t,n,r,s,o,a,l,c){sr=!1,xs=null,qh.apply(em,arguments)}function nm(e,t,n,r,s,o,a,l,c){if(tm.apply(this,arguments),sr){if(sr){var d=xs;sr=!1,xs=null}else throw Error(T(198));vs||(vs=!0,oo=d)}}function on(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ad(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ol(e){if(on(e)!==e)throw Error(T(188))}function rm(e){var t=e.alternate;if(!t){if(t=on(e),t===null)throw Error(T(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var o=s.alternate;if(o===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===n)return ol(s),e;if(o===r)return ol(s),t;o=o.sibling}throw Error(T(188))}if(n.return!==r.return)n=s,r=o;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=o;break}if(l===r){a=!0,r=s,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=s;break}if(l===r){a=!0,r=o,n=s;break}l=l.sibling}if(!a)throw Error(T(189))}}if(n.alternate!==r)throw Error(T(190))}if(n.tag!==3)throw Error(T(188));return n.stateNode.current===n?e:t}function ld(e){return e=rm(e),e!==null?cd(e):null}function cd(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=cd(e);if(t!==null)return t;e=e.sibling}return null}var dd=Ae.unstable_scheduleCallback,al=Ae.unstable_cancelCallback,sm=Ae.unstable_shouldYield,im=Ae.unstable_requestPaint,ne=Ae.unstable_now,om=Ae.unstable_getCurrentPriorityLevel,na=Ae.unstable_ImmediatePriority,ud=Ae.unstable_UserBlockingPriority,ys=Ae.unstable_NormalPriority,am=Ae.unstable_LowPriority,hd=Ae.unstable_IdlePriority,Hs=null,nt=null;function lm(e){if(nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Hs,e,void 0,(e.current.flags&128)===128)}catch{}}var Je=Math.clz32?Math.clz32:um,cm=Math.log,dm=Math.LN2;function um(e){return e>>>=0,e===0?32:31-(cm(e)/dm|0)|0}var Br=64,Kr=4194304;function tr(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 ws(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=tr(l):(o&=a,o!==0&&(r=tr(o)))}else a=n&~s,a!==0?r=tr(a):o!==0&&(r=tr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Je(t),s=1<<n,r|=e[n],t&=~s;return r}function hm(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mm(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-Je(o),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=hm(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function ao(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function md(){var e=Br;return Br<<=1,!(Br&4194240)&&(Br=64),e}function xi(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Or(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Je(t),e[t]=n}function pm(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<n;){var s=31-Je(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function ra(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var B=0;function pd(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var fd,sa,gd,xd,vd,lo=!1,Hr=[],St=null,Ct=null,Et=null,xr=new Map,vr=new Map,yt=[],fm="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ll(e,t){switch(e){case"focusin":case"focusout":St=null;break;case"dragenter":case"dragleave":Ct=null;break;case"mouseover":case"mouseout":Et=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vr.delete(t.pointerId)}}function Bn(e,t,n,r,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[s]},t!==null&&(t=Rr(t),t!==null&&sa(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function gm(e,t,n,r,s){switch(t){case"focusin":return St=Bn(St,e,t,n,r,s),!0;case"dragenter":return Ct=Bn(Ct,e,t,n,r,s),!0;case"mouseover":return Et=Bn(Et,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return xr.set(o,Bn(xr.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,vr.set(o,Bn(vr.get(o)||null,e,t,n,r,s)),!0}return!1}function yd(e){var t=Ht(e.target);if(t!==null){var n=on(t);if(n!==null){if(t=n.tag,t===13){if(t=ad(n),t!==null){e.blockedOn=t,vd(e.priority,function(){gd(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function os(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=co(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ro=r,n.target.dispatchEvent(r),ro=null}else return t=Rr(n),t!==null&&sa(t),e.blockedOn=n,!1;t.shift()}return!0}function cl(e,t,n){os(e)&&n.delete(t)}function xm(){lo=!1,St!==null&&os(St)&&(St=null),Ct!==null&&os(Ct)&&(Ct=null),Et!==null&&os(Et)&&(Et=null),xr.forEach(cl),vr.forEach(cl)}function Kn(e,t){e.blockedOn===t&&(e.blockedOn=null,lo||(lo=!0,Ae.unstable_scheduleCallback(Ae.unstable_NormalPriority,xm)))}function yr(e){function t(s){return Kn(s,e)}if(0<Hr.length){Kn(Hr[0],e);for(var n=1;n<Hr.length;n++){var r=Hr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(St!==null&&Kn(St,e),Ct!==null&&Kn(Ct,e),Et!==null&&Kn(Et,e),xr.forEach(t),vr.forEach(t),n=0;n<yt.length;n++)r=yt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<yt.length&&(n=yt[0],n.blockedOn===null);)yd(n),n.blockedOn===null&&yt.shift()}var Tn=mt.ReactCurrentBatchConfig,bs=!0;function vm(e,t,n,r){var s=B,o=Tn.transition;Tn.transition=null;try{B=1,ia(e,t,n,r)}finally{B=s,Tn.transition=o}}function ym(e,t,n,r){var s=B,o=Tn.transition;Tn.transition=null;try{B=4,ia(e,t,n,r)}finally{B=s,Tn.transition=o}}function ia(e,t,n,r){if(bs){var s=co(e,t,n,r);if(s===null)Ei(e,t,r,js,n),ll(e,r);else if(gm(s,e,t,n,r))r.stopPropagation();else if(ll(e,r),t&4&&-1<fm.indexOf(e)){for(;s!==null;){var o=Rr(s);if(o!==null&&fd(o),o=co(e,t,n,r),o===null&&Ei(e,t,r,js,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else Ei(e,t,r,null,n)}}var js=null;function co(e,t,n,r){if(js=null,e=ta(r),e=Ht(e),e!==null)if(t=on(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ad(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return js=e,null}function wd(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(om()){case na:return 1;case ud:return 4;case ys:case am:return 16;case hd:return 536870912;default:return 16}default:return 16}}var jt=null,oa=null,as=null;function bd(){if(as)return as;var e,t=oa,n=t.length,r,s="value"in jt?jt.value:jt.textContent,o=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[o-r];r++);return as=s.slice(e,1<r?1-r:void 0)}function ls(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Gr(){return!0}function dl(){return!1}function Oe(e){function t(n,r,s,o,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Gr:dl,this.isPropagationStopped=dl,this}return q(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Gr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Gr)},persist:function(){},isPersistent:Gr}),t}var Fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},aa=Oe(Fn),Lr=q({},Fn,{view:0,detail:0}),wm=Oe(Lr),vi,yi,Hn,Gs=q({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:la,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Hn&&(Hn&&e.type==="mousemove"?(vi=e.screenX-Hn.screenX,yi=e.screenY-Hn.screenY):yi=vi=0,Hn=e),vi)},movementY:function(e){return"movementY"in e?e.movementY:yi}}),ul=Oe(Gs),bm=q({},Gs,{dataTransfer:0}),jm=Oe(bm),Nm=q({},Lr,{relatedTarget:0}),wi=Oe(Nm),km=q({},Fn,{animationName:0,elapsedTime:0,pseudoElement:0}),Sm=Oe(km),Cm=q({},Fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Em=Oe(Cm),Tm=q({},Fn,{data:0}),hl=Oe(Tm),Pm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_m={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Dm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Im(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dm[e])?!!t[e]:!1}function la(){return Im}var Am=q({},Lr,{key:function(e){if(e.key){var t=Pm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ls(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?_m[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:la,charCode:function(e){return e.type==="keypress"?ls(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ls(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zm=Oe(Am),Om=q({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ml=Oe(Om),Lm=q({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:la}),Rm=Oe(Lm),$m=q({},Fn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fm=Oe($m),Vm=q({},Gs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Mm=Oe(Vm),Um=[9,13,27,32],ca=ct&&"CompositionEvent"in window,ir=null;ct&&"documentMode"in document&&(ir=document.documentMode);var Wm=ct&&"TextEvent"in window&&!ir,jd=ct&&(!ca||ir&&8<ir&&11>=ir),pl=String.fromCharCode(32),fl=!1;function Nd(e,t){switch(e){case"keyup":return Um.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pn=!1;function Bm(e,t){switch(e){case"compositionend":return kd(t);case"keypress":return t.which!==32?null:(fl=!0,pl);case"textInput":return e=t.data,e===pl&&fl?null:e;default:return null}}function Km(e,t){if(pn)return e==="compositionend"||!ca&&Nd(e,t)?(e=bd(),as=oa=jt=null,pn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jd&&t.locale!=="ko"?null:t.data;default:return null}}var Hm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hm[e.type]:t==="textarea"}function Sd(e,t,n,r){nd(r),t=Ns(t,"onChange"),0<t.length&&(n=new aa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var or=null,wr=null;function Gm(e){Ld(e,0)}function Zs(e){var t=xn(e);if(Jc(t))return e}function Zm(e,t){if(e==="change")return t}var Cd=!1;if(ct){var bi;if(ct){var ji="oninput"in document;if(!ji){var xl=document.createElement("div");xl.setAttribute("oninput","return;"),ji=typeof xl.oninput=="function"}bi=ji}else bi=!1;Cd=bi&&(!document.documentMode||9<document.documentMode)}function vl(){or&&(or.detachEvent("onpropertychange",Ed),wr=or=null)}function Ed(e){if(e.propertyName==="value"&&Zs(wr)){var t=[];Sd(t,wr,e,ta(e)),od(Gm,t)}}function Jm(e,t,n){e==="focusin"?(vl(),or=t,wr=n,or.attachEvent("onpropertychange",Ed)):e==="focusout"&&vl()}function Xm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zs(wr)}function Ym(e,t){if(e==="click")return Zs(t)}function Qm(e,t){if(e==="input"||e==="change")return Zs(t)}function qm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ye=typeof Object.is=="function"?Object.is:qm;function br(e,t){if(Ye(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Ki.call(t,s)||!Ye(e[s],t[s]))return!1}return!0}function yl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wl(e,t){var n=yl(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=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=yl(n)}}function Td(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Td(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pd(){for(var e=window,t=gs();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=gs(e.document)}return t}function da(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 ep(e){var t=Pd(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Td(n.ownerDocument.documentElement,n)){if(r!==null&&da(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 s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=wl(n,o);var a=wl(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var tp=ct&&"documentMode"in document&&11>=document.documentMode,fn=null,uo=null,ar=null,ho=!1;function bl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ho||fn==null||fn!==gs(r)||(r=fn,"selectionStart"in r&&da(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}),ar&&br(ar,r)||(ar=r,r=Ns(uo,"onSelect"),0<r.length&&(t=new aa("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=fn)))}function Zr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var gn={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionend:Zr("Transition","TransitionEnd")},Ni={},_d={};ct&&(_d=document.createElement("div").style,"AnimationEvent"in window||(delete gn.animationend.animation,delete gn.animationiteration.animation,delete gn.animationstart.animation),"TransitionEvent"in window||delete gn.transitionend.transition);function Js(e){if(Ni[e])return Ni[e];if(!gn[e])return e;var t=gn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in _d)return Ni[e]=t[n];return e}var Dd=Js("animationend"),Id=Js("animationiteration"),Ad=Js("animationstart"),zd=Js("transitionend"),Od=new Map,jl="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Lt(e,t){Od.set(e,t),sn(t,[e])}for(var ki=0;ki<jl.length;ki++){var Si=jl[ki],np=Si.toLowerCase(),rp=Si[0].toUpperCase()+Si.slice(1);Lt(np,"on"+rp)}Lt(Dd,"onAnimationEnd");Lt(Id,"onAnimationIteration");Lt(Ad,"onAnimationStart");Lt("dblclick","onDoubleClick");Lt("focusin","onFocus");Lt("focusout","onBlur");Lt(zd,"onTransitionEnd");Dn("onMouseEnter",["mouseout","mouseover"]);Dn("onMouseLeave",["mouseout","mouseover"]);Dn("onPointerEnter",["pointerout","pointerover"]);Dn("onPointerLeave",["pointerout","pointerover"]);sn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));sn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));sn("onBeforeInput",["compositionend","keypress","textInput","paste"]);sn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));sn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));sn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),sp=new Set("cancel close invalid load scroll toggle".split(" ").concat(nr));function Nl(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,nm(r,t,void 0,e),e.currentTarget=null}function Ld(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==o&&s.isPropagationStopped())break e;Nl(s,l,d),o=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==o&&s.isPropagationStopped())break e;Nl(s,l,d),o=c}}}if(vs)throw e=oo,vs=!1,oo=null,e}function Z(e,t){var n=t[xo];n===void 0&&(n=t[xo]=new Set);var r=e+"__bubble";n.has(r)||(Rd(t,e,2,!1),n.add(r))}function Ci(e,t,n){var r=0;t&&(r|=4),Rd(n,e,r,t)}var Jr="_reactListening"+Math.random().toString(36).slice(2);function jr(e){if(!e[Jr]){e[Jr]=!0,Bc.forEach(function(n){n!=="selectionchange"&&(sp.has(n)||Ci(n,!1,e),Ci(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jr]||(t[Jr]=!0,Ci("selectionchange",!1,t))}}function Rd(e,t,n,r){switch(wd(t)){case 1:var s=vm;break;case 4:s=ym;break;default:s=ia}n=s.bind(null,t,n,e),s=void 0,!io||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Ei(e,t,n,r,s){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Ht(l),a===null)return;if(c=a.tag,c===5||c===6){r=o=a;continue e}l=l.parentNode}}r=r.return}od(function(){var d=o,m=ta(n),p=[];e:{var f=Od.get(e);if(f!==void 0){var g=aa,b=e;switch(e){case"keypress":if(ls(n)===0)break e;case"keydown":case"keyup":g=zm;break;case"focusin":b="focus",g=wi;break;case"focusout":b="blur",g=wi;break;case"beforeblur":case"afterblur":g=wi;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=ul;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=jm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=Rm;break;case Dd:case Id:case Ad:g=Sm;break;case zd:g=Fm;break;case"scroll":g=wm;break;case"wheel":g=Mm;break;case"copy":case"cut":case"paste":g=Em;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=ml}var w=(t&4)!==0,j=!w&&e==="scroll",x=w?f!==null?f+"Capture":null:f;w=[];for(var u=d,h;u!==null;){h=u;var y=h.stateNode;if(h.tag===5&&y!==null&&(h=y,x!==null&&(y=gr(u,x),y!=null&&w.push(Nr(u,y,h)))),j)break;u=u.return}0<w.length&&(f=new g(f,b,null,n,m),p.push({event:f,listeners:w}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",f&&n!==ro&&(b=n.relatedTarget||n.fromElement)&&(Ht(b)||b[dt]))break e;if((g||f)&&(f=m.window===m?m:(f=m.ownerDocument)?f.defaultView||f.parentWindow:window,g?(b=n.relatedTarget||n.toElement,g=d,b=b?Ht(b):null,b!==null&&(j=on(b),b!==j||b.tag!==5&&b.tag!==6)&&(b=null)):(g=null,b=d),g!==b)){if(w=ul,y="onMouseLeave",x="onMouseEnter",u="mouse",(e==="pointerout"||e==="pointerover")&&(w=ml,y="onPointerLeave",x="onPointerEnter",u="pointer"),j=g==null?f:xn(g),h=b==null?f:xn(b),f=new w(y,u+"leave",g,n,m),f.target=j,f.relatedTarget=h,y=null,Ht(m)===d&&(w=new w(x,u+"enter",b,n,m),w.target=h,w.relatedTarget=j,y=w),j=y,g&&b)t:{for(w=g,x=b,u=0,h=w;h;h=ln(h))u++;for(h=0,y=x;y;y=ln(y))h++;for(;0<u-h;)w=ln(w),u--;for(;0<h-u;)x=ln(x),h--;for(;u--;){if(w===x||x!==null&&w===x.alternate)break t;w=ln(w),x=ln(x)}w=null}else w=null;g!==null&&kl(p,f,g,w,!1),b!==null&&j!==null&&kl(p,j,b,w,!0)}}e:{if(f=d?xn(d):window,g=f.nodeName&&f.nodeName.toLowerCase(),g==="select"||g==="input"&&f.type==="file")var v=Zm;else if(gl(f))if(Cd)v=Qm;else{v=Xm;var N=Jm}else(g=f.nodeName)&&g.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(v=Ym);if(v&&(v=v(e,d))){Sd(p,v,n,m);break e}N&&N(e,f,d),e==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&Qi(f,"number",f.value)}switch(N=d?xn(d):window,e){case"focusin":(gl(N)||N.contentEditable==="true")&&(fn=N,uo=d,ar=null);break;case"focusout":ar=uo=fn=null;break;case"mousedown":ho=!0;break;case"contextmenu":case"mouseup":case"dragend":ho=!1,bl(p,n,m);break;case"selectionchange":if(tp)break;case"keydown":case"keyup":bl(p,n,m)}var k;if(ca)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else pn?Nd(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(jd&&n.locale!=="ko"&&(pn||C!=="onCompositionStart"?C==="onCompositionEnd"&&pn&&(k=bd()):(jt=m,oa="value"in jt?jt.value:jt.textContent,pn=!0)),N=Ns(d,C),0<N.length&&(C=new hl(C,e,null,n,m),p.push({event:C,listeners:N}),k?C.data=k:(k=kd(n),k!==null&&(C.data=k)))),(k=Wm?Bm(e,n):Km(e,n))&&(d=Ns(d,"onBeforeInput"),0<d.length&&(m=new hl("onBeforeInput","beforeinput",null,n,m),p.push({event:m,listeners:d}),m.data=k))}Ld(p,t)})}function Nr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ns(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=gr(e,n),o!=null&&r.unshift(Nr(e,o,s)),o=gr(e,t),o!=null&&r.push(Nr(e,o,s))),e=e.return}return r}function ln(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function kl(e,t,n,r,s){for(var o=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=gr(n,o),c!=null&&a.unshift(Nr(n,c,l))):s||(c=gr(n,o),c!=null&&a.push(Nr(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var ip=/\r\n?/g,op=/\u0000|\uFFFD/g;function Sl(e){return(typeof e=="string"?e:""+e).replace(ip,`
`).replace(op,"")}function Xr(e,t,n){if(t=Sl(t),Sl(e)!==t&&n)throw Error(T(425))}function ks(){}var mo=null,po=null;function fo(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var go=typeof setTimeout=="function"?setTimeout:void 0,ap=typeof clearTimeout=="function"?clearTimeout:void 0,Cl=typeof Promise=="function"?Promise:void 0,lp=typeof queueMicrotask=="function"?queueMicrotask:typeof Cl<"u"?function(e){return Cl.resolve(null).then(e).catch(cp)}:go;function cp(e){setTimeout(function(){throw e})}function Ti(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),yr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);yr(t)}function Tt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function El(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Vn=Math.random().toString(36).slice(2),tt="__reactFiber$"+Vn,kr="__reactProps$"+Vn,dt="__reactContainer$"+Vn,xo="__reactEvents$"+Vn,dp="__reactListeners$"+Vn,up="__reactHandles$"+Vn;function Ht(e){var t=e[tt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=El(e);e!==null;){if(n=e[tt])return n;e=El(e)}return t}e=n,n=e.parentNode}return null}function Rr(e){return e=e[tt]||e[dt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(T(33))}function Xs(e){return e[kr]||null}var vo=[],vn=-1;function Rt(e){return{current:e}}function J(e){0>vn||(e.current=vo[vn],vo[vn]=null,vn--)}function H(e,t){vn++,vo[vn]=e.current,e.current=t}var Ot={},ve=Rt(Ot),Ee=Rt(!1),qt=Ot;function In(e,t){var n=e.type.contextTypes;if(!n)return Ot;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Te(e){return e=e.childContextTypes,e!=null}function Ss(){J(Ee),J(ve)}function Tl(e,t,n){if(ve.current!==Ot)throw Error(T(168));H(ve,t),H(Ee,n)}function $d(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(T(108,Jh(e)||"Unknown",s));return q({},n,r)}function Cs(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ot,qt=ve.current,H(ve,e),H(Ee,Ee.current),!0}function Pl(e,t,n){var r=e.stateNode;if(!r)throw Error(T(169));n?(e=$d(e,t,qt),r.__reactInternalMemoizedMergedChildContext=e,J(Ee),J(ve),H(ve,e)):J(Ee),H(Ee,n)}var it=null,Ys=!1,Pi=!1;function Fd(e){it===null?it=[e]:it.push(e)}function hp(e){Ys=!0,Fd(e)}function $t(){if(!Pi&&it!==null){Pi=!0;var e=0,t=B;try{var n=it;for(B=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}it=null,Ys=!1}catch(s){throw it!==null&&(it=it.slice(e+1)),dd(na,$t),s}finally{B=t,Pi=!1}}return null}var yn=[],wn=0,Es=null,Ts=0,Re=[],$e=0,en=null,ot=1,at="";function Ut(e,t){yn[wn++]=Ts,yn[wn++]=Es,Es=e,Ts=t}function Vd(e,t,n){Re[$e++]=ot,Re[$e++]=at,Re[$e++]=en,en=e;var r=ot;e=at;var s=32-Je(r)-1;r&=~(1<<s),n+=1;var o=32-Je(t)+s;if(30<o){var a=s-s%5;o=(r&(1<<a)-1).toString(32),r>>=a,s-=a,ot=1<<32-Je(t)+s|n<<s|r,at=o+e}else ot=1<<o|n<<s|r,at=e}function ua(e){e.return!==null&&(Ut(e,1),Vd(e,1,0))}function ha(e){for(;e===Es;)Es=yn[--wn],yn[wn]=null,Ts=yn[--wn],yn[wn]=null;for(;e===en;)en=Re[--$e],Re[$e]=null,at=Re[--$e],Re[$e]=null,ot=Re[--$e],Re[$e]=null}var Ie=null,De=null,X=!1,Ge=null;function Md(e,t){var n=Fe(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function _l(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ie=e,De=Tt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ie=e,De=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=en!==null?{id:ot,overflow:at}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Fe(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ie=e,De=null,!0):!1;default:return!1}}function yo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wo(e){if(X){var t=De;if(t){var n=t;if(!_l(e,t)){if(yo(e))throw Error(T(418));t=Tt(n.nextSibling);var r=Ie;t&&_l(e,t)?Md(r,n):(e.flags=e.flags&-4097|2,X=!1,Ie=e)}}else{if(yo(e))throw Error(T(418));e.flags=e.flags&-4097|2,X=!1,Ie=e}}}function Dl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ie=e}function Yr(e){if(e!==Ie)return!1;if(!X)return Dl(e),X=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!fo(e.type,e.memoizedProps)),t&&(t=De)){if(yo(e))throw Ud(),Error(T(418));for(;t;)Md(e,t),t=Tt(t.nextSibling)}if(Dl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(T(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){De=Tt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}De=null}}else De=Ie?Tt(e.stateNode.nextSibling):null;return!0}function Ud(){for(var e=De;e;)e=Tt(e.nextSibling)}function An(){De=Ie=null,X=!1}function ma(e){Ge===null?Ge=[e]:Ge.push(e)}var mp=mt.ReactCurrentBatchConfig;function Gn(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(T(309));var r=n.stateNode}if(!r)throw Error(T(147,e));var s=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var l=s.refs;a===null?delete l[o]:l[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(T(284));if(!n._owner)throw Error(T(290,e))}return e}function Qr(e,t){throw e=Object.prototype.toString.call(t),Error(T(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Il(e){var t=e._init;return t(e._payload)}function Wd(e){function t(x,u){if(e){var h=x.deletions;h===null?(x.deletions=[u],x.flags|=16):h.push(u)}}function n(x,u){if(!e)return null;for(;u!==null;)t(x,u),u=u.sibling;return null}function r(x,u){for(x=new Map;u!==null;)u.key!==null?x.set(u.key,u):x.set(u.index,u),u=u.sibling;return x}function s(x,u){return x=It(x,u),x.index=0,x.sibling=null,x}function o(x,u,h){return x.index=h,e?(h=x.alternate,h!==null?(h=h.index,h<u?(x.flags|=2,u):h):(x.flags|=2,u)):(x.flags|=1048576,u)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,u,h,y){return u===null||u.tag!==6?(u=Li(h,x.mode,y),u.return=x,u):(u=s(u,h),u.return=x,u)}function c(x,u,h,y){var v=h.type;return v===mn?m(x,u,h.props.children,y,h.key):u!==null&&(u.elementType===v||typeof v=="object"&&v!==null&&v.$$typeof===gt&&Il(v)===u.type)?(y=s(u,h.props),y.ref=Gn(x,u,h),y.return=x,y):(y=fs(h.type,h.key,h.props,null,x.mode,y),y.ref=Gn(x,u,h),y.return=x,y)}function d(x,u,h,y){return u===null||u.tag!==4||u.stateNode.containerInfo!==h.containerInfo||u.stateNode.implementation!==h.implementation?(u=Ri(h,x.mode,y),u.return=x,u):(u=s(u,h.children||[]),u.return=x,u)}function m(x,u,h,y,v){return u===null||u.tag!==7?(u=Qt(h,x.mode,y,v),u.return=x,u):(u=s(u,h),u.return=x,u)}function p(x,u,h){if(typeof u=="string"&&u!==""||typeof u=="number")return u=Li(""+u,x.mode,h),u.return=x,u;if(typeof u=="object"&&u!==null){switch(u.$$typeof){case Mr:return h=fs(u.type,u.key,u.props,null,x.mode,h),h.ref=Gn(x,null,u),h.return=x,h;case hn:return u=Ri(u,x.mode,h),u.return=x,u;case gt:var y=u._init;return p(x,y(u._payload),h)}if(er(u)||Un(u))return u=Qt(u,x.mode,h,null),u.return=x,u;Qr(x,u)}return null}function f(x,u,h,y){var v=u!==null?u.key:null;if(typeof h=="string"&&h!==""||typeof h=="number")return v!==null?null:l(x,u,""+h,y);if(typeof h=="object"&&h!==null){switch(h.$$typeof){case Mr:return h.key===v?c(x,u,h,y):null;case hn:return h.key===v?d(x,u,h,y):null;case gt:return v=h._init,f(x,u,v(h._payload),y)}if(er(h)||Un(h))return v!==null?null:m(x,u,h,y,null);Qr(x,h)}return null}function g(x,u,h,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return x=x.get(h)||null,l(u,x,""+y,v);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Mr:return x=x.get(y.key===null?h:y.key)||null,c(u,x,y,v);case hn:return x=x.get(y.key===null?h:y.key)||null,d(u,x,y,v);case gt:var N=y._init;return g(x,u,h,N(y._payload),v)}if(er(y)||Un(y))return x=x.get(h)||null,m(u,x,y,v,null);Qr(u,y)}return null}function b(x,u,h,y){for(var v=null,N=null,k=u,C=u=0,z=null;k!==null&&C<h.length;C++){k.index>C?(z=k,k=null):z=k.sibling;var A=f(x,k,h[C],y);if(A===null){k===null&&(k=z);break}e&&k&&A.alternate===null&&t(x,k),u=o(A,u,C),N===null?v=A:N.sibling=A,N=A,k=z}if(C===h.length)return n(x,k),X&&Ut(x,C),v;if(k===null){for(;C<h.length;C++)k=p(x,h[C],y),k!==null&&(u=o(k,u,C),N===null?v=k:N.sibling=k,N=k);return X&&Ut(x,C),v}for(k=r(x,k);C<h.length;C++)z=g(k,x,C,h[C],y),z!==null&&(e&&z.alternate!==null&&k.delete(z.key===null?C:z.key),u=o(z,u,C),N===null?v=z:N.sibling=z,N=z);return e&&k.forEach(function(I){return t(x,I)}),X&&Ut(x,C),v}function w(x,u,h,y){var v=Un(h);if(typeof v!="function")throw Error(T(150));if(h=v.call(h),h==null)throw Error(T(151));for(var N=v=null,k=u,C=u=0,z=null,A=h.next();k!==null&&!A.done;C++,A=h.next()){k.index>C?(z=k,k=null):z=k.sibling;var I=f(x,k,A.value,y);if(I===null){k===null&&(k=z);break}e&&k&&I.alternate===null&&t(x,k),u=o(I,u,C),N===null?v=I:N.sibling=I,N=I,k=z}if(A.done)return n(x,k),X&&Ut(x,C),v;if(k===null){for(;!A.done;C++,A=h.next())A=p(x,A.value,y),A!==null&&(u=o(A,u,C),N===null?v=A:N.sibling=A,N=A);return X&&Ut(x,C),v}for(k=r(x,k);!A.done;C++,A=h.next())A=g(k,x,C,A.value,y),A!==null&&(e&&A.alternate!==null&&k.delete(A.key===null?C:A.key),u=o(A,u,C),N===null?v=A:N.sibling=A,N=A);return e&&k.forEach(function(M){return t(x,M)}),X&&Ut(x,C),v}function j(x,u,h,y){if(typeof h=="object"&&h!==null&&h.type===mn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case Mr:e:{for(var v=h.key,N=u;N!==null;){if(N.key===v){if(v=h.type,v===mn){if(N.tag===7){n(x,N.sibling),u=s(N,h.props.children),u.return=x,x=u;break e}}else if(N.elementType===v||typeof v=="object"&&v!==null&&v.$$typeof===gt&&Il(v)===N.type){n(x,N.sibling),u=s(N,h.props),u.ref=Gn(x,N,h),u.return=x,x=u;break e}n(x,N);break}else t(x,N);N=N.sibling}h.type===mn?(u=Qt(h.props.children,x.mode,y,h.key),u.return=x,x=u):(y=fs(h.type,h.key,h.props,null,x.mode,y),y.ref=Gn(x,u,h),y.return=x,x=y)}return a(x);case hn:e:{for(N=h.key;u!==null;){if(u.key===N)if(u.tag===4&&u.stateNode.containerInfo===h.containerInfo&&u.stateNode.implementation===h.implementation){n(x,u.sibling),u=s(u,h.children||[]),u.return=x,x=u;break e}else{n(x,u);break}else t(x,u);u=u.sibling}u=Ri(h,x.mode,y),u.return=x,x=u}return a(x);case gt:return N=h._init,j(x,u,N(h._payload),y)}if(er(h))return b(x,u,h,y);if(Un(h))return w(x,u,h,y);Qr(x,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,u!==null&&u.tag===6?(n(x,u.sibling),u=s(u,h),u.return=x,x=u):(n(x,u),u=Li(h,x.mode,y),u.return=x,x=u),a(x)):n(x,u)}return j}var zn=Wd(!0),Bd=Wd(!1),Ps=Rt(null),_s=null,bn=null,pa=null;function fa(){pa=bn=_s=null}function ga(e){var t=Ps.current;J(Ps),e._currentValue=t}function bo(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 Pn(e,t){_s=e,pa=bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ce=!0),e.firstContext=null)}function Me(e){var t=e._currentValue;if(pa!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(_s===null)throw Error(T(308));bn=e,_s.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var Gt=null;function xa(e){Gt===null?Gt=[e]:Gt.push(e)}function Kd(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,xa(t)):(n.next=s.next,s.next=n),t.interleaved=n,ut(e,r)}function ut(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 xt=!1;function va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(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 lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,V&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ut(e,n)}return s=r.interleaved,s===null?(t.next=t,xa(r)):(t.next=s.next,s.next=t),r.interleaved=t,ut(e,n)}function cs(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,ra(e,n)}}function Al(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,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 Ds(e,t,n,r){var s=e.updateQueue;xt=!1;var o=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?o=d:a.next=d,a=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==a&&(l===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=c))}if(o!==null){var p=s.baseState;a=0,m=d=c=null,l=o;do{var f=l.lane,g=l.eventTime;if((r&f)===f){m!==null&&(m=m.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,w=l;switch(f=t,g=n,w.tag){case 1:if(b=w.payload,typeof b=="function"){p=b.call(g,p,f);break e}p=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=w.payload,f=typeof b=="function"?b.call(g,p,f):b,f==null)break e;p=q({},p,f);break e;case 2:xt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else g={eventTime:g,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(d=m=g,c=p):m=m.next=g,a|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(1);if(m===null&&(c=p),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=m,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);nn|=a,e.lanes=a,e.memoizedState=p}}function zl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(T(191,s));s.call(r)}}}var $r={},rt=Rt($r),Sr=Rt($r),Cr=Rt($r);function Zt(e){if(e===$r)throw Error(T(174));return e}function ya(e,t){switch(H(Cr,t),H(Sr,e),H(rt,$r),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:eo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=eo(t,e)}J(rt),H(rt,t)}function On(){J(rt),J(Sr),J(Cr)}function Gd(e){Zt(Cr.current);var t=Zt(rt.current),n=eo(t,e.type);t!==n&&(H(Sr,e),H(rt,n))}function wa(e){Sr.current===e&&(J(rt),J(Sr))}var Y=Rt(0);function Is(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _i=[];function ba(){for(var e=0;e<_i.length;e++)_i[e]._workInProgressVersionPrimary=null;_i.length=0}var ds=mt.ReactCurrentDispatcher,Di=mt.ReactCurrentBatchConfig,tn=0,Q=null,oe=null,ce=null,As=!1,lr=!1,Er=0,pp=0;function fe(){throw Error(T(321))}function ja(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ye(e[n],t[n]))return!1;return!0}function Na(e,t,n,r,s,o){if(tn=o,Q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ds.current=e===null||e.memoizedState===null?vp:yp,e=n(r,s),lr){o=0;do{if(lr=!1,Er=0,25<=o)throw Error(T(301));o+=1,ce=oe=null,t.updateQueue=null,ds.current=wp,e=n(r,s)}while(lr)}if(ds.current=zs,t=oe!==null&&oe.next!==null,tn=0,ce=oe=Q=null,As=!1,t)throw Error(T(300));return e}function ka(){var e=Er!==0;return Er=0,e}function qe(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ce===null?Q.memoizedState=ce=e:ce=ce.next=e,ce}function Ue(){if(oe===null){var e=Q.alternate;e=e!==null?e.memoizedState:null}else e=oe.next;var t=ce===null?Q.memoizedState:ce.next;if(t!==null)ce=t,oe=e;else{if(e===null)throw Error(T(310));oe=e,e={memoizedState:oe.memoizedState,baseState:oe.baseState,baseQueue:oe.baseQueue,queue:oe.queue,next:null},ce===null?Q.memoizedState=ce=e:ce=ce.next=e}return ce}function Tr(e,t){return typeof t=="function"?t(e):t}function Ii(e){var t=Ue(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var r=oe,s=r.baseQueue,o=n.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}r.baseQueue=s=o,n.pending=null}if(s!==null){o=s.next,r=r.baseState;var l=a=null,c=null,d=o;do{var m=d.lane;if((tn&m)===m)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var p={lane:m,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=p,a=r):c=c.next=p,Q.lanes|=m,nn|=m}d=d.next}while(d!==null&&d!==o);c===null?a=r:c.next=l,Ye(r,t.memoizedState)||(Ce=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do o=s.lane,Q.lanes|=o,nn|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ai(e){var t=Ue(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,o=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do o=e(o,a.action),a=a.next;while(a!==s);Ye(o,t.memoizedState)||(Ce=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Zd(){}function Jd(e,t){var n=Q,r=Ue(),s=t(),o=!Ye(r.memoizedState,s);if(o&&(r.memoizedState=s,Ce=!0),r=r.queue,Sa(Qd.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||ce!==null&&ce.memoizedState.tag&1){if(n.flags|=2048,Pr(9,Yd.bind(null,n,r,s,t),void 0,null),de===null)throw Error(T(349));tn&30||Xd(n,t,s)}return s}function Xd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Q.updateQueue,t===null?(t={lastEffect:null,stores:null},Q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yd(e,t,n,r){t.value=n,t.getSnapshot=r,qd(t)&&eu(e)}function Qd(e,t,n){return n(function(){qd(t)&&eu(e)})}function qd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ye(e,n)}catch{return!0}}function eu(e){var t=ut(e,1);t!==null&&Xe(t,e,1,-1)}function Ol(e){var t=qe();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Tr,lastRenderedState:e},t.queue=e,e=e.dispatch=xp.bind(null,Q,e),[t.memoizedState,e]}function Pr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Q.updateQueue,t===null?(t={lastEffect:null,stores:null},Q.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function tu(){return Ue().memoizedState}function us(e,t,n,r){var s=qe();Q.flags|=e,s.memoizedState=Pr(1|t,n,void 0,r===void 0?null:r)}function Qs(e,t,n,r){var s=Ue();r=r===void 0?null:r;var o=void 0;if(oe!==null){var a=oe.memoizedState;if(o=a.destroy,r!==null&&ja(r,a.deps)){s.memoizedState=Pr(t,n,o,r);return}}Q.flags|=e,s.memoizedState=Pr(1|t,n,o,r)}function Ll(e,t){return us(8390656,8,e,t)}function Sa(e,t){return Qs(2048,8,e,t)}function nu(e,t){return Qs(4,2,e,t)}function ru(e,t){return Qs(4,4,e,t)}function su(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function iu(e,t,n){return n=n!=null?n.concat([e]):null,Qs(4,4,su.bind(null,t,e),n)}function Ca(){}function ou(e,t){var n=Ue();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ja(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function au(e,t){var n=Ue();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ja(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function lu(e,t,n){return tn&21?(Ye(n,t)||(n=md(),Q.lanes|=n,nn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ce=!0),e.memoizedState=n)}function fp(e,t){var n=B;B=n!==0&&4>n?n:4,e(!0);var r=Di.transition;Di.transition={};try{e(!1),t()}finally{B=n,Di.transition=r}}function cu(){return Ue().memoizedState}function gp(e,t,n){var r=Dt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},du(e))uu(t,n);else if(n=Kd(e,t,n,r),n!==null){var s=be();Xe(n,e,r,s),hu(n,t,r)}}function xp(e,t,n){var r=Dt(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(du(e))uu(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,l=o(a,n);if(s.hasEagerState=!0,s.eagerState=l,Ye(l,a)){var c=t.interleaved;c===null?(s.next=s,xa(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Kd(e,t,s,r),n!==null&&(s=be(),Xe(n,e,r,s),hu(n,t,r))}}function du(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function uu(e,t){lr=As=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ra(e,n)}}var zs={readContext:Me,useCallback:fe,useContext:fe,useEffect:fe,useImperativeHandle:fe,useInsertionEffect:fe,useLayoutEffect:fe,useMemo:fe,useReducer:fe,useRef:fe,useState:fe,useDebugValue:fe,useDeferredValue:fe,useTransition:fe,useMutableSource:fe,useSyncExternalStore:fe,useId:fe,unstable_isNewReconciler:!1},vp={readContext:Me,useCallback:function(e,t){return qe().memoizedState=[e,t===void 0?null:t],e},useContext:Me,useEffect:Ll,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,us(4194308,4,su.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){return us(4,2,e,t)},useMemo:function(e,t){var n=qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=qe();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=gp.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=qe();return e={current:e},t.memoizedState=e},useState:Ol,useDebugValue:Ca,useDeferredValue:function(e){return qe().memoizedState=e},useTransition:function(){var e=Ol(!1),t=e[0];return e=fp.bind(null,e[1]),qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Q,s=qe();if(X){if(n===void 0)throw Error(T(407));n=n()}else{if(n=t(),de===null)throw Error(T(349));tn&30||Xd(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,Ll(Qd.bind(null,r,o,e),[e]),r.flags|=2048,Pr(9,Yd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=qe(),t=de.identifierPrefix;if(X){var n=at,r=ot;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Er++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=pp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},yp={readContext:Me,useCallback:ou,useContext:Me,useEffect:Sa,useImperativeHandle:iu,useInsertionEffect:nu,useLayoutEffect:ru,useMemo:au,useReducer:Ii,useRef:tu,useState:function(){return Ii(Tr)},useDebugValue:Ca,useDeferredValue:function(e){var t=Ue();return lu(t,oe.memoizedState,e)},useTransition:function(){var e=Ii(Tr)[0],t=Ue().memoizedState;return[e,t]},useMutableSource:Zd,useSyncExternalStore:Jd,useId:cu,unstable_isNewReconciler:!1},wp={readContext:Me,useCallback:ou,useContext:Me,useEffect:Sa,useImperativeHandle:iu,useInsertionEffect:nu,useLayoutEffect:ru,useMemo:au,useReducer:Ai,useRef:tu,useState:function(){return Ai(Tr)},useDebugValue:Ca,useDeferredValue:function(e){var t=Ue();return oe===null?t.memoizedState=e:lu(t,oe.memoizedState,e)},useTransition:function(){var e=Ai(Tr)[0],t=Ue().memoizedState;return[e,t]},useMutableSource:Zd,useSyncExternalStore:Jd,useId:cu,unstable_isNewReconciler:!1};function Ke(e,t){if(e&&e.defaultProps){t=q({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function jo(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:q({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var qs={isMounted:function(e){return(e=e._reactInternals)?on(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=be(),s=Dt(e),o=lt(r,s);o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,s),t!==null&&(Xe(t,e,s,r),cs(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=be(),s=Dt(e),o=lt(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,s),t!==null&&(Xe(t,e,s,r),cs(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=be(),r=Dt(e),s=lt(n,r);s.tag=2,t!=null&&(s.callback=t),t=Pt(e,s,r),t!==null&&(Xe(t,e,r,n),cs(t,e,r))}};function Rl(e,t,n,r,s,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,a):t.prototype&&t.prototype.isPureReactComponent?!br(n,r)||!br(s,o):!0}function mu(e,t,n){var r=!1,s=Ot,o=t.contextType;return typeof o=="object"&&o!==null?o=Me(o):(s=Te(t)?qt:ve.current,r=t.contextTypes,o=(r=r!=null)?In(e,s):Ot),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=qs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function $l(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&qs.enqueueReplaceState(t,t.state,null)}function No(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},va(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Me(o):(o=Te(t)?qt:ve.current,s.context=In(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(jo(e,t,o,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&qs.enqueueReplaceState(s,s.state,null),Ds(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Ln(e,t){try{var n="",r=t;do n+=Zh(r),r=r.return;while(r);var s=n}catch(o){s=`
Error generating stack: `+o.message+`
`+o.stack}return{value:e,source:t,stack:s,digest:null}}function zi(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ko(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var bp=typeof WeakMap=="function"?WeakMap:Map;function pu(e,t,n){n=lt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ls||(Ls=!0,zo=r),ko(e,t)},n}function fu(e,t,n){n=lt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){ko(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){ko(e,t),typeof r!="function"&&(_t===null?_t=new Set([this]):_t.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Fl(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new bp;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=Op.bind(null,e,t,n),t.then(e,e))}function Vl(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ml(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lt(-1,1),t.tag=2,Pt(n,t,1))),n.lanes|=1),e)}var jp=mt.ReactCurrentOwner,Ce=!1;function ye(e,t,n,r){t.child=e===null?Bd(t,null,n,r):zn(t,e.child,n,r)}function Ul(e,t,n,r,s){n=n.render;var o=t.ref;return Pn(t,s),r=Na(e,t,n,r,o,s),n=ka(),e!==null&&!Ce?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ht(e,t,s)):(X&&n&&ua(t),t.flags|=1,ye(e,t,r,s),t.child)}function Wl(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!za(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,gu(e,t,o,r,s)):(e=fs(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:br,n(a,r)&&e.ref===t.ref)return ht(e,t,s)}return t.flags|=1,e=It(o,r),e.ref=t.ref,e.return=t,t.child=e}function gu(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(br(o,r)&&e.ref===t.ref)if(Ce=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(Ce=!0);else return t.lanes=e.lanes,ht(e,t,s)}return So(e,t,n,r,s)}function xu(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},H(Nn,_e),_e|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,H(Nn,_e),_e|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,H(Nn,_e),_e|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,H(Nn,_e),_e|=r;return ye(e,t,s,n),t.child}function vu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function So(e,t,n,r,s){var o=Te(n)?qt:ve.current;return o=In(t,o),Pn(t,s),n=Na(e,t,n,r,o,s),r=ka(),e!==null&&!Ce?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ht(e,t,s)):(X&&r&&ua(t),t.flags|=1,ye(e,t,n,s),t.child)}function Bl(e,t,n,r,s){if(Te(n)){var o=!0;Cs(t)}else o=!1;if(Pn(t,s),t.stateNode===null)hs(e,t),mu(t,n,r),No(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Me(d):(d=Te(n)?qt:ve.current,d=In(t,d));var m=n.getDerivedStateFromProps,p=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function";p||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&$l(t,a,r,d),xt=!1;var f=t.memoizedState;a.state=f,Ds(t,r,a,s),c=t.memoizedState,l!==r||f!==c||Ee.current||xt?(typeof m=="function"&&(jo(t,n,m,r),c=t.memoizedState),(l=xt||Rl(t,n,l,r,f,c,d))?(p||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Hd(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Ke(t.type,l),a.props=d,p=t.pendingProps,f=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Me(c):(c=Te(n)?qt:ve.current,c=In(t,c));var g=n.getDerivedStateFromProps;(m=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==p||f!==c)&&$l(t,a,r,c),xt=!1,f=t.memoizedState,a.state=f,Ds(t,r,a,s);var b=t.memoizedState;l!==p||f!==b||Ee.current||xt?(typeof g=="function"&&(jo(t,n,g,r),b=t.memoizedState),(d=xt||Rl(t,n,d,r,f,b,c)||!1)?(m||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,b,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,b,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=b),a.props=r,a.state=b,a.context=c,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Co(e,t,n,r,o,s)}function Co(e,t,n,r,s,o){vu(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Pl(t,n,!1),ht(e,t,o);r=t.stateNode,jp.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=zn(t,e.child,null,o),t.child=zn(t,null,l,o)):ye(e,t,l,o),t.memoizedState=r.state,s&&Pl(t,n,!0),t.child}function yu(e){var t=e.stateNode;t.pendingContext?Tl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Tl(e,t.context,!1),ya(e,t.containerInfo)}function Kl(e,t,n,r,s){return An(),ma(s),t.flags|=256,ye(e,t,n,r),t.child}var Eo={dehydrated:null,treeContext:null,retryLane:0};function To(e){return{baseLanes:e,cachePool:null,transitions:null}}function wu(e,t,n){var r=t.pendingProps,s=Y.current,o=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),H(Y,s&1),e===null)return wo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=ni(a,r,0,null),e=Qt(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=To(n),t.memoizedState=Eo,e):Ea(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Np(e,t,a,r,l,s,n);if(o){o=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=It(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=It(l,o):(o=Qt(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=e.child.memoizedState,a=a===null?To(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Eo,r}return o=e.child,e=o.sibling,r=It(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ea(e,t){return t=ni({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function qr(e,t,n,r){return r!==null&&ma(r),zn(t,e.child,null,n),e=Ea(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Np(e,t,n,r,s,o,a){if(n)return t.flags&256?(t.flags&=-257,r=zi(Error(T(422))),qr(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=ni({mode:"visible",children:r.children},s,0,null),o=Qt(o,s,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&zn(t,e.child,null,a),t.child.memoizedState=To(a),t.memoizedState=Eo,o);if(!(t.mode&1))return qr(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(T(419)),r=zi(o,r,void 0),qr(e,t,a,r)}if(l=(a&e.childLanes)!==0,Ce||l){if(r=de,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,ut(e,s),Xe(r,e,s,-1))}return Aa(),r=zi(Error(T(421))),qr(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=Lp.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,De=Tt(s.nextSibling),Ie=t,X=!0,Ge=null,e!==null&&(Re[$e++]=ot,Re[$e++]=at,Re[$e++]=en,ot=e.id,at=e.overflow,en=t),t=Ea(t,r.children),t.flags|=4096,t)}function Hl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),bo(e.return,t,n)}function Oi(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function bu(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(ye(e,t,r.children,n),r=Y.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hl(e,n,t);else if(e.tag===19)Hl(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(H(Y,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Is(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Oi(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Is(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Oi(t,!0,n,null,o);break;case"together":Oi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hs(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ht(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),nn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(T(153));if(t.child!==null){for(e=t.child,n=It(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=It(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kp(e,t,n){switch(t.tag){case 3:yu(t),An();break;case 5:Gd(t);break;case 1:Te(t.type)&&Cs(t);break;case 4:ya(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;H(Ps,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(H(Y,Y.current&1),t.flags|=128,null):n&t.child.childLanes?wu(e,t,n):(H(Y,Y.current&1),e=ht(e,t,n),e!==null?e.sibling:null);H(Y,Y.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return bu(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),H(Y,Y.current),r)break;return null;case 22:case 23:return t.lanes=0,xu(e,t,n)}return ht(e,t,n)}var ju,Po,Nu,ku;ju=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Po=function(){};Nu=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Zt(rt.current);var o=null;switch(n){case"input":s=Xi(e,s),r=Xi(e,r),o=[];break;case"select":s=q({},s,{value:void 0}),r=q({},r,{value:void 0}),o=[];break;case"textarea":s=qi(e,s),r=qi(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ks)}to(n,r);var a;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(pr.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(o||(o=[]),o.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(pr.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Z("scroll",e),o||l===c||(o=[])):(o=o||[]).push(d,c))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};ku=function(e,t,n,r){n!==r&&(t.flags|=4)};function Zn(e,t){if(!X)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ge(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Sp(e,t,n){var r=t.pendingProps;switch(ha(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ge(t),null;case 1:return Te(t.type)&&Ss(),ge(t),null;case 3:return r=t.stateNode,On(),J(Ee),J(ve),ba(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ge!==null&&(Ro(Ge),Ge=null))),Po(e,t),ge(t),null;case 5:wa(t);var s=Zt(Cr.current);if(n=t.type,e!==null&&t.stateNode!=null)Nu(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(T(166));return ge(t),null}if(e=Zt(rt.current),Yr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[tt]=t,r[kr]=o,e=(t.mode&1)!==0,n){case"dialog":Z("cancel",r),Z("close",r);break;case"iframe":case"object":case"embed":Z("load",r);break;case"video":case"audio":for(s=0;s<nr.length;s++)Z(nr[s],r);break;case"source":Z("error",r);break;case"img":case"image":case"link":Z("error",r),Z("load",r);break;case"details":Z("toggle",r);break;case"input":tl(r,o),Z("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Z("invalid",r);break;case"textarea":rl(r,o),Z("invalid",r)}to(n,o),s=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&Xr(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Xr(r.textContent,l,e),s=["children",""+l]):pr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&Z("scroll",r)}switch(n){case"input":Ur(r),nl(r,o,!0);break;case"textarea":Ur(r),sl(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ks)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Qc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[tt]=t,e[kr]=r,ju(e,t,!1,!1),t.stateNode=e;e:{switch(a=no(n,r),n){case"dialog":Z("cancel",e),Z("close",e),s=r;break;case"iframe":case"object":case"embed":Z("load",e),s=r;break;case"video":case"audio":for(s=0;s<nr.length;s++)Z(nr[s],e);s=r;break;case"source":Z("error",e),s=r;break;case"img":case"image":case"link":Z("error",e),Z("load",e),s=r;break;case"details":Z("toggle",e),s=r;break;case"input":tl(e,r),s=Xi(e,r),Z("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=q({},r,{value:void 0}),Z("invalid",e);break;case"textarea":rl(e,r),s=qi(e,r),Z("invalid",e);break;default:s=r}to(n,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?td(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&qc(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&fr(e,c):typeof c=="number"&&fr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(pr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&Z("scroll",e):c!=null&&Yo(e,o,c,a))}switch(n){case"input":Ur(e),nl(e,r,!1);break;case"textarea":Ur(e),sl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zt(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Sn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Sn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=ks)}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 ge(t),null;case 6:if(e&&t.stateNode!=null)ku(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(T(166));if(n=Zt(Cr.current),Zt(rt.current),Yr(t)){if(r=t.stateNode,n=t.memoizedProps,r[tt]=t,(o=r.nodeValue!==n)&&(e=Ie,e!==null))switch(e.tag){case 3:Xr(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Xr(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 ge(t),null;case 13:if(J(Y),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(X&&De!==null&&t.mode&1&&!(t.flags&128))Ud(),An(),t.flags|=98560,o=!1;else if(o=Yr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(T(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(T(317));o[tt]=t}else An(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ge(t),o=!1}else Ge!==null&&(Ro(Ge),Ge=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Y.current&1?ae===0&&(ae=3):Aa())),t.updateQueue!==null&&(t.flags|=4),ge(t),null);case 4:return On(),Po(e,t),e===null&&jr(t.stateNode.containerInfo),ge(t),null;case 10:return ga(t.type._context),ge(t),null;case 17:return Te(t.type)&&Ss(),ge(t),null;case 19:if(J(Y),o=t.memoizedState,o===null)return ge(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)Zn(o,!1);else{if(ae!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Is(e),a!==null){for(t.flags|=128,Zn(o,!1),r=a.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,a=o.alternate,a===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=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return H(Y,Y.current&1|2),t.child}e=e.sibling}o.tail!==null&&ne()>Rn&&(t.flags|=128,r=!0,Zn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Is(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Zn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!X)return ge(t),null}else 2*ne()-o.renderingStartTime>Rn&&n!==1073741824&&(t.flags|=128,r=!0,Zn(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ne(),t.sibling=null,n=Y.current,H(Y,r?n&1|2:n&1),t):(ge(t),null);case 22:case 23:return Ia(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?_e&1073741824&&(ge(t),t.subtreeFlags&6&&(t.flags|=8192)):ge(t),null;case 24:return null;case 25:return null}throw Error(T(156,t.tag))}function Cp(e,t){switch(ha(t),t.tag){case 1:return Te(t.type)&&Ss(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return On(),J(Ee),J(ve),ba(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wa(t),null;case 13:if(J(Y),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(T(340));An()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return J(Y),null;case 4:return On(),null;case 10:return ga(t.type._context),null;case 22:case 23:return Ia(),null;case 24:return null;default:return null}}var es=!1,xe=!1,Ep=typeof WeakSet=="function"?WeakSet:Set,_=null;function jn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ee(e,t,r)}else n.current=null}function _o(e,t,n){try{n()}catch(r){ee(e,t,r)}}var Gl=!1;function Tp(e,t){if(mo=bs,e=Pd(),da(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 s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,d=0,m=0,p=e,f=null;t:for(;;){for(var g;p!==n||s!==0&&p.nodeType!==3||(l=a+s),p!==o||r!==0&&p.nodeType!==3||(c=a+r),p.nodeType===3&&(a+=p.nodeValue.length),(g=p.firstChild)!==null;)f=p,p=g;for(;;){if(p===e)break t;if(f===n&&++d===s&&(l=a),f===o&&++m===r&&(c=a),(g=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=g}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(po={focusedElem:e,selectionRange:n},bs=!1,_=t;_!==null;)if(t=_,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_=e;else for(;_!==null;){t=_;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var w=b.memoizedProps,j=b.memoizedState,x=t.stateNode,u=x.getSnapshotBeforeUpdate(t.elementType===t.type?w:Ke(t.type,w),j);x.__reactInternalSnapshotBeforeUpdate=u}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(T(163))}}catch(y){ee(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,_=e;break}_=t.return}return b=Gl,Gl=!1,b}function cr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&_o(t,n,o)}s=s.next}while(s!==r)}}function ei(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 Do(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 Su(e){var t=e.alternate;t!==null&&(e.alternate=null,Su(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tt],delete t[kr],delete t[xo],delete t[dp],delete t[up])),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 Cu(e){return e.tag===5||e.tag===3||e.tag===4}function Zl(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cu(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 Io(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=ks));else if(r!==4&&(e=e.child,e!==null))for(Io(e,t,n),e=e.sibling;e!==null;)Io(e,t,n),e=e.sibling}function Ao(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(Ao(e,t,n),e=e.sibling;e!==null;)Ao(e,t,n),e=e.sibling}var he=null,He=!1;function pt(e,t,n){for(n=n.child;n!==null;)Eu(e,t,n),n=n.sibling}function Eu(e,t,n){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Hs,n)}catch{}switch(n.tag){case 5:xe||jn(n,t);case 6:var r=he,s=He;he=null,pt(e,t,n),he=r,He=s,he!==null&&(He?(e=he,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):he.removeChild(n.stateNode));break;case 18:he!==null&&(He?(e=he,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),yr(e)):Ti(he,n.stateNode));break;case 4:r=he,s=He,he=n.stateNode.containerInfo,He=!0,pt(e,t,n),he=r,He=s;break;case 0:case 11:case 14:case 15:if(!xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&_o(n,t,a),s=s.next}while(s!==r)}pt(e,t,n);break;case 1:if(!xe&&(jn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ee(n,t,l)}pt(e,t,n);break;case 21:pt(e,t,n);break;case 22:n.mode&1?(xe=(r=xe)||n.memoizedState!==null,pt(e,t,n),xe=r):pt(e,t,n);break;default:pt(e,t,n)}}function Jl(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ep),t.forEach(function(r){var s=Rp.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Be(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var o=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:he=l.stateNode,He=!1;break e;case 3:he=l.stateNode.containerInfo,He=!0;break e;case 4:he=l.stateNode.containerInfo,He=!0;break e}l=l.return}if(he===null)throw Error(T(160));Eu(o,a,s),he=null,He=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){ee(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Tu(t,e),t=t.sibling}function Tu(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Be(t,e),Qe(e),r&4){try{cr(3,e,e.return),ei(3,e)}catch(w){ee(e,e.return,w)}try{cr(5,e,e.return)}catch(w){ee(e,e.return,w)}}break;case 1:Be(t,e),Qe(e),r&512&&n!==null&&jn(n,n.return);break;case 5:if(Be(t,e),Qe(e),r&512&&n!==null&&jn(n,n.return),e.flags&32){var s=e.stateNode;try{fr(s,"")}catch(w){ee(e,e.return,w)}}if(r&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&Xc(s,o),no(l,a);var d=no(l,o);for(a=0;a<c.length;a+=2){var m=c[a],p=c[a+1];m==="style"?td(s,p):m==="dangerouslySetInnerHTML"?qc(s,p):m==="children"?fr(s,p):Yo(s,m,p,d)}switch(l){case"input":Yi(s,o);break;case"textarea":Yc(s,o);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var g=o.value;g!=null?Sn(s,!!o.multiple,g,!1):f!==!!o.multiple&&(o.defaultValue!=null?Sn(s,!!o.multiple,o.defaultValue,!0):Sn(s,!!o.multiple,o.multiple?[]:"",!1))}s[kr]=o}catch(w){ee(e,e.return,w)}}break;case 6:if(Be(t,e),Qe(e),r&4){if(e.stateNode===null)throw Error(T(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(w){ee(e,e.return,w)}}break;case 3:if(Be(t,e),Qe(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{yr(t.containerInfo)}catch(w){ee(e,e.return,w)}break;case 4:Be(t,e),Qe(e);break;case 13:Be(t,e),Qe(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(_a=ne())),r&4&&Jl(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(xe=(d=xe)||m,Be(t,e),xe=d):Be(t,e),Qe(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!m&&e.mode&1)for(_=e,m=e.child;m!==null;){for(p=_=m;_!==null;){switch(f=_,g=f.child,f.tag){case 0:case 11:case 14:case 15:cr(4,f,f.return);break;case 1:jn(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(w){ee(r,n,w)}}break;case 5:jn(f,f.return);break;case 22:if(f.memoizedState!==null){Yl(p);continue}}g!==null?(g.return=f,_=g):Yl(p)}m=m.sibling}e:for(m=null,p=e;;){if(p.tag===5){if(m===null){m=p;try{s=p.stateNode,d?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=p.stateNode,c=p.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=ed("display",a))}catch(w){ee(e,e.return,w)}}}else if(p.tag===6){if(m===null)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(w){ee(e,e.return,w)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;m===p&&(m=null),p=p.return}m===p&&(m=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Be(t,e),Qe(e),r&4&&Jl(e);break;case 21:break;default:Be(t,e),Qe(e)}}function Qe(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Cu(n)){var r=n;break e}n=n.return}throw Error(T(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(fr(s,""),r.flags&=-33);var o=Zl(e);Ao(e,o,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=Zl(e);Io(e,l,a);break;default:throw Error(T(161))}}catch(c){ee(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pp(e,t,n){_=e,Pu(e)}function Pu(e,t,n){for(var r=(e.mode&1)!==0;_!==null;){var s=_,o=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||es;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||xe;l=es;var d=xe;if(es=a,(xe=c)&&!d)for(_=s;_!==null;)a=_,c=a.child,a.tag===22&&a.memoizedState!==null?Ql(s):c!==null?(c.return=a,_=c):Ql(s);for(;o!==null;)_=o,Pu(o),o=o.sibling;_=s,es=l,xe=d}Xl(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,_=o):Xl(e)}}function Xl(e){for(;_!==null;){var t=_;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:xe||ei(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!xe)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Ke(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&zl(t,o,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}zl(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var m=d.memoizedState;if(m!==null){var p=m.dehydrated;p!==null&&yr(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(T(163))}xe||t.flags&512&&Do(t)}catch(f){ee(t,t.return,f)}}if(t===e){_=null;break}if(n=t.sibling,n!==null){n.return=t.return,_=n;break}_=t.return}}function Yl(e){for(;_!==null;){var t=_;if(t===e){_=null;break}var n=t.sibling;if(n!==null){n.return=t.return,_=n;break}_=t.return}}function Ql(e){for(;_!==null;){var t=_;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ei(4,t)}catch(c){ee(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){ee(t,s,c)}}var o=t.return;try{Do(t)}catch(c){ee(t,o,c)}break;case 5:var a=t.return;try{Do(t)}catch(c){ee(t,a,c)}}}catch(c){ee(t,t.return,c)}if(t===e){_=null;break}var l=t.sibling;if(l!==null){l.return=t.return,_=l;break}_=t.return}}var _p=Math.ceil,Os=mt.ReactCurrentDispatcher,Ta=mt.ReactCurrentOwner,Ve=mt.ReactCurrentBatchConfig,V=0,de=null,re=null,me=0,_e=0,Nn=Rt(0),ae=0,_r=null,nn=0,ti=0,Pa=0,dr=null,Se=null,_a=0,Rn=1/0,st=null,Ls=!1,zo=null,_t=null,ts=!1,Nt=null,Rs=0,ur=0,Oo=null,ms=-1,ps=0;function be(){return V&6?ne():ms!==-1?ms:ms=ne()}function Dt(e){return e.mode&1?V&2&&me!==0?me&-me:mp.transition!==null?(ps===0&&(ps=md()),ps):(e=B,e!==0||(e=window.event,e=e===void 0?16:wd(e.type)),e):1}function Xe(e,t,n,r){if(50<ur)throw ur=0,Oo=null,Error(T(185));Or(e,n,r),(!(V&2)||e!==de)&&(e===de&&(!(V&2)&&(ti|=n),ae===4&&wt(e,me)),Pe(e,r),n===1&&V===0&&!(t.mode&1)&&(Rn=ne()+500,Ys&&$t()))}function Pe(e,t){var n=e.callbackNode;mm(e,t);var r=ws(e,e===de?me:0);if(r===0)n!==null&&al(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&al(n),t===1)e.tag===0?hp(ql.bind(null,e)):Fd(ql.bind(null,e)),lp(function(){!(V&6)&&$t()}),n=null;else{switch(pd(r)){case 1:n=na;break;case 4:n=ud;break;case 16:n=ys;break;case 536870912:n=hd;break;default:n=ys}n=Ru(n,_u.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _u(e,t){if(ms=-1,ps=0,V&6)throw Error(T(327));var n=e.callbackNode;if(_n()&&e.callbackNode!==n)return null;var r=ws(e,e===de?me:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=$s(e,r);else{t=r;var s=V;V|=2;var o=Iu();(de!==e||me!==t)&&(st=null,Rn=ne()+500,Yt(e,t));do try{Ap();break}catch(l){Du(e,l)}while(1);fa(),Os.current=o,V=s,re!==null?t=0:(de=null,me=0,t=ae)}if(t!==0){if(t===2&&(s=ao(e),s!==0&&(r=s,t=Lo(e,s))),t===1)throw n=_r,Yt(e,0),wt(e,r),Pe(e,ne()),n;if(t===6)wt(e,r);else{if(s=e.current.alternate,!(r&30)&&!Dp(s)&&(t=$s(e,r),t===2&&(o=ao(e),o!==0&&(r=o,t=Lo(e,o))),t===1))throw n=_r,Yt(e,0),wt(e,r),Pe(e,ne()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(T(345));case 2:Wt(e,Se,st);break;case 3:if(wt(e,r),(r&130023424)===r&&(t=_a+500-ne(),10<t)){if(ws(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){be(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=go(Wt.bind(null,e,Se,st),t);break}Wt(e,Se,st);break;case 4:if(wt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Je(r);o=1<<a,a=t[a],a>s&&(s=a),r&=~o}if(r=s,r=ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*_p(r/1960))-r,10<r){e.timeoutHandle=go(Wt.bind(null,e,Se,st),r);break}Wt(e,Se,st);break;case 5:Wt(e,Se,st);break;default:throw Error(T(329))}}}return Pe(e,ne()),e.callbackNode===n?_u.bind(null,e):null}function Lo(e,t){var n=dr;return e.current.memoizedState.isDehydrated&&(Yt(e,t).flags|=256),e=$s(e,t),e!==2&&(t=Se,Se=n,t!==null&&Ro(t)),e}function Ro(e){Se===null?Se=e:Se.push.apply(Se,e)}function Dp(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],o=s.getSnapshot;s=s.value;try{if(!Ye(o(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wt(e,t){for(t&=~Pa,t&=~ti,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Je(t),r=1<<n;e[n]=-1,t&=~r}}function ql(e){if(V&6)throw Error(T(327));_n();var t=ws(e,0);if(!(t&1))return Pe(e,ne()),null;var n=$s(e,t);if(e.tag!==0&&n===2){var r=ao(e);r!==0&&(t=r,n=Lo(e,r))}if(n===1)throw n=_r,Yt(e,0),wt(e,t),Pe(e,ne()),n;if(n===6)throw Error(T(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Wt(e,Se,st),Pe(e,ne()),null}function Da(e,t){var n=V;V|=1;try{return e(t)}finally{V=n,V===0&&(Rn=ne()+500,Ys&&$t())}}function rn(e){Nt!==null&&Nt.tag===0&&!(V&6)&&_n();var t=V;V|=1;var n=Ve.transition,r=B;try{if(Ve.transition=null,B=1,e)return e()}finally{B=r,Ve.transition=n,V=t,!(V&6)&&$t()}}function Ia(){_e=Nn.current,J(Nn)}function Yt(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ap(n)),re!==null)for(n=re.return;n!==null;){var r=n;switch(ha(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ss();break;case 3:On(),J(Ee),J(ve),ba();break;case 5:wa(r);break;case 4:On();break;case 13:J(Y);break;case 19:J(Y);break;case 10:ga(r.type._context);break;case 22:case 23:Ia()}n=n.return}if(de=e,re=e=It(e.current,null),me=_e=t,ae=0,_r=null,Pa=ti=nn=0,Se=dr=null,Gt!==null){for(t=0;t<Gt.length;t++)if(n=Gt[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,o=n.pending;if(o!==null){var a=o.next;o.next=s,r.next=a}n.pending=r}Gt=null}return e}function Du(e,t){do{var n=re;try{if(fa(),ds.current=zs,As){for(var r=Q.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}As=!1}if(tn=0,ce=oe=Q=null,lr=!1,Er=0,Ta.current=null,n===null||n.return===null){ae=1,_r=t,re=null;break}e:{var o=e,a=n.return,l=n,c=t;if(t=me,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,m=l,p=m.tag;if(!(m.mode&1)&&(p===0||p===11||p===15)){var f=m.alternate;f?(m.updateQueue=f.updateQueue,m.memoizedState=f.memoizedState,m.lanes=f.lanes):(m.updateQueue=null,m.memoizedState=null)}var g=Vl(a);if(g!==null){g.flags&=-257,Ml(g,a,l,o,t),g.mode&1&&Fl(o,d,t),t=g,c=d;var b=t.updateQueue;if(b===null){var w=new Set;w.add(c),t.updateQueue=w}else b.add(c);break e}else{if(!(t&1)){Fl(o,d,t),Aa();break e}c=Error(T(426))}}else if(X&&l.mode&1){var j=Vl(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Ml(j,a,l,o,t),ma(Ln(c,l));break e}}o=c=Ln(c,l),ae!==4&&(ae=2),dr===null?dr=[o]:dr.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var x=pu(o,c,t);Al(o,x);break e;case 1:l=c;var u=o.type,h=o.stateNode;if(!(o.flags&128)&&(typeof u.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(_t===null||!_t.has(h)))){o.flags|=65536,t&=-t,o.lanes|=t;var y=fu(o,l,t);Al(o,y);break e}}o=o.return}while(o!==null)}zu(n)}catch(v){t=v,re===n&&n!==null&&(re=n=n.return);continue}break}while(1)}function Iu(){var e=Os.current;return Os.current=zs,e===null?zs:e}function Aa(){(ae===0||ae===3||ae===2)&&(ae=4),de===null||!(nn&268435455)&&!(ti&268435455)||wt(de,me)}function $s(e,t){var n=V;V|=2;var r=Iu();(de!==e||me!==t)&&(st=null,Yt(e,t));do try{Ip();break}catch(s){Du(e,s)}while(1);if(fa(),V=n,Os.current=r,re!==null)throw Error(T(261));return de=null,me=0,ae}function Ip(){for(;re!==null;)Au(re)}function Ap(){for(;re!==null&&!sm();)Au(re)}function Au(e){var t=Lu(e.alternate,e,_e);e.memoizedProps=e.pendingProps,t===null?zu(e):re=t,Ta.current=null}function zu(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Cp(n,t),n!==null){n.flags&=32767,re=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ae=6,re=null;return}}else if(n=Sp(n,t,_e),n!==null){re=n;return}if(t=t.sibling,t!==null){re=t;return}re=t=e}while(t!==null);ae===0&&(ae=5)}function Wt(e,t,n){var r=B,s=Ve.transition;try{Ve.transition=null,B=1,zp(e,t,n,r)}finally{Ve.transition=s,B=r}return null}function zp(e,t,n,r){do _n();while(Nt!==null);if(V&6)throw Error(T(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(T(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(pm(e,o),e===de&&(re=de=null,me=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ts||(ts=!0,Ru(ys,function(){return _n(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ve.transition,Ve.transition=null;var a=B;B=1;var l=V;V|=4,Ta.current=null,Tp(e,n),Tu(n,e),ep(po),bs=!!mo,po=mo=null,e.current=n,Pp(n),im(),V=l,B=a,Ve.transition=o}else e.current=n;if(ts&&(ts=!1,Nt=e,Rs=s),o=e.pendingLanes,o===0&&(_t=null),lm(n.stateNode),Pe(e,ne()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Ls)throw Ls=!1,e=zo,zo=null,e;return Rs&1&&e.tag!==0&&_n(),o=e.pendingLanes,o&1?e===Oo?ur++:(ur=0,Oo=e):ur=0,$t(),null}function _n(){if(Nt!==null){var e=pd(Rs),t=Ve.transition,n=B;try{if(Ve.transition=null,B=16>e?16:e,Nt===null)var r=!1;else{if(e=Nt,Nt=null,Rs=0,V&6)throw Error(T(331));var s=V;for(V|=4,_=e.current;_!==null;){var o=_,a=o.child;if(_.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(_=d;_!==null;){var m=_;switch(m.tag){case 0:case 11:case 15:cr(8,m,o)}var p=m.child;if(p!==null)p.return=m,_=p;else for(;_!==null;){m=_;var f=m.sibling,g=m.return;if(Su(m),m===d){_=null;break}if(f!==null){f.return=g,_=f;break}_=g}}}var b=o.alternate;if(b!==null){var w=b.child;if(w!==null){b.child=null;do{var j=w.sibling;w.sibling=null,w=j}while(w!==null)}}_=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,_=a;else e:for(;_!==null;){if(o=_,o.flags&2048)switch(o.tag){case 0:case 11:case 15:cr(9,o,o.return)}var x=o.sibling;if(x!==null){x.return=o.return,_=x;break e}_=o.return}}var u=e.current;for(_=u;_!==null;){a=_;var h=a.child;if(a.subtreeFlags&2064&&h!==null)h.return=a,_=h;else e:for(a=u;_!==null;){if(l=_,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ei(9,l)}}catch(v){ee(l,l.return,v)}if(l===a){_=null;break e}var y=l.sibling;if(y!==null){y.return=l.return,_=y;break e}_=l.return}}if(V=s,$t(),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Hs,e)}catch{}r=!0}return r}finally{B=n,Ve.transition=t}}return!1}function ec(e,t,n){t=Ln(n,t),t=pu(e,t,1),e=Pt(e,t,1),t=be(),e!==null&&(Or(e,1,t),Pe(e,t))}function ee(e,t,n){if(e.tag===3)ec(e,e,n);else for(;t!==null;){if(t.tag===3){ec(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(_t===null||!_t.has(r))){e=Ln(n,e),e=fu(t,e,1),t=Pt(t,e,1),e=be(),t!==null&&(Or(t,1,e),Pe(t,e));break}}t=t.return}}function Op(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=be(),e.pingedLanes|=e.suspendedLanes&n,de===e&&(me&n)===n&&(ae===4||ae===3&&(me&130023424)===me&&500>ne()-_a?Yt(e,0):Pa|=n),Pe(e,t)}function Ou(e,t){t===0&&(e.mode&1?(t=Kr,Kr<<=1,!(Kr&130023424)&&(Kr=4194304)):t=1);var n=be();e=ut(e,t),e!==null&&(Or(e,t,n),Pe(e,n))}function Lp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ou(e,n)}function Rp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(T(314))}r!==null&&r.delete(t),Ou(e,n)}var Lu;Lu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ee.current)Ce=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ce=!1,kp(e,t,n);Ce=!!(e.flags&131072)}else Ce=!1,X&&t.flags&1048576&&Vd(t,Ts,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;hs(e,t),e=t.pendingProps;var s=In(t,ve.current);Pn(t,n),s=Na(null,t,r,e,s,n);var o=ka();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Te(r)?(o=!0,Cs(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,va(t),s.updater=qs,t.stateNode=s,s._reactInternals=t,No(t,r,e,n),t=Co(null,t,r,!0,o,n)):(t.tag=0,X&&o&&ua(t),ye(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(hs(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Fp(r),e=Ke(r,e),s){case 0:t=So(null,t,r,e,n);break e;case 1:t=Bl(null,t,r,e,n);break e;case 11:t=Ul(null,t,r,e,n);break e;case 14:t=Wl(null,t,r,Ke(r.type,e),n);break e}throw Error(T(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ke(r,s),So(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ke(r,s),Bl(e,t,r,s,n);case 3:e:{if(yu(t),e===null)throw Error(T(387));r=t.pendingProps,o=t.memoizedState,s=o.element,Hd(e,t),Ds(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=Ln(Error(T(423)),t),t=Kl(e,t,r,n,s);break e}else if(r!==s){s=Ln(Error(T(424)),t),t=Kl(e,t,r,n,s);break e}else for(De=Tt(t.stateNode.containerInfo.firstChild),Ie=t,X=!0,Ge=null,n=Bd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(An(),r===s){t=ht(e,t,n);break e}ye(e,t,r,n)}t=t.child}return t;case 5:return Gd(t),e===null&&wo(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,a=s.children,fo(r,s)?a=null:o!==null&&fo(r,o)&&(t.flags|=32),vu(e,t),ye(e,t,a,n),t.child;case 6:return e===null&&wo(t),null;case 13:return wu(e,t,n);case 4:return ya(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zn(t,null,r,n):ye(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ke(r,s),Ul(e,t,r,s,n);case 7:return ye(e,t,t.pendingProps,n),t.child;case 8:return ye(e,t,t.pendingProps.children,n),t.child;case 12:return ye(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,a=s.value,H(Ps,r._currentValue),r._currentValue=a,o!==null)if(Ye(o.value,a)){if(o.children===s.children&&!Ee.current){t=ht(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=lt(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var m=d.pending;m===null?c.next=c:(c.next=m.next,m.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),bo(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(T(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),bo(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}ye(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Pn(t,n),s=Me(s),r=r(s),t.flags|=1,ye(e,t,r,n),t.child;case 14:return r=t.type,s=Ke(r,t.pendingProps),s=Ke(r.type,s),Wl(e,t,r,s,n);case 15:return gu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ke(r,s),hs(e,t),t.tag=1,Te(r)?(e=!0,Cs(t)):e=!1,Pn(t,n),mu(t,r,s),No(t,r,s,n),Co(null,t,r,!0,e,n);case 19:return bu(e,t,n);case 22:return xu(e,t,n)}throw Error(T(156,t.tag))};function Ru(e,t){return dd(e,t)}function $p(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 Fe(e,t,n,r){return new $p(e,t,n,r)}function za(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fp(e){if(typeof e=="function")return za(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qo)return 11;if(e===ea)return 14}return 2}function It(e,t){var n=e.alternate;return n===null?(n=Fe(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 fs(e,t,n,r,s,o){var a=2;if(r=e,typeof e=="function")za(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case mn:return Qt(n.children,s,o,t);case Qo:a=8,s|=8;break;case Hi:return e=Fe(12,n,t,s|2),e.elementType=Hi,e.lanes=o,e;case Gi:return e=Fe(13,n,t,s),e.elementType=Gi,e.lanes=o,e;case Zi:return e=Fe(19,n,t,s),e.elementType=Zi,e.lanes=o,e;case Gc:return ni(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Kc:a=10;break e;case Hc:a=9;break e;case qo:a=11;break e;case ea:a=14;break e;case gt:a=16,r=null;break e}throw Error(T(130,e==null?e:typeof e,""))}return t=Fe(a,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function Qt(e,t,n,r){return e=Fe(7,e,r,t),e.lanes=n,e}function ni(e,t,n,r){return e=Fe(22,e,r,t),e.elementType=Gc,e.lanes=n,e.stateNode={isHidden:!1},e}function Li(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function Ri(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vp(e,t,n,r,s){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=xi(0),this.expirationTimes=xi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xi(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Oa(e,t,n,r,s,o,a,l,c){return e=new Vp(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Fe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},va(o),e}function Mp(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function $u(e){if(!e)return Ot;e=e._reactInternals;e:{if(on(e)!==e||e.tag!==1)throw Error(T(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Te(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(T(171))}if(e.tag===1){var n=e.type;if(Te(n))return $d(e,n,t)}return t}function Fu(e,t,n,r,s,o,a,l,c){return e=Oa(n,r,!0,e,s,o,a,l,c),e.context=$u(null),n=e.current,r=be(),s=Dt(n),o=lt(r,s),o.callback=t??null,Pt(n,o,s),e.current.lanes=s,Or(e,s,r),Pe(e,r),e}function ri(e,t,n,r){var s=t.current,o=be(),a=Dt(s);return n=$u(n),t.context===null?t.context=n:t.pendingContext=n,t=lt(o,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Pt(s,t,a),e!==null&&(Xe(e,s,a,o),cs(e,s,a)),a}function Fs(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function tc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function La(e,t){tc(e,t),(e=e.alternate)&&tc(e,t)}function Up(){return null}var Vu=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ra(e){this._internalRoot=e}si.prototype.render=Ra.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(T(409));ri(e,t,null,null)};si.prototype.unmount=Ra.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rn(function(){ri(null,e,null,null)}),t[dt]=null}};function si(e){this._internalRoot=e}si.prototype.unstable_scheduleHydration=function(e){if(e){var t=xd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<yt.length&&t!==0&&t<yt[n].priority;n++);yt.splice(n,0,e),n===0&&yd(e)}};function $a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ii(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function nc(){}function Wp(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var d=Fs(a);o.call(d)}}var a=Fu(t,r,e,0,null,!1,!1,"",nc);return e._reactRootContainer=a,e[dt]=a.current,jr(e.nodeType===8?e.parentNode:e),rn(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=Fs(c);l.call(d)}}var c=Oa(e,0,!1,null,null,!1,!1,"",nc);return e._reactRootContainer=c,e[dt]=c.current,jr(e.nodeType===8?e.parentNode:e),rn(function(){ri(t,c,n,r)}),c}function oi(e,t,n,r,s){var o=n._reactRootContainer;if(o){var a=o;if(typeof s=="function"){var l=s;s=function(){var c=Fs(a);l.call(c)}}ri(t,a,e,s)}else a=Wp(n,t,e,s,r);return Fs(a)}fd=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tr(t.pendingLanes);n!==0&&(ra(t,n|1),Pe(t,ne()),!(V&6)&&(Rn=ne()+500,$t()))}break;case 13:rn(function(){var r=ut(e,1);if(r!==null){var s=be();Xe(r,e,1,s)}}),La(e,1)}};sa=function(e){if(e.tag===13){var t=ut(e,134217728);if(t!==null){var n=be();Xe(t,e,134217728,n)}La(e,134217728)}};gd=function(e){if(e.tag===13){var t=Dt(e),n=ut(e,t);if(n!==null){var r=be();Xe(n,e,t,r)}La(e,t)}};xd=function(){return B};vd=function(e,t){var n=B;try{return B=e,t()}finally{B=n}};so=function(e,t,n){switch(t){case"input":if(Yi(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Xs(r);if(!s)throw Error(T(90));Jc(r),Yi(r,s)}}}break;case"textarea":Yc(e,n);break;case"select":t=n.value,t!=null&&Sn(e,!!n.multiple,t,!1)}};sd=Da;id=rn;var Bp={usingClientEntryPoint:!1,Events:[Rr,xn,Xs,nd,rd,Da]},Jn={findFiberByHostInstance:Ht,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Kp={bundleType:Jn.bundleType,version:Jn.version,rendererPackageName:Jn.rendererPackageName,rendererConfig:Jn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:mt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ld(e),e===null?null:e.stateNode},findFiberByHostInstance:Jn.findFiberByHostInstance||Up,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ns=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ns.isDisabled&&ns.supportsFiber)try{Hs=ns.inject(Kp),nt=ns}catch{}}ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bp;ze.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$a(t))throw Error(T(200));return Mp(e,t,null,n)};ze.createRoot=function(e,t){if(!$a(e))throw Error(T(299));var n=!1,r="",s=Vu;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Oa(e,1,!1,null,null,n,!1,r,s),e[dt]=t.current,jr(e.nodeType===8?e.parentNode:e),new Ra(t)};ze.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(T(188)):(e=Object.keys(e).join(","),Error(T(268,e)));return e=ld(t),e=e===null?null:e.stateNode,e};ze.flushSync=function(e){return rn(e)};ze.hydrate=function(e,t,n){if(!ii(t))throw Error(T(200));return oi(null,e,t,!0,n)};ze.hydrateRoot=function(e,t,n){if(!$a(e))throw Error(T(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",a=Vu;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Fu(t,null,e,1,n??null,s,!1,o,a),e[dt]=t.current,jr(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new si(t)};ze.render=function(e,t,n){if(!ii(t))throw Error(T(200));return oi(null,e,t,!1,n)};ze.unmountComponentAtNode=function(e){if(!ii(e))throw Error(T(40));return e._reactRootContainer?(rn(function(){oi(null,null,e,!1,function(){e._reactRootContainer=null,e[dt]=null})}),!0):!1};ze.unstable_batchedUpdates=Da;ze.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ii(n))throw Error(T(200));if(e==null||e._reactInternals===void 0)throw Error(T(38));return oi(e,t,n,!1,r)};ze.version="18.3.1-next-f1338f8080-20240426";function Mu(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mu)}catch(e){console.error(e)}}Mu(),Mc.exports=ze;var Hp=Mc.exports,rc=Hp;Bi.createRoot=rc.createRoot,Bi.hydrateRoot=rc.hydrateRoot;var $o=function(e,t){return $o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},$o(e,t)};function Gp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$o(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var le=function(){return le=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},le.apply(this,arguments)};function sc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function cn(e,t,n,r){function s(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function l(m){try{d(r.next(m))}catch(p){a(p)}}function c(m){try{d(r.throw(m))}catch(p){a(p)}}function d(m){m.done?o(m.value):s(m.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}function dn(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(d){return function(m){return c([d,m])}}function c(d){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,d[0]&&(n=0)),n;)try{if(r=1,s&&(o=d[0]&2?s.return:d[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,d[1])).done)return o;switch(s=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,s=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){n.label=d[1];break}if(d[0]===6&&n.label<o[1]){n.label=o[1],o=d;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(d);break}o[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(m){d=[6,m],s=0}finally{r=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Zp(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function et(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}var Kt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Va(e,t){return e(t={exports:{}},t.exports),t.exports}var Bt=Va(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function r(){var s=this;this.locked=new Map,this.addToLocked=function(o,a){var l=s.locked.get(o);l===void 0?a===void 0?s.locked.set(o,[]):s.locked.set(o,[a]):a!==void 0&&(l.unshift(a),s.locked.set(o,l))},this.isLocked=function(o){return s.locked.has(o)},this.lock=function(o){return new Promise(function(a,l){s.isLocked(o)?s.addToLocked(o,a):(s.addToLocked(o),a())})},this.unlock=function(o){var a=s.locked.get(o);if(a!==void 0&&a.length!==0){var l=a.pop();s.locked.set(o,a),l!==void 0&&setTimeout(l,0)}else s.locked.delete(o)}}return r.getInstance=function(){return r.instance===void 0&&(r.instance=new r),r.instance},r}();t.default=function(){return n.getInstance()}});Fa(Bt);var Jp=Fa(Va(function(e,t){var n=Kt&&Kt.__awaiter||function(m,p,f,g){return new(f||(f=Promise))(function(b,w){function j(h){try{u(g.next(h))}catch(y){w(y)}}function x(h){try{u(g.throw(h))}catch(y){w(y)}}function u(h){h.done?b(h.value):new f(function(y){y(h.value)}).then(j,x)}u((g=g.apply(m,p||[])).next())})},r=Kt&&Kt.__generator||function(m,p){var f,g,b,w,j={label:0,sent:function(){if(1&b[0])throw b[1];return b[1]},trys:[],ops:[]};return w={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function x(u){return function(h){return function(y){if(f)throw new TypeError("Generator is already executing.");for(;j;)try{if(f=1,g&&(b=2&y[0]?g.return:y[0]?g.throw||((b=g.return)&&b.call(g),0):g.next)&&!(b=b.call(g,y[1])).done)return b;switch(g=0,b&&(y=[2&y[0],b.value]),y[0]){case 0:case 1:b=y;break;case 4:return j.label++,{value:y[1],done:!1};case 5:j.label++,g=y[1],y=[0];continue;case 7:y=j.ops.pop(),j.trys.pop();continue;default:if(b=j.trys,!((b=b.length>0&&b[b.length-1])||y[0]!==6&&y[0]!==2)){j=0;continue}if(y[0]===3&&(!b||y[1]>b[0]&&y[1]<b[3])){j.label=y[1];break}if(y[0]===6&&j.label<b[1]){j.label=b[1],b=y;break}if(b&&j.label<b[2]){j.label=b[2],j.ops.push(y);break}b[2]&&j.ops.pop(),j.trys.pop();continue}y=p.call(m,j)}catch(v){y=[6,v],g=0}finally{f=b=0}if(5&y[0])throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}([u,h])}}},s=Kt;Object.defineProperty(t,"__esModule",{value:!0});var o="browser-tabs-lock-key",a={key:function(m){return n(s,void 0,void 0,function(){return r(this,function(p){throw new Error("Unsupported")})})},getItem:function(m){return n(s,void 0,void 0,function(){return r(this,function(p){throw new Error("Unsupported")})})},clear:function(){return n(s,void 0,void 0,function(){return r(this,function(m){return[2,window.localStorage.clear()]})})},removeItem:function(m){return n(s,void 0,void 0,function(){return r(this,function(p){throw new Error("Unsupported")})})},setItem:function(m,p){return n(s,void 0,void 0,function(){return r(this,function(f){throw new Error("Unsupported")})})},keySync:function(m){return window.localStorage.key(m)},getItemSync:function(m){return window.localStorage.getItem(m)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(m){return window.localStorage.removeItem(m)},setItemSync:function(m,p){return window.localStorage.setItem(m,p)}};function l(m){return new Promise(function(p){return setTimeout(p,m)})}function c(m){for(var p="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",f="",g=0;g<m;g++)f+=p[Math.floor(Math.random()*p.length)];return f}var d=function(){function m(p){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+c(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=p,m.waiters===void 0&&(m.waiters=[])}return m.prototype.acquireLock=function(p,f){return f===void 0&&(f=5e3),n(this,void 0,void 0,function(){var g,b,w,j,x,u,h;return r(this,function(y){switch(y.label){case 0:g=Date.now()+c(4),b=Date.now()+f,w=o+"-"+p,j=this.storageHandler===void 0?a:this.storageHandler,y.label=1;case 1:return Date.now()<b?[4,l(30)]:[3,8];case 2:return y.sent(),j.getItemSync(w)!==null?[3,5]:(x=this.id+"-"+p+"-"+g,[4,l(Math.floor(25*Math.random()))]);case 3:return y.sent(),j.setItemSync(w,JSON.stringify({id:this.id,iat:g,timeoutKey:x,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,l(30)];case 4:return y.sent(),(u=j.getItemSync(w))!==null&&(h=JSON.parse(u)).id===this.id&&h.iat===g?(this.acquiredIatSet.add(g),this.refreshLockWhileAcquired(w,g),[2,!0]):[3,7];case 5:return m.lockCorrector(this.storageHandler===void 0?a:this.storageHandler),[4,this.waitForSomethingToChange(b)];case 6:y.sent(),y.label=7;case 7:return g=Date.now()+c(4),[3,1];case 8:return[2,!1]}})})},m.prototype.refreshLockWhileAcquired=function(p,f){return n(this,void 0,void 0,function(){var g=this;return r(this,function(b){return setTimeout(function(){return n(g,void 0,void 0,function(){var w,j,x;return r(this,function(u){switch(u.label){case 0:return[4,Bt.default().lock(f)];case 1:return u.sent(),this.acquiredIatSet.has(f)?(w=this.storageHandler===void 0?a:this.storageHandler,(j=w.getItemSync(p))===null?(Bt.default().unlock(f),[2]):((x=JSON.parse(j)).timeRefreshed=Date.now(),w.setItemSync(p,JSON.stringify(x)),Bt.default().unlock(f),this.refreshLockWhileAcquired(p,f),[2])):(Bt.default().unlock(f),[2])}})})},1e3),[2]})})},m.prototype.waitForSomethingToChange=function(p){return n(this,void 0,void 0,function(){return r(this,function(f){switch(f.label){case 0:return[4,new Promise(function(g){var b=!1,w=Date.now(),j=!1;function x(){if(j||(window.removeEventListener("storage",x),m.removeFromWaiting(x),clearTimeout(u),j=!0),!b){b=!0;var h=50-(Date.now()-w);h>0?setTimeout(g,h):g(null)}}window.addEventListener("storage",x),m.addToWaiting(x);var u=setTimeout(x,Math.max(0,p-Date.now()))})];case 1:return f.sent(),[2]}})})},m.addToWaiting=function(p){this.removeFromWaiting(p),m.waiters!==void 0&&m.waiters.push(p)},m.removeFromWaiting=function(p){m.waiters!==void 0&&(m.waiters=m.waiters.filter(function(f){return f!==p}))},m.notifyWaiters=function(){m.waiters!==void 0&&m.waiters.slice().forEach(function(p){return p()})},m.prototype.releaseLock=function(p){return n(this,void 0,void 0,function(){return r(this,function(f){switch(f.label){case 0:return[4,this.releaseLock__private__(p)];case 1:return[2,f.sent()]}})})},m.prototype.releaseLock__private__=function(p){return n(this,void 0,void 0,function(){var f,g,b,w;return r(this,function(j){switch(j.label){case 0:return f=this.storageHandler===void 0?a:this.storageHandler,g=o+"-"+p,(b=f.getItemSync(g))===null?[2]:(w=JSON.parse(b)).id!==this.id?[3,2]:[4,Bt.default().lock(w.iat)];case 1:j.sent(),this.acquiredIatSet.delete(w.iat),f.removeItemSync(g),Bt.default().unlock(w.iat),m.notifyWaiters(),j.label=2;case 2:return[2]}})})},m.lockCorrector=function(p){for(var f=Date.now()-5e3,g=p,b=[],w=0;;){var j=g.keySync(w);if(j===null)break;b.push(j),w++}for(var x=!1,u=0;u<b.length;u++){var h=b[u];if(h.includes(o)){var y=g.getItemSync(h);if(y!==null){var v=JSON.parse(y);(v.timeRefreshed===void 0&&v.timeAcquired<f||v.timeRefreshed!==void 0&&v.timeRefreshed<f)&&(g.removeItemSync(h),x=!0)}}}x&&m.notifyWaiters()},m.waiters=void 0,m}();t.default=d}));const Xp={timeoutInSeconds:60},Uu={name:"auth0-spa-js",version:"2.7.0"},Wu=()=>Date.now();class te extends Error{constructor(t,n){super(n),this.error=t,this.error_description=n,Object.setPrototypeOf(this,te.prototype)}static fromPayload({error:t,error_description:n}){return new te(t,n)}}class Ma extends te{constructor(t,n,r,s=null){super(t,n),this.state=r,this.appState=s,Object.setPrototypeOf(this,Ma.prototype)}}class Ua extends te{constructor(t,n,r,s,o=null){super(t,n),this.connection=r,this.state=s,this.appState=o,Object.setPrototypeOf(this,Ua.prototype)}}class Dr extends te{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,Dr.prototype)}}class Wa extends Dr{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,Wa.prototype)}}class Ba extends te{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,Ba.prototype)}}class Ka extends te{constructor(t,n,r){super(t,n),this.mfa_token=r,Object.setPrototypeOf(this,Ka.prototype)}}class ai extends te{constructor(t,n){super("missing_refresh_token",`Missing Refresh Token (audience: '${Vs(t,["default"])}', scope: '${Vs(n)}')`),this.audience=t,this.scope=n,Object.setPrototypeOf(this,ai.prototype)}}class Ha extends te{constructor(t,n){super("missing_scopes",`Missing requested scopes after refresh (audience: '${Vs(t,["default"])}', missing scope: '${Vs(n)}')`),this.audience=t,this.scope=n,Object.setPrototypeOf(this,Ha.prototype)}}class li extends te{constructor(t){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=t,Object.setPrototypeOf(this,li.prototype)}}function Vs(e,t=[]){return e&&!t.includes(e)?e:""}const Ms=()=>window.crypto,Xn=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(Ms().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%e.length]),t},$i=e=>btoa(e),Fo=e=>{var{clientId:t}=e,n=et(e,["clientId"]);return new URLSearchParams((r=>Object.keys(r).filter(s=>r[s]!==void 0).reduce((s,o)=>Object.assign(Object.assign({},s),{[o]:r[o]}),{}))(Object.assign({client_id:t},n))).toString()},ic=async e=>await Ms().subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),oc=e=>(t=>decodeURIComponent(atob(t).split("").map(n=>"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),ac=e=>{const t=new Uint8Array(e);return(n=>{const r={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,s=>r[s])})(window.btoa(String.fromCharCode(...Array.from(t))))},Yp=new TextEncoder,Qp=new TextDecoder;function hr(e){return typeof e=="string"?Yp.encode(e):Qp.decode(e)}function lc(e){if(typeof e.modulusLength!="number"||e.modulusLength<2048)throw new ef(`${e.name} modulusLength must be at least 2048 bits`)}async function qp(e,t,n){if(n.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const r=`${mr(hr(JSON.stringify(e)))}.${mr(hr(JSON.stringify(t)))}`;return`${r}.${mr(await crypto.subtle.sign(function(s){switch(s.algorithm.name){case"ECDSA":return{name:s.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return lc(s.algorithm),{name:s.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return lc(s.algorithm),{name:s.algorithm.name};case"Ed25519":return{name:s.algorithm.name}}throw new Jt}(n),n,hr(r)))}`}let Vo;Uint8Array.prototype.toBase64?Vo=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0})):Vo=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=32768)n.push(String.fromCharCode.apply(null,t.subarray(r,r+32768)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function mr(e){return Vo(e)}class Jt extends Error{constructor(t){var n;super(t??"operation not supported"),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}class ef extends Error{constructor(t){var n;super(t),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}function tf(e){switch(e.algorithm.name){case"RSA-PSS":return function(t){if(t.algorithm.hash.name==="SHA-256")return"PS256";throw new Jt("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(t){if(t.algorithm.hash.name==="SHA-256")return"RS256";throw new Jt("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(t){if(t.algorithm.namedCurve==="P-256")return"ES256";throw new Jt("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new Jt("unsupported CryptoKey algorithm name")}}function Bu(e){return e instanceof CryptoKey}function Ku(e){return Bu(e)&&e.type==="public"}async function nf(e,t,n,r,s,o){const a=e==null?void 0:e.privateKey,l=e==null?void 0:e.publicKey;if(!Bu(c=a)||c.type!=="private")throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!Ku(l))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(l.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof t!="string")throw new TypeError('"htu" must be a string');if(typeof n!="string")throw new TypeError('"htm" must be a string');if(r!==void 0&&typeof r!="string")throw new TypeError('"nonce" must be a string or undefined');if(s!==void 0&&typeof s!="string")throw new TypeError('"accessToken" must be a string or undefined');if(o!==void 0&&(typeof o!="object"||o===null||Array.isArray(o)))throw new TypeError('"additional" must be an object');return qp({alg:tf(a),typ:"dpop+jwt",jwk:await Hu(l)},Object.assign(Object.assign({},o),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:r,htu:t,ath:s?mr(await crypto.subtle.digest("SHA-256",hr(s))):void 0}),a)}async function Hu(e){const{kty:t,e:n,n:r,x:s,y:o,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:r,x:s,y:o}}const rf=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange"];function sf(){return async function(e,t){var n;let r;if(typeof e!="string"||e.length===0)throw new TypeError('"alg" must be a non-empty string');switch(e){case"PS256":r={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":r={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":r={name:"Ed25519"};break;default:throw new Jt}return crypto.subtle.generateKey(r,(n=t==null?void 0:t.extractable)!==null&&n!==void 0&&n,["sign","verify"])}("ES256",{extractable:!1})}function of(e){return async function(t){if(!Ku(t))throw new TypeError('"publicKey" must be a public CryptoKey');if(t.extractable!==!0)throw new TypeError('"publicKey.extractable" must be true');const n=await Hu(t);let r;switch(n.kty){case"EC":r={crv:n.crv,kty:n.kty,x:n.x,y:n.y};break;case"OKP":r={crv:n.crv,kty:n.kty,x:n.x};break;case"RSA":r={e:n.e,kty:n.kty,n:n.n};break;default:throw new Jt("unsupported JWK kty")}return mr(await crypto.subtle.digest({name:"SHA-256"},hr(JSON.stringify(r))))}(e.publicKey)}function af({keyPair:e,url:t,method:n,nonce:r,accessToken:s}){const o=function(a){const l=new URL(a);return l.search="",l.hash="",l.href}(t);return nf(e,o,n,r,s)}const lf=async(e,t)=>{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((s,[o,a])=>(s[o]=a,s),{}))};var r},cf=async(e,t,n)=>{const r=new AbortController;let s;return t.signal=r.signal,Promise.race([lf(e,t),new Promise((o,a)=>{s=setTimeout(()=>{r.abort(),a(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(s)})},df=async(e,t,n,r,s,o,a,l)=>{return c={auth:{audience:t,scope:n},timeout:s,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:l},d=o,new Promise(function(m,p){const f=new MessageChannel;f.port1.onmessage=function(g){g.data.error?p(new Error(g.data.error)):m(g.data),f.port1.close()},d.postMessage(c,[f.port2])});var c,d},uf=async(e,t,n,r,s,o,a=1e4,l)=>s?df(e,t,n,r,a,s,o,l):cf(e,r,a);async function Gu(e,t,n,r,s,o,a,l,c,d){if(c){const h=await c.generateProof({url:e,method:s.method||"GET",nonce:await c.getNonce()});s.headers=Object.assign(Object.assign({},s.headers),{dpop:h})}let m,p=null;for(let h=0;h<3;h++)try{m=await uf(e,n,r,s,o,a,t,l),p=null;break}catch(y){p=y}if(p)throw p;const f=m.json,{error:g,error_description:b}=f,w=et(f,["error","error_description"]),{headers:j,ok:x}=m;let u;if(c&&(u=j["dpop-nonce"],u&&await c.setNonce(u)),!x){const h=b||`HTTP error. Unable to fetch ${e}`;if(g==="mfa_required")throw new Ka(g,h,w.mfa_token);if(g==="missing_refresh_token")throw new ai(n,r);if(g==="use_dpop_nonce"){if(!c||!u||d)throw new li(u);return Gu(e,t,n,r,s,o,a,l,c,!0)}throw new te(g||"request_error",h)}return w}async function hf(e,t){var{baseUrl:n,timeout:r,audience:s,scope:o,auth0Client:a,useFormData:l,useMrrt:c,dpop:d}=e,m=et(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const p=m.grant_type==="urn:ietf:params:oauth:grant-type:token-exchange",f=m.grant_type==="refresh_token"&&c,g=Object.assign(Object.assign(Object.assign(Object.assign({},m),p&&s&&{audience:s}),p&&o&&{scope:o}),f&&{audience:s,scope:o}),b=l?Fo(g):JSON.stringify(g),w=(j=m.grant_type,rf.includes(j));var j;return await Gu(`${n}/oauth/token`,r,s||"default",o,{method:"POST",body:b,headers:{"Content-Type":l?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||Uu))}},t,l,c,w?d:void 0)}const Yn=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};class Ze{constructor(t,n="@@auth0spajs@@",r){this.prefix=n,this.suffix=r,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[n,r,s,o]=t.split("::");return new Ze({clientId:r,scope:o,audience:s},n)}static fromCacheEntry(t){const{scope:n,audience:r,client_id:s}=t;return new Ze({scope:n,audience:r,clientId:s})}}class mf{set(t,n){localStorage.setItem(t,JSON.stringify(n))}get(t){const n=window.localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch{return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter(t=>t.startsWith("@@auth0spajs@@"))}}class Zu{constructor(){this.enclosedCache=function(){let t={};return{set(n,r){t[n]=r},get(n){const r=t[n];if(r)return r},remove(n){delete t[n]},allKeys:()=>Object.keys(t)}}()}}class pf{constructor(t,n,r){this.cache=t,this.keyManifest=n,this.nowProvider=r||Wu}async setIdToken(t,n,r){var s;const o=this.getIdTokenCacheKey(t);await this.cache.set(o,{id_token:n,decodedToken:r}),await((s=this.keyManifest)===null||s===void 0?void 0:s.add(o))}async getIdToken(t){const n=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!n&&t.scope&&t.audience){const r=await this.get(t);return!r||!r.id_token||!r.decodedToken?void 0:{id_token:r.id_token,decodedToken:r.decodedToken}}if(n)return{id_token:n.id_token,decodedToken:n.decodedToken}}async get(t,n=0,r=!1,s){var o;let a=await this.cache.get(t.toKey());if(!a){const d=await this.getCacheKeys();if(!d)return;const m=this.matchExistingCacheKey(t,d);if(m&&(a=await this.cache.get(m)),!m&&r&&s!=="cache-only")return this.getEntryWithRefreshToken(t,d)}if(!a)return;const l=await this.nowProvider(),c=Math.floor(l/1e3);return a.expiresAt-n<c?a.body.refresh_token?this.modifiedCachedEntry(a,t):(await this.cache.remove(t.toKey()),void await((o=this.keyManifest)===null||o===void 0?void 0:o.remove(t.toKey()))):a.body}async modifiedCachedEntry(t,n){return t.body={refresh_token:t.body.refresh_token,audience:t.body.audience,scope:t.body.scope},await this.cache.set(n.toKey(),t),{refresh_token:t.body.refresh_token,audience:t.body.audience,scope:t.body.scope}}async set(t){var n;const r=new Ze({clientId:t.client_id,scope:t.scope,audience:t.audience}),s=await this.wrapCacheEntry(t);await this.cache.set(r.toKey(),s),await((n=this.keyManifest)===null||n===void 0?void 0:n.add(r.toKey()))}async clear(t){var n;const r=await this.getCacheKeys();r&&(await r.filter(s=>!t||s.includes(t)).reduce(async(s,o)=>{await s,await this.cache.remove(o)},Promise.resolve()),await((n=this.keyManifest)===null||n===void 0?void 0:n.clear()))}async wrapCacheEntry(t){const n=await this.nowProvider();return{body:t,expiresAt:Math.floor(n/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?(t=await this.keyManifest.get())===null||t===void 0?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new Ze({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,n){return n.filter(r=>{var s;const o=Ze.fromKey(r),a=new Set(o.scope&&o.scope.split(" ")),l=((s=t.scope)===null||s===void 0?void 0:s.split(" "))||[],c=o.scope&&l.reduce((d,m)=>d&&a.has(m),!0);return o.prefix==="@@auth0spajs@@"&&o.clientId===t.clientId&&o.audience===t.audience&&c})[0]}async getEntryWithRefreshToken(t,n){var r;for(const s of n){const o=Ze.fromKey(s);if(o.prefix==="@@auth0spajs@@"&&o.clientId===t.clientId){const a=await this.cache.get(s);if(!((r=a==null?void 0:a.body)===null||r===void 0)&&r.refresh_token)return this.modifiedCachedEntry(a,t)}}}async updateEntry(t,n){var r;const s=await this.getCacheKeys();if(s)for(const o of s){const a=await this.cache.get(o);if(((r=a==null?void 0:a.body)===null||r===void 0?void 0:r.refresh_token)===t){const l=Object.assign(Object.assign({},a.body),{refresh_token:n});await this.set(l)}}}}class ff{constructor(t,n,r){this.storage=t,this.clientId=n,this.cookieDomain=r,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const Qn=e=>typeof e=="number",gf=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],xf=e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(o=>{const a=o.split("."),[l,c,d]=a;if(a.length!==3||!l||!c||!d)throw new Error("ID token could not be decoded");const m=JSON.parse(oc(c)),p={__raw:o},f={};return Object.keys(m).forEach(g=>{p[g]=m[g],gf.includes(g)||(f[g]=m[g])}),{encoded:{header:l,payload:c,signature:d},header:JSON.parse(oc(l)),claims:p,user:f}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${e.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(t.header.alg!=="RS256")throw new Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||typeof t.claims.aud!="string"&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but was not one of "${t.claims.aud.join(", ")}"`);if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${e.aud}", found "${t.claims.azp}"`)}}else if(t.claims.aud!==e.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but found "${t.claims.aud}"`);if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${e.nonce}", found "${t.claims.nonce}"`)}if(e.max_age&&!Qn(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(t.claims.exp==null||!Qn(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Qn(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),s=new Date(0);if(s.setUTCSeconds(t.claims.exp+n),r>s)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${s})`);if(t.claims.nbf!=null&&Qn(t.claims.nbf)){const o=new Date(0);if(o.setUTCSeconds(t.claims.nbf-n),r<o)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${o}`)}if(t.claims.auth_time!=null&&Qn(t.claims.auth_time)){const o=new Date(0);if(o.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),r>o)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${o}`)}if(e.organization){const o=e.organization.trim();if(o.startsWith("org_")){const a=o;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(a!==t.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${a}", found "${t.claims.org_id}"`)}else{const a=o.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(a!==t.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${a}", found "${t.claims.org_name}"`)}}return t};var Xt=Va(function(e,t){var n=Kt&&Kt.__assign||function(){return n=Object.assign||function(c){for(var d,m=1,p=arguments.length;m<p;m++)for(var f in d=arguments[m])Object.prototype.hasOwnProperty.call(d,f)&&(c[f]=d[f]);return c},n.apply(this,arguments)};function r(c,d){if(!d)return"";var m="; "+c;return d===!0?m:m+"="+d}function s(c,d,m){return encodeURIComponent(c).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(d).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(p){if(typeof p.expires=="number"){var f=new Date;f.setMilliseconds(f.getMilliseconds()+864e5*p.expires),p.expires=f}return r("Expires",p.expires?p.expires.toUTCString():"")+r("Domain",p.domain)+r("Path",p.path)+r("Secure",p.secure)+r("SameSite",p.sameSite)}(m)}function o(c){for(var d={},m=c?c.split("; "):[],p=/(%[\dA-F]{2})+/gi,f=0;f<m.length;f++){var g=m[f].split("="),b=g.slice(1).join("=");b.charAt(0)==='"'&&(b=b.slice(1,-1));try{d[g[0].replace(p,decodeURIComponent)]=b.replace(p,decodeURIComponent)}catch{}}return d}function a(){return o(document.cookie)}function l(c,d,m){document.cookie=s(c,d,n({path:"/"},m))}t.__esModule=!0,t.encode=s,t.parse=o,t.getAll=a,t.get=function(c){return a()[c]},t.set=l,t.remove=function(c,d){l(c,"",n(n({},d),{expires:-1}))}});Fa(Xt),Xt.encode,Xt.parse,Xt.getAll;var vf=Xt.get,Ju=Xt.set,Xu=Xt.remove;const un={get(e){const t=vf(e);if(t!==void 0)return JSON.parse(t)},save(e,t,n){let r={};window.location.protocol==="https:"&&(r={secure:!0,sameSite:"none"}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Ju(e,JSON.stringify(t),r)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Xu(e,n)}},yf={get(e){return un.get(e)||un.get(`_legacy_${e}`)},save(e,t,n){let r={};window.location.protocol==="https:"&&(r={secure:!0}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Ju(`_legacy_${e}`,JSON.stringify(t),r),un.save(e,t,n)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Xu(e,n),un.remove(e,t),un.remove(`_legacy_${e}`,t)}},wf={get(e){if(typeof sessionStorage>"u")return;const t=sessionStorage.getItem(e);return t!=null?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};var bt;(function(e){e.Code="code",e.ConnectCode="connect_code"})(bt||(bt={}));function bf(e,t,n){var r=t===void 0?null:t,s=function(c,d){var m=atob(c);if(d){for(var p=new Uint8Array(m.length),f=0,g=m.length;f<g;++f)p[f]=m.charCodeAt(f);return String.fromCharCode.apply(null,new Uint16Array(p.buffer))}return m}(e,n!==void 0&&n),o=s.indexOf(`
`,10)+1,a=s.substring(o)+(r?"//# sourceMappingURL="+r:""),l=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(l)}var cc,dc,uc,Fi,jf=(cc="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==",dc=null,uc=!1,function(e){return Fi=Fi||bf(cc,dc,uc),new Worker(Fi,e)});const Vi={};class Nf{constructor(t,n){this.cache=t,this.clientId=n,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var n;const r=new Set(((n=await this.cache.get(this.manifestKey))===null||n===void 0?void 0:n.keys)||[]);r.add(t),await this.cache.set(this.manifestKey,{keys:[...r]})}async remove(t){const n=await this.cache.get(this.manifestKey);if(n){const r=new Set(n.keys);return r.delete(t),r.size>0?await this.cache.set(this.manifestKey,{keys:[...r]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const kf={memory:()=>new Zu().enclosedCache,localstorage:()=>new mf},hc=e=>kf[e],mc=e=>{const{openUrl:t,onRedirect:n}=e,r=et(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:t===!1||t?t:n})},pc=(e,t)=>{const n=(t==null?void 0:t.split(" "))||[];return((e==null?void 0:e.split(" "))||[]).every(r=>n.includes(r))},Mt={NONCE:"nonce",KEYPAIR:"keypair"};class Sf{constructor(t){this.clientId=t}getVersion(){return 1}createDbHandle(){const t=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((n,r)=>{t.onupgradeneeded=()=>Object.values(Mt).forEach(s=>t.result.createObjectStore(s)),t.onerror=()=>r(t.error),t.onsuccess=()=>n(t.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(t,n,r){const s=r((await this.getDbHandle()).transaction(t,n).objectStore(t));return new Promise((o,a)=>{s.onsuccess=()=>o(s.result),s.onerror=()=>a(s.error)})}buildKey(t){const n=t?`_${t}`:"auth0";return`${this.clientId}::${n}`}setNonce(t,n){return this.save(Mt.NONCE,this.buildKey(n),t)}setKeyPair(t){return this.save(Mt.KEYPAIR,this.buildKey(),t)}async save(t,n,r){await this.executeDbRequest(t,"readwrite",s=>s.put(r,n))}findNonce(t){return this.find(Mt.NONCE,this.buildKey(t))}findKeyPair(){return this.find(Mt.KEYPAIR,this.buildKey())}find(t,n){return this.executeDbRequest(t,"readonly",r=>r.get(n))}async deleteBy(t,n){const r=await this.executeDbRequest(t,"readonly",s=>s.getAllKeys());r==null||r.filter(n).map(s=>this.executeDbRequest(t,"readwrite",o=>o.delete(s)))}deleteByClientId(t,n){return this.deleteBy(t,r=>typeof r=="string"&&r.startsWith(`${n}::`))}clearNonces(){return this.deleteByClientId(Mt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Mt.KEYPAIR,this.clientId)}}class Cf{constructor(t){this.storage=new Sf(t)}getNonce(t){return this.storage.findNonce(t)}setNonce(t,n){return this.storage.setNonce(t,n)}async getOrGenerateKeyPair(){let t=await this.storage.findKeyPair();return t||(t=await sf(),await this.storage.setKeyPair(t)),t}async generateProof(t){const n=await this.getOrGenerateKeyPair();return af(Object.assign({keyPair:n},t))}async calculateThumbprint(){return of(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var kn;(function(e){e.Bearer="Bearer",e.DPoP="DPoP"})(kn||(kn={}));class Ef{constructor(t,n){this.hooks=n,this.config=Object.assign(Object.assign({},t),{fetch:t.fetch||(typeof window>"u"?fetch:window.fetch.bind(window))})}isAbsoluteUrl(t){return/^(https?:)?\/\//i.test(t)}buildUrl(t,n){if(n){if(this.isAbsoluteUrl(n))return n;if(t)return`${t.replace(/\/?\/$/,"")}/${n.replace(/^\/+/,"")}`}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(t){return this.config.getAccessToken?this.config.getAccessToken(t):this.hooks.getAccessToken(t)}extractUrl(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url}buildBaseRequest(t,n){if(!this.config.baseUrl)return new Request(t,n);const r=this.buildUrl(this.config.baseUrl,this.extractUrl(t)),s=t instanceof Request?new Request(r,t):r;return new Request(s,n)}setAuthorizationHeader(t,n,r=kn.Bearer){t.headers.set("authorization",`${r} ${n}`)}async setDpopProofHeader(t,n){if(!this.config.dpopNonceId)return;const r=await this.hooks.getDpopNonce(),s=await this.hooks.generateDpopProof({accessToken:n,method:t.method,nonce:r,url:t.url});t.headers.set("dpop",s)}async prepareRequest(t,n){const r=await this.getAccessToken(n);let s,o;typeof r=="string"?(s=this.config.dpopNonceId?kn.DPoP:kn.Bearer,o=r):(s=r.token_type,o=r.access_token),this.setAuthorizationHeader(t,o,s),s===kn.DPoP&&await this.setDpopProofHeader(t,o)}getHeader(t,n){return Array.isArray(t)?new Headers(t).get(n)||"":typeof t.get=="function"?t.get(n)||"":t[n]||""}hasUseDpopNonceError(t){if(t.status!==401)return!1;const n=this.getHeader(t.headers,"www-authenticate");return n.includes("invalid_dpop_nonce")||n.includes("use_dpop_nonce")}async handleResponse(t,n){const r=this.getHeader(t.headers,"dpop-nonce");if(r&&await this.hooks.setDpopNonce(r),!this.hasUseDpopNonceError(t))return t;if(!r||!n.onUseDpopNonceError)throw new li(r);return n.onUseDpopNonceError()}async internalFetchWithAuth(t,n,r,s){const o=this.buildBaseRequest(t,n);await this.prepareRequest(o,s);const a=await this.config.fetch(o);return this.handleResponse(a,r)}fetchWithAuth(t,n,r){const s={onUseDpopNonceError:()=>this.internalFetchWithAuth(t,n,Object.assign(Object.assign({},s),{onUseDpopNonceError:void 0}),r)};return this.internalFetchWithAuth(t,n,s,r)}}class Tf{constructor(t,n){this.myAccountFetcher=t,this.apiBase=n}async connectAccount(t){const n=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return this._handleResponse(n)}async completeAccount(t){const n=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return this._handleResponse(n)}async _handleResponse(t){let n;try{n=await t.text(),n=JSON.parse(n)}catch(r){throw new Us({type:"invalid_json",status:t.status,title:"Invalid JSON response",detail:n||String(r)})}if(t.ok)return n;throw new Us(n)}}class Us extends Error{constructor({type:t,status:n,title:r,detail:s,validation_errors:o}){super(s),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=s,this.validation_errors=o,Object.setPrototypeOf(this,Us.prototype)}}const Mi=new Jp;class Pf{constructor(t){let n,r;if(this.userCache=new Zu().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Mi.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),typeof window<"u"&&(()=>{if(!Ms())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Ms().subtle===void 0)throw new Error(`
auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
`)})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)r=t.cache;else{if(n=t.cacheLocation||"memory",!hc(n))throw new Error(`Invalid cache location "${n}"`);r=hc(n)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=t.legacySameSiteCookie===!1?un:yf,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(c=>`auth0.${c}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const s=t.useCookiesForTransactions?this.cookieStorage:wf;var o;this.scope=Yn("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new ff(s,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||Wu,this.cacheManager=new pf(r,r.allKeys?void 0:new Nf(r,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Cf(this.options.clientId):void 0,this.domainUrl=(o=this.options.domain,/^https?:\/\//.test(o)?o:`https://${o}`),this.tokenIssuer=((c,d)=>c?c.startsWith("https://")?c:`https://${c}/`:`${d}/`)(this.options.issuer,this.domainUrl);const a=`${this.domainUrl}/me/`,l=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new Tf(l,a),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&n==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new jf)}_url(t){const n=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Uu)));return`${this.domainUrl}${t}&auth0Client=${n}`}_authorizeUrl(t){return this._url(`/authorize?${Fo(t)}`)}async _verifyIdToken(t,n,r){const s=await this.nowProvider();return xf({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:n,organization:r,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,typeof o!="string"?o:parseInt(o,10)||void 0),now:s});var o}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,n,r){var s;const o=$i(Xn()),a=$i(Xn()),l=Xn(),c=await ic(l),d=ac(c),m=await((s=this.dpop)===null||s===void 0?void 0:s.calculateThumbprint()),p=((g,b,w,j,x,u,h,y,v)=>Object.assign(Object.assign(Object.assign({client_id:g.clientId},g.authorizationParams),w),{scope:Yn(b,w.scope),response_type:"code",response_mode:y||"query",state:j,nonce:x,redirect_uri:h||g.authorizationParams.redirect_uri,code_challenge:u,code_challenge_method:"S256",dpop_jkt:v}))(this.options,this.scope,t,o,a,d,t.redirect_uri||this.options.authorizationParams.redirect_uri||r,n==null?void 0:n.response_mode,m),f=this._authorizeUrl(p);return{nonce:a,code_verifier:l,scope:p.scope,audience:p.audience||"default",redirect_uri:p.redirect_uri,state:o,url:f}}async loginWithPopup(t,n){var r;if(t=t||{},!(n=n||{}).popup&&(n.popup=(l=>{const c=window.screenX+(window.innerWidth-400)/2,d=window.screenY+(window.innerHeight-600)/2;return window.open(l,"auth0:authorize:popup",`left=${c},top=${d},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!n.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const s=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);n.popup.location.href=s.url;const o=await(l=>new Promise((c,d)=>{let m;const p=setInterval(()=>{l.popup&&l.popup.closed&&(clearInterval(p),clearTimeout(f),window.removeEventListener("message",m,!1),d(new Ba(l.popup)))},1e3),f=setTimeout(()=>{clearInterval(p),d(new Wa(l.popup)),window.removeEventListener("message",m,!1)},1e3*(l.timeoutInSeconds||60));m=function(g){if(g.data&&g.data.type==="authorization_response"){if(clearTimeout(f),clearInterval(p),window.removeEventListener("message",m,!1),l.popup.close(),g.data.response.error)return d(te.fromPayload(g.data.response));c(g.data.response)}},window.addEventListener("message",m)}))(Object.assign(Object.assign({},n),{timeoutInSeconds:n.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(s.state!==o.state)throw new te("state_mismatch","Invalid state");const a=((r=t.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:s.redirect_uri},{nonceIn:s.nonce,organization:a})}async getUser(){var t;const n=await this._getIdTokenFromCache();return(t=n==null?void 0:n.decodedToken)===null||t===void 0?void 0:t.user}async getIdTokenClaims(){var t;const n=await this._getIdTokenFromCache();return(t=n==null?void 0:n.decodedToken)===null||t===void 0?void 0:t.claims}async loginWithRedirect(t={}){var n;const r=mc(t),{openUrl:s,fragment:o,appState:a}=r,l=et(r,["openUrl","fragment","appState"]),c=((n=l.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization,d=await this._prepareAuthorizeUrl(l.authorizationParams||{}),{url:m}=d,p=et(d,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},p),{appState:a,response_type:bt.Code}),c&&{organization:c}));const f=o?`${m}#${o}`:m;s?await s(f):window.location.assign(f)}async handleRedirectCallback(t=window.location.href){const n=t.split("?").slice(1);if(n.length===0)throw new Error("There are no query params available for parsing.");const r=this.transactionManager.get();if(!r)throw new te("missing_transaction","Invalid state");this.transactionManager.remove();const s=(o=>{o.indexOf("#")>-1&&(o=o.substring(0,o.indexOf("#")));const a=new URLSearchParams(o);return{state:a.get("state"),code:a.get("code")||void 0,connect_code:a.get("connect_code")||void 0,error:a.get("error")||void 0,error_description:a.get("error_description")||void 0}})(n.join(""));return r.response_type===bt.ConnectCode?this._handleConnectAccountRedirectCallback(s,r):this._handleLoginRedirectCallback(s,r)}async _handleLoginRedirectCallback(t,n){const{code:r,state:s,error:o,error_description:a}=t;if(o)throw new Ma(o,a||o,s,n.appState);if(!n.code_verifier||n.state&&n.state!==s)throw new te("state_mismatch","Invalid state");const l=n.organization,c=n.nonce,d=n.redirect_uri;return await this._requestToken(Object.assign({audience:n.audience,scope:n.scope,code_verifier:n.code_verifier,grant_type:"authorization_code",code:r},d?{redirect_uri:d}:{}),{nonceIn:c,organization:l}),{appState:n.appState,response_type:bt.Code}}async _handleConnectAccountRedirectCallback(t,n){const{connect_code:r,state:s,error:o,error_description:a}=t;if(o)throw new Ua(o,a||o,n.connection,s,n.appState);if(!r)throw new te("missing_connect_code","Missing connect code");if(!(n.code_verifier&&n.state&&n.auth_session&&n.redirect_uri&&n.state===s))throw new te("state_mismatch","Invalid state");const l=await this.myAccountApi.completeAccount({auth_session:n.auth_session,connect_code:r,redirect_uri:n.redirect_uri,code_verifier:n.code_verifier});return Object.assign(Object.assign({},l),{appState:n.appState,response_type:bt.ConnectCode})}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch{}}async getTokenSilently(t={}){var n;const r=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Yn(this.scope,(n=t.authorizationParams)===null||n===void 0?void 0:n.scope)})}),s=await((o,a)=>{let l=Vi[a];return l||(l=o().finally(()=>{delete Vi[a],l=null}),Vi[a]=l),l})(()=>this._getTokenSilently(r),`${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`);return t.detailedResponse?s:s==null?void 0:s.access_token}async _getTokenSilently(t){const{cacheMode:n}=t,r=et(t,["cacheMode"]);if(n!=="off"){const s=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:n});if(s)return s}if(n!=="cache-only"){if(!await(async(s,o=3)=>{for(let a=0;a<o;a++)if(await s())return!0;return!1})(()=>Mi.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new Dr;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),n!=="off"){const m=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId});if(m)return m}const s=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(r):await this._getTokenFromIFrame(r),{id_token:o,token_type:a,access_token:l,oauthTokenScope:c,expires_in:d}=s;return Object.assign(Object.assign({id_token:o,token_type:a,access_token:l},c?{scope:c}:null),{expires_in:d})}finally{await Mi.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},n={}){var r;const s=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:Yn(this.scope,(r=t.authorizationParams)===null||r===void 0?void 0:r.scope)})});return n=Object.assign(Object.assign({},Xp),n),await this.loginWithPopup(s,n),(await this.cacheManager.get(new Ze({scope:s.authorizationParams.scope,audience:s.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){t.clientId!==null?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const n=t.logoutParams||{},{federated:r}=n,s=et(n,["federated"]),o=r?"&federated":"";return this._url(`/v2/logout?${Fo(Object.assign({clientId:t.clientId},s))}`)+o}async logout(t={}){var n;const r=mc(t),{openUrl:s}=r,o=et(r,["openUrl"]);t.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await((n=this.dpop)===null||n===void 0?void 0:n.clear());const a=this._buildLogoutUrl(o);s?await s(a):s!==!1&&window.location.assign(a)}async _getTokenFromIFrame(t){const n=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),r=this.cookieStorage.get(this.orgHintCookieName);r&&!n.organization&&(n.organization=r);const{url:s,state:o,nonce:a,code_verifier:l,redirect_uri:c,scope:d,audience:m}=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new te("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const p=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let f;try{f=new URL(this.domainUrl).origin}catch{f=this.domainUrl}const g=await((w,j,x=60)=>new Promise((u,h)=>{const y=window.document.createElement("iframe");y.setAttribute("width","0"),y.setAttribute("height","0"),y.style.display="none";const v=()=>{window.document.body.contains(y)&&(window.document.body.removeChild(y),window.removeEventListener("message",N,!1))};let N;const k=setTimeout(()=>{h(new Dr),v()},1e3*x);N=function(C){if(C.origin!=j||!C.data||C.data.type!=="authorization_response")return;const z=C.source;z&&z.close(),C.data.response.error?h(te.fromPayload(C.data.response)):u(C.data.response),clearTimeout(k),window.removeEventListener("message",N,!1),setTimeout(v,2e3)},window.addEventListener("message",N,!1),window.document.body.appendChild(y),y.setAttribute("src",w)}))(s,f,p);if(o!==g.state)throw new te("state_mismatch","Invalid state");const b=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:l,code:g.code,grant_type:"authorization_code",redirect_uri:c,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:n.organization});return Object.assign(Object.assign({},b),{scope:d,oauthTokenScope:b.scope,audience:m})}catch(p){throw p.error==="login_required"&&this.logout({openUrl:!1}),p}}async _getTokenUsingRefreshToken(t){const n=await this.cacheManager.get(new Ze({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(n&&n.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new ai(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const r=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,s=typeof t.timeoutInSeconds=="number"?1e3*t.timeoutInSeconds:null,o=((m,p,f,g)=>{var b;if(m&&f&&g){if(p.audience!==f)return p.scope;const w=g.split(" "),j=((b=p.scope)===null||b===void 0?void 0:b.split(" "))||[],x=j.every(u=>w.includes(u));return w.length>=j.length&&x?g:p.scope}return p.scope})(this.options.useMrrt,t.authorizationParams,n==null?void 0:n.audience,n==null?void 0:n.scope);try{const m=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:n&&n.refresh_token,redirect_uri:r}),s&&{timeout:s}),{scopesToRequest:o});if(m.refresh_token&&this.options.useMrrt&&(n!=null&&n.refresh_token)&&await this.cacheManager.updateEntry(n.refresh_token,m.refresh_token),this.options.useMrrt&&(a=n==null?void 0:n.audience,l=n==null?void 0:n.scope,c=t.authorizationParams.audience,d=t.authorizationParams.scope,(a!==c||!pc(d,l))&&!pc(o,m.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);const p=((f,g)=>{const b=(f==null?void 0:f.split(" "))||[],w=(g==null?void 0:g.split(" "))||[];return b.filter(j=>w.indexOf(j)==-1).join(",")})(o,m.scope);throw new Ha(t.authorizationParams.audience||"default",p)}return Object.assign(Object.assign({},m),{scope:t.authorizationParams.scope,oauthTokenScope:m.scope,audience:t.authorizationParams.audience||"default"})}catch(m){if((m.message.indexOf("Missing Refresh Token")>-1||m.message&&m.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw m}var a,l,c,d}async _saveEntryInCache(t){const{id_token:n,decodedToken:r}=t,s=et(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:n,decodedToken:r}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(s)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",n=await this.cacheManager.getIdToken(new Ze({clientId:this.options.clientId,audience:t,scope:this.scope})),r=this.userCache.get("@@user@@");return n&&n.id_token===(r==null?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache({scope:t,audience:n,clientId:r,cacheMode:s}){const o=await this.cacheManager.get(new Ze({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,s);if(o&&o.access_token){const{token_type:a,access_token:l,oauthTokenScope:c,expires_in:d}=o,m=await this._getIdTokenFromCache();return m&&Object.assign(Object.assign({id_token:m.id_token,token_type:a||"Bearer",access_token:l},c?{scope:c}:null),{expires_in:d})}}async _requestToken(t,n){const{nonceIn:r,organization:s,scopesToRequest:o}=n||{},a=await hf(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},t),{scope:o||t.scope}),this.worker),l=await this._verifyIdToken(a.id_token,r,s);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},a),{decodedToken:l,scope:t.scope,audience:t.audience||"default"}),a.scope?{oauthTokenScope:a.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(s||l.claims.org_id),Object.assign(Object.assign({},a),{decodedToken:l})}async exchangeToken(t){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:t.subject_token,subject_token_type:t.subject_token_type,scope:Yn(t.scope,this.scope),audience:t.audience||this.options.authorizationParams.audience})}_assertDpop(t){if(!t)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(t){return this._assertDpop(this.dpop),this.dpop.getNonce(t)}setDpopNonce(t,n){return this._assertDpop(this.dpop),this.dpop.setNonce(t,n)}generateDpopProof(t){return this._assertDpop(this.dpop),this.dpop.generateProof(t)}createFetcher(t={}){return new Ef(t,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:n=>{var r;return this.getTokenSilently({authorizationParams:{scope:(r=n==null?void 0:n.scope)===null||r===void 0?void 0:r.join(" "),audience:n==null?void 0:n.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(t.dpopNonceId),setDpopNonce:n=>this.setDpopNonce(n,t.dpopNonceId),generateDpopProof:n=>this.generateDpopProof(n)})}async connectAccountWithRedirect(t){const{openUrl:n,appState:r,connection:s,authorization_params:o,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=t;if(!s)throw new Error("connection is required");const l=$i(Xn()),c=Xn(),d=await ic(c),m=ac(d),{connect_uri:p,connect_params:f,auth_session:g}=await this.myAccountApi.connectAccount({connection:s,redirect_uri:a,state:l,code_challenge:m,code_challenge_method:"S256",authorization_params:o});this.transactionManager.create({state:l,code_verifier:c,auth_session:g,redirect_uri:a,appState:r,connection:s,response_type:bt.ConnectCode});const b=new URL(p);b.searchParams.set("ticket",f.ticket),n?await n(b.toString()):window.location.assign(b)}}var Yu={isAuthenticated:!1,isLoading:!0,error:void 0,user:void 0},ke=function(){throw new Error("You forgot to wrap your component in <Auth0Provider>.")},_f=le(le({},Yu),{buildAuthorizeUrl:ke,buildLogoutUrl:ke,getAccessTokenSilently:ke,getAccessTokenWithPopup:ke,getIdTokenClaims:ke,loginWithRedirect:ke,loginWithPopup:ke,connectAccountWithRedirect:ke,logout:ke,handleRedirectCallback:ke,getDpopNonce:ke,setDpopNonce:ke,generateDpopProof:ke,createFetcher:ke}),Qu=S.createContext(_f),fc=function(e){Gp(t,e);function t(n,r){var s=e.call(this,r??n)||this;return s.error=n,s.error_description=r,Object.setPrototypeOf(s,t.prototype),s}return t}(Error),Df=/[?&](?:connect_)?code=[^&]+/,If=/[?&]state=[^&]+/,Af=/[?&]error=[^&]+/,zf=function(e){return e===void 0&&(e=window.location.search),(Df.test(e)||Af.test(e))&&If.test(e)},qu=function(e){return function(t){if(t instanceof Error)return t;if(t!==null&&typeof t=="object"&&"error"in t&&typeof t.error=="string"){if("error_description"in t&&typeof t.error_description=="string"){var n=t;return new fc(n.error,n.error_description)}var r=t;return new fc(r.error)}return new Error(e)}},gc=qu("Login failed"),Ui=qu("Get access token failed"),eh=function(e){var t,n;e!=null&&e.redirectUri&&(console.warn("Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version"),e.authorizationParams=(t=e.authorizationParams)!==null&&t!==void 0?t:{},e.authorizationParams.redirect_uri=e.redirectUri,delete e.redirectUri),!((n=e==null?void 0:e.authorizationParams)===null||n===void 0)&&n.redirectUri&&(console.warn("Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version"),e.authorizationParams.redirect_uri=e.authorizationParams.redirectUri,delete e.authorizationParams.redirectUri)},Of=function(e,t){switch(t.type){case"LOGIN_POPUP_STARTED":return le(le({},e),{isLoading:!0});case"LOGIN_POPUP_COMPLETE":case"INITIALISED":return le(le({},e),{isAuthenticated:!!t.user,user:t.user,isLoading:!1,error:void 0});case"HANDLE_REDIRECT_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":return e.user===t.user?e:le(le({},e),{isAuthenticated:!!t.user,user:t.user});case"LOGOUT":return le(le({},e),{isAuthenticated:!1,user:void 0});case"ERROR":return le(le({},e),{isLoading:!1,error:t.error})}},Lf=function(e){return eh(e),le(le({},e),{auth0Client:{name:"auth0-react",version:"2.8.0"}})},Rf=function(e){var t;window.history.replaceState({},document.title,(t=e.returnTo)!==null&&t!==void 0?t:window.location.pathname)},$f=function(e){var t=e.children,n=e.skipRedirectCallback,r=e.onRedirectCallback,s=r===void 0?Rf:r,o=e.context,a=o===void 0?Qu:o,l=sc(e,["children","skipRedirectCallback","onRedirectCallback","context"]),c=S.useState(function(){return new Pf(Lf(l))})[0],d=S.useReducer(Of,Yu),m=d[0],p=d[1],f=S.useRef(!1),g=S.useCallback(function(I){return p({type:"ERROR",error:I}),I},[]);S.useEffect(function(){f.current||(f.current=!0,function(){return cn(void 0,void 0,void 0,function(){var I,M,W,G,K,P,L;return dn(this,function(E){switch(E.label){case 0:return E.trys.push([0,7,,8]),I=void 0,zf()&&!n?[4,c.handleRedirectCallback()]:[3,3];case 1:return M=E.sent(),W=M.appState,G=W===void 0?{}:W,K=M.response_type,P=sc(M,["appState","response_type"]),[4,c.getUser()];case 2:return I=E.sent(),G.response_type=K,K===bt.ConnectCode&&(G.connectedAccount=P),s(G,I),[3,6];case 3:return[4,c.checkSession()];case 4:return E.sent(),[4,c.getUser()];case 5:I=E.sent(),E.label=6;case 6:return p({type:"INITIALISED",user:I}),[3,8];case 7:return L=E.sent(),g(gc(L)),[3,8];case 8:return[2]}})})}())},[c,s,n,g]);var b=S.useCallback(function(I){return eh(I),c.loginWithRedirect(I)},[c]),w=S.useCallback(function(I,M){return cn(void 0,void 0,void 0,function(){var W,G;return dn(this,function(K){switch(K.label){case 0:p({type:"LOGIN_POPUP_STARTED"}),K.label=1;case 1:return K.trys.push([1,3,,4]),[4,c.loginWithPopup(I,M)];case 2:return K.sent(),[3,4];case 3:return W=K.sent(),g(gc(W)),[2];case 4:return[4,c.getUser()];case 5:return G=K.sent(),p({type:"LOGIN_POPUP_COMPLETE",user:G}),[2]}})})},[c,g]),j=S.useCallback(function(){for(var I=[],M=0;M<arguments.length;M++)I[M]=arguments[M];return cn(void 0,Zp([],I,!0),void 0,function(W){return W===void 0&&(W={}),dn(this,function(G){switch(G.label){case 0:return[4,c.logout(W)];case 1:return G.sent(),(W.openUrl||W.openUrl===!1)&&p({type:"LOGOUT"}),[2]}})})},[c]),x=S.useCallback(function(I){return cn(void 0,void 0,void 0,function(){var M,W,G,K;return dn(this,function(P){switch(P.label){case 0:return P.trys.push([0,2,3,5]),[4,c.getTokenSilently(I)];case 1:return M=P.sent(),[3,5];case 2:throw W=P.sent(),Ui(W);case 3:return G=p,K={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,c.getUser()];case 4:return G.apply(void 0,[(K.user=P.sent(),K)]),[7];case 5:return[2,M]}})})},[c]),u=S.useCallback(function(I,M){return cn(void 0,void 0,void 0,function(){var W,G,K,P;return dn(this,function(L){switch(L.label){case 0:return L.trys.push([0,2,3,5]),[4,c.getTokenWithPopup(I,M)];case 1:return W=L.sent(),[3,5];case 2:throw G=L.sent(),Ui(G);case 3:return K=p,P={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,c.getUser()];case 4:return K.apply(void 0,[(P.user=L.sent(),P)]),[7];case 5:return[2,W]}})})},[c]),h=S.useCallback(function(I){return c.connectAccountWithRedirect(I)},[c]),y=S.useCallback(function(){return c.getIdTokenClaims()},[c]),v=S.useCallback(function(I){return cn(void 0,void 0,void 0,function(){var M,W,G;return dn(this,function(K){switch(K.label){case 0:return K.trys.push([0,2,3,5]),[4,c.handleRedirectCallback(I)];case 1:return[2,K.sent()];case 2:throw M=K.sent(),Ui(M);case 3:return W=p,G={type:"HANDLE_REDIRECT_COMPLETE"},[4,c.getUser()];case 4:return W.apply(void 0,[(G.user=K.sent(),G)]),[7];case 5:return[2]}})})},[c]),N=S.useCallback(function(I){return c.getDpopNonce(I)},[c]),k=S.useCallback(function(I,M){return c.setDpopNonce(I,M)},[c]),C=S.useCallback(function(I){return c.generateDpopProof(I)},[c]),z=S.useCallback(function(I){return c.createFetcher(I)},[c]),A=S.useMemo(function(){return le(le({},m),{getAccessTokenSilently:x,getAccessTokenWithPopup:u,getIdTokenClaims:y,loginWithRedirect:b,loginWithPopup:w,connectAccountWithRedirect:h,logout:j,handleRedirectCallback:v,getDpopNonce:N,setDpopNonce:k,generateDpopProof:C,createFetcher:z})},[m,x,u,y,b,w,h,j,v,N,k,C,z]);return Zo.createElement(a.Provider,{value:A},t)},Ff=function(e){return e===void 0&&(e=Qu),S.useContext(e)};/**
* @remix-run/router v1.23.0
*
* 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 Ir(){return Ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ir.apply(this,arguments)}var kt;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(kt||(kt={}));const xc="popstate";function Vf(e){e===void 0&&(e={});function t(r,s){let{pathname:o,search:a,hash:l}=r.location;return Mo("",{pathname:o,search:a,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:Ws(s)}return Uf(t,n,null,e)}function se(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function th(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Mf(){return Math.random().toString(36).substr(2,8)}function vc(e,t){return{usr:e.state,key:e.key,idx:t}}function Mo(e,t,n,r){return n===void 0&&(n=null),Ir({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Mn(t):t,{state:n,key:t&&t.key||r||Mf()})}function Ws(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Mn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Uf(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:o=!1}=r,a=s.history,l=kt.Pop,c=null,d=m();d==null&&(d=0,a.replaceState(Ir({},a.state,{idx:d}),""));function m(){return(a.state||{idx:null}).idx}function p(){l=kt.Pop;let j=m(),x=j==null?null:j-d;d=j,c&&c({action:l,location:w.location,delta:x})}function f(j,x){l=kt.Push;let u=Mo(w.location,j,x);n&&n(u,j),d=m()+1;let h=vc(u,d),y=w.createHref(u);try{a.pushState(h,"",y)}catch(v){if(v instanceof DOMException&&v.name==="DataCloneError")throw v;s.location.assign(y)}o&&c&&c({action:l,location:w.location,delta:1})}function g(j,x){l=kt.Replace;let u=Mo(w.location,j,x);n&&n(u,j),d=m();let h=vc(u,d),y=w.createHref(u);a.replaceState(h,"",y),o&&c&&c({action:l,location:w.location,delta:0})}function b(j){let x=s.location.origin!=="null"?s.location.origin:s.location.href,u=typeof j=="string"?j:Ws(j);return u=u.replace(/ $/,"%20"),se(x,"No window.location.(origin|href) available to create URL for href: "+u),new URL(u,x)}let w={get action(){return l},get location(){return e(s,a)},listen(j){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(xc,p),c=j,()=>{s.removeEventListener(xc,p),c=null}},createHref(j){return t(s,j)},createURL:b,encodeLocation(j){let x=b(j);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:g,go(j){return a.go(j)}};return w}var yc;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(yc||(yc={}));function Wf(e,t,n){return n===void 0&&(n="/"),Bf(e,t,n,!1)}function Bf(e,t,n,r){let s=typeof t=="string"?Mn(t):t,o=Ga(s.pathname||"/",n);if(o==null)return null;let a=nh(e);Kf(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let d=ng(o);l=eg(a[c],d,r)}return l}function nh(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(o,a,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};c.relativePath.startsWith("/")&&(se(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=At([r,c.relativePath]),m=n.concat(c);o.children&&o.children.length>0&&(se(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),nh(o.children,t,m,d)),!(o.path==null&&!o.index)&&t.push({path:d,score:Qf(d,o.index),routesMeta:m})};return e.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of rh(o.path))s(o,a,c)}),t}function rh(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let a=rh(r.join("/")),l=[];return l.push(...a.map(c=>c===""?o:[o,c].join("/"))),s&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Kf(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:qf(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Hf=/^:[\w-]+$/,Gf=3,Zf=2,Jf=1,Xf=10,Yf=-2,wc=e=>e==="*";function Qf(e,t){let n=e.split("/"),r=n.length;return n.some(wc)&&(r+=Yf),t&&(r+=Zf),n.filter(s=>!wc(s)).reduce((s,o)=>s+(Hf.test(o)?Gf:o===""?Jf:Xf),r)}function qf(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function eg(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,s={},o="/",a=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,m=o==="/"?t:t.slice(o.length)||"/",p=bc({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},m),f=c.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=bc({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},m)),!p)return null;Object.assign(s,p.params),a.push({params:s,pathname:At([o,p.pathname]),pathnameBase:og(At([o,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(o=At([o,p.pathnameBase]))}return a}function bc(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=tg(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],a=o.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((d,m,p)=>{let{paramName:f,isOptional:g}=m;if(f==="*"){let w=l[p]||"";a=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=l[p];return g&&!b?d[f]=void 0:d[f]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:a,pattern:e}}function tg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),th(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function ng(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return th(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ga(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function rg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Mn(e):e;return{pathname:n?n.startsWith("/")?n:sg(n,t):t,search:ag(r),hash:lg(s)}}function sg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Wi(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function ig(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function sh(e,t){let n=ig(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ih(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Mn(e):(s=Ir({},e),se(!s.pathname||!s.pathname.includes("?"),Wi("?","pathname","search",s)),se(!s.pathname||!s.pathname.includes("#"),Wi("#","pathname","hash",s)),se(!s.search||!s.search.includes("#"),Wi("#","search","hash",s)));let o=e===""||s.pathname==="",a=o?"/":s.pathname,l;if(a==null)l=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),p-=1;s.pathname=f.join("/")}l=p>=0?t[p]:"/"}let c=rg(s,l),d=a&&a!=="/"&&a.endsWith("/"),m=(o||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||m)&&(c.pathname+="/"),c}const At=e=>e.join("/").replace(/\/\/+/g,"/"),og=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ag=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,lg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function cg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const oh=["post","put","patch","delete"];new Set(oh);const dg=["get",...oh];new Set(dg);/**
* React Router v6.30.1
*
* 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 Ar(){return Ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ar.apply(this,arguments)}const Za=S.createContext(null),ug=S.createContext(null),an=S.createContext(null),ci=S.createContext(null),Ft=S.createContext({outlet:null,matches:[],isDataRoute:!1}),ah=S.createContext(null);function hg(e,t){let{relative:n}=t===void 0?{}:t;Fr()||se(!1);let{basename:r,navigator:s}=S.useContext(an),{hash:o,pathname:a,search:l}=uh(e,{relative:n}),c=a;return r!=="/"&&(c=a==="/"?r:At([r,a])),s.createHref({pathname:c,search:l,hash:o})}function Fr(){return S.useContext(ci)!=null}function di(){return Fr()||se(!1),S.useContext(ci).location}function lh(e){S.useContext(an).static||S.useLayoutEffect(e)}function ch(){let{isDataRoute:e}=S.useContext(Ft);return e?Sg():mg()}function mg(){Fr()||se(!1);let e=S.useContext(Za),{basename:t,future:n,navigator:r}=S.useContext(an),{matches:s}=S.useContext(Ft),{pathname:o}=di(),a=JSON.stringify(sh(s,n.v7_relativeSplatPath)),l=S.useRef(!1);return lh(()=>{l.current=!0}),S.useCallback(function(d,m){if(m===void 0&&(m={}),!l.current)return;if(typeof d=="number"){r.go(d);return}let p=ih(d,JSON.parse(a),o,m.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:At([t,p.pathname])),(m.replace?r.replace:r.push)(p,m.state,m)},[t,r,a,o,e])}function dh(){let{matches:e}=S.useContext(Ft),t=e[e.length-1];return t?t.params:{}}function uh(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(an),{matches:s}=S.useContext(Ft),{pathname:o}=di(),a=JSON.stringify(sh(s,r.v7_relativeSplatPath));return S.useMemo(()=>ih(e,JSON.parse(a),o,n==="path"),[e,a,o,n])}function pg(e,t){return fg(e,t)}function fg(e,t,n,r){Fr()||se(!1);let{navigator:s}=S.useContext(an),{matches:o}=S.useContext(Ft),a=o[o.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let d=di(),m;if(t){var p;let j=typeof t=="string"?Mn(t):t;c==="/"||(p=j.pathname)!=null&&p.startsWith(c)||se(!1),m=j}else m=d;let f=m.pathname||"/",g=f;if(c!=="/"){let j=c.replace(/^\//,"").split("/");g="/"+f.replace(/^\//,"").split("/").slice(j.length).join("/")}let b=Wf(e,{pathname:g}),w=wg(b&&b.map(j=>Object.assign({},j,{params:Object.assign({},l,j.params),pathname:At([c,s.encodeLocation?s.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?c:At([c,s.encodeLocation?s.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),o,n,r);return t&&w?S.createElement(ci.Provider,{value:{location:Ar({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:kt.Pop}},w):w}function gg(){let e=kg(),t=cg(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:s},n):null,o)}const xg=S.createElement(gg,null);class vg extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(Ft.Provider,{value:this.props.routeContext},S.createElement(ah.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function yg(e){let{routeContext:t,match:n,children:r}=e,s=S.useContext(Za);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(Ft.Provider,{value:t},r)}function wg(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let m=a.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);m>=0||se(!1),a=a.slice(0,Math.min(a.length,m+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let m=0;m<a.length;m++){let p=a[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=m),p.route.id){let{loaderData:f,errors:g}=n,b=p.route.loader&&f[p.route.id]===void 0&&(!g||g[p.route.id]===void 0);if(p.route.lazy||b){c=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((m,p,f)=>{let g,b=!1,w=null,j=null;n&&(g=l&&p.route.id?l[p.route.id]:void 0,w=p.route.errorElement||xg,c&&(d<0&&f===0?(Cg("route-fallback",!1),b=!0,j=null):d===f&&(b=!0,j=p.route.hydrateFallbackElement||null)));let x=t.concat(a.slice(0,f+1)),u=()=>{let h;return g?h=w:b?h=j:p.route.Component?h=S.createElement(p.route.Component,null):p.route.element?h=p.route.element:h=m,S.createElement(yg,{match:p,routeContext:{outlet:m,matches:x,isDataRoute:n!=null},children:h})};return n&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?S.createElement(vg,{location:n.location,revalidation:n.revalidation,component:w,error:g,children:u(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):u()},null)}var hh=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(hh||{}),Bs=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Bs||{});function bg(e){let t=S.useContext(Za);return t||se(!1),t}function jg(e){let t=S.useContext(ug);return t||se(!1),t}function Ng(e){let t=S.useContext(Ft);return t||se(!1),t}function mh(e){let t=Ng(),n=t.matches[t.matches.length-1];return n.route.id||se(!1),n.route.id}function kg(){var e;let t=S.useContext(ah),n=jg(Bs.UseRouteError),r=mh(Bs.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Sg(){let{router:e}=bg(hh.UseNavigateStable),t=mh(Bs.UseNavigateStable),n=S.useRef(!1);return lh(()=>{n.current=!0}),S.useCallback(function(s,o){o===void 0&&(o={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Ar({fromRouteId:t},o)))},[e,t])}const jc={};function Cg(e,t,n){!t&&!jc[e]&&(jc[e]=!0)}function Eg(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function ft(e){se(!1)}function Tg(e){let{basename:t="/",children:n=null,location:r,navigationType:s=kt.Pop,navigator:o,static:a=!1,future:l}=e;Fr()&&se(!1);let c=t.replace(/^\/*/,"/"),d=S.useMemo(()=>({basename:c,navigator:o,static:a,future:Ar({v7_relativeSplatPath:!1},l)}),[c,l,o,a]);typeof r=="string"&&(r=Mn(r));let{pathname:m="/",search:p="",hash:f="",state:g=null,key:b="default"}=r,w=S.useMemo(()=>{let j=Ga(m,c);return j==null?null:{location:{pathname:j,search:p,hash:f,state:g,key:b},navigationType:s}},[c,m,p,f,g,b,s]);return w==null?null:S.createElement(an.Provider,{value:d},S.createElement(ci.Provider,{children:n,value:w}))}function Pg(e){let{children:t,location:n}=e;return pg(Uo(t),n)}new Promise(()=>{});function Uo(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,s)=>{if(!S.isValidElement(r))return;let o=[...t,s];if(r.type===S.Fragment){n.push.apply(n,Uo(r.props.children,o));return}r.type!==ft&&se(!1),!r.props.index||!r.props.children||se(!1);let a={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Uo(r.props.children,o)),n.push(a)}),n}/**
* React Router DOM v6.30.1
*
* 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 Wo(){return Wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wo.apply(this,arguments)}function _g(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function Dg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ig(e,t){return e.button===0&&(!t||t==="_self")&&!Dg(e)}const Ag=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],zg="6";try{window.__reactRouterVersion=zg}catch{}const Og="startTransition",Nc=Oh[Og];function Lg(e){let{basename:t,children:n,future:r,window:s}=e,o=S.useRef();o.current==null&&(o.current=Vf({window:s,v5Compat:!0}));let a=o.current,[l,c]=S.useState({action:a.action,location:a.location}),{v7_startTransition:d}=r||{},m=S.useCallback(p=>{d&&Nc?Nc(()=>c(p)):c(p)},[c,d]);return S.useLayoutEffect(()=>a.listen(m),[a,m]),S.useEffect(()=>Eg(r),[r]),S.createElement(Tg,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:r})}const Rg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$g=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,we=S.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:o,replace:a,state:l,target:c,to:d,preventScrollReset:m,viewTransition:p}=t,f=_g(t,Ag),{basename:g}=S.useContext(an),b,w=!1;if(typeof d=="string"&&$g.test(d)&&(b=d,Rg))try{let h=new URL(window.location.href),y=d.startsWith("//")?new URL(h.protocol+d):new URL(d),v=Ga(y.pathname,g);y.origin===h.origin&&v!=null?d=v+y.search+y.hash:w=!0}catch{}let j=hg(d,{relative:s}),x=Fg(d,{replace:a,state:l,target:c,preventScrollReset:m,relative:s,viewTransition:p});function u(h){r&&r(h),h.defaultPrevented||x(h)}return S.createElement("a",Wo({},f,{href:b||j,onClick:w||o?r:u,ref:n,target:c}))});var kc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(kc||(kc={}));var Sc;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Sc||(Sc={}));function Fg(e,t){let{target:n,replace:r,state:s,preventScrollReset:o,relative:a,viewTransition:l}=t===void 0?{}:t,c=ch(),d=di(),m=uh(e,{relative:a});return S.useCallback(p=>{if(Ig(p,n)){p.preventDefault();let f=r!==void 0?r:Ws(d)===Ws(m);c(e,{replace:f,state:s,preventScrollReset:o,relative:a,viewTransition:l})}},[d,c,m,r,s,n,e,o,a,l])}const Vg=typeof window<"u"?window.location.origin:"http://localhost:3000";var Pc;const vt=((Pc={}.VITE_API_URL)==null?void 0:Pc.replace(/\/$/,""))||Vg,U=(e,t)=>{const n=/^https?:\/\//.test(e)?e:`${vt}${e}`;return fetch(n,t)},Mg=({onSubmit:e,onCancel:t})=>{const[n,r]=S.useState({name:"",organization:"",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"",flightDate:"",segment:1}],expectedArrival:"",needsAirportPickup:!0,needsVenueTransport:!0,notes:""}),[s,o]=S.useState({}),[a,l]=S.useState({}),c=w=>{var x;w.preventDefault();const j=((x=n.flights)==null?void 0:x.filter(u=>u.flightNumber))||[];e({...n,flights:j.length>0?j:void 0})},d=w=>{const{name:j,value:x,type:u}=w.target;if(u==="checkbox"){const h=w.target.checked;r(y=>({...y,[j]:h}))}else r(h=>({...h,[j]:x}))},m=w=>{r(j=>({...j,transportMode:w,flights:w==="flight"?[{flightNumber:"",flightDate:"",segment:1}]:void 0,expectedArrival:w==="self-driving"?j.expectedArrival:"",needsAirportPickup:w==="flight"})),w!=="flight"&&l({})},p=(w,j,x)=>{r(u=>{var h;return{...u,flights:((h=u.flights)==null?void 0:h.map((y,v)=>v===w?{...y,[j]:x,validated:!1}:y))||[]}}),l(u=>({...u,[w]:""}))},f=()=>{const w=n.flights||[];w.length<3&&r(j=>{var x;return{...j,flights:[...w,{flightNumber:"",flightDate:((x=w[w.length-1])==null?void 0:x.flightDate)||"",segment:w.length+1}]}})},g=w=>{r(j=>{var x;return{...j,flights:((x=j.flights)==null?void 0:x.filter((u,h)=>h!==w).map((u,h)=>({...u,segment:h+1})))||[]}}),l(j=>{const x={...j};return delete x[w],x})},b=async w=>{var x;const j=(x=n.flights)==null?void 0:x[w];if(!j||!j.flightNumber||!j.flightDate){l(u=>({...u,[w]:"Please enter flight number and date"}));return}o(u=>({...u,[w]:!0})),l(u=>({...u,[w]:""}));try{const u=`/api/flights/${j.flightNumber}?date=${j.flightDate}`,h=await fetch(u);if(h.ok){const y=await h.json();r(v=>{var N;return{...v,flights:((N=v.flights)==null?void 0:N.map((k,C)=>C===w?{...k,validated:!0,validationData:y}:k))||[]}}),l(v=>({...v,[w]:""}))}else{const y=await h.json();l(v=>({...v,[w]:y.error||"Invalid flight number"}))}}catch{l(h=>({...h,[w]:"Error validating flight"}))}finally{o(u=>({...u,[w]:!1}))}};return i.jsx("div",{className:"modal-overlay",children:i.jsxs("div",{className:"modal-content",children:[i.jsxs("div",{className:"modal-header",children:[i.jsx("h2",{className:"text-2xl font-bold text-slate-800",children:"Add New VIP"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Enter VIP details and travel information"})]}),i.jsx("div",{className:"modal-body",children:i.jsxs("form",{onSubmit:c,className:"space-y-8",children:[i.jsxs("div",{className:"form-section",children:[i.jsx("div",{className:"form-section-header",children:i.jsx("h3",{className:"form-section-title",children:"Basic Information"})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"name",className:"form-label",children:"Full Name *"}),i.jsx("input",{type:"text",id:"name",name:"name",value:n.name,onChange:d,className:"form-input",placeholder:"Enter full name",required:!0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"organization",className:"form-label",children:"Organization *"}),i.jsx("input",{type:"text",id:"organization",name:"organization",value:n.organization,onChange:d,className:"form-input",placeholder:"Enter organization name",required:!0})]})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"department",className:"form-label",children:"Department *"}),i.jsxs("select",{id:"department",name:"department",value:n.department,onChange:d,className:"form-select",required:!0,children:[i.jsx("option",{value:"Office of Development",children:"Office of Development"}),i.jsx("option",{value:"Admin",children:"Admin"})]})]})]}),i.jsxs("div",{className:"form-section",children:[i.jsx("div",{className:"form-section-header",children:i.jsx("h3",{className:"form-section-title",children:"Transportation Details"})}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{className:"form-label",children:"How are you arriving? *"}),i.jsxs("div",{className:"radio-group",children:[i.jsxs("div",{className:`radio-option ${n.transportMode==="flight"?"selected":""}`,onClick:()=>m("flight"),children:[i.jsx("input",{type:"radio",name:"transportMode",value:"flight",checked:n.transportMode==="flight",onChange:()=>m("flight"),className:"form-radio mr-3"}),i.jsx("span",{className:"font-medium",children:"Arriving by Flight"})]}),i.jsxs("div",{className:`radio-option ${n.transportMode==="self-driving"?"selected":""}`,onClick:()=>m("self-driving"),children:[i.jsx("input",{type:"radio",name:"transportMode",value:"self-driving",checked:n.transportMode==="self-driving",onChange:()=>m("self-driving"),className:"form-radio mr-3"}),i.jsx("span",{className:"font-medium",children:"Self-Driving"})]})]})]}),n.transportMode==="flight"&&n.flights&&i.jsxs("div",{className:"space-y-6",children:[n.flights.map((w,j)=>{var x,u;return i.jsxs("div",{className:"bg-white border-2 border-blue-200 rounded-xl p-6 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("h4",{className:"text-lg font-bold text-slate-800",children:j===0?"Primary Flight":`Connecting Flight ${j}`}),j>0&&i.jsx("button",{type:"button",onClick:()=>g(j),className:"text-red-500 hover:text-red-700 font-medium text-sm bg-red-50 hover:bg-red-100 px-3 py-1 rounded-lg transition-colors duration-200",children:"Remove"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:`flightNumber-${j}`,className:"form-label",children:"Flight Number *"}),i.jsx("input",{type:"text",id:`flightNumber-${j}`,value:w.flightNumber,onChange:h=>p(j,"flightNumber",h.target.value),className:"form-input",placeholder:"e.g., AA123",required:j===0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:`flightDate-${j}`,className:"form-label",children:"Flight Date *"}),i.jsx("input",{type:"date",id:`flightDate-${j}`,value:w.flightDate,onChange:h=>p(j,"flightDate",h.target.value),className:"form-input",required:j===0,min:new Date().toISOString().split("T")[0]})]})]}),i.jsx("button",{type:"button",className:"btn btn-secondary w-full",onClick:()=>b(j),disabled:s[j]||!w.flightNumber||!w.flightDate,children:s[j]?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"animate-spin inline-block w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Validating Flight..."]}):i.jsx(i.Fragment,{children:"Validate Flight"})}),a[j]&&i.jsx("div",{className:"mt-4 bg-red-50 border border-red-200 rounded-lg p-4",children:i.jsx("div",{className:"text-red-700 font-medium",children:a[j]})}),w.validated&&w.validationData&&i.jsxs("div",{className:"mt-4 bg-green-50 border border-green-200 rounded-lg p-4",children:[i.jsxs("div",{className:"text-green-700 font-medium mb-2",children:["Valid: ",w.validationData.airline||"Flight"," - ",(x=w.validationData.departure)==null?void 0:x.airport," → ",(u=w.validationData.arrival)==null?void 0:u.airport]}),w.validationData.flightDate!==w.flightDate&&i.jsxs("div",{className:"text-sm text-green-600",children:["Live tracking starts 4 hours before departure on ",new Date(w.flightDate).toLocaleDateString()]})]})]},j)}),n.flights.length<3&&i.jsx("button",{type:"button",className:"btn btn-secondary w-full",onClick:f,children:"Add Connecting Flight"}),i.jsxs("div",{className:"checkbox-option checked",children:[i.jsx("input",{type:"checkbox",name:"needsAirportPickup",checked:n.needsAirportPickup||!1,onChange:d,className:"form-checkbox mr-3"}),i.jsx("span",{className:"font-medium",children:"Needs Airport Pickup (from final destination)"})]})]}),n.transportMode==="self-driving"&&i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"expectedArrival",className:"form-label",children:"Expected Arrival *"}),i.jsx("input",{type:"datetime-local",id:"expectedArrival",name:"expectedArrival",value:n.expectedArrival,onChange:d,className:"form-input",required:!0})]}),i.jsxs("div",{className:`checkbox-option ${n.needsVenueTransport?"checked":""}`,children:[i.jsx("input",{type:"checkbox",name:"needsVenueTransport",checked:n.needsVenueTransport,onChange:d,className:"form-checkbox mr-3"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Needs Transportation Between Venues"}),i.jsx("div",{className:"text-sm text-slate-500 mt-1",children:"Check this if the VIP needs rides between different event locations"})]})]})]}),i.jsxs("div",{className:"form-section",children:[i.jsx("div",{className:"form-section-header",children:i.jsx("h3",{className:"form-section-title",children:"Additional Information"})}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"notes",className:"form-label",children:"Additional Notes"}),i.jsx("textarea",{id:"notes",name:"notes",value:n.notes,onChange:d,rows:4,className:"form-textarea",placeholder:"Special requirements, dietary restrictions, accessibility needs, etc."})]})]}),i.jsxs("div",{className:"form-actions",children:[i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn btn-primary",children:"Add VIP"})]})]})})]})})},Ug=({vip:e,onSubmit:t,onCancel:n})=>{const r=e.flights||(e.flightNumber?[{flightNumber:e.flightNumber,flightDate:e.flightDate||"",segment:1}]:[{flightNumber:"",flightDate:"",segment:1}]),[s,o]=S.useState({id:e.id,name:e.name,organization:e.organization,transportMode:e.transportMode||"flight",flights:r,expectedArrival:e.expectedArrival?e.expectedArrival.slice(0,16):"",arrivalTime:e.arrivalTime?e.arrivalTime.slice(0,16):"",needsAirportPickup:e.needsAirportPickup!==!1,needsVenueTransport:e.needsVenueTransport!==!1,notes:e.notes||""}),[a,l]=S.useState({}),[c,d]=S.useState({}),[m,p]=S.useState(!1),f=async h=>{var y;h.preventDefault(),p(!0);try{const v=((y=s.flights)==null?void 0:y.filter(N=>N.flightNumber))||[];await t({...s,flights:v.length>0?v:void 0})}catch(v){console.error("Error updating VIP:",v)}finally{p(!1)}},g=h=>{const{name:y,value:v,type:N}=h.target;if(N==="checkbox"){const k=h.target.checked;o(C=>({...C,[y]:k}))}else o(k=>({...k,[y]:v}))},b=h=>{o(y=>({...y,transportMode:h,flights:h==="flight"?y.flights||[{flightNumber:"",flightDate:"",segment:1}]:void 0,expectedArrival:h==="self-driving"?y.expectedArrival:"",needsAirportPickup:h==="flight"})),h!=="flight"&&d({})},w=(h,y,v)=>{o(N=>{var k;return{...N,flights:((k=N.flights)==null?void 0:k.map((C,z)=>z===h?{...C,[y]:v,validated:!1}:C))||[]}}),d(N=>({...N,[h]:""}))},j=()=>{const h=s.flights||[];h.length<3&&o(y=>{var v;return{...y,flights:[...h,{flightNumber:"",flightDate:((v=h[h.length-1])==null?void 0:v.flightDate)||"",segment:h.length+1}]}})},x=h=>{o(y=>{var v;return{...y,flights:((v=y.flights)==null?void 0:v.filter((N,k)=>k!==h).map((N,k)=>({...N,segment:k+1})))||[]}}),d(y=>{const v={...y};return delete v[h],v})},u=async h=>{var v;const y=(v=s.flights)==null?void 0:v[h];if(!y||!y.flightNumber||!y.flightDate){d(N=>({...N,[h]:"Please enter flight number and date"}));return}l(N=>({...N,[h]:!0})),d(N=>({...N,[h]:""}));try{const N=`/api/flights/${y.flightNumber}?date=${y.flightDate}`,k=await fetch(N);if(k.ok){const C=await k.json();o(z=>{var A;return{...z,flights:((A=z.flights)==null?void 0:A.map((I,M)=>M===h?{...I,validated:!0,validationData:C}:I))||[]}}),d(z=>({...z,[h]:""}))}else{const C=await k.json();d(z=>({...z,[h]:C.error||"Invalid flight number"}))}}catch{d(k=>({...k,[h]:"Error validating flight"}))}finally{l(N=>({...N,[h]:!1}))}};return i.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl border border-slate-200/60 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsxs("h2",{className:"text-2xl font-bold text-slate-800 flex items-center gap-2",children:["✏️ Edit VIP: ",e.name]}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Update VIP information and travel arrangements"})]}),i.jsxs("form",{onSubmit:f,className:"p-8 space-y-8",children:[i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"👤 Basic Information"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-slate-700 mb-2",children:"Full Name"}),i.jsx("input",{type:"text",id:"name",name:"name",value:s.name,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Enter full name",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"organization",className:"block text-sm font-medium text-slate-700 mb-2",children:"Organization"}),i.jsx("input",{type:"text",id:"organization",name:"organization",value:s.organization,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Enter organization",required:!0})]})]})]}),i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"🚗 Transportation"}),i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-3",children:"How are you arriving?"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("label",{className:`relative flex items-center p-4 border-2 rounded-xl cursor-pointer transition-all duration-200 ${s.transportMode==="flight"?"border-blue-500 bg-blue-50":"border-slate-300 bg-white hover:border-slate-400"}`,children:[i.jsx("input",{type:"radio",name:"transportMode",value:"flight",checked:s.transportMode==="flight",onChange:()=>b("flight"),className:"sr-only"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-2xl",children:"✈️"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold text-slate-900",children:"Arriving by Flight"}),i.jsx("div",{className:"text-sm text-slate-600",children:"Commercial airline travel"})]})]}),s.transportMode==="flight"&&i.jsx("div",{className:"absolute top-2 right-2 w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs",children:"✓"})})]}),i.jsxs("label",{className:`relative flex items-center p-4 border-2 rounded-xl cursor-pointer transition-all duration-200 ${s.transportMode==="self-driving"?"border-green-500 bg-green-50":"border-slate-300 bg-white hover:border-slate-400"}`,children:[i.jsx("input",{type:"radio",name:"transportMode",value:"self-driving",checked:s.transportMode==="self-driving",onChange:()=>b("self-driving"),className:"sr-only"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-2xl",children:"🚗"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold text-slate-900",children:"Self-Driving"}),i.jsx("div",{className:"text-sm text-slate-600",children:"Personal vehicle"})]})]}),s.transportMode==="self-driving"&&i.jsx("div",{className:"absolute top-2 right-2 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs",children:"✓"})})]})]})]})})]}),s.transportMode==="flight"&&s.flights&&i.jsxs("div",{className:"bg-blue-50 rounded-xl p-6 border border-blue-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"✈️ Flight Information"}),i.jsxs("div",{className:"space-y-6",children:[s.flights.map((h,y)=>{var v,N;return i.jsxs("div",{className:"bg-white rounded-xl border border-blue-200 p-6",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("h4",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:y===0?i.jsx(i.Fragment,{children:"✈️ Primary Flight"}):i.jsxs(i.Fragment,{children:["🔄 Connecting Flight ",y]})}),y>0&&i.jsx("button",{type:"button",onClick:()=>x(y),className:"text-red-600 hover:text-red-700 font-medium text-sm flex items-center gap-1",children:"✕ Remove"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:`flightNumber-${y}`,className:"block text-sm font-medium text-slate-700 mb-2",children:"Flight Number"}),i.jsx("input",{type:"text",id:`flightNumber-${y}`,value:h.flightNumber,onChange:k=>w(y,"flightNumber",k.target.value),className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"e.g., AA123",required:y===0})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:`flightDate-${y}`,className:"block text-sm font-medium text-slate-700 mb-2",children:"Flight Date"}),i.jsx("input",{type:"date",id:`flightDate-${y}`,value:h.flightDate,onChange:k=>w(y,"flightDate",k.target.value),className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",required:y===0,min:new Date().toISOString().split("T")[0]})]})]}),i.jsx("button",{type:"button",onClick:()=>u(y),disabled:a[y]||!h.flightNumber||!h.flightDate,className:"w-full bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 disabled:from-slate-400 disabled:to-slate-500 text-white px-4 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl disabled:cursor-not-allowed",children:a[y]?i.jsxs("span",{className:"flex items-center justify-center gap-2",children:[i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"🔍 Validating..."]}):"🔍 Validate Flight"}),c[y]&&i.jsx("div",{className:"mt-4 bg-red-50 border border-red-200 rounded-xl p-4",children:i.jsxs("div",{className:"text-red-800 font-medium flex items-center gap-2",children:["❌ ",c[y]]})}),h.validated&&h.validationData&&i.jsxs("div",{className:"mt-4 bg-green-50 border border-green-200 rounded-xl p-4",children:[i.jsxs("div",{className:"text-green-800 font-medium flex items-center gap-2 mb-2",children:["✅ Valid Flight: ",h.validationData.airline||"Flight"," - ",(v=h.validationData.departure)==null?void 0:v.airport," → ",(N=h.validationData.arrival)==null?void 0:N.airport]}),h.validationData.flightDate!==h.flightDate&&i.jsxs("div",{className:"text-green-700 text-sm",children:[" Live tracking starts 4 hours before departure on ",new Date(h.flightDate).toLocaleDateString()]})]})]},y)}),s.flights.length<3&&i.jsx("button",{type:"button",onClick:j,className:"w-full bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-4 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl",children:"+ Add Connecting Flight"}),i.jsx("div",{className:"bg-white rounded-xl border border-blue-200 p-4",children:i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",name:"needsAirportPickup",checked:s.needsAirportPickup||!1,onChange:g,className:"w-5 h-5 text-blue-600 border-slate-300 rounded focus:ring-blue-500"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-slate-900",children:"✅ Needs Airport Pickup"}),i.jsx("div",{className:"text-sm text-slate-600",children:"Pickup from final destination airport"})]})]})})]})]}),s.transportMode==="self-driving"&&i.jsxs("div",{className:"bg-green-50 rounded-xl p-6 border border-green-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"🚗 Arrival Information"}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"expectedArrival",className:"block text-sm font-medium text-slate-700 mb-2",children:"Expected Arrival Time"}),i.jsx("input",{type:"datetime-local",id:"expectedArrival",name:"expectedArrival",value:s.expectedArrival,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors",required:!0})]})]}),i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"🚐 Transportation Options"}),i.jsx("div",{className:"bg-white rounded-xl border border-slate-200 p-4",children:i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",name:"needsVenueTransport",checked:s.needsVenueTransport,onChange:g,className:"w-5 h-5 text-blue-600 border-slate-300 rounded focus:ring-blue-500"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-slate-900",children:"🚐 Needs Transportation Between Venues"}),i.jsx("div",{className:"text-sm text-slate-600",children:"Check this if the VIP needs rides between different event locations"})]})]})})]}),i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"📝 Additional Notes"}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"notes",className:"block text-sm font-medium text-slate-700 mb-2",children:"Special Requirements"}),i.jsx("textarea",{id:"notes",name:"notes",value:s.notes,onChange:g,rows:4,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Special requirements, dietary restrictions, accessibility needs, security details, etc."})]})]}),i.jsxs("div",{className:"flex justify-end gap-4 pt-6 border-t border-slate-200",children:[i.jsx("button",{type:"button",className:"px-6 py-3 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors font-medium",onClick:n,disabled:m,children:"Cancel"}),i.jsx("button",{type:"submit",className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed",disabled:m,children:m?i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Updating VIP..."]}):"✏️ Update VIP"})]})]})]})})},ph=({flightNumber:e,flightDate:t})=>{const[n,r]=S.useState(null),[s,o]=S.useState(!0),[a,l]=S.useState(null);if(S.useEffect(()=>{const m=async()=>{try{o(!0);const p=t?`/api/flights/${e}?date=${t}`:`/api/flights/${e}`,f=await fetch(p);if(f.ok){const g=await f.json();r(g),l(null)}else l("Flight not found")}catch{l("Failed to fetch flight data")}finally{o(!1)}};if(e){m();const p=setInterval(m,5*60*1e3);return()=>clearInterval(p)}},[e,t]),s)return i.jsx("div",{className:"flight-status loading",children:"Loading flight data..."});if(a)return i.jsxs("div",{className:"flight-status error",children:["⚠️ ",a]});if(!n)return null;const c=m=>{switch(m.toLowerCase()){case"active":return"#2ecc71";case"scheduled":return"#3498db";case"delayed":return"#f39c12";case"cancelled":return"#e74c3c";default:return"#95a5a6"}},d=m=>new Date(m).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return i.jsxs("div",{className:"flight-status",children:[i.jsxs("div",{className:"flight-header",children:[i.jsxs("h4",{children:["✈️ Flight ",n.flightNumber]}),i.jsx("span",{className:"flight-status-badge",style:{backgroundColor:c(n.status),color:"white",padding:"0.25rem 0.5rem",borderRadius:"4px",fontSize:"0.8rem",textTransform:"uppercase"},children:n.status})]}),i.jsxs("div",{className:"flight-details",children:[i.jsxs("div",{className:"flight-route",children:[i.jsxs("div",{className:"departure",children:[i.jsx("strong",{children:n.departure.airport}),i.jsxs("div",{children:["Scheduled: ",d(n.departure.scheduled)]}),n.departure.estimated&&i.jsxs("div",{children:["Estimated: ",d(n.departure.estimated)]})]}),i.jsx("div",{className:"route-arrow",children:"→"}),i.jsxs("div",{className:"arrival",children:[i.jsx("strong",{children:n.arrival.airport}),i.jsxs("div",{children:["Scheduled: ",d(n.arrival.scheduled)]}),n.arrival.estimated&&i.jsxs("div",{children:["Estimated: ",d(n.arrival.estimated)]})]})]}),n.delay&&n.delay>0&&i.jsxs("div",{className:"delay-info",style:{color:"#f39c12",marginTop:"0.5rem"},children:["⚠️ Delayed by ",n.delay," minutes"]}),n.gate&&i.jsxs("div",{className:"gate-info",style:{marginTop:"0.5rem"},children:["🚪 Gate: ",n.gate]})]})]})},Wg=()=>{const[e,t]=S.useState([]),[n,r]=S.useState(!0),[s,o]=S.useState(!1),[a,l]=S.useState(null),c=g=>{const b=g.trim().split(" ");return b[b.length-1].toLowerCase()},d=g=>[...g].sort((b,w)=>{const j=c(b.name),x=c(w.name);return j.localeCompare(x)});S.useEffect(()=>{(async()=>{try{const b=localStorage.getItem("authToken"),w=await U("/api/vips",{headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"}});if(w.ok){const j=await w.json(),x=d(j);t(x)}else console.error("Failed to fetch VIPs:",w.status)}catch(b){console.error("Error fetching VIPs:",b)}finally{r(!1)}})()},[]);const m=async g=>{try{const b=localStorage.getItem("authToken"),w=await U("/api/vips",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(g)});if(w.ok){const j=await w.json();t(x=>d([...x,j])),o(!1)}else console.error("Failed to add VIP:",w.status)}catch(b){console.error("Error adding VIP:",b)}},p=async g=>{try{const b=localStorage.getItem("authToken"),w=await U(`/api/vips/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(g)});if(w.ok){const j=await w.json();t(x=>d(x.map(u=>u.id===j.id?j:u))),l(null)}else console.error("Failed to update VIP:",w.status)}catch(b){console.error("Error updating VIP:",b)}},f=async g=>{if(confirm("Are you sure you want to delete this VIP?"))try{const b=localStorage.getItem("authToken"),w=await U(`/api/vips/${g}`,{method:"DELETE",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"}});w.ok?t(j=>j.filter(x=>x.id!==g)):console.error("Failed to delete VIP:",w.status)}catch(b){console.error("Error deleting VIP:",b)}};return n?i.jsx("div",{className:"flex justify-center items-center min-h-64",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 flex items-center space-x-4",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading VIPs..."})]})}):i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:"VIP Management"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Manage VIP profiles and travel arrangements"})]}),i.jsx("button",{className:"btn btn-primary",onClick:()=>o(!0),children:"Add New VIP"})]})}),e.length===0?i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-12 border border-slate-200/60 text-center",children:[i.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("div",{className:"w-8 h-8 bg-slate-300 rounded-full"})}),i.jsx("h3",{className:"text-lg font-semibold text-slate-800 mb-2",children:"No VIPs Found"}),i.jsx("p",{className:"text-slate-600 mb-6",children:"Get started by adding your first VIP"}),i.jsx("button",{className:"btn btn-primary",onClick:()=>o(!0),children:"Add New VIP"})]}):i.jsx("div",{className:"space-y-4",children:e.map(g=>i.jsx("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden hover:shadow-xl transition-shadow duration-200",children:i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("h3",{className:"text-xl font-bold text-slate-900",children:g.name}),i.jsx("span",{className:"bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-full",children:g.department})]}),i.jsx("p",{className:"text-slate-600 text-sm mb-4",children:g.organization}),i.jsxs("div",{className:"bg-slate-50 rounded-lg p-4 mb-4",children:[g.transportMode==="flight"?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"font-medium text-slate-700",children:"Flight:"}),i.jsx("span",{className:"text-slate-600",children:g.flights&&g.flights.length>0?g.flights.map(b=>b.flightNumber).join(" → "):g.flightNumber||"No flight"})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"font-medium text-slate-700",children:"Airport Pickup:"}),i.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${g.needsAirportPickup?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:g.needsAirportPickup?"Required":"Not needed"})]})]}):i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"font-medium text-slate-700",children:"Self-driving, Expected:"}),i.jsx("span",{className:"text-slate-600",children:g.expectedArrival?new Date(g.expectedArrival).toLocaleString():"TBD"})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm mt-2",children:[i.jsx("span",{className:"font-medium text-slate-700",children:"Venue Transport:"}),i.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${g.needsVenueTransport?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:g.needsVenueTransport?"Required":"Not needed"})]})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 ml-6",children:[i.jsx(we,{to:`/vips/${g.id}`,className:"btn btn-success text-center",children:"View Details"}),i.jsx("button",{className:"btn btn-secondary",onClick:()=>l(g),children:"Edit"}),i.jsx("button",{className:"btn btn-danger",onClick:()=>f(g.id),children:"Delete"})]})]}),g.transportMode==="flight"&&g.flightNumber&&i.jsx("div",{className:"mt-4 pt-4 border-t border-slate-200",children:i.jsx(ph,{flightNumber:g.flightNumber})})]})},g.id))}),s&&i.jsx(Mg,{onSubmit:m,onCancel:()=>o(!1)}),a&&i.jsx(Ug,{vip:{...a,notes:a.notes||""},onSubmit:p,onCancel:()=>l(null)})]})},Bg=({selectedDriverId:e,onDriverSelect:t,eventTime:n})=>{const[r,s]=S.useState([]),[o,a]=S.useState(!1),[l,c]=S.useState(!1),[d,m]=S.useState(null);S.useEffect(()=>{n.startTime&&n.endTime&&p()},[n.startTime,n.endTime,n.location]);const p=async()=>{a(!0);try{const u=localStorage.getItem("authToken"),h=await U("/api/drivers/availability",{method:"POST",headers:{Authorization:`Bearer ${u}`,"Content-Type":"application/json"},body:JSON.stringify(n)});if(h.ok){const y=await h.json();s(y)}}catch(u){console.error("Error checking driver availability:",u)}finally{a(!1)}},f=u=>{switch(u){case"available":return"🟢";case"scheduled":return"🟡";case"tight_turnaround":return"⚡";case"overlapping":return"🔴";default:return"⚪"}},g=u=>{switch(u){case"available":return"bg-green-50 border-green-200 text-green-800";case"scheduled":return"bg-amber-50 border-amber-200 text-amber-800";case"tight_turnaround":return"bg-orange-50 border-orange-200 text-orange-800";case"overlapping":return"bg-red-50 border-red-200 text-red-800";default:return"bg-slate-50 border-slate-200 text-slate-800"}},b=u=>{switch(u){case"available":return"Available";case"scheduled":return"Busy";case"tight_turnaround":return"Tight Schedule";case"overlapping":return"Conflict";default:return"Unknown"}},w=u=>{u.conflicts.length>0?(m(u),c(!0)):t(u.driverId)},j=()=>{d&&(t(d.driverId),c(!1),m(null))},x=u=>new Date(u).toLocaleString([],{hour:"2-digit",minute:"2-digit"});return o?i.jsx("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-6 h-6 border-2 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-slate-700 font-medium",children:"Checking driver availability..."})]})}):i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-4 flex items-center gap-2",children:"🚗 Assign Driver"}),r.length===0?i.jsxs("div",{className:"text-center py-8",children:[i.jsx("div",{className:"w-12 h-12 bg-slate-200 rounded-full flex items-center justify-center mx-auto mb-3",children:i.jsx("span",{className:"text-xl",children:"🚗"})}),i.jsx("p",{className:"text-slate-500 font-medium",children:"No drivers available"}),i.jsx("p",{className:"text-slate-400 text-sm",children:"Check the time and try again"})]}):i.jsxs("div",{className:"space-y-3",children:[r.map(u=>{var h,y;return i.jsxs("div",{className:`relative rounded-xl border-2 p-4 cursor-pointer transition-all duration-200 hover:shadow-lg ${e===u.driverId?"border-blue-500 bg-blue-50 shadow-lg":"border-slate-200 bg-white hover:border-slate-300"}`,onClick:()=>w(u),children:[e===u.driverId&&i.jsx("div",{className:"absolute top-2 right-2 w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs font-bold",children:"✓"})}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("span",{className:"text-xl",children:f(u.status)}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-slate-900",children:u.driverName}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium border ${g(u.status)}`,children:b(u.status)}),i.jsxs("span",{className:"bg-slate-100 text-slate-700 px-2 py-1 rounded-full text-xs font-medium",children:["🚗 ",u.vehicleCapacity," seats"]}),i.jsxs("span",{className:"bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs font-medium",children:[u.assignmentCount," assignments"]})]})]})]}),u.conflicts.length>0&&i.jsx("div",{className:"space-y-2 mb-3",children:u.conflicts.map((v,N)=>i.jsxs("div",{className:`p-3 rounded-lg border ${v.severity==="high"?"bg-red-50 border-red-200":"bg-amber-50 border-amber-200"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"text-sm",children:v.type==="overlap"?"🔴":"⚡"}),i.jsx("span",{className:`text-sm font-medium ${v.severity==="high"?"text-red-800":"text-amber-800"}`,children:v.type==="overlap"?"Time Overlap":"Tight Turnaround"})]}),i.jsx("p",{className:`text-sm ${v.severity==="high"?"text-red-700":"text-amber-700"}`,children:v.message})]},N))}),u.currentAssignments.length>0&&u.conflicts.length===0&&i.jsxs("div",{className:"bg-slate-100 rounded-lg p-3",children:[i.jsx("p",{className:"text-sm font-medium text-slate-700 mb-1",children:"Next Assignment:"}),i.jsxs("p",{className:"text-sm text-slate-600",children:[(h=u.currentAssignments[0])==null?void 0:h.title," at ",x((y=u.currentAssignments[0])==null?void 0:y.startTime)]})]})]}),u.conflicts.length>0&&i.jsx("div",{className:"ml-4",children:i.jsx("span",{className:"bg-amber-100 text-amber-800 px-3 py-1 rounded-full text-xs font-bold",children:"⚠️ CONFLICTS"})})]})]},u.driverId)}),e&&i.jsx("button",{onClick:()=>t(""),className:"w-full bg-slate-100 hover:bg-slate-200 text-slate-700 px-4 py-3 rounded-lg font-medium transition-colors border border-slate-200",children:"❌ Clear Driver Assignment"})]}),l&&d&&i.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl border border-slate-200/60 w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h3",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:"⚠️ Driver Assignment Conflict"}),i.jsxs("p",{className:"text-slate-600 mt-1",children:[i.jsx("strong",{children:d.driverName})," has scheduling conflicts that need your attention"]})]}),i.jsxs("div",{className:"p-8 space-y-6",children:[i.jsx("div",{className:"bg-slate-50 rounded-xl p-4 border border-slate-200",children:i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("span",{className:"text-2xl",children:"🚗"}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-slate-900",children:d.driverName}),i.jsxs("p",{className:"text-sm text-slate-600",children:["Vehicle Capacity: ",d.vehicleCapacity," passengers • Current Assignments: ",d.assignmentCount]})]})]})}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-slate-800 mb-3",children:"Scheduling Conflicts:"}),i.jsx("div",{className:"space-y-3",children:d.conflicts.map((u,h)=>i.jsxs("div",{className:`p-4 rounded-xl border ${u.severity==="high"?"bg-red-50 border-red-200":"bg-amber-50 border-amber-200"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"text-lg",children:u.type==="overlap"?"🔴":"⚡"}),i.jsx("span",{className:`font-bold ${u.severity==="high"?"text-red-800":"text-amber-800"}`,children:u.type==="overlap"?"Time Overlap":"Tight Turnaround"})]}),i.jsx("p",{className:`mb-2 ${u.severity==="high"?"text-red-700":"text-amber-700"}`,children:u.message}),i.jsxs("div",{className:"text-sm text-slate-600 bg-white/50 rounded-lg p-2",children:[i.jsx("strong",{children:"Conflicting event:"})," ",u.conflictingEvent.title,i.jsx("br",{}),i.jsx("strong",{children:"Time:"})," ",x(u.conflictingEvent.startTime)," - ",x(u.conflictingEvent.endTime),i.jsx("br",{}),i.jsx("strong",{children:"VIP:"})," ",u.conflictingEvent.vipName]})]},h))})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-bold text-slate-800 mb-3",children:"Current Schedule:"}),i.jsx("div",{className:"bg-slate-50 rounded-xl p-4 border border-slate-200",children:d.currentAssignments.length===0?i.jsx("p",{className:"text-slate-500 text-sm",children:"No current assignments"}):i.jsx("div",{className:"space-y-2",children:d.currentAssignments.map((u,h)=>i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"w-2 h-2 bg-blue-500 rounded-full"}),i.jsx("span",{className:"font-medium",children:u.title}),i.jsxs("span",{className:"text-slate-500",children:["(",x(u.startTime)," - ",x(u.endTime),")"]}),i.jsxs("span",{className:"text-slate-400",children:["• ",u.vipName]})]},h))})})]})]}),i.jsxs("div",{className:"flex justify-end gap-4 p-8 border-t border-slate-200",children:[i.jsx("button",{className:"px-6 py-3 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors font-medium",onClick:()=>c(!1),children:"Choose Different Driver"}),i.jsx("button",{className:"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl",onClick:j,children:"⚠️ Assign Anyway"})]})]})})]})},Kg=({vipId:e,vipName:t})=>{const[n,r]=S.useState([]),[s,o]=S.useState(!1),[a,l]=S.useState(null),[c,d]=S.useState([]);S.useEffect(()=>{m(),p()},[e]);const m=async()=>{try{const v=localStorage.getItem("authToken"),N=await U(`/api/vips/${e}/schedule`,{headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"}});if(N.ok){const k=await N.json();r(k)}}catch(v){console.error("Error fetching schedule:",v)}},p=async()=>{try{const v=localStorage.getItem("authToken"),N=await U("/api/drivers",{headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"}});if(N.ok){const k=await N.json();d(k)}}catch(v){console.error("Error fetching drivers:",v)}},f=v=>{const N=c.find(k=>k.id===v);return N?N.name:`Driver ID: ${v}`},g=v=>{switch(v){case"scheduled":return"#3498db";case"in-progress":return"#f39c12";case"completed":return"#2ecc71";case"cancelled":return"#e74c3c";default:return"#95a5a6"}},b=v=>{switch(v){case"transport":return"🚗";case"meeting":return"🤝";case"event":return"🎉";case"meal":return"🍽️";case"accommodation":return"🏨";default:return"📅"}},w=v=>{try{const N=new Date(v);if(isNaN(N.getTime()))return"Invalid Time";const k=N.getHours(),C=N.getMinutes(),z=k>=12?"PM":"AM",A=k%12||12,I=C.toString().padStart(2,"0");return`${A}:${I} ${z}`}catch(N){return console.error("Error formatting time:",N,v),"Time Error"}},x=(v=>{const N={};return v.forEach(k=>{const C=new Date(k.startTime).toDateString();N[C]||(N[C]=[]),N[C].push(k)}),Object.keys(N).forEach(k=>{N[k].sort((C,z)=>new Date(C.startTime).getTime()-new Date(z.startTime).getTime())}),N})(n);return i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsx("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 px-8 py-6 border-b border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:["📅 Schedule for ",t]}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Manage daily events and activities"})]}),i.jsx("button",{className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:()=>o(!0),children:" Add Event"})]})}),i.jsx("div",{className:"p-8",children:Object.keys(x).length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl",children:"📅"})}),i.jsx("p",{className:"text-slate-500 font-medium mb-2",children:"No scheduled events"}),i.jsx("p",{className:"text-slate-400 text-sm",children:'Click "Add Event" to get started with scheduling'})]}):i.jsx("div",{className:"space-y-8",children:Object.entries(x).map(([v,N])=>i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"bg-gradient-to-r from-slate-600 to-slate-700 text-white px-6 py-3 rounded-xl shadow-lg",children:i.jsx("h3",{className:"text-lg font-bold",children:new Date(v).toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric"})})}),i.jsx("div",{className:"grid gap-4",children:N.map(k=>i.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-slate-100 rounded-xl border border-slate-200/60 p-6 hover:shadow-lg transition-all duration-200",children:i.jsxs("div",{className:"flex items-start gap-6",children:[i.jsx("div",{className:"flex-shrink-0 text-center",children:i.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-3 shadow-sm",children:[i.jsx("div",{className:"text-sm font-bold text-slate-900",children:w(k.startTime)}),i.jsx("div",{className:"text-xs text-slate-500 mt-1",children:"to"}),i.jsx("div",{className:"text-sm font-bold text-slate-900",children:w(k.endTime)})]})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("span",{className:"text-2xl",children:b(k.type)}),i.jsx("h4",{className:"text-lg font-bold text-slate-900",children:k.title}),i.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-bold text-white shadow-sm",style:{backgroundColor:g(k.status)},children:k.status.toUpperCase()})]}),i.jsxs("div",{className:"flex items-center gap-2 text-slate-600 mb-2",children:[i.jsx("span",{children:"📍"}),i.jsx("span",{className:"font-medium",children:k.location})]}),k.description&&i.jsx("div",{className:"text-slate-600 mb-3 bg-white/50 rounded-lg p-3 border border-slate-200/50",children:k.description}),k.assignedDriverId?i.jsxs("div",{className:"flex items-center gap-2 text-slate-600 mb-4",children:[i.jsx("span",{children:"👤"}),i.jsxs("span",{className:"font-medium",children:["Driver: ",f(k.assignedDriverId)]})]}):i.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-amber-800 mb-2",children:[i.jsx("span",{children:"⚠️"}),i.jsx("span",{className:"font-medium text-sm",children:"No Driver Assigned"})]}),i.jsx("p",{className:"text-amber-700 text-xs mb-2",children:"This event needs a driver to ensure VIP transportation"}),i.jsx("button",{className:"bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white px-3 py-1 rounded-lg text-xs font-medium transition-all duration-200 shadow-sm hover:shadow-md",onClick:()=>l(k),children:"🚗 Assign Driver"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl",onClick:()=>l(k),children:"✏️ Edit"}),k.status==="scheduled"&&i.jsx("button",{className:"bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl",onClick:()=>y(k.id,"in-progress"),children:"▶️ Start"}),k.status==="in-progress"&&i.jsx("button",{className:"bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl",onClick:()=>y(k.id,"completed"),children:"✅ Complete"}),k.status==="completed"&&i.jsx("span",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-xs font-medium",children:"✅ Completed"})]})]})]})},k.id))})]},v))})}),s&&i.jsx(Cc,{vipId:e,onSubmit:u,onCancel:()=>o(!1)}),a&&i.jsx(Cc,{vipId:e,event:a,onSubmit:h,onCancel:()=>l(null)})]});async function u(v){try{const N=localStorage.getItem("authToken"),k=await U(`/api/vips/${e}/schedule`,{method:"POST",headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"},body:JSON.stringify(v)});if(k.ok)await m(),o(!1);else throw await k.json()}catch(N){throw console.error("Error adding event:",N),N}}async function h(v){try{const N=localStorage.getItem("authToken"),k=await U(`/api/vips/${e}/schedule/${v.id}`,{method:"PUT",headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"},body:JSON.stringify(v)});if(k.ok)await m(),l(null);else throw await k.json()}catch(N){throw console.error("Error updating event:",N),N}}async function y(v,N){try{const k=localStorage.getItem("authToken");(await U(`/api/vips/${e}/schedule/${v}/status`,{method:"PATCH",headers:{Authorization:`Bearer ${k}`,"Content-Type":"application/json"},body:JSON.stringify({status:N})})).ok&&await m()}catch(k){console.error("Error updating event status:",k)}}},Cc=({vipId:e,event:t,onSubmit:n,onCancel:r})=>{var b,w;const[s,o]=S.useState({title:(t==null?void 0:t.title)||"",location:(t==null?void 0:t.location)||"",startTime:((b=t==null?void 0:t.startTime)==null?void 0:b.slice(0,16))||"",endTime:((w=t==null?void 0:t.endTime)==null?void 0:w.slice(0,16))||"",description:(t==null?void 0:t.description)||"",type:(t==null?void 0:t.type)||"event",assignedDriverId:(t==null?void 0:t.assignedDriverId)||""}),[a,l]=S.useState([]),[c,d]=S.useState([]),[m,p]=S.useState(!1),f=async j=>{j.preventDefault(),p(!0),l([]),d([]);try{await n({...s,id:t==null?void 0:t.id,startTime:new Date(s.startTime).toISOString(),endTime:new Date(s.endTime).toISOString(),status:(t==null?void 0:t.status)||"scheduled"})}catch(x){x.validationErrors&&l(x.validationErrors),x.warnings&&d(x.warnings)}finally{p(!1)}},g=j=>{const{name:x,value:u}=j.target;o(h=>({...h,[x]:u}))};return i.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl border border-slate-200/60 w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800",children:t?"✏️ Edit Event":" Add New Event"}),i.jsx("p",{className:"text-slate-600 mt-1",children:t?"Update event details":"Create a new schedule event"})]}),i.jsxs("form",{onSubmit:f,className:"p-8 space-y-6",children:[a.length>0&&i.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4",children:[i.jsx("h4",{className:"text-red-800 font-semibold mb-2",children:"❌ Validation Errors:"}),i.jsx("ul",{className:"text-red-700 space-y-1",children:a.map((j,x)=>i.jsxs("li",{className:"text-sm",children:["• ",j.message]},x))})]}),c.length>0&&i.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:[i.jsx("h4",{className:"text-amber-800 font-semibold mb-2",children:"⚠️ Warnings:"}),i.jsx("ul",{className:"text-amber-700 space-y-1",children:c.map((j,x)=>i.jsxs("li",{className:"text-sm",children:["• ",j.message]},x))})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"md:col-span-2",children:[i.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-slate-700 mb-2",children:"Event Title"}),i.jsx("input",{type:"text",id:"title",name:"title",value:s.title,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Enter event title",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"type",className:"block text-sm font-medium text-slate-700 mb-2",children:"Event Type"}),i.jsxs("select",{id:"type",name:"type",value:s.type,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",required:!0,children:[i.jsx("option",{value:"transport",children:"🚗 Transport"}),i.jsx("option",{value:"meeting",children:"🤝 Meeting"}),i.jsx("option",{value:"event",children:"🎉 Event"}),i.jsx("option",{value:"meal",children:"🍽️ Meal"}),i.jsx("option",{value:"accommodation",children:"🏨 Accommodation"})]})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"location",className:"block text-sm font-medium text-slate-700 mb-2",children:"Location"}),i.jsx("input",{type:"text",id:"location",name:"location",value:s.location,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Enter location",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"startTime",className:"block text-sm font-medium text-slate-700 mb-2",children:"Start Time"}),i.jsx("input",{type:"datetime-local",id:"startTime",name:"startTime",value:s.startTime,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"endTime",className:"block text-sm font-medium text-slate-700 mb-2",children:"End Time"}),i.jsx("input",{type:"datetime-local",id:"endTime",name:"endTime",value:s.endTime,onChange:g,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",required:!0})]}),i.jsxs("div",{className:"md:col-span-2",children:[i.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-slate-700 mb-2",children:"Description"}),i.jsx("textarea",{id:"description",name:"description",value:s.description,onChange:g,rows:3,className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",placeholder:"Enter event description (optional)"})]}),i.jsx("div",{className:"md:col-span-2",children:i.jsx(Bg,{selectedDriverId:s.assignedDriverId,onDriverSelect:j=>o(x=>({...x,assignedDriverId:j})),eventTime:{startTime:s.startTime?new Date(s.startTime).toISOString():"",endTime:s.endTime?new Date(s.endTime).toISOString():"",location:s.location}})})]}),i.jsxs("div",{className:"flex justify-end gap-4 pt-6 border-t border-slate-200",children:[i.jsx("button",{type:"button",className:"px-6 py-3 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors font-medium",onClick:r,disabled:m,children:"Cancel"}),i.jsx("button",{type:"submit",className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed",disabled:m,children:m?i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t?"Updating...":"Creating..."]}):t?"✏️ Update Event":" Create Event"})]})]})]})})},Hg=()=>{const{id:e}=dh(),[t,n]=S.useState(null),[r,s]=S.useState(!0),[o,a]=S.useState(null),[l,c]=S.useState([]);S.useEffect(()=>{e&&(async()=>{try{const g=localStorage.getItem("authToken"),b=await U("/api/vips",{headers:{Authorization:`Bearer ${g}`,"Content-Type":"application/json"}});if(b.ok){const j=(await b.json()).find(x=>x.id===e);j?n(j):a("VIP not found")}else a("Failed to fetch VIP data")}catch{a("Error loading VIP data")}finally{s(!1)}})()},[e]),S.useEffect(()=>{(async()=>{if(t)try{const g=localStorage.getItem("authToken"),b=await U(`/api/vips/${t.id}/schedule`,{headers:{Authorization:`Bearer ${g}`,"Content-Type":"application/json"}});if(b.ok){const w=await b.json();c(w)}}catch(g){console.error("Error fetching schedule:",g)}})()},[t]),S.useEffect(()=>{t&&window.location.hash==="#schedule"&&setTimeout(()=>{const f=document.getElementById("schedule-section");f&&f.scrollIntoView({behavior:"smooth"})},100)},[t]);const d=()=>{if(!t)return null;if(t.transportMode==="flight"){if(t.flights&&t.flights.length>0)return{flights:t.flights,primaryFlight:t.flights[0]};if(t.flightNumber)return{flights:[{flightNumber:t.flightNumber,flightDate:t.flightDate||"",segment:1}],primaryFlight:{flightNumber:t.flightNumber,flightDate:t.flightDate||"",segment:1}}}return null},m=()=>{if(!t)return;const f=window.open("","_blank");if(!f)return;const g=h=>{const y={};return h.forEach(v=>{const N=new Date(v.startTime).toDateString();y[N]||(y[N]=[]),y[N].push(v)}),Object.keys(y).forEach(v=>{y[v].sort((N,k)=>new Date(N.startTime).getTime()-new Date(k.startTime).getTime())}),y},b=h=>new Date(h).toLocaleString([],{hour:"2-digit",minute:"2-digit"}),w=h=>{switch(h){case"transport":return"🚗";case"meeting":return"🤝";case"event":return"🎉";case"meal":return"🍽️";case"accommodation":return"🏨";default:return"📅"}},j=g(l),x=d(),u=`
<!DOCTYPE html>
<html>
<head>
<title>VIP Schedule - ${t.name}</title>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #2d3748;
background: #ffffff;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 40px 30px;
}
.header {
text-align: center;
margin-bottom: 40px;
padding-bottom: 30px;
border-bottom: 3px solid #e2e8f0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 40px 30px;
border-radius: 15px;
margin: -40px -30px 40px -30px;
}
.header h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 10px;
text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header h2 {
font-size: 1.8rem;
font-weight: 600;
margin-bottom: 20px;
opacity: 0.95;
}
.vip-info {
background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
padding: 25px;
border-radius: 12px;
margin-bottom: 30px;
border: 1px solid #e2e8f0;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.vip-info p {
margin-bottom: 8px;
font-size: 1rem;
}
.vip-info strong {
color: #4a5568;
font-weight: 600;
}
.day-section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.day-header {
background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
color: white;
padding: 20px 25px;
font-size: 1.3rem;
font-weight: 700;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-align: center;
}
.event {
background: white;
border: 1px solid #e2e8f0;
margin-bottom: 15px;
padding: 25px;
border-radius: 12px;
display: flex;
align-items: flex-start;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
transition: all 0.2s ease;
}
.event:hover {
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.event-time {
min-width: 120px;
background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
padding: 15px;
border-radius: 8px;
text-align: center;
margin-right: 25px;
border: 1px solid #cbd5e0;
}
.event-time .time {
font-weight: 700;
font-size: 1rem;
color: #2d3748;
display: block;
}
.event-time .separator {
font-size: 0.8rem;
color: #718096;
margin: 5px 0;
}
.event-details {
flex: 1;
}
.event-title {
font-weight: 700;
font-size: 1.2rem;
margin-bottom: 10px;
color: #2d3748;
display: flex;
align-items: center;
gap: 8px;
}
.event-icon {
font-size: 1.3rem;
}
.event-location {
color: #4a5568;
margin-bottom: 8px;
font-weight: 500;
display: flex;
align-items: center;
gap: 6px;
}
.event-description {
background: #f7fafc;
padding: 12px 15px;
border-radius: 8px;
font-style: italic;
color: #4a5568;
margin-bottom: 10px;
border-left: 4px solid #cbd5e0;
}
.event-driver {
color: #3182ce;
font-weight: 600;
font-size: 0.9rem;
background: #ebf8ff;
padding: 8px 12px;
border-radius: 6px;
display: inline-flex;
align-items: center;
gap: 6px;
}
.status-badge {
display: inline-block;
padding: 4px 12px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-scheduled {
background: #bee3f8;
color: #2b6cb0;
}
.status-in-progress {
background: #fbd38d;
color: #c05621;
}
.status-completed {
background: #c6f6d5;
color: #276749;
}
.footer {
margin-top: 50px;
text-align: center;
color: #718096;
font-size: 0.9rem;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
}
.company-logo {
width: 60px;
height: 60px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 20px;
color: white;
font-size: 1.5rem;
font-weight: bold;
}
@media print {
body {
margin: 0;
padding: 0;
}
.container {
padding: 20px;
}
.header {
margin: -20px -20px 30px -20px;
}
.day-section {
page-break-inside: avoid;
}
.event {
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="company-logo">VC</div>
<h1>📅 VIP Schedule</h1>
<h2>${t.name}</h2>
</div>
<div class="vip-info">
<p><strong>Organization:</strong> ${t.organization}</p>
${t.transportMode==="flight"&&x?`
<p><strong>Flight Information:</strong> ${x.flights.map(h=>h.flightNumber).join(" → ")}</p>
<p><strong>Flight Date:</strong> ${x.primaryFlight.flightDate?new Date(x.primaryFlight.flightDate).toLocaleDateString():"TBD"}</p>
`:t.transportMode==="self-driving"?`
<p><strong>Transport Mode:</strong> 🚗 Self-Driving</p>
<p><strong>Expected Arrival:</strong> ${t.expectedArrival?new Date(t.expectedArrival).toLocaleString():"TBD"}</p>
`:""}
<p><strong>Airport Pickup:</strong> ${t.needsAirportPickup?"✅ Required":"❌ Not Required"}</p>
<p><strong>Venue Transport:</strong> ${t.needsVenueTransport?"✅ Required":"❌ Not Required"}</p>
${t.notes?`<p><strong>Special Notes:</strong> ${t.notes}</p>`:""}
</div>
${Object.entries(j).map(([h,y])=>`
<div class="day-section">
<div class="day-header">
${new Date(h).toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric"})}
</div>
${y.map(v=>`
<div class="event">
<div class="event-time">
<span class="time">${b(v.startTime)}</span>
<div class="separator">to</div>
<span class="time">${b(v.endTime)}</span>
</div>
<div class="event-details">
<div class="event-title">
<span class="event-icon">${w(v.type)}</span>
${v.title}
<span class="status-badge status-${v.status}">${v.status}</span>
</div>
<div class="event-location">
<span>📍</span>
${v.location}
</div>
${v.description?`<div class="event-description">${v.description}</div>`:""}
${v.assignedDriverId?`<div class="event-driver"><span>👤</span> Driver: ${v.assignedDriverId}</div>`:""}
</div>
</div>
`).join("")}
</div>
`).join("")}
<div class="footer">
<p><strong>VIP Coordinator System</strong></p>
<p>Generated on ${new Date().toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}</p>
</div>
</div>
</body>
</html>
`;f.document.write(u),f.document.close(),f.focus(),setTimeout(()=>{f.print(),f.close()},250)};if(r)return i.jsx("div",{children:"Loading VIP details..."});if(o||!t)return i.jsxs("div",{children:[i.jsx("h1",{children:"Error"}),i.jsx("p",{children:o||"VIP not found"}),i.jsx(we,{to:"/vips",className:"btn",children:"Back to VIP List"})]});const p=d();return i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:["VIP Details: ",t.name]}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Complete profile and schedule management"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("button",{className:"bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:m,children:"🖨️ Print Schedule"}),i.jsx(we,{to:"/vips",className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl",children:"Back to VIP List"})]})]})}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:"📋 VIP Information"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Personal details and travel arrangements"})]}),i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-slate-50 rounded-xl p-4 border border-slate-200/60",children:[i.jsx("div",{className:"text-sm font-medium text-slate-500 mb-1",children:"Name"}),i.jsx("div",{className:"text-lg font-bold text-slate-900",children:t.name})]}),i.jsxs("div",{className:"bg-slate-50 rounded-xl p-4 border border-slate-200/60",children:[i.jsx("div",{className:"text-sm font-medium text-slate-500 mb-1",children:"Organization"}),i.jsx("div",{className:"text-lg font-bold text-slate-900",children:t.organization})]}),t.transportMode==="flight"&&p?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"bg-blue-50 rounded-xl p-4 border border-blue-200/60",children:[i.jsxs("div",{className:"text-sm font-medium text-blue-600 mb-1",children:["Flight",p.flights.length>1?"s":""]}),i.jsx("div",{className:"text-lg font-bold text-blue-900",children:p.flights.map(f=>f.flightNumber).join(" → ")})]}),i.jsxs("div",{className:"bg-blue-50 rounded-xl p-4 border border-blue-200/60",children:[i.jsx("div",{className:"text-sm font-medium text-blue-600 mb-1",children:"Flight Date"}),i.jsx("div",{className:"text-lg font-bold text-blue-900",children:p.primaryFlight.flightDate?new Date(p.primaryFlight.flightDate).toLocaleDateString():"TBD"})]})]}):t.transportMode==="self-driving"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"bg-green-50 rounded-xl p-4 border border-green-200/60",children:[i.jsx("div",{className:"text-sm font-medium text-green-600 mb-1",children:"Transport Mode"}),i.jsx("div",{className:"text-lg font-bold text-green-900 flex items-center gap-2",children:"🚗 Self-Driving"})]}),i.jsxs("div",{className:"bg-green-50 rounded-xl p-4 border border-green-200/60",children:[i.jsx("div",{className:"text-sm font-medium text-green-600 mb-1",children:"Expected Arrival"}),i.jsx("div",{className:"text-lg font-bold text-green-900",children:t.expectedArrival?new Date(t.expectedArrival).toLocaleString():"TBD"})]})]}):null,i.jsxs("div",{className:`rounded-xl p-4 border ${t.needsAirportPickup?"bg-green-50 border-green-200/60":"bg-red-50 border-red-200/60"}`,children:[i.jsx("div",{className:`text-sm font-medium mb-1 ${t.needsAirportPickup?"text-green-600":"text-red-600"}`,children:"Airport Pickup"}),i.jsx("div",{className:`text-lg font-bold flex items-center gap-2 ${t.needsAirportPickup?"text-green-900":"text-red-900"}`,children:t.needsAirportPickup?"✅ Required":"❌ Not Required"})]}),i.jsxs("div",{className:`rounded-xl p-4 border ${t.needsVenueTransport?"bg-green-50 border-green-200/60":"bg-red-50 border-red-200/60"}`,children:[i.jsx("div",{className:`text-sm font-medium mb-1 ${t.needsVenueTransport?"text-green-600":"text-red-600"}`,children:"Venue Transport"}),i.jsx("div",{className:`text-lg font-bold flex items-center gap-2 ${t.needsVenueTransport?"text-green-900":"text-red-900"}`,children:t.needsVenueTransport?"✅ Required":"❌ Not Required"})]})]}),t.notes&&i.jsxs("div",{className:"mt-6",children:[i.jsx("div",{className:"text-sm font-medium text-slate-500 mb-2",children:"Special Notes"}),i.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:i.jsx("p",{className:"text-amber-800",children:t.notes})})]}),t.assignedDriverIds&&t.assignedDriverIds.length>0&&i.jsxs("div",{className:"mt-6",children:[i.jsx("div",{className:"text-sm font-medium text-slate-500 mb-2",children:"Assigned Drivers"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:t.assignedDriverIds.map(f=>i.jsxs("span",{className:"bg-gradient-to-r from-blue-500 to-blue-600 text-white px-4 py-2 rounded-full text-sm font-medium flex items-center gap-2",children:["👤 ",f]},f))})]})]})]}),t.transportMode==="flight"&&p&&i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-sky-50 to-blue-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:"✈️ Flight Information"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Real-time flight status and details"})]}),i.jsx("div",{className:"p-8 space-y-6",children:p.flights.map((f,g)=>i.jsxs("div",{className:"bg-slate-50 rounded-xl p-6 border border-slate-200/60",children:[i.jsxs("h3",{className:"text-lg font-bold text-slate-900 mb-4",children:[g===0?"Primary Flight":`Connecting Flight ${g}`,": ",f.flightNumber]}),i.jsx(ph,{flightNumber:f.flightNumber,flightDate:f.flightDate})]},g))})]}),i.jsx("div",{id:"schedule-section",children:i.jsx(Kg,{vipId:t.id,vipName:t.name})})]})},Gg=({onSubmit:e,onCancel:t})=>{const[n,r]=S.useState({name:"",phone:"",vehicleCapacity:4}),s=a=>{a.preventDefault(),e(n)},o=a=>{const{name:l,value:c,type:d}=a.target;r(m=>({...m,[l]:d==="number"||l==="vehicleCapacity"?parseInt(c)||0:c}))};return i.jsx("div",{className:"modal-overlay",children:i.jsxs("div",{className:"modal-content",children:[i.jsxs("div",{className:"modal-header",children:[i.jsx("h2",{className:"text-2xl font-bold text-slate-800",children:"Add New Driver"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Enter driver contact information"})]}),i.jsx("div",{className:"modal-body",children:i.jsxs("form",{onSubmit:s,className:"space-y-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"name",className:"form-label",children:"Driver Name *"}),i.jsx("input",{type:"text",id:"name",name:"name",value:n.name,onChange:o,className:"form-input",placeholder:"Enter driver's full name",required:!0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"phone",className:"form-label",children:"Phone Number *"}),i.jsx("input",{type:"tel",id:"phone",name:"phone",value:n.phone,onChange:o,className:"form-input",placeholder:"Enter phone number",required:!0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"vehicleCapacity",className:"form-label",children:"Vehicle Capacity *"}),i.jsxs("select",{id:"vehicleCapacity",name:"vehicleCapacity",value:n.vehicleCapacity,onChange:o,className:"form-input",required:!0,children:[i.jsx("option",{value:2,children:"2 passengers (Sedan/Coupe)"}),i.jsx("option",{value:4,children:"4 passengers (Standard Car)"}),i.jsx("option",{value:6,children:"6 passengers (SUV/Van)"}),i.jsx("option",{value:8,children:"8 passengers (Large Van)"}),i.jsx("option",{value:12,children:"12 passengers (Mini Bus)"})]}),i.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"🚗 Select the maximum number of passengers this vehicle can accommodate"})]}),i.jsxs("div",{className:"form-actions",children:[i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn btn-primary",children:"Add Driver"})]})]})})]})})},Zg=({driver:e,onSubmit:t,onCancel:n})=>{const[r,s]=S.useState({name:e.name,phone:e.phone,vehicleCapacity:e.vehicleCapacity||4,currentLocation:{lat:e.currentLocation.lat,lng:e.currentLocation.lng}}),o=l=>{l.preventDefault(),t({...r,id:e.id})},a=l=>{const{name:c,value:d,type:m}=l.target;s(c==="lat"||c==="lng"?p=>({...p,currentLocation:{...p.currentLocation,[c]:parseFloat(d)||0}}):c==="vehicleCapacity"?p=>({...p,[c]:parseInt(d)||0}):p=>({...p,[c]:d}))};return i.jsx("div",{className:"modal-overlay",children:i.jsxs("div",{className:"modal-content",children:[i.jsxs("div",{className:"modal-header",children:[i.jsx("h2",{className:"text-2xl font-bold text-slate-800",children:"Edit Driver"}),i.jsxs("p",{className:"text-slate-600 mt-2",children:["Update driver information for ",e.name]})]}),i.jsx("div",{className:"modal-body",children:i.jsxs("form",{onSubmit:o,className:"space-y-8",children:[i.jsxs("div",{className:"form-section",children:[i.jsx("div",{className:"form-section-header",children:i.jsx("h3",{className:"form-section-title",children:"Basic Information"})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"name",className:"form-label",children:"Driver Name *"}),i.jsx("input",{type:"text",id:"name",name:"name",value:r.name,onChange:a,className:"form-input",placeholder:"Enter driver's full name",required:!0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"phone",className:"form-label",children:"Phone Number *"}),i.jsx("input",{type:"tel",id:"phone",name:"phone",value:r.phone,onChange:a,className:"form-input",placeholder:"Enter phone number",required:!0})]})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"vehicleCapacity",className:"form-label",children:"Vehicle Capacity *"}),i.jsxs("select",{id:"vehicleCapacity",name:"vehicleCapacity",value:r.vehicleCapacity,onChange:a,className:"form-input",required:!0,children:[i.jsx("option",{value:2,children:"2 passengers (Sedan/Coupe)"}),i.jsx("option",{value:4,children:"4 passengers (Standard Car)"}),i.jsx("option",{value:6,children:"6 passengers (SUV/Van)"}),i.jsx("option",{value:8,children:"8 passengers (Large Van)"}),i.jsx("option",{value:12,children:"12 passengers (Mini Bus)"})]}),i.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"🚗 Select the maximum number of passengers this vehicle can accommodate"})]})]}),i.jsxs("div",{className:"form-section",children:[i.jsx("div",{className:"form-section-header",children:i.jsx("h3",{className:"form-section-title",children:"Current Location"})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"lat",className:"form-label",children:"Latitude *"}),i.jsx("input",{type:"number",id:"lat",name:"lat",value:r.currentLocation.lat,onChange:a,className:"form-input",placeholder:"Enter latitude",step:"any",required:!0})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"lng",className:"form-label",children:"Longitude *"}),i.jsx("input",{type:"number",id:"lng",name:"lng",value:r.currentLocation.lng,onChange:a,className:"form-input",placeholder:"Enter longitude",step:"any",required:!0})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[i.jsxs("p",{className:"text-sm text-blue-700",children:[i.jsx("strong",{children:"Current coordinates:"})," ",r.currentLocation.lat.toFixed(6),", ",r.currentLocation.lng.toFixed(6)]}),i.jsx("p",{className:"text-xs text-blue-600 mt-1",children:"You can use GPS coordinates or get them from a mapping service"})]})]}),i.jsxs("div",{className:"form-actions",children:[i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:n,children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn btn-primary",children:"Update Driver"})]})]})})]})})},Jg=()=>{const[e,t]=S.useState([]),[n,r]=S.useState(!0),[s,o]=S.useState(!1),[a,l]=S.useState(null),c=g=>{const b=g.trim().split(" ");return b[b.length-1].toLowerCase()},d=g=>[...g].sort((b,w)=>{const j=c(b.name),x=c(w.name);return j.localeCompare(x)});S.useEffect(()=>{(async()=>{try{const b=localStorage.getItem("authToken"),w=await U("/api/drivers",{headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"}});if(w.ok){const j=await w.json(),x=d(j);t(x)}else console.error("Failed to fetch drivers:",w.status)}catch(b){console.error("Error fetching drivers:",b)}finally{r(!1)}})()},[]);const m=async g=>{try{const b=localStorage.getItem("authToken"),w=await U("/api/drivers",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(g)});if(w.ok){const j=await w.json();t(x=>d([...x,j])),o(!1)}else console.error("Failed to add driver:",w.status)}catch(b){console.error("Error adding driver:",b)}},p=async g=>{try{const b=localStorage.getItem("authToken"),w=await U(`/api/drivers/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(g)});if(w.ok){const j=await w.json();t(x=>d(x.map(u=>u.id===j.id?j:u))),l(null)}else console.error("Failed to update driver:",w.status)}catch(b){console.error("Error updating driver:",b)}},f=async g=>{if(confirm("Are you sure you want to delete this driver?"))try{const b=localStorage.getItem("authToken"),w=await U(`/api/drivers/${g}`,{method:"DELETE",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"}});w.ok?t(j=>j.filter(x=>x.id!==g)):console.error("Failed to delete driver:",w.status)}catch(b){console.error("Error deleting driver:",b)}};return n?i.jsx("div",{className:"flex justify-center items-center min-h-64",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 flex items-center space-x-4",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading drivers..."})]})}):i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:"Driver Management"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Manage driver profiles and assignments"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsxs("div",{className:"bg-gradient-to-r from-green-500 to-green-600 text-white px-4 py-2 rounded-lg text-sm font-medium",children:[e.length," Active Drivers"]}),i.jsx("button",{className:"btn btn-primary",onClick:()=>o(!0),children:"Add New Driver"})]})]})}),e.length===0?i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-12 border border-slate-200/60 text-center",children:[i.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("div",{className:"w-8 h-8 bg-slate-300 rounded-full"})}),i.jsx("h3",{className:"text-lg font-semibold text-slate-800 mb-2",children:"No Drivers Found"}),i.jsx("p",{className:"text-slate-600 mb-6",children:"Get started by adding your first driver"}),i.jsx("button",{className:"btn btn-primary",onClick:()=>o(!0),children:"Add New Driver"})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(g=>i.jsx("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden hover:shadow-xl transition-shadow duration-200",children:i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-xl font-bold text-slate-900",children:g.name}),i.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-400 to-green-600 rounded-full flex items-center justify-center",children:i.jsx("span",{className:"text-white text-sm font-bold",children:g.name.charAt(0).toUpperCase()})})]}),i.jsxs("div",{className:"space-y-3 mb-6",children:[i.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[i.jsx("div",{className:"text-sm font-medium text-slate-700 mb-1",children:"Contact"}),i.jsx("div",{className:"text-slate-600",children:g.phone})]}),i.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[i.jsx("div",{className:"text-sm font-medium text-slate-700 mb-1",children:"Current Location"}),i.jsxs("div",{className:"text-slate-600 text-sm",children:[g.currentLocation.lat.toFixed(4),", ",g.currentLocation.lng.toFixed(4)]})]}),i.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[i.jsx("div",{className:"text-sm font-medium text-slate-700 mb-1",children:"Vehicle Capacity"}),i.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[i.jsx("span",{children:"🚗"}),i.jsxs("span",{className:"font-medium",children:[g.vehicleCapacity||4," passengers"]})]})]}),i.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[i.jsx("div",{className:"text-sm font-medium text-slate-700 mb-1",children:"Assignments"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded-full",children:[g.assignedVipIds.length," VIPs"]}),i.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded-full ${g.assignedVipIds.length===0?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:g.assignedVipIds.length===0?"Available":"Assigned"})]})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(we,{to:`/drivers/${g.id}`,className:"bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-sm hover:shadow-md w-full text-center block",children:"View Dashboard"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-3 py-2 rounded-lg text-xs font-medium transition-all duration-200 shadow-sm hover:shadow-md flex-1",onClick:()=>l(g),children:"Edit"}),i.jsx("button",{className:"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white px-3 py-2 rounded-lg text-xs font-medium transition-all duration-200 shadow-sm hover:shadow-md flex-1",onClick:()=>f(g.id),children:"Delete"})]})]})]})},g.id))}),s&&i.jsx(Gg,{onSubmit:m,onCancel:()=>o(!1)}),a&&i.jsx(Zg,{driver:a,onSubmit:p,onCancel:()=>l(null)})]})},Xg=({events:e,driverName:t})=>{const n=f=>{switch(f){case"transport":return"#3498db";case"meeting":return"#9b59b6";case"event":return"#e74c3c";case"meal":return"#f39c12";case"accommodation":return"#2ecc71";default:return"#95a5a6"}},r=f=>{switch(f){case"completed":return .5;case"cancelled":return .3;case"in-progress":return 1;case"scheduled":return .8;default:return .8}},s=f=>{switch(f){case"transport":return"🚗";case"meeting":return"🤝";case"event":return"🎉";case"meal":return"🍽️";case"accommodation":return"🏨";default:return"📅"}},o=f=>new Date(f).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),a=()=>{if(e.length===0)return{start:new Date,end:new Date};const f=e.flatMap(x=>[new Date(x.startTime),new Date(x.endTime)]),g=new Date(Math.min(...f.map(x=>x.getTime()))),b=new Date(Math.max(...f.map(x=>x.getTime()))),w=new Date(g.getTime()-30*60*1e3),j=new Date(b.getTime()+30*60*1e3);return{start:w,end:j}},l=(f,g)=>{const b=g.end.getTime()-g.start.getTime(),w=new Date(f.startTime),j=new Date(f.endTime),x=w.getTime()-g.start.getTime(),u=j.getTime()-w.getTime(),h=x/b*100,y=u/b*100;return{left:h,width:y}},c=f=>{const g=[],b=new Date(f.start);for(b.setMinutes(0,0,0);b<=f.end;)g.push(new Date(b)),b.setHours(b.getHours()+1);return g};if(e.length===0)return i.jsxs("div",{className:"card",children:[i.jsx("h3",{children:"📊 Schedule Gantt Chart"}),i.jsx("p",{children:"No events to display in Gantt chart."})]});const d=a(),m=c(d),p=d.end.getTime()-d.start.getTime();return i.jsxs("div",{className:"card",children:[i.jsxs("h3",{children:["📊 Schedule Gantt Chart - ",t]}),i.jsxs("div",{style:{marginBottom:"1rem",fontSize:"0.9rem",color:"#666"},children:["Timeline: ",d.start.toLocaleDateString()," ",o(d.start.toISOString())," - ",o(d.end.toISOString())]}),i.jsxs("div",{style:{border:"1px solid #ddd",borderRadius:"6px",overflow:"hidden",backgroundColor:"#fff"},children:[i.jsx("div",{style:{display:"flex",borderBottom:"2px solid #333",backgroundColor:"#f8f9fa",position:"relative",height:"40px",alignItems:"center"},children:m.map((f,g)=>{const b=(f.getTime()-d.start.getTime())/p*100;return i.jsx("div",{style:{position:"absolute",left:`${b}%`,transform:"translateX(-50%)",fontSize:"0.8rem",fontWeight:"bold",color:"#333",whiteSpace:"nowrap"},children:o(f.toISOString())},g)})}),i.jsx("div",{style:{padding:"1rem 0"},children:e.map((f,g)=>{const b=l(f,d);return i.jsxs("div",{style:{position:"relative",height:"60px",marginBottom:"8px",borderRadius:"4px",border:"1px solid #e9ecef"},children:[i.jsxs("div",{style:{position:"absolute",left:`${b.left}%`,width:`${b.width}%`,height:"100%",backgroundColor:n(f.type),opacity:r(f.status),borderRadius:"4px",display:"flex",alignItems:"center",padding:"0 8px",color:"white",fontSize:"0.8rem",fontWeight:"bold",overflow:"hidden",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",cursor:"pointer",transition:"transform 0.2s ease"},onMouseEnter:w=>{w.currentTarget.style.transform="scale(1.02)",w.currentTarget.style.zIndex="10"},onMouseLeave:w=>{w.currentTarget.style.transform="scale(1)",w.currentTarget.style.zIndex="1"},title:`${f.title}
${f.location}
${f.vipName}
${o(f.startTime)} - ${o(f.endTime)}`,children:[i.jsx("span",{style:{marginRight:"4px"},children:s(f.type)}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:f.title})]}),b.width<15&&i.jsxs("div",{style:{position:"absolute",left:`${b.left+b.width+1}%`,top:"50%",transform:"translateY(-50%)",fontSize:"0.7rem",color:"#666",whiteSpace:"nowrap",backgroundColor:"#f8f9fa",padding:"2px 6px",borderRadius:"3px",border:"1px solid #e9ecef"},children:[s(f.type)," ",f.title," - ",f.vipName]})]},f.id)})}),i.jsxs("div",{style:{borderTop:"1px solid #ddd",padding:"1rem",backgroundColor:"#f8f9fa"},children:[i.jsx("div",{style:{fontSize:"0.8rem",fontWeight:"bold",marginBottom:"0.5rem"},children:"Event Types:"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"1rem"},children:[{type:"transport",label:"Transport"},{type:"meeting",label:"Meetings"},{type:"meal",label:"Meals"},{type:"event",label:"Events"},{type:"accommodation",label:"Accommodation"}].map(({type:f,label:g})=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[i.jsx("div",{style:{width:"16px",height:"16px",backgroundColor:n(f),borderRadius:"2px"}}),i.jsxs("span",{style:{fontSize:"0.7rem"},children:[s(f)," ",g]})]},f))})]})]})]})},Yg=()=>{const{driverId:e}=dh(),[t,n]=S.useState(null),[r,s]=S.useState(!0),[o,a]=S.useState(null);S.useEffect(()=>{e&&l()},[e]);const l=async()=>{try{const h=localStorage.getItem("authToken"),y=await U(`/api/drivers/${e}/schedule`,{headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"}});if(y.ok){const v=await y.json();n(v)}else a("Driver not found")}catch{a("Error loading driver schedule")}finally{s(!1)}},c=h=>{switch(h){case"scheduled":return"#3498db";case"in-progress":return"#f39c12";case"completed":return"#2ecc71";case"cancelled":return"#e74c3c";default:return"#95a5a6"}},d=h=>{switch(h){case"transport":return"🚗";case"meeting":return"🤝";case"event":return"🎉";case"meal":return"🍽️";case"accommodation":return"🏨";default:return"📅"}},m=h=>new Date(h).toLocaleString([],{hour:"2-digit",minute:"2-digit"}),p=()=>{if(!(t!=null&&t.schedule))return null;const h=new Date,y=t.schedule.filter(v=>new Date(v.startTime)>h&&v.status==="scheduled").sort((v,N)=>new Date(v.startTime).getTime()-new Date(N.startTime).getTime());return y.length>0?y[0]:null},f=()=>{if(!(t!=null&&t.schedule))return null;const h=new Date;return t.schedule.find(y=>new Date(y.startTime)<=h&&new Date(y.endTime)>h&&y.status==="in-progress")||null},g=h=>{const y={};return h.forEach(v=>{const N=new Date(v.startTime).toDateString();y[N]||(y[N]=[]),y[N].push(v)}),Object.keys(y).forEach(v=>{y[v].sort((N,k)=>new Date(N.startTime).getTime()-new Date(k.startTime).getTime())}),y},b=()=>{if(!t)return;const h=window.open("","_blank");if(!h)return;const y=g(t.schedule),v=`
<!DOCTYPE html>
<html>
<head>
<title>Driver Schedule - ${t.driver.name}</title>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #2d3748;
background: #ffffff;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 40px 30px;
}
.header {
text-align: center;
margin-bottom: 40px;
padding-bottom: 30px;
border-bottom: 3px solid #e2e8f0;
background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
color: white;
padding: 40px 30px;
border-radius: 15px;
margin: -40px -30px 40px -30px;
}
.header h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 10px;
text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header h2 {
font-size: 1.8rem;
font-weight: 600;
margin-bottom: 20px;
opacity: 0.95;
}
.driver-info {
background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
padding: 25px;
border-radius: 12px;
margin-bottom: 30px;
border: 1px solid #e2e8f0;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.driver-info p {
margin-bottom: 8px;
font-size: 1rem;
}
.driver-info strong {
color: #4a5568;
font-weight: 600;
}
.day-section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.day-header {
background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
color: white;
padding: 20px 25px;
font-size: 1.3rem;
font-weight: 700;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-align: center;
}
.event {
background: white;
border: 1px solid #e2e8f0;
margin-bottom: 15px;
padding: 25px;
border-radius: 12px;
display: flex;
align-items: flex-start;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.event-time {
min-width: 120px;
background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
padding: 15px;
border-radius: 8px;
text-align: center;
margin-right: 25px;
border: 1px solid #cbd5e0;
}
.event-time .time {
font-weight: 700;
font-size: 1rem;
color: #2d3748;
display: block;
}
.event-time .separator {
font-size: 0.8rem;
color: #718096;
margin: 5px 0;
}
.event-details {
flex: 1;
}
.event-title {
font-weight: 700;
font-size: 1.2rem;
margin-bottom: 10px;
color: #2d3748;
display: flex;
align-items: center;
gap: 8px;
}
.event-icon {
font-size: 1.3rem;
}
.event-location {
color: #4a5568;
margin-bottom: 8px;
font-weight: 500;
display: flex;
align-items: center;
gap: 6px;
}
.event-vip {
color: #e53e3e;
font-weight: 600;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 6px;
}
.event-description {
background: #f7fafc;
padding: 12px 15px;
border-radius: 8px;
font-style: italic;
color: #4a5568;
margin-bottom: 10px;
border-left: 4px solid #cbd5e0;
}
.footer {
margin-top: 50px;
text-align: center;
color: #718096;
font-size: 0.9rem;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
}
.company-logo {
width: 60px;
height: 60px;
background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 20px;
color: white;
font-size: 1.5rem;
font-weight: bold;
}
@media print {
body {
margin: 0;
padding: 0;
}
.container {
padding: 20px;
}
.header {
margin: -20px -20px 30px -20px;
}
.day-section {
page-break-inside: avoid;
}
.event {
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="company-logo">🚗</div>
<h1>Driver Schedule</h1>
<h2>${t.driver.name}</h2>
</div>
<div class="driver-info">
<p><strong>Driver:</strong> ${t.driver.name}</p>
<p><strong>Phone:</strong> ${t.driver.phone}</p>
<p><strong>Total Assignments:</strong> ${t.schedule.length}</p>
</div>
${Object.entries(y).map(([N,k])=>`
<div class="day-section">
<div class="day-header">
${new Date(N).toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric"})}
</div>
${k.map(C=>`
<div class="event">
<div class="event-time">
<span class="time">${m(C.startTime)}</span>
<div class="separator">to</div>
<span class="time">${m(C.endTime)}</span>
</div>
<div class="event-details">
<div class="event-title">
<span class="event-icon">${d(C.type)}</span>
${C.title}
</div>
<div class="event-vip">
<span>👤</span>
VIP: ${C.vipName}
</div>
<div class="event-location">
<span>📍</span>
${C.location}
</div>
${C.description?`<div class="event-description">${C.description}</div>`:""}
</div>
</div>
`).join("")}
</div>
`).join("")}
<div class="footer">
<p><strong>VIP Coordinator System</strong></p>
<p>Generated on ${new Date().toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}</p>
</div>
</div>
</body>
</html>
`;h.document.write(v),h.document.close(),h.focus(),setTimeout(()=>{h.print(),h.close()},250)};async function w(h,y){if(!t)return;const v=t.schedule.find(N=>N.id===h);if(v)try{const N=localStorage.getItem("authToken");(await U(`/api/vips/${v.vipId}/schedule/${h}/status`,{method:"PATCH",headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"},body:JSON.stringify({status:y})})).ok&&await l()}catch(N){console.error("Error updating event status:",N)}}if(r)return i.jsx("div",{className:"flex justify-center items-center min-h-64",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 flex items-center space-x-4",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-red-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading driver schedule..."})]})});if(o||!t)return i.jsx("div",{className:"space-y-8",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60 text-center",children:[i.jsx("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl",children:"❌"})}),i.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Error"}),i.jsx("p",{className:"text-slate-600 mb-6",children:o||"Driver not found"}),i.jsx(we,{to:"/drivers",className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl",children:"Back to Drivers"})]})});const j=p(),x=f(),u=g(t.schedule);return i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent flex items-center gap-3",children:["🚗 Driver Dashboard: ",t.driver.name]}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Real-time schedule and assignment management"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("button",{className:"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:b,children:"🖨️ Print Schedule"}),i.jsx(we,{to:"/drivers",className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-6 py-3 rounded-lg font-medium transition-all duration-200 shadow-lg hover:shadow-xl",children:"Back to Drivers"})]})]})}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:"📍 Current Status"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Real-time driver activity and next assignment"})]}),i.jsxs("div",{className:"p-8 space-y-6",children:[x?i.jsxs("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 border border-amber-200 rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("span",{className:"text-2xl",children:d(x.type)}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-amber-900",children:"Currently Active"}),i.jsx("p",{className:"text-amber-700 font-semibold",children:x.title})]}),i.jsx("span",{className:"ml-auto px-3 py-1 rounded-full text-xs font-bold text-white",style:{backgroundColor:c(x.status)},children:x.status.toUpperCase()})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 text-amber-800",children:[i.jsx("span",{children:"📍"}),i.jsx("span",{children:x.location})]}),i.jsxs("div",{className:"flex items-center gap-2 text-amber-800",children:[i.jsx("span",{children:"👤"}),i.jsxs("span",{children:["VIP: ",x.vipName]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-amber-800",children:[i.jsx("span",{children:"⏰"}),i.jsxs("span",{children:["Until ",m(x.endTime)]})]})]})]}):i.jsx("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 rounded-xl p-6",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-2xl",children:"✅"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-green-900",children:"Currently Available"}),i.jsx("p",{className:"text-green-700",children:"Ready for next assignment"})]})]})}),j&&i.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-200 rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("span",{className:"text-2xl",children:d(j.type)}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-blue-900",children:"Next Assignment"}),i.jsx("p",{className:"text-blue-700 font-semibold",children:j.title})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-blue-800",children:[i.jsx("span",{children:"📍"}),i.jsx("span",{children:j.location})]}),i.jsxs("div",{className:"flex items-center gap-2 text-blue-800",children:[i.jsx("span",{children:"👤"}),i.jsxs("span",{children:["VIP: ",j.vipName]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-blue-800",children:[i.jsx("span",{children:"⏰"}),i.jsxs("span",{children:[m(j.startTime)," - ",m(j.endTime)]})]})]}),i.jsx("button",{className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:()=>window.open(`https://maps.google.com/?q=${encodeURIComponent(j.location)}`,"_blank"),children:"🗺️ Get Directions"})]})]})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsxs("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:["📅 Complete Schedule",i.jsxs("span",{className:"bg-purple-100 text-purple-800 text-sm font-medium px-2.5 py-0.5 rounded-full",children:[t.schedule.length," assignments"]})]}),i.jsx("p",{className:"text-slate-600 mt-1",children:"All scheduled events and assignments"})]}),i.jsx("div",{className:"p-8",children:t.schedule.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl",children:"📅"})}),i.jsx("p",{className:"text-slate-500 font-medium",children:"No assignments scheduled"})]}):i.jsx("div",{className:"space-y-8",children:Object.entries(u).map(([h,y])=>i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"bg-gradient-to-r from-slate-600 to-slate-700 text-white px-6 py-3 rounded-xl shadow-lg",children:i.jsx("h3",{className:"text-lg font-bold",children:new Date(h).toLocaleDateString([],{weekday:"long",year:"numeric",month:"long",day:"numeric"})})}),i.jsx("div",{className:"grid gap-4",children:y.map(v=>i.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-slate-100 rounded-xl border border-slate-200/60 p-6 hover:shadow-lg transition-all duration-200",children:i.jsxs("div",{className:"flex items-start gap-6",children:[i.jsx("div",{className:"flex-shrink-0 text-center",children:i.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-3 shadow-sm",children:[i.jsx("div",{className:"text-sm font-bold text-slate-900",children:m(v.startTime)}),i.jsx("div",{className:"text-xs text-slate-500 mt-1",children:"to"}),i.jsx("div",{className:"text-sm font-bold text-slate-900",children:m(v.endTime)})]})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("span",{className:"text-2xl",children:d(v.type)}),i.jsx("h4",{className:"text-lg font-bold text-slate-900",children:v.title}),i.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-bold text-white shadow-sm",style:{backgroundColor:c(v.status)},children:v.status.toUpperCase()})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[i.jsx("span",{children:"📍"}),i.jsx("span",{className:"font-medium",children:v.location})]}),i.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[i.jsx("span",{children:"👤"}),i.jsxs("span",{className:"font-medium",children:["VIP: ",v.vipName]})]})]}),v.description&&i.jsx("div",{className:"text-slate-600 mb-4 bg-white/50 rounded-lg p-3 border border-slate-200/50",children:v.description}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:()=>window.open(`https://maps.google.com/?q=${encodeURIComponent(v.location)}`,"_blank"),children:"🗺️ Directions"}),v.status==="scheduled"&&i.jsx("button",{className:"bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:()=>w(v.id,"in-progress"),children:"▶️ Start"}),v.status==="in-progress"&&i.jsx("button",{className:"bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl flex items-center gap-2",onClick:()=>w(v.id,"completed"),children:"✅ Complete"}),v.status==="completed"&&i.jsx("span",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-xs font-medium flex items-center gap-1",children:"✅ Completed"})]})]})]})},v.id))})]},h))})})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800 flex items-center gap-2",children:"📊 Schedule Timeline"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Visual timeline of all assignments"})]}),i.jsx("div",{className:"p-8",children:i.jsx(Xg,{events:t.schedule,driverName:t.driver.name})})]})]})},Qg=()=>{const[e,t]=S.useState([]),[n,r]=S.useState([]),[s,o]=S.useState(!0),a=d=>{const m=new Date;return d.find(p=>new Date(p.startTime)<=m&&new Date(p.endTime)>m&&p.status==="in-progress")||null},l=d=>{const m=new Date,p=d.filter(f=>new Date(f.startTime)>m&&f.status==="scheduled").sort((f,g)=>new Date(f.startTime).getTime()-new Date(g.startTime).getTime());return p.length>0?p[0]:null},c=d=>new Date(d).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return S.useEffect(()=>{(async()=>{try{const p={Authorization:`Bearer ${localStorage.getItem("authToken")}`,"Content-Type":"application/json"},[f,g]=await Promise.all([U("/api/vips",{headers:p}),U("/api/drivers",{headers:p})]);if(!f.ok||!g.ok)throw new Error("Failed to fetch data");const b=await f.json(),w=await g.json(),x=(await Promise.all(b.map(async u=>{try{const h=await U(`/api/vips/${u.id}/schedule`,{headers:p});if(h.ok){const y=await h.json(),v=a(y),N=l(y);return{...u,currentEvent:v,nextEvent:N,nextEventTime:N?N.startTime:null}}else return{...u,currentEvent:null,nextEvent:null,nextEventTime:null}}catch(h){return console.error(`Error fetching schedule for VIP ${u.id}:`,h),{...u,currentEvent:null,nextEvent:null,nextEventTime:null}}}))).sort((u,h)=>u.currentEvent&&!h.currentEvent?-1:!u.currentEvent&&h.currentEvent?1:u.nextEventTime&&h.nextEventTime?new Date(u.nextEventTime).getTime()-new Date(h.nextEventTime).getTime():u.nextEventTime&&!h.nextEventTime?-1:!u.nextEventTime&&h.nextEventTime?1:u.name.localeCompare(h.name));t(x),r(w)}catch(m){console.error("Error fetching data:",m)}finally{o(!1)}})()},[]),s?i.jsx("div",{className:"flex justify-center items-center min-h-64",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 flex items-center space-x-4",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading dashboard..."})]})}):i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:"VIP Coordinator Dashboard"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"Real-time overview of VIP activities and coordination"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsxs("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium",children:[e.length," Active VIPs"]}),i.jsxs("div",{className:"bg-gradient-to-r from-green-500 to-green-600 text-white px-4 py-2 rounded-lg text-sm font-medium",children:[n.length," Drivers"]})]})]})}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-8",children:[i.jsx("div",{className:"xl:col-span-2",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 px-6 py-4 border-b border-slate-200/60",children:i.jsxs("h2",{className:"text-xl font-bold text-slate-800 flex items-center",children:["VIP Status Dashboard",i.jsxs("span",{className:"ml-2 bg-blue-100 text-blue-800 text-sm font-medium px-2.5 py-0.5 rounded-full",children:[e.length," VIPs"]})]})}),i.jsx("div",{className:"p-6",children:e.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx("div",{className:"w-8 h-8 bg-slate-300 rounded-full"})}),i.jsx("p",{className:"text-slate-500 font-medium",children:"No VIPs currently scheduled"})]}):i.jsx("div",{className:"space-y-4",children:e.map(d=>{const m=!!d.currentEvent,p=!!d.nextEvent;return i.jsx("div",{className:`
relative rounded-xl border-2 p-6 transition-all duration-200 hover:shadow-lg
${m?"border-amber-300 bg-gradient-to-r from-amber-50 to-orange-50":p?"border-blue-300 bg-gradient-to-r from-blue-50 to-indigo-50":"border-slate-200 bg-slate-50"}
`,children:i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-900",children:d.name}),m&&i.jsx("span",{className:"bg-gradient-to-r from-amber-500 to-orange-500 text-white px-3 py-1 rounded-full text-xs font-bold animate-pulse",children:"ACTIVE"})]}),i.jsx("p",{className:"text-slate-600 text-sm mb-4",children:d.organization}),d.currentEvent&&i.jsxs("div",{className:"bg-white border border-amber-200 rounded-lg p-4 mb-3 shadow-sm",children:[i.jsx("div",{className:"flex items-center gap-2 mb-2",children:i.jsx("span",{className:"text-amber-600 font-bold text-sm",children:"CURRENT EVENT"})}),i.jsx("div",{className:"flex items-center gap-2 mb-1",children:i.jsx("span",{className:"font-semibold text-slate-900",children:d.currentEvent.title})}),i.jsxs("p",{className:"text-slate-600 text-sm mb-1",children:["Location: ",d.currentEvent.location]}),i.jsxs("p",{className:"text-slate-500 text-xs",children:["Until ",c(d.currentEvent.endTime)]})]}),d.nextEvent&&i.jsxs("div",{className:"bg-white border border-blue-200 rounded-lg p-4 mb-3 shadow-sm",children:[i.jsx("div",{className:"flex items-center gap-2 mb-2",children:i.jsx("span",{className:"text-blue-600 font-bold text-sm",children:"NEXT EVENT"})}),i.jsx("div",{className:"flex items-center gap-2 mb-1",children:i.jsx("span",{className:"font-semibold text-slate-900",children:d.nextEvent.title})}),i.jsxs("p",{className:"text-slate-600 text-sm mb-1",children:["Location: ",d.nextEvent.location]}),i.jsxs("p",{className:"text-slate-500 text-xs",children:[c(d.nextEvent.startTime)," - ",c(d.nextEvent.endTime)]})]}),!d.currentEvent&&!d.nextEvent&&i.jsx("div",{className:"bg-white border border-slate-200 rounded-lg p-4 mb-3",children:i.jsx("p",{className:"text-slate-500 text-sm italic",children:"No scheduled events"})}),i.jsx("div",{className:"flex items-center gap-2 text-xs text-slate-500 bg-white/50 rounded-lg px-3 py-2",children:d.transportMode==="flight"?i.jsxs("span",{children:["Flight: ",d.flights&&d.flights.length>0?d.flights.map(f=>f.flightNumber).join(" → "):d.flightNumber||"TBD"]}):i.jsxs("span",{children:["Self-driving | Expected: ",d.expectedArrival?c(d.expectedArrival):"TBD"]})})]}),i.jsxs("div",{className:"flex flex-col gap-2 ml-6",children:[i.jsx(we,{to:`/vips/${d.id}`,className:"bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 text-center shadow-lg hover:shadow-xl",children:"Details"}),i.jsx(we,{to:`/vips/${d.id}#schedule`,className:"bg-gradient-to-r from-slate-500 to-slate-600 hover:from-slate-600 hover:to-slate-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 text-center shadow-lg hover:shadow-xl",children:"Schedule"})]})]})},d.id)})})})]})}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsx("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 px-6 py-4 border-b border-slate-200/60",children:i.jsxs("h2",{className:"text-lg font-bold text-slate-800 flex items-center",children:["Available Drivers",i.jsx("span",{className:"ml-2 bg-green-100 text-green-800 text-sm font-medium px-2.5 py-0.5 rounded-full",children:n.length})]})}),i.jsx("div",{className:"p-6",children:n.length===0?i.jsxs("div",{className:"text-center py-8",children:[i.jsx("div",{className:"w-12 h-12 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-3",children:i.jsx("div",{className:"w-6 h-6 bg-slate-300 rounded-full"})}),i.jsx("p",{className:"text-slate-500 text-sm",children:"No drivers available"})]}):i.jsx("div",{className:"space-y-3",children:n.map(d=>i.jsx("div",{className:"bg-slate-50 rounded-lg p-4 border border-slate-200",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-semibold text-slate-900",children:d.name}),i.jsx("p",{className:"text-slate-600 text-sm",children:d.phone})]}),i.jsx("div",{className:"text-right",children:i.jsxs("span",{className:"bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded-full",children:[d.assignedVipIds.length," VIPs"]})})]})},d.id))})})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsx("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 px-6 py-4 border-b border-slate-200/60",children:i.jsx("h2",{className:"text-lg font-bold text-slate-800",children:"Quick Actions"})}),i.jsxs("div",{className:"p-6 space-y-3",children:[i.jsx(we,{to:"/vips",className:"block w-full bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-4 py-3 rounded-lg font-medium transition-all duration-200 text-center shadow-lg hover:shadow-xl",children:"Manage VIPs"}),i.jsx(we,{to:"/drivers",className:"block w-full bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white px-4 py-3 rounded-lg font-medium transition-all duration-200 text-center shadow-lg hover:shadow-xl",children:"Manage Drivers"})]})]})]})]})]})},qg=()=>{const e=new Date,t=new Date(e);t.setDate(t.getDate()+1);const n=new Date(e);n.setDate(n.getDate()+2);const r=o=>o.toISOString().split("T")[0],s=o=>{const a=new Date(o);return a.setHours(14,30,0,0),a.toISOString().slice(0,16)};return[{name:"Dr. Sarah Chen",organization:"Stanford University",department:"Admin",transportMode:"flight",flights:[{flightNumber:"UA1234",flightDate:r(t),segment:1},{flightNumber:"DL5678",flightDate:r(t),segment:2}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Vegetarian meals, requires wheelchair assistance"},{name:"Ambassador Michael Rodriguez",organization:"Embassy of Spain",department:"Admin",transportMode:"self-driving",expectedArrival:s(t),needsVenueTransport:!0,notes:"Security detail required, diplomatic immunity"},{name:"Prof. Aisha Patel",organization:"MIT Technology Review",department:"Admin",transportMode:"flight",flights:[{flightNumber:"AA9876",flightDate:r(n),segment:1}],needsAirportPickup:!0,needsVenueTransport:!1,notes:"Allergic to shellfish, prefers ground floor rooms"},{name:"CEO James Thompson",organization:"TechCorp Industries",department:"Admin",transportMode:"flight",flights:[{flightNumber:"SW2468",flightDate:r(t),segment:1}],needsAirportPickup:!1,needsVenueTransport:!0,notes:"Private jet arrival, has own security team"},{name:"Dr. Elena Volkov",organization:"Russian Academy of Sciences",department:"Admin",transportMode:"self-driving",expectedArrival:s(n),needsVenueTransport:!0,notes:"Interpreter required, kosher meals"},{name:"Minister David Kim",organization:"South Korean Ministry of Education",department:"Admin",transportMode:"flight",flights:[{flightNumber:"KE0123",flightDate:r(t),segment:1},{flightNumber:"UA7890",flightDate:r(t),segment:2},{flightNumber:"DL3456",flightDate:r(t),segment:3}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Long international flight, may need rest upon arrival"},{name:"Dr. Maria Santos",organization:"University of São Paulo",department:"Admin",transportMode:"flight",flights:[{flightNumber:"LH4567",flightDate:r(n),segment:1}],needsAirportPickup:!0,needsVenueTransport:!1,notes:"Speaks Portuguese and English, lactose intolerant"},{name:"Sheikh Ahmed Al-Rashid",organization:"UAE University",department:"Admin",transportMode:"self-driving",expectedArrival:s(t),needsVenueTransport:!0,notes:"Halal meals required, prayer room access needed"},{name:"Prof. Catherine Williams",organization:"Oxford University",department:"Admin",transportMode:"flight",flights:[{flightNumber:"BA1357",flightDate:r(t),segment:1}],needsAirportPickup:!1,needsVenueTransport:!0,notes:"Prefers tea over coffee, has mobility issues"},{name:"Dr. Hiroshi Tanaka",organization:"Tokyo Institute of Technology",department:"Admin",transportMode:"flight",flights:[{flightNumber:"NH0246",flightDate:r(n),segment:1},{flightNumber:"UA8642",flightDate:r(n),segment:2}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Jet lag concerns, prefers Japanese cuisine when available"},{name:"Ms. Jennifer Walsh",organization:"Walsh Foundation",department:"Office of Development",transportMode:"self-driving",expectedArrival:s(t),needsVenueTransport:!1,notes:"Major donor, prefers informal settings"},{name:"Mr. Robert Sterling",organization:"Sterling Philanthropies",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"JB1122",flightDate:r(t),segment:1}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Potential $10M donation, wine enthusiast"},{name:"Mrs. Elizabeth Hartwell",organization:"Hartwell Family Trust",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"AS3344",flightDate:r(n),segment:1}],needsAirportPickup:!1,needsVenueTransport:!0,notes:"Alumni donor, interested in scholarship programs"},{name:"Mr. Charles Montgomery",organization:"Montgomery Industries",department:"Office of Development",transportMode:"self-driving",expectedArrival:s(n),needsVenueTransport:!0,notes:"Corporate partnership opportunity, golf enthusiast"},{name:"Dr. Patricia Lee",organization:"Lee Medical Foundation",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"F91234",flightDate:r(t),segment:1},{flightNumber:"UA5555",flightDate:r(t),segment:2}],needsAirportPickup:!0,needsVenueTransport:!1,notes:"Medical research funding, diabetic dietary needs"},{name:"Mr. Thomas Anderson",organization:"Anderson Capital Group",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"VX7788",flightDate:r(t),segment:1}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Venture capital investor, tech startup focus"},{name:"Mrs. Grace Chen-Williams",organization:"Chen-Williams Foundation",department:"Office of Development",transportMode:"self-driving",expectedArrival:s(t),needsVenueTransport:!0,notes:"Arts and culture patron, vegan diet"},{name:"Mr. Daniel Foster",organization:"Foster Energy Solutions",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"WN9999",flightDate:r(n),segment:1}],needsAirportPickup:!1,needsVenueTransport:!1,notes:"Renewable energy focus, environmental sustainability"},{name:"Mrs. Victoria Blackstone",organization:"Blackstone Charitable Trust",department:"Office of Development",transportMode:"flight",flights:[{flightNumber:"B61111",flightDate:r(n),segment:1},{flightNumber:"AA2222",flightDate:r(n),segment:2}],needsAirportPickup:!0,needsVenueTransport:!0,notes:"Education advocate, prefers luxury accommodations"},{name:"Mr. Alexander Petrov",organization:"Petrov International Holdings",department:"Office of Development",transportMode:"self-driving",expectedArrival:s(n),needsVenueTransport:!0,notes:"International business, speaks Russian and English"}]},Ec=()=>["Stanford University","Embassy of Spain","MIT Technology Review","TechCorp Industries","Russian Academy of Sciences","South Korean Ministry of Education","University of São Paulo","UAE University","Oxford University","Tokyo Institute of Technology","Walsh Foundation","Sterling Philanthropies","Hartwell Family Trust","Montgomery Industries","Lee Medical Foundation","Anderson Capital Group","Chen-Williams Foundation","Foster Energy Solutions","Blackstone Charitable Trust","Petrov International Holdings"],e0=(e,t,n)=>{const r=new Date,s=new Date(r);s.setDate(s.getDate()+1);const o=(l,c=0)=>{const d=new Date(s);return d.setHours(l,c,0,0),d.toISOString()},a=[{title:n==="flight"?"Airport Pickup":"Arrival Check-in",location:n==="flight"?"Airport Terminal":"Hotel Lobby",startTime:o(8,0),endTime:o(9,0),description:n==="flight"?"Meet and greet at airport, transport to hotel":"Check-in and welcome briefing",type:"transport",status:"scheduled"},{title:"Welcome Breakfast",location:"Executive Dining Room",startTime:o(9,0),endTime:o(10,0),description:"Welcome breakfast with key stakeholders and orientation materials",type:"meal",status:"scheduled"}];return t==="Admin"?[...a,{title:"Academic Leadership Meeting",location:"Board Room A",startTime:o(10,30),endTime:o(12,0),description:"Strategic planning session with academic leadership team",type:"meeting",status:"scheduled"},{title:"Working Lunch",location:"Faculty Club",startTime:o(12,0),endTime:o(13,30),description:"Lunch meeting with department heads and key faculty",type:"meal",status:"scheduled"},{title:"Campus Tour",location:"Main Campus",startTime:o(14,0),endTime:o(15,30),description:"Guided tour of campus facilities and research centers",type:"event",status:"scheduled"},{title:"Research Presentation",location:"Auditorium B",startTime:o(16,0),endTime:o(17,30),description:"Presentation of current research initiatives and future plans",type:"meeting",status:"scheduled"},{title:"Reception Dinner",location:"University Club",startTime:o(19,0),endTime:o(21,0),description:"Formal dinner reception with university leadership",type:"event",status:"scheduled"}]:[...a,{title:"Donor Relations Meeting",location:"Development Office",startTime:o(10,30),endTime:o(12,0),description:"Private meeting with development team about giving opportunities",type:"meeting",status:"scheduled"},{title:"Scholarship Recipients Lunch",location:"Student Center",startTime:o(12,0),endTime:o(13,30),description:"Meet with current scholarship recipients and hear their stories",type:"meal",status:"scheduled"},{title:"Facility Naming Ceremony",location:"New Science Building",startTime:o(14,0),endTime:o(15,0),description:"Dedication ceremony for newly named facility",type:"event",status:"scheduled"},{title:"Impact Presentation",location:"Conference Room C",startTime:o(15,30),endTime:o(16,30),description:"Presentation on the impact of philanthropic giving",type:"meeting",status:"scheduled"},{title:"Private Dinner",location:"Presidents House",startTime:o(18,30),endTime:o(20,30),description:"Intimate dinner with university president and spouse",type:"meal",status:"scheduled"},{title:"Evening Cultural Event",location:"Arts Center",startTime:o(21,0),endTime:o(22,30),description:"Special performance by university arts programs",type:"event",status:"scheduled"}]},t0=()=>{const e=ch(),[t,n]=S.useState({}),[r,s]=S.useState({}),[o,a]=S.useState({}),[l,c]=S.useState(!0),[d,m]=S.useState(!1),[p,f]=S.useState(null),[g,b]=S.useState({}),[w,j]=S.useState({}),[x,u]=S.useState(!1),[h,y]=S.useState(null),[v,N]=S.useState(null),k=(P=!1)=>{const L={},E=typeof window<"u"?localStorage.getItem("authToken"):null;return E&&(L.Authorization=`Bearer ${E}`),P&&(L["Content-Type"]="application/json"),L},C=async()=>{try{c(!0),N(null);const P=await U("/api/admin/settings",{headers:k()});if(P.ok){const L=await P.json(),E={},D={},O={};L.apiKeys&&Object.entries(L.apiKeys).forEach(([$,F])=>{F&&F.startsWith("***")?(E[$]=!0,D[$]=F):F&&(O[$]=F)}),b(E),j(D),n(O),s(L.systemSettings||{})}else P.status===403?N("You need administrator access to view this page."):P.status===401?N("Authentication required. Please sign in again."):N("Failed to load admin settings.")}catch(P){console.error("Failed to load settings:",P),N("Failed to load admin settings.")}finally{c(!1)}};S.useEffect(()=>{C()},[]);const z=(P,L)=>{n(E=>({...E,[P]:L})),L&&!L.startsWith("***")&&(b(E=>({...E,[P]:!1})),j(E=>{const D={...E};return delete D[P],D}))},A=(P,L)=>{s(E=>({...E,[P]:L}))},I=async P=>{a(L=>({...L,[P]:"Testing..."}));try{const L=await U(`/api/admin/test-api/${P}`,{method:"POST",headers:k(!0),body:JSON.stringify({apiKey:t[P]})}),E=await L.json();L.ok?a(D=>({...D,[P]:`Success: ${E.message}`})):a(D=>({...D,[P]:`Failed: ${E.error}`}))}catch{a(E=>({...E,[P]:"Connection error"}))}},M=async()=>{m(!0),f(null);try{(await U("/api/admin/settings",{method:"POST",headers:k(!0),body:JSON.stringify({apiKeys:t,systemSettings:r})})).ok?(f("Settings saved successfully!"),await C(),setTimeout(()=>f(null),3e3)):f("Failed to save settings")}catch{f("Error saving settings")}finally{m(!1)}},W=()=>{localStorage.removeItem("authToken"),e("/"),window.location.reload()},G=async()=>{u(!0),y("Creating test VIPs and schedules...");try{const P=localStorage.getItem("authToken"),L=qg();let E=0,D=0,O=0,$=0;const F=[];for(const ie of L)try{const ue=await U("/api/vips",{method:"POST",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"},body:JSON.stringify(ie)});if(ue.ok){const Le=await ue.json();F.push(Le.id),E++}else D++,console.error(`Failed to create VIP: ${ie.name}`)}catch(ue){D++,console.error(`Error creating VIP ${ie.name}:`,ue)}y(`Created ${E} VIPs, now creating schedules...`);for(let ie=0;ie<F.length;ie++){const ue=F[ie],Le=L[ie];try{const We=e0(Le.name,Le.department,Le.transportMode);for(const Vt of We)try{const ui={...Vt,id:Date.now().toString()+Math.random().toString(36).substr(2,9)};(await U(`/api/vips/${ue}/schedule`,{method:"POST",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"},body:JSON.stringify(ui)})).ok?O++:($++,console.error(`Failed to create schedule event for ${Le.name}: ${Vt.title}`))}catch(ui){$++,console.error(`Error creating schedule event for ${Le.name}:`,ui)}}catch(We){console.error(`Error generating schedule for ${Le.name}:`,We)}}y(`✅ Created ${E} VIPs with ${O} schedule events! ${D>0||$>0?`(${D+$} failed)`:""}`)}catch(P){y("❌ Failed to create test VIPs and schedules"),console.error("Error creating test data:",P)}finally{u(!1),setTimeout(()=>y(null),8e3)}},K=async()=>{if(confirm("Are you sure you want to remove all test VIPs? This will delete VIPs from the test organizations.")){u(!0),y("Removing test VIPs...");try{const P=localStorage.getItem("authToken"),L=await U("/api/vips",{headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"}});if(!L.ok)throw new Error("Failed to fetch VIPs");const E=await L.json(),D=Ec(),O=E.filter(ie=>D.includes(ie.organization));let $=0,F=0;for(const ie of O)try{(await U(`/api/vips/${ie.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"}})).ok?$++:(F++,console.error(`Failed to delete VIP: ${ie.name}`))}catch(ue){F++,console.error(`Error deleting VIP ${ie.name}:`,ue)}y(`🗑️ Removed ${$} test VIPs successfully! ${F>0?`(${F} failed)`:""}`)}catch(P){y("❌ Failed to remove test VIPs"),console.error("Error removing test VIPs:",P)}finally{u(!1),setTimeout(()=>y(null),5e3)}}};return l?i.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 flex justify-center items-center",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 flex items-center space-x-4 border border-slate-200/60",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading admin settings..."})]})}):v?i.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 flex justify-center items-center",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 w-full max-w-xl border border-rose-200/70",children:[i.jsx("h2",{className:"text-2xl font-bold text-rose-700 mb-4",children:"Admin access required"}),i.jsx("p",{className:"text-slate-600 mb-6",children:v}),i.jsx("button",{className:"btn btn-primary",onClick:()=>e("/"),children:"Return to dashboard"})]})}):i.jsxs("div",{className:"space-y-8",children:[i.jsx("div",{className:"bg-white rounded-2xl shadow-lg p-8 border border-slate-200/60",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:"Admin Dashboard"}),i.jsx("p",{className:"text-slate-600 mt-2",children:"System configuration and API management"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("button",{className:"btn btn-secondary",onClick:()=>e("/"),children:"Back to Dashboard"}),i.jsx("button",{className:"btn btn-danger",onClick:W,children:"Logout"})]})]})}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"API Key Management"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Configure external service integrations"})]}),i.jsxs("div",{className:"p-8 space-y-8",children:[i.jsxs("div",{className:"form-section",children:[i.jsxs("div",{className:"form-section-header",children:[i.jsx("h3",{className:"form-section-title",children:"AviationStack API"}),g.aviationStackKey&&i.jsx("span",{className:"bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded-full",children:"Configured"})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4 items-end",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("label",{className:"form-label",children:"API Key"}),i.jsx("input",{type:"password",placeholder:g.aviationStackKey&&w.aviationStackKey?`Saved (${w.aviationStackKey.slice(-4)})`:"Enter AviationStack API key",value:t.aviationStackKey||"",onChange:P=>z("aviationStackKey",P.target.value),className:"form-input"}),g.aviationStackKey&&w.aviationStackKey&&!t.aviationStackKey&&i.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Currently saved key ends with ",w.aviationStackKey.slice(-4),". Enter a new value to replace it."]}),i.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Get your key from: https://aviationstack.com/dashboard"})]}),i.jsx("div",{children:i.jsx("button",{className:"btn btn-secondary w-full",onClick:()=>I("aviationStackKey"),children:"Test Connection"})}),i.jsx("div",{children:o.aviationStackKey&&i.jsx("div",{className:`p-3 rounded-lg text-sm ${o.aviationStackKey.includes("Success")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:o.aviationStackKey})})]})]}),i.jsxs("div",{className:"form-section",children:[i.jsxs("div",{className:"form-section-header",children:[i.jsx("h3",{className:"form-section-title",children:"Auth0 Configuration"}),(g.auth0Domain||g.auth0ClientId||g.auth0ClientSecret)&&i.jsx("span",{className:"bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded-full",children:"Configured"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{className:"form-label",children:"Auth0 Domain"}),i.jsx("input",{type:"text",placeholder:g.auth0Domain&&w.auth0Domain?`Saved (${w.auth0Domain.slice(-4)})`:"e.g. dev-1234abcd.us.auth0.com",value:t.auth0Domain||"",onChange:P=>z("auth0Domain",P.target.value),className:"form-input"})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{className:"form-label",children:"Client ID"}),i.jsx("input",{type:"password",placeholder:g.auth0ClientId&&w.auth0ClientId?`Saved (${w.auth0ClientId.slice(-4)})`:"Enter Auth0 application Client ID",value:t.auth0ClientId||"",onChange:P=>z("auth0ClientId",P.target.value),className:"form-input"}),g.auth0ClientId&&w.auth0ClientId&&!t.auth0ClientId&&i.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Saved client ID ends with ",w.auth0ClientId.slice(-4),". Provide a new ID to update it."]})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{className:"form-label",children:"Client Secret"}),i.jsx("input",{type:"password",placeholder:g.auth0ClientSecret&&w.auth0ClientSecret?`Saved (${w.auth0ClientSecret.slice(-4)})`:"Enter Auth0 application Client Secret",value:t.auth0ClientSecret||"",onChange:P=>z("auth0ClientSecret",P.target.value),className:"form-input"}),g.auth0ClientSecret&&w.auth0ClientSecret&&!t.auth0ClientSecret&&i.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Saved client secret ends with ",w.auth0ClientSecret.slice(-4),". Provide a new secret to rotate it."]})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{className:"form-label",children:"API Audience (Identifier)"}),i.jsx("input",{type:"text",placeholder:t.auth0Audience||"https://your-api-identifier",value:t.auth0Audience||"",onChange:P=>z("auth0Audience",P.target.value),className:"form-input"}),i.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Create an API in Auth0 and use its Identifier here (e.g. https://vip-coordinator-api)."})]})]}),i.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mt-4",children:[i.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:"Setup Instructions"}),i.jsxs("ol",{className:"text-sm text-blue-800 space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:"Sign in to the Auth0 Dashboard"}),i.jsxs("li",{children:["Create a ",i.jsx("strong",{children:"Single Page Application"})," for the frontend"]}),i.jsxs("li",{children:["Set Allowed Callback URL to ",i.jsx("code",{children:"https://bsa.madeamess.online/auth/callback"})]}),i.jsxs("li",{children:["Set Allowed Logout URL to ",i.jsx("code",{children:"https://bsa.madeamess.online/"})]}),i.jsxs("li",{children:["Set Allowed Web Origins to ",i.jsx("code",{children:"https://bsa.madeamess.online"})]}),i.jsxs("li",{children:["Create an ",i.jsx("strong",{children:"API"})," in Auth0 for the backend and use its Identifier as the audience"]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 opacity-50",children:[i.jsxs("div",{className:"form-section",children:[i.jsxs("div",{className:"form-section-header",children:[i.jsx("h3",{className:"form-section-title",children:"Google Maps API"}),i.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs font-medium px-2.5 py-0.5 rounded-full",children:"Coming Soon"})]}),i.jsx("input",{type:"password",placeholder:"Google Maps API key (not yet implemented)",disabled:!0,className:"form-input"})]}),i.jsxs("div",{className:"form-section",children:[i.jsxs("div",{className:"form-section-header",children:[i.jsx("h3",{className:"form-section-title",children:"Twilio API"}),i.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs font-medium px-2.5 py-0.5 rounded-full",children:"Coming Soon"})]}),i.jsx("input",{type:"password",placeholder:"Twilio API key (not yet implemented)",disabled:!0,className:"form-input"})]})]})]})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"System Settings"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Configure default system behavior"})]}),i.jsx("div",{className:"p-8",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"defaultPickup",className:"form-label",children:"Default Pickup Location"}),i.jsx("input",{type:"text",id:"defaultPickup",value:r.defaultPickupLocation||"",onChange:P=>A("defaultPickupLocation",P.target.value),placeholder:"e.g., JFK Airport Terminal 4",className:"form-input"})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"defaultDropoff",className:"form-label",children:"Default Dropoff Location"}),i.jsx("input",{type:"text",id:"defaultDropoff",value:r.defaultDropoffLocation||"",onChange:P=>A("defaultDropoffLocation",P.target.value),placeholder:"e.g., Hilton Downtown",className:"form-input"})]}),i.jsxs("div",{className:"form-group",children:[i.jsx("label",{htmlFor:"timezone",className:"form-label",children:"Time Zone"}),i.jsxs("select",{id:"timezone",value:r.timeZone||"America/New_York",onChange:P=>A("timeZone",P.target.value),className:"form-select",children:[i.jsx("option",{value:"America/New_York",children:"Eastern Time"}),i.jsx("option",{value:"America/Chicago",children:"Central Time"}),i.jsx("option",{value:"America/Denver",children:"Mountain Time"}),i.jsx("option",{value:"America/Los_Angeles",children:"Pacific Time"}),i.jsx("option",{value:"UTC",children:"UTC"})]})]}),i.jsx("div",{className:"form-group",children:i.jsxs("div",{className:"checkbox-option",children:[i.jsx("input",{type:"checkbox",checked:r.notificationsEnabled||!1,onChange:P=>A("notificationsEnabled",P.target.checked),className:"form-checkbox mr-3"}),i.jsx("span",{className:"font-medium",children:"Enable Email/SMS Notifications"})]})})]})})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-orange-50 to-red-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"Test VIP Data Management"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage test VIP data for application testing"})]}),i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-6",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-3",children:"Create Test VIPs"}),i.jsx("p",{className:"text-slate-600 mb-4",children:"Generate 20 diverse test VIPs (10 Admin department, 10 Office of Development) with realistic data including flights, transport modes, and special requirements."}),i.jsxs("ul",{className:"text-sm text-slate-600 mb-4 space-y-1",children:[i.jsx("li",{children:"• Mixed flight and self-driving transport modes"}),i.jsx("li",{children:"• Single flights, connecting flights, and multi-segment journeys"}),i.jsx("li",{children:"• Diverse organizations and special requirements"}),i.jsx("li",{children:"• Realistic arrival dates (tomorrow and day after)"})]}),i.jsx("button",{className:"btn btn-success w-full",onClick:G,disabled:x,children:x?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"animate-spin inline-block w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Creating Test VIPs..."]}):"🎭 Create 20 Test VIPs"})]}),i.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-6",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-3",children:"Remove Test VIPs"}),i.jsx("p",{className:"text-slate-600 mb-4",children:"Remove all test VIPs from the system. This will delete VIPs from the following test organizations:"}),i.jsx("div",{className:"text-xs text-slate-500 mb-4 max-h-20 overflow-y-auto",children:i.jsxs("div",{className:"grid grid-cols-1 gap-1",children:[Ec().slice(0,8).map(P=>i.jsxs("div",{children:["• ",P]},P)),i.jsx("div",{className:"text-slate-400",children:"... and 12 more organizations"})]})}),i.jsx("button",{className:"btn btn-danger w-full",onClick:K,disabled:x,children:x?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"animate-spin inline-block w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Removing Test VIPs..."]}):"🗑️ Remove All Test VIPs"})]})]}),h&&i.jsx("div",{className:`mt-6 p-4 rounded-lg text-center font-medium ${h.includes("✅")||h.includes("🗑️")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:h}),i.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mt-6",children:[i.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:"💡 Test Data Details"}),i.jsxs("div",{className:"text-sm text-blue-800 space-y-1",children:[i.jsxs("p",{children:[i.jsx("strong",{children:"Admin Department (10 VIPs):"})," University officials, ambassadors, ministers, and executives"]}),i.jsxs("p",{children:[i.jsx("strong",{children:"Office of Development (10 VIPs):"})," Donors, foundation leaders, and philanthropists"]}),i.jsxs("p",{children:[i.jsx("strong",{children:"Transport Modes:"})," Mix of flights (single, connecting, multi-segment) and self-driving"]}),i.jsxs("p",{children:[i.jsx("strong",{children:"Special Requirements:"})," Dietary restrictions, accessibility needs, security details, interpreters"]}),i.jsxs("p",{children:[i.jsx("strong",{children:"Full Day Schedules:"})," Each VIP gets 5-7 realistic events including meetings, meals, tours, and presentations"]}),i.jsxs("p",{children:[i.jsx("strong",{children:"Schedule Types:"})," Airport pickup, welcome breakfast, department meetings, working lunches, campus tours, receptions"]})]})]})]})]}),i.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-200/60 overflow-hidden",children:[i.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 px-8 py-6 border-b border-slate-200/60",children:[i.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"API Documentation"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Developer resources and API testing"})]}),i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-6",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-3",children:"Interactive API Documentation"}),i.jsx("p",{className:"text-slate-600 mb-4",children:"Explore and test all API endpoints with the interactive Swagger UI documentation."}),i.jsx("button",{className:"btn btn-primary w-full mb-2",onClick:()=>window.open(`${vt}/api-docs.html`,"_blank"),children:"Open API Documentation"}),i.jsx("p",{className:"text-xs text-slate-500",children:"Opens in a new tab with full endpoint documentation and testing capabilities"})]}),i.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-6",children:[i.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-3",children:"Quick API Examples"}),i.jsxs("div",{className:"space-y-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Health Check:"}),i.jsx("code",{className:"ml-2 bg-white px-2 py-1 rounded text-xs",children:"GET /api/health"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Get VIPs:"}),i.jsx("code",{className:"ml-2 bg-white px-2 py-1 rounded text-xs",children:"GET /api/vips"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Get Drivers:"}),i.jsx("code",{className:"ml-2 bg-white px-2 py-1 rounded text-xs",children:"GET /api/drivers"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:"Flight Info:"}),i.jsx("code",{className:"ml-2 bg-white px-2 py-1 rounded text-xs",children:"GET /api/flights/UA1234"})]})]}),i.jsx("button",{className:"btn btn-secondary w-full mt-4",onClick:()=>window.open("/README-API.md","_blank"),children:"View API Guide"})]})]}),i.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mt-6",children:i.jsxs("p",{className:"text-amber-800",children:[i.jsx("strong",{children:"Pro Tip:"})," The interactive documentation allows you to test API endpoints directly in your browser. Perfect for developers integrating with the VIP Coordinator system!"]})})]})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("button",{className:"btn btn-success text-lg px-8 py-4",onClick:M,disabled:d,children:d?"Saving...":"Save All Settings"}),p&&i.jsx("div",{className:`mt-4 p-4 rounded-lg ${p.includes("successfully")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:p})]})]})},n0=({currentUser:e})=>{const[t,n]=S.useState([]),[r,s]=S.useState([]),[o,a]=S.useState(!0),[l,c]=S.useState(null),[d,m]=S.useState("all"),[p,f]=S.useState(null);if((e==null?void 0:e.role)!=="administrator")return i.jsxs("div",{className:"p-6 bg-red-50 border border-red-200 rounded-lg",children:[i.jsx("h2",{className:"text-xl font-semibold text-red-800 mb-2",children:"Access Denied"}),i.jsx("p",{className:"text-red-600",children:"You need administrator privileges to access user management."})]});const g=async()=>{try{const v=localStorage.getItem("authToken"),N=await fetch(`${vt}/auth/users`,{headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"}});if(!N.ok)throw new Error("Failed to fetch users");const k=await N.json();n(k)}catch(v){c(v instanceof Error?v.message:"Failed to fetch users")}finally{a(!1)}},b=async()=>{try{const v=localStorage.getItem("authToken"),N=await fetch(`${vt}/auth/users/pending/list`,{headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"}});if(!N.ok)throw new Error("Failed to fetch pending users");const k=await N.json();s(k)}catch(v){c(v instanceof Error?v.message:"Failed to fetch pending users")}},w=async(v,N)=>{f(v);try{const k=localStorage.getItem("authToken");if(!(await fetch(`${vt}/auth/users/${v}/role`,{method:"PATCH",headers:{Authorization:`Bearer ${k}`,"Content-Type":"application/json"},body:JSON.stringify({role:N})})).ok)throw new Error("Failed to update user role");await g()}catch(k){c(k instanceof Error?k.message:"Failed to update user role")}finally{f(null)}},j=async(v,N)=>{if(confirm(`Are you sure you want to delete user "${N}"? This action cannot be undone.`))try{const k=localStorage.getItem("authToken");if(!(await fetch(`${vt}/auth/users/${v}`,{method:"DELETE",headers:{Authorization:`Bearer ${k}`,"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete user");await g(),await b()}catch(k){c(k instanceof Error?k.message:"Failed to delete user")}},x=async(v,N)=>{f(v);try{const k=localStorage.getItem("authToken");if(!(await fetch(`${vt}/auth/users/${v}/approval`,{method:"PATCH",headers:{Authorization:`Bearer ${k}`,"Content-Type":"application/json"},body:JSON.stringify({status:"approved"})})).ok)throw new Error("Failed to approve user");await g(),await b()}catch(k){c(k instanceof Error?k.message:"Failed to approve user")}finally{f(null)}},u=async(v,N)=>{if(confirm(`Are you sure you want to deny access for "${N}"?`)){f(v);try{const k=localStorage.getItem("authToken");if(!(await fetch(`${vt}/auth/users/${v}/approval`,{method:"PATCH",headers:{Authorization:`Bearer ${k}`,"Content-Type":"application/json"},body:JSON.stringify({status:"denied"})})).ok)throw new Error("Failed to deny user");await g(),await b()}catch(k){c(k instanceof Error?k.message:"Failed to deny user")}finally{f(null)}}};S.useEffect(()=>{g(),b()},[]),S.useEffect(()=>{d==="pending"&&b()},[d]);const h=v=>new Date(v).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),y=v=>{switch(v){case"administrator":return"bg-red-100 text-red-800 border-red-200";case"coordinator":return"bg-blue-100 text-blue-800 border-blue-200";case"driver":return"bg-green-100 text-green-800 border-green-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}};return o?i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"animate-pulse",children:[i.jsx("div",{className:"h-8 bg-gray-200 rounded-lg w-1/4 mb-6"}),i.jsx("div",{className:"space-y-4",children:[1,2,3].map(v=>i.jsx("div",{className:"h-20 bg-gray-200 rounded-lg"},v))})]})}):i.jsxs("div",{className:"p-6",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"User Management"}),i.jsx("p",{className:"text-gray-600",children:"Manage user accounts and permissions (PostgreSQL Database)"})]}),l&&i.jsxs("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:[i.jsx("p",{className:"text-red-600",children:l}),i.jsx("button",{onClick:()=>c(null),className:"mt-2 text-sm text-red-500 hover:text-red-700",children:"Dismiss"})]}),i.jsx("div",{className:"mb-6",children:i.jsx("div",{className:"border-b border-gray-200",children:i.jsxs("nav",{className:"-mb-px flex space-x-8",children:[i.jsxs("button",{onClick:()=>m("all"),className:`py-2 px-1 border-b-2 font-medium text-sm ${d==="all"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:["👥 All Users (",t.length,")"]}),i.jsxs("button",{onClick:()=>m("pending"),className:`py-2 px-1 border-b-2 font-medium text-sm ${d==="pending"?"border-orange-500 text-orange-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:["⏳ Pending Approval (",r.length,")",r.length>0&&i.jsx("span",{className:"ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800",children:r.length})]})]})})}),d==="all"&&i.jsxs("div",{className:"bg-white shadow-sm border border-gray-200 rounded-lg overflow-hidden",children:[i.jsx("div",{className:"px-6 py-4 border-b border-gray-200 bg-gray-50",children:i.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["All Users (",t.length,")"]})}),i.jsx("div",{className:"divide-y divide-gray-200",children:t.map(v=>i.jsx("div",{className:"p-6 hover:bg-gray-50",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-4",children:[v.picture?i.jsx("img",{src:v.picture,alt:v.name,className:"w-12 h-12 rounded-full"}):i.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-300 flex items-center justify-center",children:i.jsx("span",{className:"text-gray-600 font-medium",children:v.name.charAt(0).toUpperCase()})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-lg font-medium text-gray-900",children:v.name}),i.jsx("p",{className:"text-gray-600",children:v.email}),i.jsxs("div",{className:"flex items-center space-x-4 mt-1 text-sm text-gray-500",children:[i.jsxs("span",{children:["Joined: ",h(v.created_at)]}),v.last_sign_in_at&&i.jsxs("span",{children:["Last login: ",h(v.last_sign_in_at)]}),i.jsxs("span",{className:"capitalize",children:["via ",v.provider]})]})]})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("span",{className:"text-sm text-gray-600",children:"Role:"}),i.jsxs("select",{value:v.role,onChange:N=>w(v.email,N.target.value),disabled:p===v.email||v.email===e.email,className:`px-3 py-1 border rounded-md text-sm font-medium ${y(v.role)} ${p===v.email?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-opacity-80"}`,children:[i.jsx("option",{value:"coordinator",children:"Coordinator"}),i.jsx("option",{value:"administrator",children:"Administrator"}),i.jsx("option",{value:"driver",children:"Driver"})]})]}),v.email!==e.email&&i.jsx("button",{onClick:()=>j(v.email,v.name),className:"px-3 py-1 text-sm text-red-600 hover:text-red-800 hover:bg-red-50 rounded-md border border-red-200 transition-colors",children:"🗑️ Delete"}),v.email===e.email&&i.jsx("span",{className:"px-3 py-1 text-sm text-blue-600 bg-blue-50 rounded-md border border-blue-200",children:"👤 You"})]})]})},v.email))}),t.length===0&&i.jsx("div",{className:"p-6 text-center text-gray-500",children:"No users found."})]}),d==="pending"&&i.jsxs("div",{className:"bg-white shadow-sm border border-gray-200 rounded-lg overflow-hidden",children:[i.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 bg-orange-50",children:[i.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["Pending Approval (",r.length,")"]}),i.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Users waiting for administrator approval to access the system"})]}),i.jsx("div",{className:"divide-y divide-gray-200",children:r.map(v=>i.jsx("div",{className:"p-6 hover:bg-gray-50",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center space-x-4",children:[v.picture?i.jsx("img",{src:v.picture,alt:v.name,className:"w-12 h-12 rounded-full"}):i.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-300 flex items-center justify-center",children:i.jsx("span",{className:"text-gray-600 font-medium",children:v.name.charAt(0).toUpperCase()})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-lg font-medium text-gray-900",children:v.name}),i.jsx("p",{className:"text-gray-600",children:v.email}),i.jsxs("div",{className:"flex items-center space-x-4 mt-1 text-sm text-gray-500",children:[i.jsxs("span",{children:["Requested: ",h(v.created_at)]}),i.jsxs("span",{className:"capitalize",children:["via ",v.provider]}),i.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${y(v.role)}`,children:v.role})]})]})]}),i.jsxs("div",{className:"flex items-center space-x-3",children:[i.jsx("button",{onClick:()=>x(v.email,v.name),disabled:p===v.email,className:`px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-md transition-colors ${p===v.email?"opacity-50 cursor-not-allowed":""}`,children:p===v.email?"⏳ Approving...":"✅ Approve"}),i.jsx("button",{onClick:()=>u(v.email,v.name),disabled:p===v.email,className:`px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-md transition-colors ${p===v.email?"opacity-50 cursor-not-allowed":""}`,children:p===v.email?"⏳ Denying...":"❌ Deny"})]})]})},v.email))}),r.length===0&&i.jsxs("div",{className:"p-6 text-center text-gray-500",children:[i.jsx("div",{className:"text-6xl mb-4",children:"✅"}),i.jsx("p",{className:"text-lg font-medium mb-2",children:"No pending approvals"}),i.jsx("p",{className:"text-sm",children:"All users have been processed."})]})]}),i.jsxs("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[i.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Role Descriptions:"}),i.jsxs("ul",{className:"text-sm text-blue-800 space-y-1",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Administrator:"})," Full access to all features including user management"]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Coordinator:"})," Can manage VIPs, drivers, and schedules"]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Driver:"})," Can view assigned schedules and update status"]})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-orange-50 border border-orange-200 rounded-lg",children:[i.jsx("h4",{className:"font-medium text-orange-900 mb-2",children:"🔐 User Approval System:"}),i.jsx("p",{className:"text-sm text-orange-800",children:'New users (except the first administrator) require approval before accessing the system. Users with pending approval will see a "pending approval" message when they try to sign in.'})]}),i.jsxs("div",{className:"mt-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:[i.jsx("h4",{className:"font-medium text-green-900 mb-2",children:"✅ PostgreSQL Database:"}),i.jsx("p",{className:"text-sm text-green-800",children:"User data is stored in your PostgreSQL database with proper indexing and relationships. All user management operations are transactional and fully persistent across server restarts."})]})]})};const r0=({onLogin:e,errorMessage:t})=>{const[n,r]=S.useState(null),[s,o]=S.useState(!0);return S.useEffect(()=>{U("/auth/setup").then(a=>a.json()).then(a=>{r(a),o(!1)}).catch(a=>{console.error("Error checking setup status:",a),o(!1)})},[]),s?i.jsx("div",{className:"login-container",children:i.jsx("div",{className:"login-card",children:i.jsx("div",{className:"loading",children:"Loading..."})})}):i.jsx("div",{className:"login-container",children:i.jsxs("div",{className:"login-card",children:[i.jsxs("div",{className:"login-header",children:[i.jsx("h1",{children:"VIP Coordinator"}),i.jsx("p",{children:"Secure access required"})]}),!(n!=null&&n.firstAdminCreated)&&i.jsxs("div",{className:"setup-notice",children:[i.jsx("h3",{children:"🚀 First Time Setup"}),i.jsx("p",{children:"The first person to sign in will be promoted to administrator automatically."})]}),i.jsxs("div",{className:"login-content",children:[i.jsxs("button",{className:"google-login-btn",onClick:e,children:[i.jsx("svg",{className:"google-icon",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#635dff",d:"M22 12.07c0-5.52-4.48-10-10-10s-10 4.48-10 10a9.97 9.97 0 006.85 9.48.73.73 0 00.95-.7v-3.05c-2.79.61-3.38-1.19-3.38-1.19-.46-1.17-1.12-1.49-1.12-1.49-.91-.62.07-.61.07-.61 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.37 1.09 2.96.83.09-.65.35-1.09.63-1.34-2.23-.25-4.57-1.12-4.57-4.96 0-1.1.39-2 1.03-2.7-.1-.25-.45-1.25.1-2.6 0 0 .84-.27 2.75 1.02a9.53 9.53 0 015 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.35.1 2.6.64.7 1.03 1.6 1.03 2.7 0 3.85-2.34 4.71-4.58 4.95.36.31.69.92.69 1.86v2.75c0 .39.27.71.66.79a10 10 0 007.61-9.71z"})}),"Continue with Auth0"]}),i.jsx("div",{className:"login-info",children:i.jsx("p",{children:(n==null?void 0:n.authProvider)==="auth0"?"Sign in with your organisation account. We use Auth0 for secure authentication.":"Authentication service is being configured. Please try again later."})}),t&&i.jsx("div",{className:"dev-login-error",style:{marginTop:"1rem"},children:t})]}),i.jsx("div",{className:"login-footer",children:i.jsx("p",{children:"Secure authentication powered by Auth0"})})]})})};const rs={}.VITE_AUTH0_AUDIENCE;function s0(){const{isLoading:e,isAuthenticated:t,loginWithRedirect:n,logout:r,getAccessTokenSilently:s,user:o,error:a}=Ff(),[l,c]=S.useState(null),[d,m]=S.useState(!0),[p,f]=S.useState(null),[g,b]=S.useState(!1);S.useEffect(()=>{e||(async()=>{if(!t){c(null),f(null),b(!1),m(!1);return}m(!0),b(!1),f(null);try{const v=await s({authorizationParams:{...rs?{audience:rs}:{},scope:"openid profile email"}});localStorage.setItem("authToken",v);const N=await U("/auth/me",{headers:{Authorization:`Bearer ${v}`}});if(N.status===403){const A=await N.json();c(null),b(!0),f(A.message||"Your account is pending administrator approval.");return}if(!N.ok)throw new Error(`Failed to load profile (${N.status})`);const k=await N.json(),C=k.user||k,z=C.name||(o==null?void 0:o.name)||(o==null?void 0:o.nickname)||(o==null?void 0:o.email)||C.email;c({...C,name:z,role:C.role,picture:C.picture||(o==null?void 0:o.picture)})}catch(v){console.error("Authentication bootstrap failed:",v),c(null),f("Authentication failed. Please try signing in again.")}finally{m(!1)}})()},[t,e,s,o]);const w=()=>{localStorage.removeItem("authToken"),r({logoutParams:{returnTo:window.location.origin}})};if(e||d)return i.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 flex justify-center items-center",children:i.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 flex items-center space-x-4",children:[i.jsx("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"}),i.jsx("span",{className:"text-lg font-medium text-slate-700",children:"Loading VIP Coordinator..."})]})});if(g)return i.jsx("div",{className:"min-h-screen bg-gradient-to-br from-amber-50 to-rose-50 flex justify-center items-center px-4",children:i.jsxs("div",{className:"bg-white border border-amber-200/60 rounded-2xl shadow-xl max-w-xl w-full p-8 space-y-4 text-center",children:[i.jsx("div",{className:"flex justify-center",children:i.jsx("div",{className:"w-16 h-16 rounded-full bg-amber-100 text-amber-600 flex items-center justify-center text-3xl",children:"⏳"})}),i.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"Awaiting Administrator Approval"}),i.jsx("p",{className:"text-slate-600",children:p||"Thanks for signing in. An administrator needs to approve your account before you can access the dashboard."}),i.jsx("button",{onClick:w,className:"btn btn-secondary mt-4",children:"Sign out"})]})});const j=async()=>{try{await n({authorizationParams:{...rs?{audience:rs}:{},scope:"openid profile email",redirect_uri:`${window.location.origin}/auth/callback`}})}catch(y){console.error("Auth0 login failed:",y),f((y==null?void 0:y.message)||"Authentication failed. Please try again.")}};if(!t||!l)return i.jsx(r0,{onLogin:j,errorMessage:p||(a==null?void 0:a.message)});const x=l.name&&l.name.trim().length>0?l.name:l.email||"User",u=x.trim().charAt(0).toUpperCase(),h=l.role||"user";return i.jsx(Lg,{children:i.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50",children:[i.jsx("nav",{className:"bg-white/80 backdrop-blur-lg border-b border-slate-200/60 sticky top-0 z-50",children:i.jsx("div",{className:"max-w-7xl mx-auto px-6 lg:px-8",children:i.jsxs("div",{className:"flex justify-between items-center h-16",children:[i.jsxs("div",{className:"flex items-center space-x-3",children:[i.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-600 to-indigo-600 rounded-lg flex items-center justify-center",children:i.jsx("span",{className:"text-white font-bold text-sm",children:"VC"})}),i.jsx("h1",{className:"text-xl font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent",children:"VIP Coordinator"})]}),i.jsxs("div",{className:"hidden md:flex items-center space-x-1",children:[i.jsx(we,{to:"/",className:"px-4 py-2 text-sm font-medium text-slate-700 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all duration-200",children:"Dashboard"}),i.jsx(we,{to:"/vips",className:"px-4 py-2 text-sm font-medium text-slate-700 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all duration-200",children:"VIPs"}),i.jsx(we,{to:"/drivers",className:"px-4 py-2 text-sm font-medium text-slate-700 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all duration-200",children:"Drivers"}),h==="administrator"&&i.jsx(we,{to:"/admin",className:"px-4 py-2 text-sm font-medium text-slate-700 hover:text-amber-600 hover:bg-amber-50 rounded-lg transition-all duration-200",children:"Admin"}),h==="administrator"&&i.jsx(we,{to:"/users",className:"px-4 py-2 text-sm font-medium text-slate-700 hover:text-purple-600 hover:bg-purple-50 rounded-lg transition-all duration-200",children:"Users"})]}),i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsxs("div",{className:"hidden sm:flex items-center space-x-3",children:[i.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-slate-400 to-slate-600 rounded-full flex items-center justify-center overflow-hidden",children:l.picture?i.jsx("img",{src:l.picture,alt:x,className:"w-8 h-8 object-cover"}):i.jsx("span",{className:"text-white text-xs font-medium",children:u})}),i.jsxs("div",{className:"text-sm",children:[i.jsx("div",{className:"font-medium text-slate-900",children:x}),i.jsx("div",{className:"text-slate-500 capitalize",children:h})]})]}),i.jsx("button",{onClick:w,className:"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-lg hover:shadow-xl",children:"Logout"})]})]})})}),i.jsx("main",{className:"max-w-7xl mx-auto px-6 lg:px-8 py-8",children:i.jsxs(Pg,{children:[i.jsx(ft,{path:"/",element:i.jsx(Qg,{})}),i.jsx(ft,{path:"/vips",element:i.jsx(Wg,{})}),i.jsx(ft,{path:"/vips/:id",element:i.jsx(Hg,{})}),i.jsx(ft,{path:"/drivers",element:i.jsx(Jg,{})}),i.jsx(ft,{path:"/drivers/:driverId",element:i.jsx(Yg,{})}),i.jsx(ft,{path:"/admin",element:i.jsx(t0,{})}),i.jsx(ft,{path:"/users",element:i.jsx(n0,{currentUser:l})})]})})]})})}const fh={}.VITE_AUTH0_DOMAIN,gh={}.VITE_AUTH0_CLIENT_ID,Tc={}.VITE_AUTH0_AUDIENCE;if(!fh||!gh)throw new Error("Auth0 environment variables are missing. Please set VITE_AUTH0_DOMAIN and VITE_AUTH0_CLIENT_ID.");const xh={redirect_uri:`${window.location.origin}/auth/callback`,scope:"openid profile email"};Tc&&(xh.audience=Tc);Bi.createRoot(document.getElementById("root")).render(i.jsx(Zo.StrictMode,{children:i.jsx($f,{domain:fh,clientId:gh,authorizationParams:xh,cacheLocation:"localstorage",useRefreshTokens:!0,children:i.jsx(s0,{})})}));