diff --git a/src/GreenHome.Api/Controllers/AdminController.cs b/src/GreenHome.Api/Controllers/AdminController.cs index 975a570..eb9a682 100644 --- a/src/GreenHome.Api/Controllers/AdminController.cs +++ b/src/GreenHome.Api/Controllers/AdminController.cs @@ -254,6 +254,17 @@ public sealed class AdminController : ControllerBase return Ok(result); } + /// + /// Queues a one-shot reset: the device's next AddData response is the bare token "RST". + /// + [HttpPost("devices/{id:int}/request-reset")] + public async Task> RequestDeviceReset(int id, CancellationToken cancellationToken) + { + var currentAdminId = ((UserDto)HttpContext.Items["AdminUser"]!).Id; + var result = await _adminService.RequestDeviceResetAsync(id, currentAdminId, cancellationToken); + return Ok(result); + } + // ==================== Reports ==================== [HttpGet("reports/users")] diff --git a/src/GreenHome.Api/Controllers/TelemetryController.cs b/src/GreenHome.Api/Controllers/TelemetryController.cs index 10bf97c..afdca56 100644 --- a/src/GreenHome.Api/Controllers/TelemetryController.cs +++ b/src/GreenHome.Api/Controllers/TelemetryController.cs @@ -35,10 +35,15 @@ public class TelemetryController : ControllerBase telementry.TimestampUtc = DateTime.UtcNow; telementry.RelayStates = ParseRelayStates(Request.Query); var id = await telemetryService.AddAsync(telementry, cancellationToken); + var deviceId = telementry.DeviceId; + + // A queued reset is answered with the bare token "RST" and nothing else. The flag is + // consumed here, so every request after this one follows the normal routine again. + if (deviceId > 0 && await telemetryService.ConsumeResetRequestAsync(deviceId, cancellationToken)) + return Ok("RST"); var parts = new List { $"ID:{id}" }; - var deviceId = telementry.DeviceId; - + if (deviceId > 0) { // 1. Check alerts and power status diff --git a/src/GreenHome.Api/Program.cs b/src/GreenHome.Api/Program.cs index e2420c9..030e8b4 100644 --- a/src/GreenHome.Api/Program.cs +++ b/src/GreenHome.Api/Program.cs @@ -121,20 +121,10 @@ void ApplyMigrations(WebApplication app) try { + // Both providers now own a real migration set, so the schema only ever comes from + // Migrate(): SqlServer -> Data/Migrations/Migrations, Postgres -> Data/Migrations/Postgres. var context = services.GetRequiredService(); - var provider = app.Configuration["Database:Provider"] ?? "SqlServer"; - - if (provider == "Postgres") - { - // Soft-migration path: Postgres starts empty. EnsureCreated() is - // idempotent — it builds the full schema from the model only when no - // tables exist yet, and is a no-op once schema + data are in place. - context.Database.EnsureCreated(); - } - else - { - context.Database.Migrate(); - } + context.Database.Migrate(); } catch (Exception ex) { diff --git a/src/GreenHome.Api/wwwroot/assets/AnalysisTab-C68ADY84.js b/src/GreenHome.Api/wwwroot/assets/AnalysisTab-Cx882vvN.js similarity index 99% rename from src/GreenHome.Api/wwwroot/assets/AnalysisTab-C68ADY84.js rename to src/GreenHome.Api/wwwroot/assets/AnalysisTab-Cx882vvN.js index 66018b4..0d6a951 100644 --- a/src/GreenHome.Api/wwwroot/assets/AnalysisTab-C68ADY84.js +++ b/src/GreenHome.Api/wwwroot/assets/AnalysisTab-Cx882vvN.js @@ -1,4 +1,4 @@ -import{e as br,g as Pt,j as W,r as Te,h as wr,L as Sr,E as Er,B as Cr,R as Ir,k as Tr,t as en}from"./index-BNRf8j5s.js";/** +import{e as br,g as Pt,j as W,r as Te,h as wr,L as Sr,E as Er,B as Cr,R as Ir,k as Tr,t as en}from"./index-DJFTNPFV.js";/** * @license lucide-react v0.553.0 - ISC * * This source code is licensed under the ISC license. diff --git a/src/GreenHome.Api/wwwroot/assets/WeatherTab-CRtiHhGA.js b/src/GreenHome.Api/wwwroot/assets/WeatherTab-Ds0s1BtG.js similarity index 97% rename from src/GreenHome.Api/wwwroot/assets/WeatherTab-CRtiHhGA.js rename to src/GreenHome.Api/wwwroot/assets/WeatherTab-Ds0s1BtG.js index e63e848..3d8152d 100644 --- a/src/GreenHome.Api/wwwroot/assets/WeatherTab-CRtiHhGA.js +++ b/src/GreenHome.Api/wwwroot/assets/WeatherTab-Ds0s1BtG.js @@ -1 +1 @@ -import{j as s,T as g,P as N,S as b,W as v,r,i as m,f as T,a as W,b as E,Q as S,c as w,L as C,E as L,B as M,R as H,M as P,d as k}from"./index-BNRf8j5s.js";function O({weatherData:e,selectedDate:a}){return s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[s.jsx("div",{className:"bg-blue-600 p-5",children:s.jsxs("div",{className:"text-center text-white",children:[s.jsx("p",{className:"text-sm opacity-90 mb-1",children:"📅 وضعیت آب و هوای روز"}),s.jsx("p",{className:"text-xl font-bold",children:a})]})}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-3",children:[s.jsx(g,{weatherData:e,isToday:!1}),s.jsx(N,{weatherData:e}),s.jsx(b,{weatherData:e}),s.jsx(v,{weatherData:e})]})]})})}function R({selectedDate:e}){const[a,t]=r.useState(null),[h,o]=r.useState(!1),[c,n]=r.useState(null),[f,d]=r.useState(null),[j,i]=r.useState("در حال دریافت..."),x=r.useCallback(async()=>{if(!a){o(!0),n(null);try{const l=m(e),[p,y]=await Promise.all([l?T():W(e),E(S,w)]);t(p),i(y)}catch(l){console.error("Error loading weather:",l),n("خطا در دریافت اطلاعات آب و هوا. لطفاً دوباره تلاش کنید."),i("کهک قم، ایران")}finally{o(!1)}}},[e,a]);if(r.useEffect(()=>{t(null),n(null),d(null),i("در حال دریافت...")},[e]),h)return s.jsx(C,{message:"در حال دریافت اطلاعات آب و هوا...",fullScreen:!1});if(c)return s.jsx(L,{message:c,action:s.jsx(M,{onClick:()=>{t(null),x()},variant:"primary",icon:H,children:"تلاش مجدد"})});if(!a)return x(),null;const u=m(e);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[s.jsx(P,{className:"w-5 h-5 text-sky-500"}),s.jsx("span",{className:"font-medium",children:j})]}),s.jsx("span",{className:"text-xs text-gray-400",children:u?"پیش‌بینی هواشناسی برای مدیریت گلخانه":"وضعیت آب و هوای روز انتخاب شده"})]}),u?s.jsx(k,{weatherData:a,expandedDayIndex:f,onDayToggle:d}):s.jsx(O,{weatherData:a,selectedDate:e})]})}export{R as WeatherTab}; +import{j as s,T as g,P as N,S as b,W as v,r,i as m,f as T,a as W,b as E,Q as S,c as w,L as C,E as L,B as M,R as H,M as P,d as k}from"./index-DJFTNPFV.js";function O({weatherData:e,selectedDate:a}){return s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[s.jsx("div",{className:"bg-blue-600 p-5",children:s.jsxs("div",{className:"text-center text-white",children:[s.jsx("p",{className:"text-sm opacity-90 mb-1",children:"📅 وضعیت آب و هوای روز"}),s.jsx("p",{className:"text-xl font-bold",children:a})]})}),s.jsxs("div",{className:"p-4 grid grid-cols-2 gap-3",children:[s.jsx(g,{weatherData:e,isToday:!1}),s.jsx(N,{weatherData:e}),s.jsx(b,{weatherData:e}),s.jsx(v,{weatherData:e})]})]})})}function R({selectedDate:e}){const[a,t]=r.useState(null),[h,o]=r.useState(!1),[c,n]=r.useState(null),[f,d]=r.useState(null),[j,i]=r.useState("در حال دریافت..."),x=r.useCallback(async()=>{if(!a){o(!0),n(null);try{const l=m(e),[p,y]=await Promise.all([l?T():W(e),E(S,w)]);t(p),i(y)}catch(l){console.error("Error loading weather:",l),n("خطا در دریافت اطلاعات آب و هوا. لطفاً دوباره تلاش کنید."),i("کهک قم، ایران")}finally{o(!1)}}},[e,a]);if(r.useEffect(()=>{t(null),n(null),d(null),i("در حال دریافت...")},[e]),h)return s.jsx(C,{message:"در حال دریافت اطلاعات آب و هوا...",fullScreen:!1});if(c)return s.jsx(L,{message:c,action:s.jsx(M,{onClick:()=>{t(null),x()},variant:"primary",icon:H,children:"تلاش مجدد"})});if(!a)return x(),null;const u=m(e);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[s.jsx(P,{className:"w-5 h-5 text-sky-500"}),s.jsx("span",{className:"font-medium",children:j})]}),s.jsx("span",{className:"text-xs text-gray-400",children:u?"پیش‌بینی هواشناسی برای مدیریت گلخانه":"وضعیت آب و هوای روز انتخاب شده"})]}),u?s.jsx(k,{weatherData:a,expandedDayIndex:f,onDayToggle:d}):s.jsx(O,{weatherData:a,selectedDate:e})]})}export{R as WeatherTab}; diff --git a/src/GreenHome.Api/wwwroot/assets/index-BNRf8j5s.js b/src/GreenHome.Api/wwwroot/assets/index-BNRf8j5s.js deleted file mode 100644 index 2199c77..0000000 --- a/src/GreenHome.Api/wwwroot/assets/index-BNRf8j5s.js +++ /dev/null @@ -1,417 +0,0 @@ -var RS=Object.defineProperty;var OS=(n,t,a)=>t in n?RS(n,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[t]=a;var _e=(n,t,a)=>OS(n,typeof t!="symbol"?t+"":t,a);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function a(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(l){if(l.ep)return;l.ep=!0;const o=a(l);fetch(l.href,o)}})();function ly(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var sf={exports:{}},Al={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Bp;function LS(){if(Bp)return Al;Bp=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(s,l,o){var u=null;if(o!==void 0&&(u=""+o),l.key!==void 0&&(u=""+l.key),"key"in l){o={};for(var d in l)d!=="key"&&(o[d]=l[d])}else o=l;return l=o.ref,{$$typeof:n,type:s,key:u,ref:l!==void 0?l:null,props:o}}return Al.Fragment=t,Al.jsx=a,Al.jsxs=a,Al}var Up;function HS(){return Up||(Up=1,sf.exports=LS()),sf.exports}var h=HS(),lf={exports:{}},be={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var $p;function BS(){if($p)return be;$p=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function _(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,S={};function N(O,I,W){this.props=O,this.context=I,this.refs=S,this.updater=W||M}N.prototype.isReactComponent={},N.prototype.setState=function(O,I){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,I,"setState")},N.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function C(){}C.prototype=N.prototype;function k(O,I,W){this.props=O,this.context=I,this.refs=S,this.updater=W||M}var E=k.prototype=new C;E.constructor=k,j(E,N.prototype),E.isPureReactComponent=!0;var A=Array.isArray;function z(){}var L={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function X(O,I,W){var ee=W.ref;return{$$typeof:n,type:O,key:I,ref:ee!==void 0?ee:null,props:W}}function de(O,I){return X(O.type,I,O.props)}function Q(O){return typeof O=="object"&&O!==null&&O.$$typeof===n}function ae(O){var I={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(W){return I[W]})}var Ee=/\/+/g;function Oe(O,I){return typeof O=="object"&&O!==null&&O.key!=null?ae(""+O.key):I.toString(36)}function he(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(z,z):(O.status="pending",O.then(function(I){O.status==="pending"&&(O.status="fulfilled",O.value=I)},function(I){O.status==="pending"&&(O.status="rejected",O.reason=I)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function U(O,I,W,ee,ne){var le=typeof O;(le==="undefined"||le==="boolean")&&(O=null);var ge=!1;if(O===null)ge=!0;else switch(le){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(O.$$typeof){case n:case t:ge=!0;break;case x:return ge=O._init,U(ge(O._payload),I,W,ee,ne)}}if(ge)return ne=ne(O),ge=ee===""?"."+Oe(O,0):ee,A(ne)?(W="",ge!=null&&(W=ge.replace(Ee,"$&/")+"/"),U(ne,I,W,"",function(kn){return kn})):ne!=null&&(Q(ne)&&(ne=de(ne,W+(ne.key==null||O&&O.key===ne.key?"":(""+ne.key).replace(Ee,"$&/")+"/")+ge)),I.push(ne)),1;ge=0;var rt=ee===""?".":ee+":";if(A(O))for(var ye=0;ye>>1,P=U[we];if(0>>1;wel(W,fe))eel(ne,W)?(U[we]=ne,U[ee]=fe,we=ee):(U[we]=W,U[I]=fe,we=I);else if(eel(ne,fe))U[we]=ne,U[ee]=fe,we=ee;else break e}}return K}function l(U,K){var fe=U.sortIndex-K.sortIndex;return fe!==0?fe:U.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var u=Date,d=u.now();n.unstable_now=function(){return u.now()-d}}var f=[],g=[],x=1,b=null,v=3,_=!1,M=!1,j=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function E(U){for(var K=a(g);K!==null;){if(K.callback===null)s(g);else if(K.startTime<=U)s(g),K.sortIndex=K.expirationTime,t(f,K);else break;K=a(g)}}function A(U){if(j=!1,E(U),!M)if(a(f)!==null)M=!0,z||(z=!0,ae());else{var K=a(g);K!==null&&he(A,K.startTime-U)}}var z=!1,L=-1,R=5,X=-1;function de(){return S?!0:!(n.unstable_now()-XU&&de());){var we=b.callback;if(typeof we=="function"){b.callback=null,v=b.priorityLevel;var P=we(b.expirationTime<=U);if(U=n.unstable_now(),typeof P=="function"){b.callback=P,E(U),K=!0;break t}b===a(f)&&s(f),E(U)}else s(f);b=a(f)}if(b!==null)K=!0;else{var O=a(g);O!==null&&he(A,O.startTime-U),K=!1}}break e}finally{b=null,v=fe,_=!1}K=void 0}}finally{K?ae():z=!1}}}var ae;if(typeof k=="function")ae=function(){k(Q)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Oe=Ee.port2;Ee.port1.onmessage=Q,ae=function(){Oe.postMessage(null)}}else ae=function(){N(Q,0)};function he(U,K){L=N(function(){U(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125we?(U.sortIndex=fe,t(g,U),a(f)===null&&U===a(g)&&(j?(C(L),L=-1):j=!0,he(A,fe-we))):(U.sortIndex=P,t(f,U),M||_||(M=!0,z||(z=!0,ae()))),U},n.unstable_shouldYield=de,n.unstable_wrapCallback=function(U){var K=v;return function(){var fe=v;v=K;try{return U.apply(this,arguments)}finally{v=fe}}}})(cf)),cf}var Gp;function $S(){return Gp||(Gp=1,of.exports=US()),of.exports}var uf={exports:{}},Mt={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var qp;function VS(){if(qp)return Mt;qp=1;var n=eh();function t(f){var g="https://react.dev/errors/"+f;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),uf.exports=VS(),uf.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ip;function GS(){if(Ip)return Dl;Ip=1;var n=$S(),t=eh(),a=YS();function s(e){var i="https://react.dev/errors/"+e;if(1P||(e.current=we[P],we[P]=null,P--)}function W(e,i){P++,we[P]=e.current,e.current=i}var ee=O(null),ne=O(null),le=O(null),ge=O(null);function rt(e,i){switch(W(le,i),W(ne,e),W(ee,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?rp(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=rp(i),e=op(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}I(ee),W(ee,e)}function ye(){I(ee),I(ne),I(le)}function kn(e){e.memoizedState!==null&&W(ge,e);var i=ee.current,r=op(i,e.type);i!==r&&(W(ne,e),W(ee,r))}function re(e){ne.current===e&&(I(ee),I(ne)),ge.current===e&&(I(ge),Tl._currentValue=fe)}var xe,Ae;function je(e){if(xe===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);xe=i&&i[1]||"",Ae=-1)":-1m||D[c]!==V[m]){var q=` -`+D[c].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=c&&0<=m);break}}}finally{Je=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?je(r):""}function bn(e,i){switch(e.tag){case 26:case 27:case 5:return je(e.type);case 16:return je("Lazy");case 13:return e.child!==i&&i!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return xt(e.type,!1);case 11:return xt(e.type.render,!1);case 1:return xt(e.type,!0);case 31:return je("Activity");default:return""}}function Ct(e){try{var i="",r=null;do i+=bn(e,r),r=e,e=e.return;while(e);return i}catch(c){return` -Error generating stack: `+c.message+` -`+c.stack}}var an=Object.prototype.hasOwnProperty,ot=n.unstable_scheduleCallback,Xc=n.unstable_cancelCallback,f1=n.unstable_shouldYield,h1=n.unstable_requestPaint,Gt=n.unstable_now,m1=n.unstable_getCurrentPriorityLevel,Uh=n.unstable_ImmediatePriority,$h=n.unstable_UserBlockingPriority,ur=n.unstable_NormalPriority,g1=n.unstable_LowPriority,Vh=n.unstable_IdlePriority,p1=n.log,x1=n.unstable_setDisableYieldValue,Us=null,qt=null;function fa(e){if(typeof p1=="function"&&x1(e),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Us,e)}catch{}}var Xt=Math.clz32?Math.clz32:v1,b1=Math.log,y1=Math.LN2;function v1(e){return e>>>=0,e===0?32:31-(b1(e)/y1|0)|0}var dr=256,fr=262144,hr=4194304;function Za(e){var i=e&42;if(i!==0)return i;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function mr(e,i,r){var c=e.pendingLanes;if(c===0)return 0;var m=0,p=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var T=c&134217727;return T!==0?(c=T&~p,c!==0?m=Za(c):(y&=T,y!==0?m=Za(y):r||(r=T&~e,r!==0&&(m=Za(r))))):(T=c&~p,T!==0?m=Za(T):y!==0?m=Za(y):r||(r=c&~e,r!==0&&(m=Za(r)))),m===0?0:i!==0&&i!==m&&(i&p)===0&&(p=m&-m,r=i&-i,p>=r||p===32&&(r&4194048)!==0)?i:m}function $s(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function S1(e,i){switch(e){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yh(){var e=hr;return hr<<=1,(hr&62914560)===0&&(hr=4194304),e}function Ic(e){for(var i=[],r=0;31>r;r++)i.push(e);return i}function Vs(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _1(e,i,r,c,m,p){var y=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var T=e.entanglements,D=e.expirationTimes,V=e.hiddenUpdates;for(r=y&~r;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var k1=/[\n"\\]/g;function ln(e){return e.replace(k1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Wc(e,i,r,c,m,p,y,T){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),i!=null?y==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+sn(i)):e.value!==""+sn(i)&&(e.value=""+sn(i)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),i!=null?Jc(e,y,sn(i)):r!=null?Jc(e,y,sn(r)):c!=null&&e.removeAttribute("value"),m==null&&p!=null&&(e.defaultChecked=!!p),m!=null&&(e.checked=m&&typeof m!="function"&&typeof m!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.name=""+sn(T):e.removeAttribute("name")}function tm(e,i,r,c,m,p,y,T){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),i!=null||r!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Pc(e);return}r=r!=null?""+sn(r):"",i=i!=null?""+sn(i):r,T||i===e.value||(e.value=i),e.defaultValue=i}c=c??m,c=typeof c!="function"&&typeof c!="symbol"&&!!c,e.checked=T?e.checked:!!c,e.defaultChecked=!!c,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),Pc(e)}function Jc(e,i,r){i==="number"&&xr(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Hi(e,i,r,c){if(e=e.options,i){i={};for(var m=0;m"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),iu=!1;if(Yn)try{var Xs={};Object.defineProperty(Xs,"passive",{get:function(){iu=!0}}),window.addEventListener("test",Xs,Xs),window.removeEventListener("test",Xs,Xs)}catch{iu=!1}var ma=null,su=null,yr=null;function om(){if(yr)return yr;var e,i=su,r=i.length,c,m="value"in ma?ma.value:ma.textContent,p=m.length;for(e=0;e=Qs),mm=" ",gm=!1;function pm(e,i){switch(e){case"keyup":return n2.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vi=!1;function i2(e,i){switch(e){case"compositionend":return xm(i);case"keypress":return i.which!==32?null:(gm=!0,mm);case"textInput":return e=i.data,e===mm&&gm?null:e;default:return null}}function s2(e,i){if(Vi)return e==="compositionend"||!uu&&pm(e,i)?(e=om(),yr=su=ma=null,Vi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:r,offset:i-e};e=c}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Nm(r)}}function Tm(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Tm(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function km(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=xr(e.document);i instanceof e.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)e=i.contentWindow;else break;i=xr(e.document)}return i}function hu(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var h2=Yn&&"documentMode"in document&&11>=document.documentMode,Yi=null,mu=null,Ws=null,gu=!1;function Cm(e,i,r){var c=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;gu||Yi==null||Yi!==xr(c)||(c=Yi,"selectionStart"in c&&hu(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ws&&Ps(Ws,c)||(Ws=c,c=ho(mu,"onSelect"),0>=y,m-=y,Cn=1<<32-Xt(i)+m|r<Se?(Ce=ue,ue=null):Ce=ue.sibling;var He=Y(B,ue,$[Se],F);if(He===null){ue===null&&(ue=Ce);break}e&&ue&&He.alternate===null&&i(B,ue),H=p(He,H,Se),Le===null?me=He:Le.sibling=He,Le=He,ue=Ce}if(Se===$.length)return r(B,ue),De&&qn(B,Se),me;if(ue===null){for(;Se<$.length;Se++)ue=Z(B,$[Se],F),ue!==null&&(H=p(ue,H,Se),Le===null?me=ue:Le.sibling=ue,Le=ue);return De&&qn(B,Se),me}for(ue=c(ue);Se<$.length;Se++)Ce=G(ue,B,Se,$[Se],F),Ce!==null&&(e&&Ce.alternate!==null&&ue.delete(Ce.key===null?Se:Ce.key),H=p(Ce,H,Se),Le===null?me=Ce:Le.sibling=Ce,Le=Ce);return e&&ue.forEach(function(La){return i(B,La)}),De&&qn(B,Se),me}function pe(B,H,$,F){if($==null)throw Error(s(151));for(var me=null,Le=null,ue=H,Se=H=0,Ce=null,He=$.next();ue!==null&&!He.done;Se++,He=$.next()){ue.index>Se?(Ce=ue,ue=null):Ce=ue.sibling;var La=Y(B,ue,He.value,F);if(La===null){ue===null&&(ue=Ce);break}e&&ue&&La.alternate===null&&i(B,ue),H=p(La,H,Se),Le===null?me=La:Le.sibling=La,Le=La,ue=Ce}if(He.done)return r(B,ue),De&&qn(B,Se),me;if(ue===null){for(;!He.done;Se++,He=$.next())He=Z(B,He.value,F),He!==null&&(H=p(He,H,Se),Le===null?me=He:Le.sibling=He,Le=He);return De&&qn(B,Se),me}for(ue=c(ue);!He.done;Se++,He=$.next())He=G(ue,B,Se,He.value,F),He!==null&&(e&&He.alternate!==null&&ue.delete(He.key===null?Se:He.key),H=p(He,H,Se),Le===null?me=He:Le.sibling=He,Le=He);return e&&ue.forEach(function(zS){return i(B,zS)}),De&&qn(B,Se),me}function qe(B,H,$,F){if(typeof $=="object"&&$!==null&&$.type===j&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case _:e:{for(var me=$.key;H!==null;){if(H.key===me){if(me=$.type,me===j){if(H.tag===7){r(B,H.sibling),F=m(H,$.props.children),F.return=B,B=F;break e}}else if(H.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===R&&li(me)===H.type){r(B,H.sibling),F=m(H,$.props),il(F,$),F.return=B,B=F;break e}r(B,H);break}else i(B,H);H=H.sibling}$.type===j?(F=ti($.props.children,B.mode,F,$.key),F.return=B,B=F):(F=Cr($.type,$.key,$.props,null,B.mode,F),il(F,$),F.return=B,B=F)}return y(B);case M:e:{for(me=$.key;H!==null;){if(H.key===me)if(H.tag===4&&H.stateNode.containerInfo===$.containerInfo&&H.stateNode.implementation===$.implementation){r(B,H.sibling),F=m(H,$.children||[]),F.return=B,B=F;break e}else{r(B,H);break}else i(B,H);H=H.sibling}F=_u($,B.mode,F),F.return=B,B=F}return y(B);case R:return $=li($),qe(B,H,$,F)}if(he($))return oe(B,H,$,F);if(ae($)){if(me=ae($),typeof me!="function")throw Error(s(150));return $=me.call($),pe(B,H,$,F)}if(typeof $.then=="function")return qe(B,H,Lr($),F);if($.$$typeof===k)return qe(B,H,Dr(B,$),F);Hr(B,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,H!==null&&H.tag===6?(r(B,H.sibling),F=m(H,$),F.return=B,B=F):(r(B,H),F=Su($,B.mode,F),F.return=B,B=F),y(B)):r(B,H)}return function(B,H,$,F){try{al=0;var me=qe(B,H,$,F);return Ji=null,me}catch(ue){if(ue===Wi||ue===Rr)throw ue;var Le=Ft(29,ue,null,B.mode);return Le.lanes=F,Le.return=B,Le}finally{}}}var oi=Wm(!0),Jm=Wm(!1),ya=!1;function Ru(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ou(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,i,r){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Be&2)!==0){var m=c.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),c.pending=i,i=kr(e),Lm(e,null,r),i}return Tr(e,c,i,r),kr(e)}function sl(e,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var c=i.lanes;c&=e.pendingLanes,r|=c,i.lanes=r,qh(e,r)}}function Lu(e,i){var r=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,r===c)){var m=null,p=null;if(r=r.firstBaseUpdate,r!==null){do{var y={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};p===null?m=p=y:p=p.next=y,r=r.next}while(r!==null);p===null?m=p=i:p=p.next=i}else m=p=i;r={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=i:e.next=i,r.lastBaseUpdate=i}var Hu=!1;function ll(){if(Hu){var e=Pi;if(e!==null)throw e}}function rl(e,i,r,c){Hu=!1;var m=e.updateQueue;ya=!1;var p=m.firstBaseUpdate,y=m.lastBaseUpdate,T=m.shared.pending;if(T!==null){m.shared.pending=null;var D=T,V=D.next;D.next=null,y===null?p=V:y.next=V,y=D;var q=e.alternate;q!==null&&(q=q.updateQueue,T=q.lastBaseUpdate,T!==y&&(T===null?q.firstBaseUpdate=V:T.next=V,q.lastBaseUpdate=D))}if(p!==null){var Z=m.baseState;y=0,q=V=D=null,T=p;do{var Y=T.lane&-536870913,G=Y!==T.lane;if(G?(ke&Y)===Y:(c&Y)===Y){Y!==0&&Y===Ki&&(Hu=!0),q!==null&&(q=q.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var oe=e,pe=T;Y=i;var qe=r;switch(pe.tag){case 1:if(oe=pe.payload,typeof oe=="function"){Z=oe.call(qe,Z,Y);break e}Z=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=pe.payload,Y=typeof oe=="function"?oe.call(qe,Z,Y):oe,Y==null)break e;Z=b({},Z,Y);break e;case 2:ya=!0}}Y=T.callback,Y!==null&&(e.flags|=64,G&&(e.flags|=8192),G=m.callbacks,G===null?m.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:T.tag,payload:T.payload,callback:T.callback,next:null},q===null?(V=q=G,D=Z):q=q.next=G,y|=Y;if(T=T.next,T===null){if(T=m.shared.pending,T===null)break;G=T,T=G.next,G.next=null,m.lastBaseUpdate=G,m.shared.pending=null}}while(!0);q===null&&(D=Z),m.baseState=D,m.firstBaseUpdate=V,m.lastBaseUpdate=q,p===null&&(m.shared.lanes=0),Ma|=y,e.lanes=y,e.memoizedState=Z}}function eg(e,i){if(typeof e!="function")throw Error(s(191,e));e.call(i)}function tg(e,i){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;ep?p:8;var y=U.T,T={};U.T=T,nd(e,!1,i,r);try{var D=m(),V=U.S;if(V!==null&&V(T,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var q=_2(D,c);ul(e,i,q,Wt(e))}else ul(e,i,c,Wt(e))}catch(Z){ul(e,i,{then:function(){},status:"rejected",reason:Z},Wt())}finally{K.p=p,y!==null&&T.types!==null&&(y.types=T.types),U.T=y}}function k2(){}function ed(e,i,r,c){if(e.tag!==5)throw Error(s(476));var m=zg(e).queue;Dg(e,m,i,fe,r===null?k2:function(){return Rg(e),r(c)})}function zg(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:fe},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:r},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Rg(e){var i=zg(e);i.next===null&&(i=e.alternate.memoizedState),ul(e,i.next.queue,{},Wt())}function td(){return wt(Tl)}function Og(){return st().memoizedState}function Lg(){return st().memoizedState}function C2(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var r=Wt();e=va(r);var c=Sa(i,e,r);c!==null&&(Ht(c,i,r),sl(c,i,r)),i={cache:Eu()},e.payload=i;return}i=i.return}}function E2(e,i,r){var c=Wt();r={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fr(e)?Bg(i,r):(r=yu(e,i,r,c),r!==null&&(Ht(r,e,c),Ug(r,i,c)))}function Hg(e,i,r){var c=Wt();ul(e,i,r,c)}function ul(e,i,r,c){var m={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Fr(e))Bg(i,m);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var y=i.lastRenderedState,T=p(y,r);if(m.hasEagerState=!0,m.eagerState=T,It(T,y))return Tr(e,i,m,0),Xe===null&&Mr(),!1}catch{}finally{}if(r=yu(e,i,m,c),r!==null)return Ht(r,e,c),Ug(r,i,c),!0}return!1}function nd(e,i,r,c){if(c={lane:2,revertLane:Rd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Fr(e)){if(i)throw Error(s(479))}else i=yu(e,r,c,2),i!==null&&Ht(i,e,2)}function Fr(e){var i=e.alternate;return e===ve||i!==null&&i===ve}function Bg(e,i){ts=$r=!0;var r=e.pending;r===null?i.next=i:(i.next=r.next,r.next=i),e.pending=i}function Ug(e,i,r){if((r&4194048)!==0){var c=i.lanes;c&=e.pendingLanes,r|=c,i.lanes=r,qh(e,r)}}var dl={readContext:wt,use:Gr,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useLayoutEffect:nt,useInsertionEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useSyncExternalStore:nt,useId:nt,useHostTransitionStatus:nt,useFormState:nt,useActionState:nt,useOptimistic:nt,useMemoCache:nt,useCacheRefresh:nt};dl.useEffectEvent=nt;var $g={readContext:wt,use:Gr,useCallback:function(e,i){return Et().memoizedState=[e,i===void 0?null:i],e},useContext:wt,useEffect:wg,useImperativeHandle:function(e,i,r){r=r!=null?r.concat([e]):null,Xr(4194308,4,Tg.bind(null,i,e),r)},useLayoutEffect:function(e,i){return Xr(4194308,4,e,i)},useInsertionEffect:function(e,i){Xr(4,2,e,i)},useMemo:function(e,i){var r=Et();i=i===void 0?null:i;var c=e();if(ci){fa(!0);try{e()}finally{fa(!1)}}return r.memoizedState=[c,i],c},useReducer:function(e,i,r){var c=Et();if(r!==void 0){var m=r(i);if(ci){fa(!0);try{r(i)}finally{fa(!1)}}}else m=i;return c.memoizedState=c.baseState=m,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:m},c.queue=e,e=e.dispatch=E2.bind(null,ve,e),[c.memoizedState,e]},useRef:function(e){var i=Et();return e={current:e},i.memoizedState=e},useState:function(e){e=Zu(e);var i=e.queue,r=Hg.bind(null,ve,i);return i.dispatch=r,[e.memoizedState,r]},useDebugValue:Wu,useDeferredValue:function(e,i){var r=Et();return Ju(r,e,i)},useTransition:function(){var e=Zu(!1);return e=Dg.bind(null,ve,e.queue,!0,!1),Et().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,r){var c=ve,m=Et();if(De){if(r===void 0)throw Error(s(407));r=r()}else{if(r=i(),Xe===null)throw Error(s(349));(ke&127)!==0||rg(c,i,r)}m.memoizedState=r;var p={value:r,getSnapshot:i};return m.queue=p,wg(cg.bind(null,c,p,e),[e]),c.flags|=2048,as(9,{destroy:void 0},og.bind(null,c,p,r,i),null),r},useId:function(){var e=Et(),i=Xe.identifierPrefix;if(De){var r=En,c=Cn;r=(c&~(1<<32-Xt(c)-1)).toString(32)+r,i="_"+i+"R_"+r,r=Vr++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?y.createElement("select",{is:c.is}):y.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?y.createElement(m,{is:c.is}):y.createElement(m)}}p[St]=i,p[At]=c;e:for(y=i.child;y!==null;){if(y.tag===5||y.tag===6)p.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===i)break e;for(;y.sibling===null;){if(y.return===null||y.return===i)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}i.stateNode=p;e:switch(Nt(p,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Kn(i)}}return Ze(i),pd(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,r),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==c&&Kn(i);else{if(typeof c!="string"&&i.stateNode===null)throw Error(s(166));if(e=le.current,Qi(i)){if(e=i.stateNode,r=i.memoizedProps,c=null,m=_t,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}e[St]=i,e=!!(e.nodeValue===r||c!==null&&c.suppressHydrationWarning===!0||sp(e.nodeValue,r)),e||xa(i,!0)}else e=mo(e).createTextNode(c),e[St]=i,i.stateNode=e}return Ze(i),null;case 31:if(r=i.memoizedState,e===null||e.memoizedState!==null){if(c=Qi(i),r!==null){if(e===null){if(!c)throw Error(s(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[St]=i}else ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ze(i),e=!1}else r=Mu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return i.flags&256?(Zt(i),i):(Zt(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Ze(i),null;case 13:if(c=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(m=Qi(i),c!==null&&c.dehydrated!==null){if(e===null){if(!m)throw Error(s(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));m[St]=i}else ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ze(i),m=!1}else m=Mu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(Zt(i),i):(Zt(i),null)}return Zt(i),(i.flags&128)!==0?(i.lanes=r,i):(r=c!==null,e=e!==null&&e.memoizedState!==null,r&&(c=i.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==m&&(c.flags|=2048)),r!==e&&r&&(i.child.flags|=8192),Wr(i,i.updateQueue),Ze(i),null);case 4:return ye(),e===null&&Bd(i.stateNode.containerInfo),Ze(i),null;case 10:return In(i.type),Ze(i),null;case 19:if(I(it),c=i.memoizedState,c===null)return Ze(i),null;if(m=(i.flags&128)!==0,p=c.rendering,p===null)if(m)hl(c,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(p=Ur(e),p!==null){for(i.flags|=128,hl(c,!1),e=p.updateQueue,i.updateQueue=e,Wr(i,e),i.subtreeFlags=0,e=r,r=i.child;r!==null;)Hm(r,e),r=r.sibling;return W(it,it.current&1|2),De&&qn(i,c.treeForkCount),i.child}e=e.sibling}c.tail!==null&&Gt()>ao&&(i.flags|=128,m=!0,hl(c,!1),i.lanes=4194304)}else{if(!m)if(e=Ur(p),e!==null){if(i.flags|=128,m=!0,e=e.updateQueue,i.updateQueue=e,Wr(i,e),hl(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!De)return Ze(i),null}else 2*Gt()-c.renderingStartTime>ao&&r!==536870912&&(i.flags|=128,m=!0,hl(c,!1),i.lanes=4194304);c.isBackwards?(p.sibling=i.child,i.child=p):(e=c.last,e!==null?e.sibling=p:i.child=p,c.last=p)}return c.tail!==null?(e=c.tail,c.rendering=e,c.tail=e.sibling,c.renderingStartTime=Gt(),e.sibling=null,r=it.current,W(it,m?r&1|2:r&1),De&&qn(i,c.treeForkCount),e):(Ze(i),null);case 22:case 23:return Zt(i),Uu(),c=i.memoizedState!==null,e!==null?e.memoizedState!==null!==c&&(i.flags|=8192):c&&(i.flags|=8192),c?(r&536870912)!==0&&(i.flags&128)===0&&(Ze(i),i.subtreeFlags&6&&(i.flags|=8192)):Ze(i),r=i.updateQueue,r!==null&&Wr(i,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),c=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),c!==r&&(i.flags|=2048),e!==null&&I(si),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),In(ct),Ze(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function O2(e,i){switch(ju(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return In(ct),ye(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return re(i),null;case 31:if(i.memoizedState!==null){if(Zt(i),i.alternate===null)throw Error(s(340));ni()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(Zt(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(s(340));ni()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return I(it),null;case 4:return ye(),null;case 10:return In(i.type),null;case 22:case 23:return Zt(i),Uu(),e!==null&&I(si),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return In(ct),null;case 25:return null;default:return null}}function u0(e,i){switch(ju(i),i.tag){case 3:In(ct),ye();break;case 26:case 27:case 5:re(i);break;case 4:ye();break;case 31:i.memoizedState!==null&&Zt(i);break;case 13:Zt(i);break;case 19:I(it);break;case 10:In(i.type);break;case 22:case 23:Zt(i),Uu(),e!==null&&I(si);break;case 24:In(ct)}}function ml(e,i){try{var r=i.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var m=c.next;r=m;do{if((r.tag&e)===e){c=void 0;var p=r.create,y=r.inst;c=p(),y.destroy=c}r=r.next}while(r!==m)}}catch(T){$e(i,i.return,T)}}function ja(e,i,r){try{var c=i.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var p=m.next;c=p;do{if((c.tag&e)===e){var y=c.inst,T=y.destroy;if(T!==void 0){y.destroy=void 0,m=i;var D=r,V=T;try{V()}catch(q){$e(m,D,q)}}}c=c.next}while(c!==p)}}catch(q){$e(i,i.return,q)}}function d0(e){var i=e.updateQueue;if(i!==null){var r=e.stateNode;try{tg(i,r)}catch(c){$e(e,e.return,c)}}}function f0(e,i,r){r.props=ui(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(c){$e(e,i,c)}}function gl(e,i){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var c=e.stateNode;break;case 30:c=e.stateNode;break;default:c=e.stateNode}typeof r=="function"?e.refCleanup=r(c):r.current=c}}catch(m){$e(e,i,m)}}function An(e,i){var r=e.ref,c=e.refCleanup;if(r!==null)if(typeof c=="function")try{c()}catch(m){$e(e,i,m)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(m){$e(e,i,m)}else r.current=null}function h0(e){var i=e.type,r=e.memoizedProps,c=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&c.focus();break e;case"img":r.src?c.src=r.src:r.srcSet&&(c.srcset=r.srcSet)}}catch(m){$e(e,e.return,m)}}function xd(e,i,r){try{var c=e.stateNode;aS(c,e.type,r,i),c[At]=i}catch(m){$e(e,e.return,m)}}function m0(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function bd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||m0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yd(e,i,r){var c=e.tag;if(c===5||c===6)e=e.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(e),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=Vn));else if(c!==4&&(c===27&&Aa(e.type)&&(r=e.stateNode,i=null),e=e.child,e!==null))for(yd(e,i,r),e=e.sibling;e!==null;)yd(e,i,r),e=e.sibling}function Jr(e,i,r){var c=e.tag;if(c===5||c===6)e=e.stateNode,i?r.insertBefore(e,i):r.appendChild(e);else if(c!==4&&(c===27&&Aa(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Jr(e,i,r),e=e.sibling;e!==null;)Jr(e,i,r),e=e.sibling}function g0(e){var i=e.stateNode,r=e.memoizedProps;try{for(var c=e.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);Nt(i,c,r),i[St]=e,i[At]=r}catch(p){$e(e,e.return,p)}}var Pn=!1,ft=!1,vd=!1,p0=typeof WeakSet=="function"?WeakSet:Set,yt=null;function L2(e,i){if(e=e.containerInfo,Vd=So,e=km(e),hu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var c=r.getSelection&&r.getSelection();if(c&&c.rangeCount!==0){r=c.anchorNode;var m=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{r.nodeType,p.nodeType}catch{r=null;break e}var y=0,T=-1,D=-1,V=0,q=0,Z=e,Y=null;t:for(;;){for(var G;Z!==r||m!==0&&Z.nodeType!==3||(T=y+m),Z!==p||c!==0&&Z.nodeType!==3||(D=y+c),Z.nodeType===3&&(y+=Z.nodeValue.length),(G=Z.firstChild)!==null;)Y=Z,Z=G;for(;;){if(Z===e)break t;if(Y===r&&++V===m&&(T=y),Y===p&&++q===c&&(D=y),(G=Z.nextSibling)!==null)break;Z=Y,Y=Z.parentNode}Z=G}r=T===-1||D===-1?null:{start:T,end:D}}else r=null}r=r||{start:0,end:0}}else r=null;for(Yd={focusedElem:e,selectionRange:r},So=!1,yt=i;yt!==null;)if(i=yt,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,yt=e;else for(;yt!==null;){switch(i=yt,p=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r title"))),Nt(p,c,r),p[St]=e,bt(p),c=p;break e;case"link":var y=_p("link","href",m).get(c+(r.href||""));if(y){for(var T=0;Tqe&&(y=qe,qe=pe,pe=y);var B=Mm(T,pe),H=Mm(T,qe);if(B&&H&&(G.rangeCount!==1||G.anchorNode!==B.node||G.anchorOffset!==B.offset||G.focusNode!==H.node||G.focusOffset!==H.offset)){var $=Z.createRange();$.setStart(B.node,B.offset),G.removeAllRanges(),pe>qe?(G.addRange($),G.extend(H.node,H.offset)):($.setEnd(H.node,H.offset),G.addRange($))}}}}for(Z=[],G=T;G=G.parentNode;)G.nodeType===1&&Z.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;Tr?32:r,U.T=null,r=Td,Td=null;var p=ka,y=na;if(mt=0,os=ka=null,na=0,(Be&6)!==0)throw Error(s(331));var T=Be;if(Be|=4,T0(p.current),j0(p,p.current,y,r),Be=T,Sl(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Us,p)}catch{}return!0}finally{K.p=m,U.T=c,X0(e,i)}}function F0(e,i,r){i=on(r,i),i=ld(e.stateNode,i,2),e=Sa(e,i,2),e!==null&&(Vs(e,2),Dn(e))}function $e(e,i,r){if(e.tag===3)F0(e,e,r);else for(;i!==null;){if(i.tag===3){F0(i,e,r);break}else if(i.tag===1){var c=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ta===null||!Ta.has(c))){e=on(r,e),r=Qg(2),c=Sa(i,r,2),c!==null&&(Zg(r,c,i,e),Vs(c,2),Dn(c));break}}i=i.return}}function Ad(e,i,r){var c=e.pingCache;if(c===null){c=e.pingCache=new U2;var m=new Set;c.set(i,m)}else m=c.get(i),m===void 0&&(m=new Set,c.set(i,m));m.has(r)||(wd=!0,m.add(r),e=q2.bind(null,e,i,r),i.then(e,e))}function q2(e,i,r){var c=e.pingCache;c!==null&&c.delete(i),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Xe===e&&(ke&r)===r&&(at===4||at===3&&(ke&62914560)===ke&&300>Gt()-no?(Be&2)===0&&cs(e,0):jd|=r,rs===ke&&(rs=0)),Dn(e)}function Q0(e,i){i===0&&(i=Yh()),e=ei(e,i),e!==null&&(Vs(e,i),Dn(e))}function X2(e){var i=e.memoizedState,r=0;i!==null&&(r=i.retryLane),Q0(e,r)}function I2(e,i){var r=0;switch(e.tag){case 31:case 13:var c=e.stateNode,m=e.memoizedState;m!==null&&(r=m.retryLane);break;case 19:c=e.stateNode;break;case 22:c=e.stateNode._retryCache;break;default:throw Error(s(314))}c!==null&&c.delete(i),Q0(e,r)}function F2(e,i){return ot(e,i)}var co=null,ds=null,Dd=!1,uo=!1,zd=!1,Ea=0;function Dn(e){e!==ds&&e.next===null&&(ds===null?co=ds=e:ds=ds.next=e),uo=!0,Dd||(Dd=!0,Z2())}function Sl(e,i){if(!zd&&uo){zd=!0;do for(var r=!1,c=co;c!==null;){if(e!==0){var m=c.pendingLanes;if(m===0)var p=0;else{var y=c.suspendedLanes,T=c.pingedLanes;p=(1<<31-Xt(42|e)+1)-1,p&=m&~(y&~T),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(r=!0,W0(c,p))}else p=ke,p=mr(c,c===Xe?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||$s(c,p)||(r=!0,W0(c,p));c=c.next}while(r);zd=!1}}function Q2(){Z0()}function Z0(){uo=Dd=!1;var e=0;Ea!==0&&sS()&&(e=Ea);for(var i=Gt(),r=null,c=co;c!==null;){var m=c.next,p=K0(c,i);p===0?(c.next=null,r===null?co=m:r.next=m,m===null&&(ds=r)):(r=c,(e!==0||(p&3)!==0)&&(uo=!0)),c=m}mt!==0&&mt!==5||Sl(e),Ea!==0&&(Ea=0)}function K0(e,i){for(var r=e.suspendedLanes,c=e.pingedLanes,m=e.expirationTimes,p=e.pendingLanes&-62914561;0T)break;var q=D.transferSize,Z=D.initiatorType;q&&lp(Z)&&(D=D.responseEnd,y+=q*(D"u"?null:document;function bp(e,i,r){var c=fs;if(c&&typeof i=="string"&&i){var m=ln(i);m='link[rel="'+e+'"][href="'+m+'"]',typeof r=="string"&&(m+='[crossorigin="'+r+'"]'),xp.has(m)||(xp.add(m),e={rel:e,crossOrigin:r,href:i},c.querySelector(m)===null&&(i=c.createElement("link"),Nt(i,"link",e),bt(i),c.head.appendChild(i)))}}function mS(e){aa.D(e),bp("dns-prefetch",e,null)}function gS(e,i){aa.C(e,i),bp("preconnect",e,i)}function pS(e,i,r){aa.L(e,i,r);var c=fs;if(c&&e&&i){var m='link[rel="preload"][as="'+ln(i)+'"]';i==="image"&&r&&r.imageSrcSet?(m+='[imagesrcset="'+ln(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(m+='[imagesizes="'+ln(r.imageSizes)+'"]')):m+='[href="'+ln(e)+'"]';var p=m;switch(i){case"style":p=hs(e);break;case"script":p=ms(e)}mn.has(p)||(e=b({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:e,as:i},r),mn.set(p,e),c.querySelector(m)!==null||i==="style"&&c.querySelector(Nl(p))||i==="script"&&c.querySelector(Ml(p))||(i=c.createElement("link"),Nt(i,"link",e),bt(i),c.head.appendChild(i)))}}function xS(e,i){aa.m(e,i);var r=fs;if(r&&e){var c=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+ln(c)+'"][href="'+ln(e)+'"]',p=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ms(e)}if(!mn.has(p)&&(e=b({rel:"modulepreload",href:e},i),mn.set(p,e),r.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ml(p)))return}c=r.createElement("link"),Nt(c,"link",e),bt(c),r.head.appendChild(c)}}}function bS(e,i,r){aa.S(e,i,r);var c=fs;if(c&&e){var m=Oi(c).hoistableStyles,p=hs(e);i=i||"default";var y=m.get(p);if(!y){var T={loading:0,preload:null};if(y=c.querySelector(Nl(p)))T.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":i},r),(r=mn.get(p))&&Zd(e,r);var D=y=c.createElement("link");bt(D),Nt(D,"link",e),D._p=new Promise(function(V,q){D.onload=V,D.onerror=q}),D.addEventListener("load",function(){T.loading|=1}),D.addEventListener("error",function(){T.loading|=2}),T.loading|=4,po(y,i,c)}y={type:"stylesheet",instance:y,count:1,state:T},m.set(p,y)}}}function yS(e,i){aa.X(e,i);var r=fs;if(r&&e){var c=Oi(r).hoistableScripts,m=ms(e),p=c.get(m);p||(p=r.querySelector(Ml(m)),p||(e=b({src:e,async:!0},i),(i=mn.get(m))&&Kd(e,i),p=r.createElement("script"),bt(p),Nt(p,"link",e),r.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(m,p))}}function vS(e,i){aa.M(e,i);var r=fs;if(r&&e){var c=Oi(r).hoistableScripts,m=ms(e),p=c.get(m);p||(p=r.querySelector(Ml(m)),p||(e=b({src:e,async:!0,type:"module"},i),(i=mn.get(m))&&Kd(e,i),p=r.createElement("script"),bt(p),Nt(p,"link",e),r.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(m,p))}}function yp(e,i,r,c){var m=(m=le.current)?go(m):null;if(!m)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=hs(r.href),r=Oi(m).hoistableStyles,c=r.get(i),c||(c={type:"style",instance:null,count:0,state:null},r.set(i,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=hs(r.href);var p=Oi(m).hoistableStyles,y=p.get(e);if(y||(m=m.ownerDocument||m,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,y),(p=m.querySelector(Nl(e)))&&!p._p&&(y.instance=p,y.state.loading=5),mn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},mn.set(e,r),p||SS(m,e,r,y.state))),i&&c===null)throw Error(s(528,""));return y}if(i&&c!==null)throw Error(s(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ms(r),r=Oi(m).hoistableScripts,c=r.get(i),c||(c={type:"script",instance:null,count:0,state:null},r.set(i,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function hs(e){return'href="'+ln(e)+'"'}function Nl(e){return'link[rel="stylesheet"]['+e+"]"}function vp(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function SS(e,i,r,c){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?c.loading=1:(i=e.createElement("link"),c.preload=i,i.addEventListener("load",function(){return c.loading|=1}),i.addEventListener("error",function(){return c.loading|=2}),Nt(i,"link",r),bt(i),e.head.appendChild(i))}function ms(e){return'[src="'+ln(e)+'"]'}function Ml(e){return"script[async]"+e}function Sp(e,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var c=e.querySelector('style[data-href~="'+ln(r.href)+'"]');if(c)return i.instance=c,bt(c),c;var m=b({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return c=(e.ownerDocument||e).createElement("style"),bt(c),Nt(c,"style",m),po(c,r.precedence,e),i.instance=c;case"stylesheet":m=hs(r.href);var p=e.querySelector(Nl(m));if(p)return i.state.loading|=4,i.instance=p,bt(p),p;c=vp(r),(m=mn.get(m))&&Zd(c,m),p=(e.ownerDocument||e).createElement("link"),bt(p);var y=p;return y._p=new Promise(function(T,D){y.onload=T,y.onerror=D}),Nt(p,"link",c),i.state.loading|=4,po(p,r.precedence,e),i.instance=p;case"script":return p=ms(r.src),(m=e.querySelector(Ml(p)))?(i.instance=m,bt(m),m):(c=r,(m=mn.get(p))&&(c=b({},r),Kd(c,m)),e=e.ownerDocument||e,m=e.createElement("script"),bt(m),Nt(m,"link",c),e.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(c=i.instance,i.state.loading|=4,po(c,r.precedence,e));return i.instance}function po(e,i,r){for(var c=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,p=m,y=0;y title"):null)}function _S(e,i,r){if(r===1||i.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return e=i.disabled,typeof i.precedence=="string"&&e==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function jp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function wS(e,i,r,c){if(r.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var m=hs(c.href),p=i.querySelector(Nl(m));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=bo.bind(e),i.then(e,e)),r.state.loading|=4,r.instance=p,bt(p);return}p=i.ownerDocument||i,c=vp(c),(m=mn.get(m))&&Zd(c,m),p=p.createElement("link"),bt(p);var y=p;y._p=new Promise(function(T,D){y.onload=T,y.onerror=D}),Nt(p,"link",c),r.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=bo.bind(e),i.addEventListener("load",r),i.addEventListener("error",r))}}var Pd=0;function jS(e,i){return e.stylesheets&&e.count===0&&vo(e,e.stylesheets),0Pd?50:800)+i);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function bo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yo=null;function vo(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yo=new Map,i.forEach(NS,e),yo=null,bo.call(e))}function NS(e,i){if(!(i.state.loading&4)){var r=yo.get(e);if(r)var c=r.get(null);else{r=new Map,yo.set(e,r);for(var m=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),rf.exports=GS(),rf.exports}var XS=qS();const IS=ly(XS);/** - * react-router v7.18.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var th=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,oy=/^[\\/]{2}/;function FS(n,t){return t+n.replace(/\\/g,"/")}var Qp="popstate";function Zp(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function QS(n={}){function t(s,l){var g;let o=(g=l.state)==null?void 0:g.masked,{pathname:u,search:d,hash:f}=o||s.location;return Cf("",{pathname:u,search:d,hash:f},l.state&&l.state.usr||null,l.state&&l.state.key||"default",o?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function a(s,l){return typeof l=="string"?l:Ni(l)}return KS(t,a,null,n)}function tt(n,t){if(n===!1||n===null||typeof n>"u")throw new Error(t)}function xn(n,t){if(!n){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ZS(){return Math.random().toString(36).substring(2,10)}function Kp(n,t){return{usr:n.state,key:n.key,idx:t,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Cf(n,t,a=null,s,l){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof t=="string"?As(t):t,state:a,key:t&&t.key||s||ZS(),mask:l}}function Ni({pathname:n="/",search:t="",hash:a=""}){return t&&t!=="?"&&(n+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(n+=a.charAt(0)==="#"?a:"#"+a),n}function As(n){let t={};if(n){let a=n.indexOf("#");a>=0&&(t.hash=n.substring(a),n=n.substring(0,a));let s=n.indexOf("?");s>=0&&(t.search=n.substring(s),n=n.substring(0,s)),n&&(t.pathname=n)}return t}function KS(n,t,a,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,u=l.history,d="POP",f=null,g=x();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function x(){return(u.state||{idx:null}).idx}function b(){d="POP";let S=x(),N=S==null?null:S-g;g=S,f&&f({action:d,location:j.location,delta:N})}function v(S,N){d="PUSH";let C=Zp(S)?S:Cf(j.location,S,N);g=x()+1;let k=Kp(C,g),E=j.createHref(C.mask||C);try{u.pushState(k,"",E)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;l.location.assign(E)}o&&f&&f({action:d,location:j.location,delta:1})}function _(S,N){d="REPLACE";let C=Zp(S)?S:Cf(j.location,S,N);g=x();let k=Kp(C,g),E=j.createHref(C.mask||C);u.replaceState(k,"",E),o&&f&&f({action:d,location:j.location,delta:0})}function M(S){return PS(l,S)}let j={get action(){return d},get location(){return n(l,u)},listen(S){if(f)throw new Error("A history only accepts one active listener");return l.addEventListener(Qp,b),f=S,()=>{l.removeEventListener(Qp,b),f=null}},createHref(S){return t(l,S)},createURL:M,encodeLocation(S){let N=M(S);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:v,replace:_,go(S){return u.go(S)}};return j}function PS(n,t,a=!1){let s="http://localhost";n&&(s=n.location.origin!=="null"?n.location.origin:n.location.href),tt(s,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Ni(t);return l=l.replace(/ $/,"%20"),!a&&oy.test(l)&&(l=s+l),new URL(l,s)}function cy(n,t,a="/"){return WS(n,t,a,!1)}function WS(n,t,a,s,l){let o=typeof t=="string"?As(t):t,u=da(o.pathname||"/",a);if(u==null)return null;let d=JS(n),f=null,g=u_(u);for(let x=0;f==null&&x{let x={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(s)&&f)return;tt(x.relativePath.startsWith(s),`Absolute route path "${x.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(s.length)}let b=Nn([s,x.relativePath]),v=a.concat(x);u.children&&u.children.length>0&&(tt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),uy(u.children,t,v,b,f)),!(u.path==null&&!u.index)&&t.push({path:b,score:r_(b,u.index),routesMeta:v.map((_,M)=>{let[j,S]=hy(_.relativePath,_.caseSensitive,M===v.length-1);return{..._,matcher:j,compiledParams:S}})})};return n.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))o(u,d);else for(let g of dy(u.path))o(u,d,!0,g)}),t}function dy(n){let t=n.split("/");if(t.length===0)return[];let[a,...s]=t,l=a.endsWith("?"),o=a.replace(/\?$/,"");if(s.length===0)return l?[o,""]:[o];let u=dy(s.join("/")),d=[];return d.push(...u.map(f=>f===""?o:[o,f].join("/"))),l&&d.push(...u),d.map(f=>n.startsWith("/")&&f===""?"/":f)}function e_(n){n.sort((t,a)=>t.score!==a.score?a.score-t.score:o_(t.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var t_=/^:[\w-]+$/,n_=3,a_=2,i_=1,s_=10,l_=-2,Pp=n=>n==="*";function r_(n,t){let a=n.split("/"),s=a.length;return a.some(Pp)&&(s+=l_),t&&(s+=a_),a.filter(l=>!Pp(l)).reduce((l,o)=>l+(t_.test(o)?n_:o===""?i_:s_),s)}function o_(n,t){return n.length===t.length&&n.slice(0,-1).every((s,l)=>s===t[l])?n[n.length-1]-t[t.length-1]:0}function c_(n,t,a=!1){let{routesMeta:s}=n,l={},o="/",u=[];for(let d=0;d{if(x==="*"){let M=d[v]||"";u=js(o.slice(0,o.length-M.length),1)}const _=d[v];return b&&!_?g[x]=void 0:g[x]=(_||"").replace(/%2F/g,"/"),g},{}),pathname:o,pathnameBase:u,pattern:n}}function hy(n,t=!1,a=!0){xn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let s=[],l="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,g,x)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let b=x.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(s.push({paramName:"*"}),l+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?l+="\\/*$":n!==""&&n!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),s]}function u_(n){try{return n.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),n}}function da(n,t){if(t==="/")return n;if(!n.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,s=n.charAt(a);return s&&s!=="/"?null:n.slice(a)||"/"}function d_(n,t="/"){let{pathname:a,search:s="",hash:l=""}=typeof n=="string"?As(n):n,o;return a?(a=my(a),a.startsWith("/")||a.startsWith("\\")?o=Wp(a.substring(1),"/"):o=Wp(a,t)):o=t,{pathname:o,search:m_(s),hash:g_(l)}}function Wp(n,t){let a=js(t).split("/");return n.split("/").forEach(l=>{l===".."?a.length>1&&a.pop():l!=="."&&a.push(l)}),a.length>1?a.join("/"):"/"}function df(n,t,a,s){return`Cannot include a '${n}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function f_(n){return n.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function nh(n){let t=f_(n);return t.map((a,s)=>s===t.length-1?a.pathname:a.pathnameBase)}function Cc(n,t,a,s=!1){let l;typeof n=="string"?l=As(n):(l={...n},tt(!l.pathname||!l.pathname.includes("?"),df("?","pathname","search",l)),tt(!l.pathname||!l.pathname.includes("#"),df("#","pathname","hash",l)),tt(!l.search||!l.search.includes("#"),df("#","search","hash",l)));let o=n===""||l.pathname==="",u=o?"/":l.pathname,d;if(u==null)d=a;else{let b=t.length-1;if(!s&&u.startsWith("..")){let v=u.split("/");for(;v[0]==="..";)v.shift(),b-=1;l.pathname=v.join("/")}d=b>=0?t[b]:"/"}let f=d_(l,d),g=u&&u!=="/"&&u.endsWith("/"),x=(o||u===".")&&a.endsWith("/");return!f.pathname.endsWith("/")&&(g||x)&&(f.pathname+="/"),f}var my=n=>n.replace(/[\\/]{2,}/g,"/"),Nn=n=>my(n.join("/"));function js(n,t=0){let a=n.length;for(;a>t&&n.charCodeAt(a-1)===47;)a--;return a===n.length?n:n.slice(0,a)}var h_=n=>js(n).replace(/^\/*/,"/"),m_=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,g_=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,p_=class{constructor(n,t,a,s=!1){this.status=n,this.statusText=t||"",this.internal=s,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function x_(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function b_(n){let t=n.map(a=>a.route.path).filter(Boolean);return Nn(t)||"/"}var gy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function py(n,t){let a=n;if(typeof a!="string"||!th.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let s=a,l=!1;if(gy)try{let o=new URL(window.location.href),u=oy.test(a)?new URL(FS(a,o.protocol)):new URL(a),d=da(u.pathname,t);u.origin===o.origin&&d!=null?a=d+u.search+u.hash:l=!0}catch{xn(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Jp=new URL("http://localhost");function ah(n){if(n.createURL)return n.createURL("/");try{return new URL(n.createHref("/"),Jp)}catch{return Jp}}function ff(n,t){return n.origin===t.origin&&(n.origin!=="null"||n.protocol===t.protocol&&n.host===t.host)}function y_(n,t){if(n.startsWith("//"))return!0;let a=t.protocol.toLowerCase();return n.toLowerCase().startsWith(a)?t.host===""||n.slice(a.length).startsWith("//"):!1}function ih(n,t,a,s){let l=null;try{l=n==null?null:new URL(n,a)}catch{}let o=new URL(t,a),u=l!=null&&!ff(l,a),d=!ff(o,a);if(s==="reject"){if(u||d)throw new Error("External navigation is not allowed")}else if(d&&(l==null||!y_(n,l)||!ff(l,o)))throw new Error("External navigation is not allowed")}var xy=["POST","PUT","PATCH","DELETE"];new Set(xy);var v_=["GET",...xy];new Set(v_);var S_=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function __(n){try{return S_.includes(new URL(n).protocol)}catch{return!1}}var Ds=w.createContext(null);Ds.displayName="DataRouter";var Ec=w.createContext(null);Ec.displayName="DataRouterState";var by=w.createContext(!1);function w_(){return w.useContext(by)}var yy=w.createContext({isTransitioning:!1});yy.displayName="ViewTransition";var j_=w.createContext(new Map);j_.displayName="Fetchers";var N_=w.createContext(null);N_.displayName="Await";var tn=w.createContext(null);tn.displayName="Navigation";var ir=w.createContext(null);ir.displayName="Location";var Bn=w.createContext({outlet:null,matches:[],isDataRoute:!1});Bn.displayName="Route";var sh=w.createContext(null);sh.displayName="RouteError";var vy="REACT_ROUTER_ERROR",M_="REDIRECT",T_="ROUTE_ERROR_RESPONSE";function k_(n){if(n.startsWith(`${vy}:${M_}:{`))try{let t=JSON.parse(n.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function C_(n){if(n.startsWith(`${vy}:${T_}:{`))try{let t=JSON.parse(n.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new p_(t.status,t.statusText,t.data)}catch{}}function E_(n,{relative:t}={}){tt(zs(),"useHref() may be used only in the context of a component.");let{basename:a,navigator:s}=w.useContext(tn),{hash:l,pathname:o,search:u}=sr(n,{relative:t}),d=o;return a!=="/"&&(d=o==="/"?a:Nn([a,o])),s.createHref({pathname:d,search:u,hash:l})}function zs(){return w.useContext(ir)!=null}function nn(){return tt(zs(),"useLocation() may be used only in the context of a component."),w.useContext(ir).location}var Sy="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _y(n){w.useContext(tn).static||w.useLayoutEffect(n)}function Ac(){let{isDataRoute:n}=w.useContext(Bn);return n?G_():A_()}function A_(){tt(zs(),"useNavigate() may be used only in the context of a component.");let n=w.useContext(Ds),{basename:t,navigator:a}=w.useContext(tn),{matches:s}=w.useContext(Bn),{pathname:l}=nn(),o=JSON.stringify(nh(s)),u=w.useRef(!1);return _y(()=>{u.current=!0}),w.useCallback((f,g={})=>{if(xn(u.current,Sy),!u.current)return;if(typeof f=="number"){a.go(f);return}let x=Cc(f,JSON.parse(o),l,g.relative==="path");n==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:Nn([t,x.pathname])),ih(typeof f=="string"?f:Ni(f),a.createHref(x),ah(a),"reject"),(g.replace?a.replace:a.push)(x,g.state,g)},[t,a,o,l,n])}w.createContext(null);function sr(n,{relative:t}={}){let{matches:a}=w.useContext(Bn),{pathname:s}=nn(),l=JSON.stringify(nh(a));return w.useMemo(()=>Cc(n,JSON.parse(l),s,t==="path"),[n,l,s,t])}function D_(n,t){return wy(n,t)}function wy(n,t,a){var S;tt(zs(),"useRoutes() may be used only in the context of a component.");let{navigator:s}=w.useContext(tn),{matches:l}=w.useContext(Bn),o=l[l.length-1],u=o?o.params:{},d=o?o.pathname:"/",f=o?o.pathnameBase:"/",g=o&&o.route;{let N=g&&g.path||"";Ny(d,!g||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let x=nn(),b;if(t){let N=typeof t=="string"?As(t):t;tt(f==="/"||((S=N.pathname)==null?void 0:S.startsWith(f)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${N.pathname}" was given in the \`location\` prop.`),b=N}else b=x;let v=b.pathname||"/",_=v;if(f!=="/"){let N=f.replace(/^\//,"").split("/");_="/"+v.replace(/^\//,"").split("/").slice(N.length).join("/")}let M=a&&a.state.matches.length?a.state.matches.map(N=>Object.assign(N,{route:a.manifest[N.route.id]||N.route})):cy(n,{pathname:_});xn(g||M!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),xn(M==null||M[M.length-1].route.element!==void 0||M[M.length-1].route.Component!==void 0||M[M.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let j=H_(M&&M.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:Nn([f,s.encodeLocation?s.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?f:Nn([f,s.encodeLocation?s.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),l,a);return t&&j?w.createElement(ir.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},j):j}function z_(){let n=Y_(),t=x_(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),a=n instanceof Error?n.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},o={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",n),u=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:o},"ErrorBoundary")," or"," ",w.createElement("code",{style:o},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),a?w.createElement("pre",{style:l},a):null,u)}var R_=w.createElement(z_,null),jy=class extends w.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,t){return t.location!==n.location||t.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:t.error,location:t.location,revalidation:n.revalidation||t.revalidation}}componentDidCatch(n,t){this.props.onError?this.props.onError(n,t):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const a=C_(n.digest);a&&(n=a)}let t=n!==void 0?w.createElement(Bn.Provider,{value:this.props.routeContext},w.createElement(sh.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?w.createElement(O_,{error:n},t):t}};jy.contextType=by;var hf=new WeakMap;function O_({children:n,error:t}){let{basename:a,navigator:s}=w.useContext(tn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let l=k_(t.digest);if(l){let o=hf.get(t);if(o)throw o;let u=py(l.location,a),d=u.absoluteURL||u.to;if(ih(l.location,d,ah(s),"allow-explicit"),__(d))throw new Error("Invalid redirect location");if(gy&&!hf.get(t))if(u.isExternal||l.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw hf.set(t,f),f}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return n}function L_({routeContext:n,match:t,children:a}){let s=w.useContext(Ds);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(Bn.Provider,{value:n},a)}function H_(n,t=[],a){let s=a==null?void 0:a.state;if(n==null){if(!s)return null;if(s.errors)n=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)n=s.matches;else return null}let l=n,o=s==null?void 0:s.errors;if(o!=null){let x=l.findIndex(b=>b.route.id&&(o==null?void 0:o[b.route.id])!==void 0);tt(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,x+1))}let u=!1,d=-1;if(a&&s){u=s.renderFallback;for(let x=0;x=0?l=l.slice(0,d+1):l=[l[0]];break}}}}let f=a==null?void 0:a.onError,g=s&&f?(x,b)=>{var v,_;f(x,{location:s.location,params:((_=(v=s.matches)==null?void 0:v[0])==null?void 0:_.params)??{},pattern:b_(s.matches),errorInfo:b})}:void 0;return l.reduceRight((x,b,v)=>{let _,M=!1,j=null,S=null;s&&(_=o&&b.route.id?o[b.route.id]:void 0,j=b.route.errorElement||R_,u&&(d<0&&v===0?(Ny("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),M=!0,S=null):d===v&&(M=!0,S=b.route.hydrateFallbackElement||null)));let N=t.concat(l.slice(0,v+1)),C=()=>{let k;return _?k=j:M?k=S:b.route.Component?k=w.createElement(b.route.Component,null):b.route.element?k=b.route.element:k=x,w.createElement(L_,{match:b,routeContext:{outlet:x,matches:N,isDataRoute:s!=null},children:k})};return s&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?w.createElement(jy,{location:s.location,revalidation:s.revalidation,component:j,error:_,children:C(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:g}):C()},null)}function lh(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function B_(n){let t=w.useContext(Ds);return tt(t,lh(n)),t}function U_(n){let t=w.useContext(Ec);return tt(t,lh(n)),t}function $_(n){let t=w.useContext(Bn);return tt(t,lh(n)),t}function rh(n){let t=$_(n),a=t.matches[t.matches.length-1];return tt(a.route.id,`${n} can only be used on routes that contain a unique "id"`),a.route.id}function V_(){return rh("useRouteId")}function Y_(){var s;let n=w.useContext(sh),t=U_("useRouteError"),a=rh("useRouteError");return n!==void 0?n:(s=t.errors)==null?void 0:s[a]}function G_(){let{router:n}=B_("useNavigate"),t=rh("useNavigate"),a=w.useRef(!1);return _y(()=>{a.current=!0}),w.useCallback(async(l,o={})=>{xn(a.current,Sy),a.current&&(typeof l=="number"?await n.navigate(l):await n.navigate(l,{fromRouteId:t,...o}))},[n,t])}var ex={};function Ny(n,t,a){!t&&!ex[n]&&(ex[n]=!0,xn(!1,a))}w.memo(q_);function q_({routes:n,manifest:t,future:a,state:s,isStatic:l,onError:o}){return wy(n,void 0,{manifest:t,state:s,isStatic:l,onError:o})}function My({to:n,replace:t,state:a,relative:s}){tt(zs()," may be used only in the context of a component.");let{static:l,navigator:o}=w.useContext(tn);xn(!l," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:u}=w.useContext(Bn),{pathname:d}=nn(),f=Ac(),g=Cc(n,nh(u),d,s==="path");ih(typeof n=="string"?n:Ni(n),o.createHref(g),ah(o),"reject");let x=JSON.stringify(g);return w.useEffect(()=>{f(JSON.parse(x),{replace:t,state:a,relative:s})},[f,x,s,t,a]),null}function Ut(n){tt(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function X_({basename:n="/",children:t=null,location:a,navigationType:s="POP",navigator:l,static:o=!1,useTransitions:u}){tt(!zs(),"You cannot render a inside another . You should never have more than one in your app.");let d=n.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:d,navigator:l,static:o,useTransitions:u,future:{}}),[d,l,o,u]);typeof a=="string"&&(a=As(a));let{pathname:g="/",search:x="",hash:b="",state:v=null,key:_="default",mask:M}=a,j=w.useMemo(()=>{let S=da(g,d);return S==null?null:{location:{pathname:S,search:x,hash:b,state:v,key:_,mask:M},navigationType:s}},[d,g,x,b,v,_,s,M]);return xn(j!=null,` is not able to match the URL "${g}${x}${b}" because it does not start with the basename, so the won't render anything.`),j==null?null:w.createElement(tn.Provider,{value:f},w.createElement(ir.Provider,{children:t,value:j}))}function I_({children:n,location:t}){return D_(Ef(n),t)}function Ef(n,t=[]){let a=[];return w.Children.forEach(n,(s,l)=>{if(!w.isValidElement(s))return;let o=[...t,l];if(s.type===w.Fragment){a.push.apply(a,Ef(s.props.children,o));return}tt(s.type===Ut,`[${typeof s.type=="string"?s.type:s.type.name}] is not a component. All component children of must be a or `),tt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let u={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(u.children=Ef(s.props.children,o)),a.push(u)}),a}var Wo="get",Jo="application/x-www-form-urlencoded";function Dc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function F_(n){return Dc(n)&&n.tagName.toLowerCase()==="button"}function Q_(n){return Dc(n)&&n.tagName.toLowerCase()==="form"}function Z_(n){return Dc(n)&&n.tagName.toLowerCase()==="input"}function K_(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function P_(n,t){return n.button===0&&(!t||t==="_self")&&!K_(n)}function Af(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((t,a)=>{let s=n[a];return t.concat(Array.isArray(s)?s.map(l=>[a,l]):[[a,s]])},[]))}function W_(n,t){let a=Af(n);return t&&t.forEach((s,l)=>{a.has(l)||t.getAll(l).forEach(o=>{a.append(l,o)})}),a}var ko=null;function J_(){if(ko===null)try{new FormData(document.createElement("form"),0),ko=!1}catch{ko=!0}return ko}var ew=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mf(n){return n!=null&&!ew.has(n)?(xn(!1,`"${n}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Jo}"`),null):n}function tw(n,t){let a,s,l,o,u;if(Q_(n)){let d=n.getAttribute("action");s=d?da(d,t):null,a=n.getAttribute("method")||Wo,l=mf(n.getAttribute("enctype"))||Jo,o=new FormData(n)}else if(F_(n)||Z_(n)&&(n.type==="submit"||n.type==="image")){let d=n.form;if(d==null)throw new Error('Cannot submit a + - {(testSms.result || testVoice.result) && ( + {(testSms.result || testVoice.result || reset.result) && (
{testSms.result && (

@@ -267,6 +298,11 @@ export default function AdminDevicesPage() { {testVoice.result.success ? '✓ ' : '✗ '}تماس صوتی: {testVoice.result.message}

)} + {reset.result && ( +

+ {reset.result.success ? '✓ ' : '✗ '}ریست: {reset.result.message} +

+ )}
)} @@ -374,6 +410,8 @@ export default function AdminDevicesPage() { /> )} + + ) } diff --git a/src/GreenHome.Web/src/lib/api/client.ts b/src/GreenHome.Web/src/lib/api/client.ts index e040884..6cfed9d 100644 --- a/src/GreenHome.Web/src/lib/api/client.ts +++ b/src/GreenHome.Web/src/lib/api/client.ts @@ -288,6 +288,9 @@ export const api = { http(`${API_BASE}/api/admin/devices/${deviceId}/test-sms`, { method: 'POST' }), adminTestVoice: (deviceId: number) => http(`${API_BASE}/api/admin/devices/${deviceId}/test-voice`, { method: 'POST' }), + // Queues a one-shot reset: the device's next AddData response is the bare token "RST" + adminRequestDeviceReset: (deviceId: number) => + http(`${API_BASE}/api/admin/devices/${deviceId}/request-reset`, { method: 'POST' }), adminAuditLogs: (q: { adminId?: number; page?: number; pageSize?: number }) => { const params = new URLSearchParams() if (q.adminId != null) params.set('adminId', String(q.adminId)) diff --git a/src/GreenHome.Web/src/lib/api/types.ts b/src/GreenHome.Web/src/lib/api/types.ts index 5f05fd8..7b33ff6 100644 --- a/src/GreenHome.Web/src/lib/api/types.ts +++ b/src/GreenHome.Web/src/lib/api/types.ts @@ -325,6 +325,7 @@ export type AdminDeviceDetail = { ownerMobile: string isOnline: boolean memberCount: number + resetRequested: boolean productType?: string province?: string city?: string diff --git a/src/GreenHome.sln b/src/GreenHome.sln index f0062e4..62fb4ad 100644 --- a/src/GreenHome.sln +++ b/src/GreenHome.sln @@ -19,6 +19,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenHome.AI.DeepSeek", "Gr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenHome.DataCopy", "GreenHome.DataCopy\GreenHome.DataCopy.csproj", "{0F5C7A31-54F9-4C29-8E05-66CECAF520C7}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{0C88DD14-F956-CE84-757C-A364CCF449FC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenHome.SelfCheck", "Test\GreenHome.SelfCheck\GreenHome.SelfCheck.csproj", "{7210CF1A-6103-48D7-869B-890958132534}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -125,8 +129,23 @@ Global {0F5C7A31-54F9-4C29-8E05-66CECAF520C7}.Release|x64.Build.0 = Release|Any CPU {0F5C7A31-54F9-4C29-8E05-66CECAF520C7}.Release|x86.ActiveCfg = Release|Any CPU {0F5C7A31-54F9-4C29-8E05-66CECAF520C7}.Release|x86.Build.0 = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|x64.ActiveCfg = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|x64.Build.0 = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|x86.ActiveCfg = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Debug|x86.Build.0 = Debug|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|Any CPU.Build.0 = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|x64.ActiveCfg = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|x64.Build.0 = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|x86.ActiveCfg = Release|Any CPU + {7210CF1A-6103-48D7-869B-890958132534}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7210CF1A-6103-48D7-869B-890958132534} = {0C88DD14-F956-CE84-757C-A364CCF449FC} + EndGlobalSection EndGlobal diff --git a/src/Test/GreenHome.SelfCheck/GreenHome.SelfCheck.csproj b/src/Test/GreenHome.SelfCheck/GreenHome.SelfCheck.csproj new file mode 100644 index 0000000..3cb1c7d --- /dev/null +++ b/src/Test/GreenHome.SelfCheck/GreenHome.SelfCheck.csproj @@ -0,0 +1,20 @@ + + + + Exe + net9.0 + enable + enable + false + + + + + + + + + + + + diff --git a/src/Test/GreenHome.SelfCheck/Program.cs b/src/Test/GreenHome.SelfCheck/Program.cs new file mode 100644 index 0000000..8019108 --- /dev/null +++ b/src/Test/GreenHome.SelfCheck/Program.cs @@ -0,0 +1,90 @@ +// Runnable self-check for the device-reset feature and the Postgres migration set. +// +// set POSTGRES_CONNECTION=... (optional; defaults to the local dev database) +// dotnet run --project Test/GreenHome.SelfCheck +// +// It (1) applies the Postgres migrations to the target database — proving the new +// Data/Migrations/Postgres set is complete — and (2) asserts that a queued reset is +// consumed exactly once, which is the whole guarantee behind "RST goes out on the +// next request only, never again". + +using AutoMapper; +using GreenHome.Application; +using GreenHome.Domain; +using GreenHome.Infrastructure.Data; +using GreenHome.Infrastructure.Services.Telemetry; +using Microsoft.EntityFrameworkCore; + +var connectionString = Environment.GetEnvironmentVariable("POSTGRES_CONNECTION") + ?? "Host=localhost;Port=5432;Database=greenhome;Username=greenhome;Password=greenhome"; + +Console.WriteLine($"Target: {connectionString}"); + +var options = new DbContextOptionsBuilder() + .UseNpgsql(connectionString) + .Options; + +await using var db = new PostgresGreenHomeDbContext(options); + +// --reset-db wipes the target schema and lets Migrate() rebuild it from Data/Migrations/Postgres +// — the one-time step needed because EnsureCreated() left tables behind with no migration history. +if (args.Contains("--reset-db")) +{ + Console.WriteLine("--reset-db -> dropping schema public"); + await db.Database.ExecuteSqlRawAsync("DROP SCHEMA public CASCADE; CREATE SCHEMA public;"); +} + +await db.Database.MigrateAsync(); + +var applied = await db.Database.GetAppliedMigrationsAsync(); +Console.WriteLine($"Migrations applied ({applied.Count()}): {string.Join(", ", applied.Select(m => m.Split('_').Last()))}"); + +var mapper = new MapperConfiguration(cfg => cfg.AddProfile()).CreateMapper(); +var telemetry = new TelemetryService(db, mapper); + +// throwaway owner + device so the check is self-contained. +// CreatedAt is deliberately left at its Domain default (DateTime.UtcNow): writing a Kind=Utc value +// must work now that the columns are timestamptz. That line is the regression test for the +// "Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone'" bug. +var user = new User { Mobile = "0" + DateTime.UtcNow.Ticks.ToString()[^10..], Name = "Self", Family = "Check" }; +db.Users.Add(user); +await db.SaveChangesAsync(); + +var device = new Device +{ + DeviceName = "SELFCHK", + UserId = user.Id, + Location = string.Empty, + NeshanLocation = string.Empty, + ResetRequested = true +}; +db.Devices.Add(device); +await db.SaveChangesAsync(); + +try +{ + var storedUser = await db.Users.AsNoTracking().FirstAsync(u => u.Id == user.Id); + Assert(storedUser.CreatedAt.Kind == DateTimeKind.Utc, "a timestamptz column must read back as Kind=Utc"); + + var first = await telemetry.ConsumeResetRequestAsync(device.Id, default); + var second = await telemetry.ConsumeResetRequestAsync(device.Id, default); + + Assert(first, "first ConsumeResetRequestAsync must return true"); + Assert(!second, "second ConsumeResetRequestAsync must return false (one-shot)"); + Assert(!(await db.Devices.AsNoTracking().FirstAsync(d => d.Id == device.Id)).ResetRequested, + "ResetRequested must be cleared in the database"); + + Console.WriteLine("PASS: a queued reset is delivered exactly once."); +} +finally +{ + db.Devices.Remove(device); + db.Users.Remove(user); + await db.SaveChangesAsync(); +} + +static void Assert(bool condition, string message) +{ + if (!condition) + throw new InvalidOperationException($"FAIL: {message}"); +}