diff --git a/CLAUDE.md b/CLAUDE.md index ae49e83..3cdf508 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -94,7 +94,7 @@ The JS output (`pkg-js/dist/shinyreact.js`) is a self-contained IIFE that bundle - `shinyreact.set_react_page(path="www/index.html")` — Express helper that serves a static `www/index.html`; auto-discovers `HTMLDependency` objects from traditional Shiny renderers and injects the shinyreact dep - `shinyreact.page_react_html(path="www/index.html")` — Core-mode helper that serves a static `www/index.html` as the `ui` argument of `App(ui=..., server=...)`; attaches the shinyreact dep. The Core counterpart to the Express-only `set_react_page()`. Unlike `set_react_page`, it does not auto-discover renderer dependencies - `shinyreact.page_bare(...)` / `shinyreact.page_react_dep(...)` — escape-hatch page builder and app-bundle `HTMLDependency` helper -- Bookmark restore: page entry points emit a head `` + and both tiers read it via `document.getElementById`. This removes the only + structural dependency on `window.shinyreact` existing before app code runs, + and gives the handshake its delivery vehicle. This change is independent of + npm publishing and should land first. + +4. **Semver protocol handshake at hook boot.** `@posit/shinyreact` declares a + supported protocol range (e.g. `^1`); on init it checks the + server-rendered `protocolVersion` and fails fast with a message naming both + versions and the fix. The protocol version bumps only when the wire format + changes — npm and PyPI/CRAN releases do not need lockstep. + +5. **Protocol as an artifact.** Write the wire contract (custom message + shapes, input-handler suffixes, restore/config payload) down as a single + versioned schema document, with the same fixture payloads validated in TS, + Python, and R. Its semver *is* the `protocolVersion`, so "what counts as a + breaking change" is answered by diffing the schema. This is also the class + of test that would have caught the #182–#186 parity bugs earlier. + +### Accepted trade-offs + +- **Two shipped artifacts** (npm ESM + IIFE). Mitigated: single source, one + release builds both; docs must be crisp about which tier an app is in. +- **Drift between an old npm install and a new server package is possible.** + The handshake makes it a clear, actionable error instead of silent + breakage — the best any dual-registry design achieves (ipywidgets, plotly, + bokeh included). +- **An npm release pipeline** is new operational surface (publish workflow, + `NPM_TOKEN`, versioning discipline). +- **Single-React for the npm tier** rests on standard peer-dependency + semantics rather than construction. Standard for the React ecosystem; + the IIFE tier keeps the by-construction guarantee. + +## Consequences / sequencing + +1. `#shinyreact-config` script tag (restore + protocol version) — lands in + this repo now; both `_bookmark.py` and `bookmark.R` change, plus + `global.ts` reading the tag instead of `_restore`. +2. Protocol schema document + cross-language fixture tests. +3. Package `pkg-js/src/` for dual output (ESM + IIFE); add publish workflow for + `@posit/shinyreact`. +4. Convert one Vite example (`09-hmr` is the natural candidate) to import + `@posit/shinyreact`; retire its dev/prod bridge alias. +5. Longer term, if the zero-build tier is ever deprecated, the global dies + with it — completing #172's original goal. + +Related: `DESIGN.md` "Shiny client runtime as an npm package" (#28) and +`docs/posit-conf-2026-goals.md` (splitting the vendored hooks into their own +repo) both point at this end state; this record supersedes the +`@posit/shiny-react` naming used there. diff --git a/docs/posit-conf-2026-goals.md b/docs/posit-conf-2026-goals.md index 5f29f95..bfd5bde 100644 --- a/docs/posit-conf-2026-goals.md +++ b/docs/posit-conf-2026-goals.md @@ -45,7 +45,7 @@ Remaining known issues are tracked in the [GitHub issue tracker](https://github. The vendored `shiny-react` code at `pkg-js/src/shiny-react/` and the broader Shiny JS infrastructure should live in its own repository, independent of `shinyreact`. This enables: -- Other packages (not just `shinyreact`) to depend on shiny-react +- Other packages (not just `shinyreact`) to depend on the published `@posit/shinyreact` npm package (naming decided in `decisions/2026-08-17-js-distribution.md`) - Independent versioning and release cycle - Cleaner separation of concerns between Shiny's JS plumbing and `shinyreact`'s rendering diff --git a/pkg-js/dist/shinyreact.js b/pkg-js/dist/shinyreact.js index 7084d69..c55a3ba 100644 --- a/pkg-js/dist/shinyreact.js +++ b/pkg-js/dist/shinyreact.js @@ -1,4 +1,4 @@ -var Fm=Object.defineProperty;var km=(eu,tl,au)=>tl in eu?Fm(eu,tl,{enumerable:!0,configurable:!0,writable:!0,value:au}):eu[tl]=au;var J=(eu,tl,au)=>km(eu,typeof tl!="symbol"?tl+"":tl,au);(function(){"use strict";function eu(t,l){for(var u=0;ue[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function tl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var au={exports:{}},D={};/** +var Pm=Object.defineProperty;var tr=(eu,tl,au)=>tl in eu?Pm(eu,tl,{enumerable:!0,configurable:!0,writable:!0,value:au}):eu[tl]=au;var J=(eu,tl,au)=>tr(eu,typeof tl!="symbol"?tl+"":tl,au);(function(){"use strict";function eu(t,l){for(var u=0;ue[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function tl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var au={exports:{}},D={};/** * @license React * react.production.js * @@ -6,7 +6,7 @@ var Fm=Object.defineProperty;var km=(eu,tl,au)=>tl in eu?Fm(eu,tl,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var kn=Symbol.for("react.transitional.element"),C0=Symbol.for("react.portal"),B0=Symbol.for("react.fragment"),Y0=Symbol.for("react.strict_mode"),q0=Symbol.for("react.profiler"),j0=Symbol.for("react.consumer"),G0=Symbol.for("react.context"),V0=Symbol.for("react.forward_ref"),X0=Symbol.for("react.suspense"),Q0=Symbol.for("react.memo"),Vc=Symbol.for("react.lazy"),Z0=Symbol.for("react.activity"),Xc=Symbol.iterator;function L0(t){return t===null||typeof t!="object"?null:(t=Xc&&t[Xc]||t["@@iterator"],typeof t=="function"?t:null)}var Qc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zc=Object.assign,Lc={};function Du(t,l,u){this.props=t,this.context=l,this.refs=Lc,this.updater=u||Qc}Du.prototype.isReactComponent={},Du.prototype.setState=function(t,l){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,l,"setState")},Du.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function xc(){}xc.prototype=Du.prototype;function In(t,l,u){this.props=t,this.context=l,this.refs=Lc,this.updater=u||Qc}var Pn=In.prototype=new xc;Pn.constructor=In,Zc(Pn,Du.prototype),Pn.isPureReactComponent=!0;var Kc=Array.isArray;function ti(){}var W={H:null,A:null,T:null,S:null},Jc=Object.prototype.hasOwnProperty;function li(t,l,u){var e=u.ref;return{$$typeof:kn,type:t,key:l,ref:e!==void 0?e:null,props:u}}function x0(t,l){return li(t.type,l,t.props)}function ui(t){return typeof t=="object"&&t!==null&&t.$$typeof===kn}function K0(t){var l={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(u){return l[u]})}var wc=/\/+/g;function ei(t,l){return typeof t=="object"&&t!==null&&t.key!=null?K0(""+t.key):l.toString(36)}function J0(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(ti,ti):(t.status="pending",t.then(function(l){t.status==="pending"&&(t.status="fulfilled",t.value=l)},function(l){t.status==="pending"&&(t.status="rejected",t.reason=l)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function Uu(t,l,u,e,a){var n=typeof t;(n==="undefined"||n==="boolean")&&(t=null);var i=!1;if(t===null)i=!0;else switch(n){case"bigint":case"string":case"number":i=!0;break;case"object":switch(t.$$typeof){case kn:case C0:i=!0;break;case Vc:return i=t._init,Uu(i(t._payload),l,u,e,a)}}if(i)return a=a(t),i=e===""?"."+ei(t,0):e,Kc(a)?(u="",i!=null&&(u=i.replace(wc,"$&/")+"/"),Uu(a,l,u,"",function(o){return o})):a!=null&&(ui(a)&&(a=x0(a,u+(a.key==null||t&&t.key===a.key?"":(""+a.key).replace(wc,"$&/")+"/")+i)),l.push(a)),1;i=0;var f=e===""?".":e+":";if(Kc(t))for(var c=0;ctl in eu?Fm(eu,tl,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function l(T,Y){var N=T.length;T.push(Y);t:for(;0>>1,vt=T[at];if(0>>1;at<$n;){var Wn=2*(at+1)-1,Gc=T[Wn],Mu=Wn+1,Fn=T[Mu];if(0>a(Gc,N))Mua(Fn,Gc)?(T[at]=Fn,T[Mu]=N,at=Mu):(T[at]=Gc,T[Wn]=N,at=Wn);else if(Mua(Fn,N))T[at]=Fn,T[Mu]=N,at=Mu;else break t}}return Y}function a(T,Y){var N=T.sortIndex-Y.sortIndex;return N!==0?N:T.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var n=performance;t.unstable_now=function(){return n.now()}}else{var i=Date,f=i.now();t.unstable_now=function(){return i.now()-f}}var c=[],o=[],v=1,r=null,y=3,m=!1,b=!1,A=!1,H=!1,d=typeof setTimeout=="function"?setTimeout:null,s=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;function S(T){for(var Y=u(o);Y!==null;){if(Y.callback===null)e(o);else if(Y.startTime<=T)e(o),Y.sortIndex=Y.expirationTime,l(c,Y);else break;Y=u(o)}}function E(T){if(A=!1,S(T),!b)if(u(c)!==null)b=!0,O||(O=!0,uu());else{var Y=u(o);Y!==null&&jc(E,Y.startTime-T)}}var O=!1,z=-1,p=5,M=-1;function R(){return H?!0:!(t.unstable_now()-MT&&R());){var at=r.callback;if(typeof at=="function"){r.callback=null,y=r.priorityLevel;var vt=at(r.expirationTime<=T);if(T=t.unstable_now(),typeof vt=="function"){r.callback=vt,S(T),Y=!0;break l}r===u(c)&&e(c),S(T)}else e(c);r=u(c)}if(r!==null)Y=!0;else{var $n=u(o);$n!==null&&jc(E,$n.startTime-T),Y=!1}}break t}finally{r=null,y=N,m=!1}Y=void 0}}finally{Y?uu():O=!1}}}var uu;if(typeof h=="function")uu=function(){h(Ft)};else if(typeof MessageChannel<"u"){var N0=new MessageChannel,Wm=N0.port2;N0.port1.onmessage=Ft,uu=function(){Wm.postMessage(null)}}else uu=function(){d(Ft,0)};function jc(T,Y){z=d(function(){T(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(T){T.callback=null},t.unstable_forceFrameRate=function(T){0>T||125at?(T.sortIndex=N,l(o,T),u(c)===null&&T===u(o)&&(A?(s(z),z=-1):A=!0,jc(E,N-at))):(T.sortIndex=vt,l(c,T),b||m||(b=!0,O||(O=!0,uu()))),T},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(T){var Y=y;return function(){var N=y;y=Y;try{return T.apply(this,arguments)}finally{y=N}}}})(Ic),kc.exports=Ic;var W0=kc.exports,Pc={exports:{}},Et={};/** + */(function(t){function l(T,Y){var N=T.length;T.push(Y);t:for(;0>>1,vt=T[at];if(0>>1;at<$n;){var Wn=2*(at+1)-1,jc=T[Wn],Mu=Wn+1,Fn=T[Mu];if(0>a(jc,N))Mua(Fn,jc)?(T[at]=Fn,T[Mu]=N,at=Mu):(T[at]=jc,T[Wn]=N,at=Wn);else if(Mua(Fn,N))T[at]=Fn,T[Mu]=N,at=Mu;else break t}}return Y}function a(T,Y){var N=T.sortIndex-Y.sortIndex;return N!==0?N:T.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var n=performance;t.unstable_now=function(){return n.now()}}else{var i=Date,f=i.now();t.unstable_now=function(){return i.now()-f}}var c=[],y=[],v=1,r=null,d=3,m=!1,b=!1,A=!1,H=!1,o=typeof setTimeout=="function"?setTimeout:null,s=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;function S(T){for(var Y=u(y);Y!==null;){if(Y.callback===null)e(y);else if(Y.startTime<=T)e(y),Y.sortIndex=Y.expirationTime,l(c,Y);else break;Y=u(y)}}function E(T){if(A=!1,S(T),!b)if(u(c)!==null)b=!0,_||(_=!0,uu());else{var Y=u(y);Y!==null&&Vc(E,Y.startTime-T)}}var _=!1,z=-1,p=5,M=-1;function R(){return H?!0:!(t.unstable_now()-MT&&R());){var at=r.callback;if(typeof at=="function"){r.callback=null,d=r.priorityLevel;var vt=at(r.expirationTime<=T);if(T=t.unstable_now(),typeof vt=="function"){r.callback=vt,S(T),Y=!0;break l}r===u(c)&&e(c),S(T)}else e(c);r=u(c)}if(r!==null)Y=!0;else{var $n=u(y);$n!==null&&Vc(E,$n.startTime-T),Y=!1}}break t}finally{r=null,d=N,m=!1}Y=void 0}}finally{Y?uu():_=!1}}}var uu;if(typeof h=="function")uu=function(){h(Ft)};else if(typeof MessageChannel<"u"){var C0=new MessageChannel,Im=C0.port2;C0.port1.onmessage=Ft,uu=function(){Im.postMessage(null)}}else uu=function(){o(Ft,0)};function Vc(T,Y){z=o(function(){T(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(T){T.callback=null},t.unstable_forceFrameRate=function(T){0>T||125at?(T.sortIndex=N,l(y,T),u(c)===null&&T===u(y)&&(A?(s(z),z=-1):A=!0,Vc(E,N-at))):(T.sortIndex=vt,l(c,T),b||m||(b=!0,_||(_=!0,uu()))),T},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(T){var Y=d;return function(){var N=d;d=Y;try{return T.apply(this,arguments)}finally{d=N}}}})(Ic),kc.exports=Ic;var F0=kc.exports,Pc={exports:{}},Et={};/** * @license React * react-dom.production.js * @@ -22,7 +22,7 @@ var Fm=Object.defineProperty;var km=(eu,tl,au)=>tl in eu?Fm(eu,tl,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var F0=G;function ts(t){var l="https://react.dev/errors/"+t;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ls)}catch(t){console.error(t)}}ls(),Pc.exports=Et;var P0=Pc.exports;/** + */var k0=j;function ts(t){var l="https://react.dev/errors/"+t;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ls)}catch(t){console.error(t)}}ls(),Pc.exports=Et;var th=Pc.exports;/** * @license React * react-dom-client.production.js * @@ -30,15 +30,15 @@ var Fm=Object.defineProperty;var km=(eu,tl,au)=>tl in eu?Fm(eu,tl,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var st=W0,us=G,th=P0;function g(t){var l="https://react.dev/errors/"+t;if(1Ru||(t.current=yi[Ru],yi[Ru]=null,Ru--)}function w(t,l){Ru++,yi[Ru]=t.current,t.current=l}var ul=ll(null),pe=ll(null),Hl=ll(null),Ta=ll(null);function Aa(t,l){switch(w(Hl,l),w(pe,t),w(ul,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?qo(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=qo(l),t=jo(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}yt(ul),w(ul,t)}function Nu(){yt(ul),yt(pe),yt(Hl)}function oi(t){t.memoizedState!==null&&w(Ta,t);var l=ul.current,u=jo(l,t.type);l!==u&&(w(pe,t),w(ul,u))}function pa(t){pe.current===t&&(yt(ul),yt(pe)),Ta.current===t&&(yt(Ta),ha._currentValue=nu)}var hi,ys;function iu(t){if(hi===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);hi=l&&l[1]||"",ys=-1Ru||(t.current=di[Ru],di[Ru]=null,Ru--)}function w(t,l){Ru++,di[Ru]=t.current,t.current=l}var ul=ll(null),pe=ll(null),Hl=ll(null),Ta=ll(null);function Aa(t,l){switch(w(Hl,l),w(pe,t),w(ul,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?qy(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=qy(l),t=Vy(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}dt(ul),w(ul,t)}function Nu(){dt(ul),dt(pe),dt(Hl)}function yi(t){t.memoizedState!==null&&w(Ta,t);var l=ul.current,u=Vy(l,t.type);l!==u&&(w(pe,t),w(ul,u))}function pa(t){pe.current===t&&(dt(ul),dt(pe)),Ta.current===t&&(dt(Ta),ha._currentValue=nu)}var hi,ds;function iu(t){if(hi===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);hi=l&&l[1]||"",ds=-1)":-1a||c[e]!==o[a]){var v=` -`+c[e].replace(" at new "," at ");return t.displayName&&v.includes("")&&(v=v.replace("",t.displayName)),v}while(1<=e&&0<=a);break}}}finally{vi=!1,Error.prepareStackTrace=u}return(u=t?t.displayName||t.name:"")?iu(u):""}function nh(t,l){switch(t.tag){case 26:case 27:case 5:return iu(t.type);case 16:return iu("Lazy");case 13:return t.child!==l&&l!==null?iu("Suspense Fallback"):iu("Suspense");case 19:return iu("SuspenseList");case 0:case 15:return mi(t.type,!1);case 11:return mi(t.type.render,!1);case 1:return mi(t.type,!0);case 31:return iu("Activity");default:return""}}function os(t){try{var l="",u=null;do l+=nh(t,u),u=t,t=t.return;while(t);return l}catch(e){return` +`+hi+t+ds}var vi=!1;function mi(t,l){if(!t||vi)return"";vi=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var e={DetermineComponentFrameRoot:function(){try{if(l){var r=function(){throw Error()};if(Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(m){var d=m}Reflect.construct(t,[],r)}else{try{r.call()}catch(m){d=m}t.call(r.prototype)}}else{try{throw Error()}catch(m){d=m}(r=t())&&typeof r.catch=="function"&&r.catch(function(){})}}catch(m){if(m&&d&&typeof m.stack=="string")return[m.stack,d.stack]}return[null,null]}};e.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(e.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(e.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var n=e.DetermineComponentFrameRoot(),i=n[0],f=n[1];if(i&&f){var c=i.split(` +`),y=f.split(` +`);for(a=e=0;ea||c[e]!==y[a]){var v=` +`+c[e].replace(" at new "," at ");return t.displayName&&v.includes("")&&(v=v.replace("",t.displayName)),v}while(1<=e&&0<=a);break}}}finally{vi=!1,Error.prepareStackTrace=u}return(u=t?t.displayName||t.name:"")?iu(u):""}function ih(t,l){switch(t.tag){case 26:case 27:case 5:return iu(t.type);case 16:return iu("Lazy");case 13:return t.child!==l&&l!==null?iu("Suspense Fallback"):iu("Suspense");case 19:return iu("SuspenseList");case 0:case 15:return mi(t.type,!1);case 11:return mi(t.type.render,!1);case 1:return mi(t.type,!0);case 31:return iu("Activity");default:return""}}function ys(t){try{var l="",u=null;do l+=ih(t,u),u=t,t=t.return;while(t);return l}catch(e){return` Error generating stack: `+e.message+` -`+e.stack}}var ri=Object.prototype.hasOwnProperty,Si=st.unstable_scheduleCallback,gi=st.unstable_cancelCallback,ih=st.unstable_shouldYield,fh=st.unstable_requestPaint,Ht=st.unstable_now,ch=st.unstable_getCurrentPriorityLevel,hs=st.unstable_ImmediatePriority,vs=st.unstable_UserBlockingPriority,_a=st.unstable_NormalPriority,sh=st.unstable_LowPriority,ms=st.unstable_IdlePriority,dh=st.log,yh=st.unstable_setDisableYieldValue,_e=null,Rt=null;function Rl(t){if(typeof dh=="function"&&yh(t),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(_e,t)}catch{}}var Nt=Math.clz32?Math.clz32:vh,oh=Math.log,hh=Math.LN2;function vh(t){return t>>>=0,t===0?32:31-(oh(t)/hh|0)|0}var Oa=256,Ma=262144,Da=4194304;function fu(t){var l=t&42;if(l!==0)return l;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ua(t,l,u){var e=t.pendingLanes;if(e===0)return 0;var a=0,n=t.suspendedLanes,i=t.pingedLanes;t=t.warmLanes;var f=e&134217727;return f!==0?(e=f&~n,e!==0?a=fu(e):(i&=f,i!==0?a=fu(i):u||(u=f&~t,u!==0&&(a=fu(u))))):(f=e&~n,f!==0?a=fu(f):i!==0?a=fu(i):u||(u=e&~t,u!==0&&(a=fu(u)))),a===0?0:l!==0&&l!==a&&!(l&n)&&(n=a&-a,u=l&-l,n>=u||n===32&&(u&4194048)!==0)?l:a}function Oe(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function mh(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 rs(){var t=Da;return Da<<=1,!(Da&62914560)&&(Da=4194304),t}function bi(t){for(var l=[],u=0;31>u;u++)l.push(t);return l}function Me(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function rh(t,l,u,e,a,n){var i=t.pendingLanes;t.pendingLanes=u,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=u,t.entangledLanes&=u,t.errorRecoveryDisabledLanes&=u,t.shellSuspendCounter=0;var f=t.entanglements,c=t.expirationTimes,o=t.hiddenUpdates;for(u=i&~u;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Th=/[\n"\\]/g;function Qt(t){return t.replace(Th,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function _i(t,l,u,e,a,n,i,f){t.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?t.type=i:t.removeAttribute("type"),l!=null?i==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+Xt(l)):t.value!==""+Xt(l)&&(t.value=""+Xt(l)):i!=="submit"&&i!=="reset"||t.removeAttribute("value"),l!=null?Oi(t,i,Xt(l)):u!=null?Oi(t,i,Xt(u)):e!=null&&t.removeAttribute("value"),a==null&&n!=null&&(t.defaultChecked=!!n),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+Xt(f):t.removeAttribute("name")}function Us(t,l,u,e,a,n,i,f){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(t.type=n),l!=null||u!=null){if(!(n!=="submit"&&n!=="reset"||l!=null)){pi(t);return}u=u!=null?""+Xt(u):"",l=l!=null?""+Xt(l):u,f||l===t.value||(t.value=l),t.defaultValue=l}e=e??a,e=typeof e!="function"&&typeof e!="symbol"&&!!e,t.checked=f?t.checked:!!e,t.defaultChecked=!!e,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.name=i),pi(t)}function Oi(t,l,u){l==="number"&&Na(t.ownerDocument)===t||t.defaultValue===""+u||(t.defaultValue=""+u)}function Gu(t,l,u,e){if(t=t.options,l){l={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ri=!1;if(ol)try{var Re={};Object.defineProperty(Re,"passive",{get:function(){Ri=!0}}),window.addEventListener("test",Re,Re),window.removeEventListener("test",Re,Re)}catch{Ri=!1}var Cl=null,Ni=null,Ba=null;function qs(){if(Ba)return Ba;var t,l=Ni,u=l.length,e,a="value"in Cl?Cl.value:Cl.textContent,n=a.length;for(t=0;t=Be),Zs=" ",Ls=!1;function xs(t,l){switch(t){case"keyup":return Fh.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ks(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zu=!1;function Ih(t,l){switch(t){case"compositionend":return Ks(l);case"keypress":return l.which!==32?null:(Ls=!0,Zs);case"textInput":return t=l.data,t===Zs&&Ls?null:t;default:return null}}function Ph(t,l){if(Zu)return t==="compositionend"||!ji&&xs(t,l)?(t=qs(),Ba=Ni=Cl=null,Zu=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:u,offset:l-t};t=e}t:{for(;u;){if(u.nextSibling){u=u.nextSibling;break t}u=u.parentNode}u=void 0}u=Ps(u)}}function ld(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?ld(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function ud(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Na(t.document);l instanceof t.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)t=l.contentWindow;else break;l=Na(t.document)}return l}function Xi(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var fv=ol&&"documentMode"in document&&11>=document.documentMode,Lu=null,Qi=null,Ge=null,Zi=!1;function ed(t,l,u){var e=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Zi||Lu==null||Lu!==Na(e)||(e=Lu,"selectionStart"in e&&Xi(e)?e={start:e.selectionStart,end:e.selectionEnd}:(e=(e.ownerDocument&&e.ownerDocument.defaultView||window).getSelection(),e={anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset}),Ge&&je(Ge,e)||(Ge=e,e=Dn(Qi,"onSelect"),0>=i,a-=i,el=1<<32-Nt(l)+a|u<p?(M=z,z=null):M=z.sibling;var R=y(d,z,h[p],S);if(R===null){z===null&&(z=M);break}t&&z&&R.alternate===null&&l(d,z),s=n(R,s,p),O===null?E=R:O.sibling=R,O=R,z=M}if(p===h.length)return u(d,z),j&&vl(d,p),E;if(z===null){for(;pp?(M=z,z=null):M=z.sibling;var Ft=y(d,z,R.value,S);if(Ft===null){z===null&&(z=M);break}t&&z&&Ft.alternate===null&&l(d,z),s=n(Ft,s,p),O===null?E=Ft:O.sibling=Ft,O=Ft,z=M}if(R.done)return u(d,z),j&&vl(d,p),E;if(z===null){for(;!R.done;p++,R=h.next())R=r(d,R.value,S),R!==null&&(s=n(R,s,p),O===null?E=R:O.sibling=R,O=R);return j&&vl(d,p),E}for(z=e(z);!R.done;p++,R=h.next())R=m(z,d,p,R.value,S),R!==null&&(t&&R.alternate!==null&&z.delete(R.key===null?p:R.key),s=n(R,s,p),O===null?E=R:O.sibling=R,O=R);return t&&z.forEach(function(uu){return l(d,uu)}),j&&vl(d,p),E}function H(d,s,h,S){if(typeof h=="object"&&h!==null&&h.type===Hu&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case za:t:{for(var E=h.key;s!==null;){if(s.key===E){if(E=h.type,E===Hu){if(s.tag===7){u(d,s.sibling),S=a(s,h.props.children),S.return=d,d=S;break t}}else if(s.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ul&&gu(E)===s.type){u(d,s.sibling),S=a(s,h.props),xe(S,h),S.return=d,d=S;break t}u(d,s);break}else l(d,s);s=s.sibling}h.type===Hu?(S=hu(h.props.children,d.mode,S,h.key),S.return=d,d=S):(S=xa(h.type,h.key,h.props,null,d.mode,S),xe(S,h),S.return=d,d=S)}return i(d);case ze:t:{for(E=h.key;s!==null;){if(s.key===E)if(s.tag===4&&s.stateNode.containerInfo===h.containerInfo&&s.stateNode.implementation===h.implementation){u(d,s.sibling),S=a(s,h.children||[]),S.return=d,d=S;break t}else{u(d,s);break}else l(d,s);s=s.sibling}S=Wi(h,d.mode,S),S.return=d,d=S}return i(d);case Ul:return h=gu(h),H(d,s,h,S)}if(Ae(h))return b(d,s,h,S);if(Te(h)){if(E=Te(h),typeof E!="function")throw Error(g(150));return h=E.call(h),A(d,s,h,S)}if(typeof h.then=="function")return H(d,s,ka(h),S);if(h.$$typeof===sl)return H(d,s,wa(d,h),S);Ia(d,h)}return typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint"?(h=""+h,s!==null&&s.tag===6?(u(d,s.sibling),S=a(s,h),S.return=d,d=S):(u(d,s),S=$i(h,d.mode,S),S.return=d,d=S),i(d)):u(d,s)}return function(d,s,h,S){try{Le=0;var E=H(d,s,h,S);return te=null,E}catch(z){if(z===Pu||z===Wa)throw z;var O=Bt(29,z,null,d.mode);return O.lanes=S,O.return=d,O}finally{}}}var Eu=Od(!0),Md=Od(!1),Gl=!1;function cf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Vl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xl(t,l,u){var e=t.updateQueue;if(e===null)return null;if(e=e.shared,X&2){var a=e.pending;return a===null?l.next=l:(l.next=a.next,a.next=l),e.pending=l,l=La(t),dd(t,null,u),l}return Za(t,e,l,u),La(t)}function Ke(t,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var e=l.lanes;e&=t.pendingLanes,u|=e,l.lanes=u,gs(t,u)}}function df(t,l){var u=t.updateQueue,e=t.alternate;if(e!==null&&(e=e.updateQueue,u===e)){var a=null,n=null;if(u=u.firstBaseUpdate,u!==null){do{var i={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};n===null?a=n=i:n=n.next=i,u=u.next}while(u!==null);n===null?a=n=l:n=n.next=l}else a=n=l;u={baseState:e.baseState,firstBaseUpdate:a,lastBaseUpdate:n,shared:e.shared,callbacks:e.callbacks},t.updateQueue=u;return}t=u.lastBaseUpdate,t===null?u.firstBaseUpdate=l:t.next=l,u.lastBaseUpdate=l}var yf=!1;function Je(){if(yf){var t=Iu;if(t!==null)throw t}}function we(t,l,u,e){yf=!1;var a=t.updateQueue;Gl=!1;var n=a.firstBaseUpdate,i=a.lastBaseUpdate,f=a.shared.pending;if(f!==null){a.shared.pending=null;var c=f,o=c.next;c.next=null,i===null?n=o:i.next=o,i=c;var v=t.alternate;v!==null&&(v=v.updateQueue,f=v.lastBaseUpdate,f!==i&&(f===null?v.firstBaseUpdate=o:f.next=o,v.lastBaseUpdate=c))}if(n!==null){var r=a.baseState;i=0,v=o=c=null,f=n;do{var y=f.lane&-536870913,m=y!==f.lane;if(m?(q&y)===y:(e&y)===y){y!==0&&y===ku&&(yf=!0),v!==null&&(v=v.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var b=t,A=f;y=l;var H=u;switch(A.tag){case 1:if(b=A.payload,typeof b=="function"){r=b.call(H,r,y);break t}r=b;break t;case 3:b.flags=b.flags&-65537|128;case 0:if(b=A.payload,y=typeof b=="function"?b.call(H,r,y):b,y==null)break t;r=F({},r,y);break t;case 2:Gl=!0}}y=f.callback,y!==null&&(t.flags|=64,m&&(t.flags|=8192),m=a.callbacks,m===null?a.callbacks=[y]:m.push(y))}else m={lane:y,tag:f.tag,payload:f.payload,callback:f.callback,next:null},v===null?(o=v=m,c=r):v=v.next=m,i|=y;if(f=f.next,f===null){if(f=a.shared.pending,f===null)break;m=f,f=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);v===null&&(c=r),a.baseState=c,a.firstBaseUpdate=o,a.lastBaseUpdate=v,n===null&&(a.shared.lanes=0),Kl|=i,t.lanes=i,t.memoizedState=r}}function Dd(t,l){if(typeof t!="function")throw Error(g(191,t));t.call(l)}function Ud(t,l){var u=t.callbacks;if(u!==null)for(t.callbacks=null,t=0;tn?n:8;var i=_.T,f={};_.T=f,Hf(t,!1,l,u);try{var c=a(),o=_.S;if(o!==null&&o(f,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var v=rv(c,e);Fe(t,l,v,Vt(t))}else Fe(t,l,e,Vt(t))}catch(r){Fe(t,l,{then:function(){},status:"rejected",reason:r},Vt())}finally{V.p=n,i!==null&&f.types!==null&&(i.types=f.types),_.T=i}}function Tv(){}function Df(t,l,u,e){if(t.tag!==5)throw Error(g(476));var a=fy(t).queue;iy(t,a,l,nu,u===null?Tv:function(){return cy(t),u(e)})}function fy(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:nu,baseState:nu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:nu},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:u},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function cy(t){var l=fy(t);l.next===null&&(l=t.alternate.memoizedState),Fe(t,l.next.queue,{},Vt())}function Uf(){return St(ha)}function sy(){return et().memoizedState}function dy(){return et().memoizedState}function Av(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var u=Vt();t=Vl(u);var e=Xl(l,t,u);e!==null&&(Ut(e,l,u),Ke(e,l,u)),l={cache:ef()},t.payload=l;return}l=l.return}}function pv(t,l,u){var e=Vt();u={lane:e,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},sn(t)?oy(l,u):(u=Ji(t,l,u,e),u!==null&&(Ut(u,t,e),hy(u,l,e)))}function yy(t,l,u){var e=Vt();Fe(t,l,u,e)}function Fe(t,l,u,e){var a={lane:e,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(sn(t))oy(l,a);else{var n=t.alternate;if(t.lanes===0&&(n===null||n.lanes===0)&&(n=l.lastRenderedReducer,n!==null))try{var i=l.lastRenderedState,f=n(i,u);if(a.hasEagerState=!0,a.eagerState=f,Ct(f,i))return Za(t,l,a,0),K===null&&Qa(),!1}catch{}finally{}if(u=Ji(t,l,a,e),u!==null)return Ut(u,t,e),hy(u,l,e),!0}return!1}function Hf(t,l,u,e){if(e={lane:2,revertLane:cc(),gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},sn(t)){if(l)throw Error(g(479))}else l=Ji(t,u,e,2),l!==null&&Ut(l,t,2)}function sn(t){var l=t.alternate;return t===U||l!==null&&l===U}function oy(t,l){ue=ln=!0;var u=t.pending;u===null?l.next=l:(l.next=u.next,u.next=l),t.pending=l}function hy(t,l,u){if(u&4194048){var e=l.lanes;e&=t.pendingLanes,u|=e,l.lanes=u,gs(t,u)}}var ke={readContext:St,use:an,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};ke.useEffectEvent=tt;var vy={readContext:St,use:an,useCallback:function(t,l){return Tt().memoizedState=[t,l===void 0?null:l],t},useContext:St,useEffect:kd,useImperativeHandle:function(t,l,u){u=u!=null?u.concat([t]):null,fn(4194308,4,ly.bind(null,l,t),u)},useLayoutEffect:function(t,l){return fn(4194308,4,t,l)},useInsertionEffect:function(t,l){fn(4,2,t,l)},useMemo:function(t,l){var u=Tt();l=l===void 0?null:l;var e=t();if(zu){Rl(!0);try{t()}finally{Rl(!1)}}return u.memoizedState=[e,l],e},useReducer:function(t,l,u){var e=Tt();if(u!==void 0){var a=u(l);if(zu){Rl(!0);try{u(l)}finally{Rl(!1)}}}else a=l;return e.memoizedState=e.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},e.queue=t,t=t.dispatch=pv.bind(null,U,t),[e.memoizedState,t]},useRef:function(t){var l=Tt();return t={current:t},l.memoizedState=t},useState:function(t){t=Af(t);var l=t.queue,u=yy.bind(null,U,l);return l.dispatch=u,[t.memoizedState,u]},useDebugValue:Of,useDeferredValue:function(t,l){var u=Tt();return Mf(u,t,l)},useTransition:function(){var t=Af(!1);return t=iy.bind(null,U,t.queue,!0,!1),Tt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,u){var e=U,a=Tt();if(j){if(u===void 0)throw Error(g(407));u=u()}else{if(u=l(),K===null)throw Error(g(349));q&127||Yd(e,l,u)}a.memoizedState=u;var n={value:u,getSnapshot:l};return a.queue=n,kd(jd.bind(null,e,n,t),[t]),e.flags|=2048,ae(9,{destroy:void 0},qd.bind(null,e,n,u,l),null),u},useId:function(){var t=Tt(),l=K.identifierPrefix;if(j){var u=al,e=el;u=(e&~(1<<32-Nt(e)-1)).toString(32)+u,l="_"+l+"R_"+u,u=un++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof e.is=="string"?i.createElement("select",{is:e.is}):i.createElement("select"),e.multiple?n.multiple=!0:e.size&&(n.size=e.size);break;default:n=typeof e.is=="string"?i.createElement(a,{is:e.is}):i.createElement(a)}}n[mt]=l,n[At]=e;t:for(i=l.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break t;for(;i.sibling===null;){if(i.return===null||i.return===l)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}l.stateNode=n;t:switch(bt(n,a,e),a){case"button":case"input":case"select":case"textarea":e=!!e.autoFocus;break t;case"img":e=!0;break t;default:e=!1}e&&El(l)}}return I(l),xf(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,u),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==e&&El(l);else{if(typeof e!="string"&&l.stateNode===null)throw Error(g(166));if(t=Hl.current,Wu(l)){if(t=l.stateNode,u=l.memoizedProps,e=null,a=rt,a!==null)switch(a.tag){case 27:case 5:e=a.memoizedProps}t[mt]=l,t=!!(t.nodeValue===u||e!==null&&e.suppressHydrationWarning===!0||Bo(t.nodeValue,u)),t||ql(l,!0)}else t=Un(t).createTextNode(e),t[mt]=l,l.stateNode=t}return I(l),null;case 31:if(u=l.memoizedState,t===null||t.memoizedState!==null){if(e=Wu(l),u!==null){if(t===null){if(!e)throw Error(g(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(g(557));t[mt]=l}else vu(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;I(l),t=!1}else u=Pi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),t=!0;if(!t)return l.flags&256?(qt(l),l):(qt(l),null);if(l.flags&128)throw Error(g(558))}return I(l),null;case 13:if(e=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Wu(l),e!==null&&e.dehydrated!==null){if(t===null){if(!a)throw Error(g(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(g(317));a[mt]=l}else vu(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;I(l),a=!1}else a=Pi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return l.flags&256?(qt(l),l):(qt(l),null)}return qt(l),l.flags&128?(l.lanes=u,l):(u=e!==null,t=t!==null&&t.memoizedState!==null,u&&(e=l.child,a=null,e.alternate!==null&&e.alternate.memoizedState!==null&&e.alternate.memoizedState.cachePool!==null&&(a=e.alternate.memoizedState.cachePool.pool),n=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),n!==a&&(e.flags|=2048)),u!==t&&u&&(l.child.flags|=8192),vn(l,l.updateQueue),I(l),null);case 4:return Nu(),t===null&&oc(l.stateNode.containerInfo),I(l),null;case 10:return rl(l.type),I(l),null;case 19:if(yt(ut),e=l.memoizedState,e===null)return I(l),null;if(a=(l.flags&128)!==0,n=e.rendering,n===null)if(a)Pe(e,!1);else{if(lt!==0||t!==null&&t.flags&128)for(t=l.child;t!==null;){if(n=tn(t),n!==null){for(l.flags|=128,Pe(e,!1),t=n.updateQueue,l.updateQueue=t,vn(l,t),l.subtreeFlags=0,t=u,u=l.child;u!==null;)yd(u,t),u=u.sibling;return w(ut,ut.current&1|2),j&&vl(l,e.treeForkCount),l.child}t=t.sibling}e.tail!==null&&Ht()>bn&&(l.flags|=128,a=!0,Pe(e,!1),l.lanes=4194304)}else{if(!a)if(t=tn(n),t!==null){if(l.flags|=128,a=!0,t=t.updateQueue,l.updateQueue=t,vn(l,t),Pe(e,!0),e.tail===null&&e.tailMode==="hidden"&&!n.alternate&&!j)return I(l),null}else 2*Ht()-e.renderingStartTime>bn&&u!==536870912&&(l.flags|=128,a=!0,Pe(e,!1),l.lanes=4194304);e.isBackwards?(n.sibling=l.child,l.child=n):(t=e.last,t!==null?t.sibling=n:l.child=n,e.last=n)}return e.tail!==null?(t=e.tail,e.rendering=t,e.tail=t.sibling,e.renderingStartTime=Ht(),t.sibling=null,u=ut.current,w(ut,a?u&1|2:u&1),j&&vl(l,e.treeForkCount),t):(I(l),null);case 22:case 23:return qt(l),hf(),e=l.memoizedState!==null,t!==null?t.memoizedState!==null!==e&&(l.flags|=8192):e&&(l.flags|=8192),e?u&536870912&&!(l.flags&128)&&(I(l),l.subtreeFlags&6&&(l.flags|=8192)):I(l),u=l.updateQueue,u!==null&&vn(l,u.retryQueue),u=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(u=t.memoizedState.cachePool.pool),e=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),e!==u&&(l.flags|=2048),t!==null&&yt(Su),null;case 24:return u=null,t!==null&&(u=t.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),rl(nt),I(l),null;case 25:return null;case 30:return null}throw Error(g(156,l.tag))}function Uv(t,l){switch(ki(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return rl(nt),Nu(),t=l.flags,t&65536&&!(t&128)?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return pa(l),null;case 31:if(l.memoizedState!==null){if(qt(l),l.alternate===null)throw Error(g(340));vu()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(qt(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(g(340));vu()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return yt(ut),null;case 4:return Nu(),null;case 10:return rl(l.type),null;case 22:case 23:return qt(l),hf(),t!==null&&yt(Su),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return rl(nt),null;case 25:return null;default:return null}}function Gy(t,l){switch(ki(l),l.tag){case 3:rl(nt),Nu();break;case 26:case 27:case 5:pa(l);break;case 4:Nu();break;case 31:l.memoizedState!==null&&qt(l);break;case 13:qt(l);break;case 19:yt(ut);break;case 10:rl(l.type);break;case 22:case 23:qt(l),hf(),t!==null&&yt(Su);break;case 24:rl(nt)}}function ta(t,l){try{var u=l.updateQueue,e=u!==null?u.lastEffect:null;if(e!==null){var a=e.next;u=a;do{if((u.tag&t)===t){e=void 0;var n=u.create,i=u.inst;e=n(),i.destroy=e}u=u.next}while(u!==a)}}catch(f){Z(l,l.return,f)}}function Ll(t,l,u){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){var i=e.inst,f=i.destroy;if(f!==void 0){i.destroy=void 0,a=l;var c=u,o=f;try{o()}catch(v){Z(a,c,v)}}}e=e.next}while(e!==n)}}catch(v){Z(l,l.return,v)}}function Vy(t){var l=t.updateQueue;if(l!==null){var u=t.stateNode;try{Ud(l,u)}catch(e){Z(t,t.return,e)}}}function Xy(t,l,u){u.props=Tu(t.type,t.memoizedProps),u.state=t.memoizedState;try{u.componentWillUnmount()}catch(e){Z(t,l,e)}}function la(t,l){try{var u=t.ref;if(u!==null){switch(t.tag){case 26:case 27:case 5:var e=t.stateNode;break;case 30:e=t.stateNode;break;default:e=t.stateNode}typeof u=="function"?t.refCleanup=u(e):u.current=e}}catch(a){Z(t,l,a)}}function nl(t,l){var u=t.ref,e=t.refCleanup;if(u!==null)if(typeof e=="function")try{e()}catch(a){Z(t,l,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(a){Z(t,l,a)}else u.current=null}function Qy(t){var l=t.type,u=t.memoizedProps,e=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&e.focus();break t;case"img":u.src?e.src=u.src:u.srcSet&&(e.srcset=u.srcSet)}}catch(a){Z(t,t.return,a)}}function Kf(t,l,u){try{var e=t.stateNode;kv(e,t.type,u,l),e[At]=l}catch(a){Z(t,t.return,a)}}function Zy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Fl(t.type)||t.tag===4}function Jf(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||Zy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Fl(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function wf(t,l,u){var e=t.tag;if(e===5||e===6)t=t.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(t,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(t),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=yl));else if(e!==4&&(e===27&&Fl(t.type)&&(u=t.stateNode,l=null),t=t.child,t!==null))for(wf(t,l,u),t=t.sibling;t!==null;)wf(t,l,u),t=t.sibling}function mn(t,l,u){var e=t.tag;if(e===5||e===6)t=t.stateNode,l?u.insertBefore(t,l):u.appendChild(t);else if(e!==4&&(e===27&&Fl(t.type)&&(u=t.stateNode),t=t.child,t!==null))for(mn(t,l,u),t=t.sibling;t!==null;)mn(t,l,u),t=t.sibling}function Ly(t){var l=t.stateNode,u=t.memoizedProps;try{for(var e=t.type,a=l.attributes;a.length;)l.removeAttributeNode(a[0]);bt(l,e,u),l[mt]=t,l[At]=u}catch(n){Z(t,t.return,n)}}var zl=!1,ct=!1,$f=!1,xy=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Hv(t,l){if(t=t.containerInfo,mc=qn,t=ud(t),Xi(t)){if("selectionStart"in t)var u={start:t.selectionStart,end:t.selectionEnd};else t:{u=(u=t.ownerDocument)&&u.defaultView||window;var e=u.getSelection&&u.getSelection();if(e&&e.rangeCount!==0){u=e.anchorNode;var a=e.anchorOffset,n=e.focusNode;e=e.focusOffset;try{u.nodeType,n.nodeType}catch{u=null;break t}var i=0,f=-1,c=-1,o=0,v=0,r=t,y=null;l:for(;;){for(var m;r!==u||a!==0&&r.nodeType!==3||(f=i+a),r!==n||e!==0&&r.nodeType!==3||(c=i+e),r.nodeType===3&&(i+=r.nodeValue.length),(m=r.firstChild)!==null;)y=r,r=m;for(;;){if(r===t)break l;if(y===u&&++o===a&&(f=i),y===n&&++v===e&&(c=i),(m=r.nextSibling)!==null)break;r=y,y=r.parentNode}r=m}u=f===-1||c===-1?null:{start:f,end:c}}else u=null}u=u||{start:0,end:0}}else u=null;for(rc={focusedElem:t,selectionRange:u},qn=!1,ht=l;ht!==null;)if(l=ht,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,ht=t;else for(;ht!==null;){switch(l=ht,n=l.alternate,t=l.flags,l.tag){case 0:if(t&4&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(u=0;u title"))),bt(n,e,u),n[mt]=t,ot(n),e=n;break t;case"link":var i=ko("link","href",a).get(e+(u.href||""));if(i){for(var f=0;fH&&(i=H,H=A,A=i);var d=td(f,A),s=td(f,H);if(d&&s&&(m.rangeCount!==1||m.anchorNode!==d.node||m.anchorOffset!==d.offset||m.focusNode!==s.node||m.focusOffset!==s.offset)){var h=r.createRange();h.setStart(d.node,d.offset),m.removeAllRanges(),A>H?(m.addRange(h),m.extend(s.node,s.offset)):(h.setEnd(s.node,s.offset),m.addRange(h))}}}}for(r=[],m=f;m=m.parentNode;)m.nodeType===1&&r.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fu?32:u,_.T=null,u=lc,lc=null;var n=wl,i=Ol;if(dt=0,se=wl=null,Ol=0,X&6)throw Error(g(331));var f=X;if(X|=4,lo(n.current),Iy(n,n.current,i,u),X=f,fa(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(_e,n)}catch{}return!0}finally{V.p=a,_.T=e,Eo(t,l)}}function To(t,l,u){l=Lt(u,l),l=Bf(t.stateNode,l,2),t=Xl(t,l,2),t!==null&&(Me(t,2),il(t))}function Z(t,l,u){if(t.tag===3)To(t,t,u);else for(;l!==null;){if(l.tag===3){To(l,t,u);break}else if(l.tag===1){var e=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof e.componentDidCatch=="function"&&(Jl===null||!Jl.has(e))){t=Lt(u,t),u=Ty(2),e=Xl(l,u,2),e!==null&&(Ay(u,e,l,t),Me(e,2),il(e));break}}l=l.return}}function nc(t,l,u){var e=t.pingCache;if(e===null){e=t.pingCache=new Cv;var a=new Set;e.set(l,a)}else a=e.get(l),a===void 0&&(a=new Set,e.set(l,a));a.has(u)||(kf=!0,a.add(u),t=Gv.bind(null,t,l,u),l.then(t,t))}function Gv(t,l,u){var e=t.pingCache;e!==null&&e.delete(l),t.pingedLanes|=t.suspendedLanes&u,t.warmLanes&=~u,K===t&&(q&u)===u&&(lt===4||lt===3&&(q&62914560)===q&&300>Ht()-gn?!(X&2)&&de(t,0):If|=u,ce===q&&(ce=0)),il(t)}function Ao(t,l){l===0&&(l=rs()),t=ou(t,l),t!==null&&(Me(t,l),il(t))}function Vv(t){var l=t.memoizedState,u=0;l!==null&&(u=l.retryLane),Ao(t,u)}function Xv(t,l){var u=0;switch(t.tag){case 31:case 13:var e=t.stateNode,a=t.memoizedState;a!==null&&(u=a.retryLane);break;case 19:e=t.stateNode;break;case 22:e=t.stateNode._retryCache;break;default:throw Error(g(314))}e!==null&&e.delete(l),Ao(t,u)}function Qv(t,l){return Si(t,l)}var _n=null,oe=null,ic=!1,On=!1,fc=!1,Wl=0;function il(t){t!==oe&&t.next===null&&(oe===null?_n=oe=t:oe=oe.next=t),On=!0,ic||(ic=!0,Lv())}function fa(t,l){if(!fc&&On){fc=!0;do for(var u=!1,e=_n;e!==null;){if(t!==0){var a=e.pendingLanes;if(a===0)var n=0;else{var i=e.suspendedLanes,f=e.pingedLanes;n=(1<<31-Nt(42|t)+1)-1,n&=a&~(i&~f),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(u=!0,Mo(e,n))}else n=q,n=Ua(e,e===K?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),!(n&3)||Oe(e,n)||(u=!0,Mo(e,n));e=e.next}while(u);fc=!1}}function Zv(){po()}function po(){On=ic=!1;var t=0;Wl!==0&&Pv()&&(t=Wl);for(var l=Ht(),u=null,e=_n;e!==null;){var a=e.next,n=_o(e,l);n===0?(e.next=null,u===null?_n=a:u.next=a,a===null&&(oe=u)):(u=e,(t!==0||n&3)&&(On=!0)),e=a}dt!==0&&dt!==5||fa(t),Wl!==0&&(Wl=0)}function _o(t,l){for(var u=t.suspendedLanes,e=t.pingedLanes,a=t.expirationTimes,n=t.pendingLanes&-62914561;0f)break;var v=c.transferSize,r=c.initiatorType;v&&Yo(r)&&(c=c.responseEnd,i+=v*(c"u"?null:document;function wo(t,l,u){var e=he;if(e&&typeof l=="string"&&l){var a=Qt(l);a='link[rel="'+t+'"][href="'+a+'"]',typeof u=="string"&&(a+='[crossorigin="'+u+'"]'),Jo.has(a)||(Jo.add(a),t={rel:t,crossOrigin:u,href:l},e.querySelector(a)===null&&(l=e.createElement("link"),bt(l,"link",t),ot(l),e.head.appendChild(l)))}}function cm(t){Ml.D(t),wo("dns-prefetch",t,null)}function sm(t,l){Ml.C(t,l),wo("preconnect",t,l)}function dm(t,l,u){Ml.L(t,l,u);var e=he;if(e&&t&&l){var a='link[rel="preload"][as="'+Qt(l)+'"]';l==="image"&&u&&u.imageSrcSet?(a+='[imagesrcset="'+Qt(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(a+='[imagesizes="'+Qt(u.imageSizes)+'"]')):a+='[href="'+Qt(t)+'"]';var n=a;switch(l){case"style":n=ve(t);break;case"script":n=me(t)}Wt.has(n)||(t=F({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:t,as:l},u),Wt.set(n,t),e.querySelector(a)!==null||l==="style"&&e.querySelector(ya(n))||l==="script"&&e.querySelector(oa(n))||(l=e.createElement("link"),bt(l,"link",t),ot(l),e.head.appendChild(l)))}}function ym(t,l){Ml.m(t,l);var u=he;if(u&&t){var e=l&&typeof l.as=="string"?l.as:"script",a='link[rel="modulepreload"][as="'+Qt(e)+'"][href="'+Qt(t)+'"]',n=a;switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=me(t)}if(!Wt.has(n)&&(t=F({rel:"modulepreload",href:t},l),Wt.set(n,t),u.querySelector(a)===null)){switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(oa(n)))return}e=u.createElement("link"),bt(e,"link",t),ot(e),u.head.appendChild(e)}}}function om(t,l,u){Ml.S(t,l,u);var e=he;if(e&&t){var a=qu(e).hoistableStyles,n=ve(t);l=l||"default";var i=a.get(n);if(!i){var f={loading:0,preload:null};if(i=e.querySelector(ya(n)))f.loading=5;else{t=F({rel:"stylesheet",href:t,"data-precedence":l},u),(u=Wt.get(n))&&Ac(t,u);var c=i=e.createElement("link");ot(c),bt(c,"link",t),c._p=new Promise(function(o,v){c.onload=o,c.onerror=v}),c.addEventListener("load",function(){f.loading|=1}),c.addEventListener("error",function(){f.loading|=2}),f.loading|=4,Rn(i,l,e)}i={type:"stylesheet",instance:i,count:1,state:f},a.set(n,i)}}}function hm(t,l){Ml.X(t,l);var u=he;if(u&&t){var e=qu(u).hoistableScripts,a=me(t),n=e.get(a);n||(n=u.querySelector(oa(a)),n||(t=F({src:t,async:!0},l),(l=Wt.get(a))&&pc(t,l),n=u.createElement("script"),ot(n),bt(n,"link",t),u.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},e.set(a,n))}}function vm(t,l){Ml.M(t,l);var u=he;if(u&&t){var e=qu(u).hoistableScripts,a=me(t),n=e.get(a);n||(n=u.querySelector(oa(a)),n||(t=F({src:t,async:!0,type:"module"},l),(l=Wt.get(a))&&pc(t,l),n=u.createElement("script"),ot(n),bt(n,"link",t),u.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},e.set(a,n))}}function $o(t,l,u,e){var a=(a=Hl.current)?Hn(a):null;if(!a)throw Error(g(446));switch(t){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=ve(u.href),u=qu(a).hoistableStyles,e=u.get(l),e||(e={type:"style",instance:null,count:0,state:null},u.set(l,e)),e):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){t=ve(u.href);var n=qu(a).hoistableStyles,i=n.get(t);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(t,i),(n=a.querySelector(ya(t)))&&!n._p&&(i.instance=n,i.state.loading=5),Wt.has(t)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Wt.set(t,u),n||mm(a,t,u,i.state))),l&&e===null)throw Error(g(528,""));return i}if(l&&e!==null)throw Error(g(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=me(u),u=qu(a).hoistableScripts,e=u.get(l),e||(e={type:"script",instance:null,count:0,state:null},u.set(l,e)),e):{type:"void",instance:null,count:0,state:null};default:throw Error(g(444,t))}}function ve(t){return'href="'+Qt(t)+'"'}function ya(t){return'link[rel="stylesheet"]['+t+"]"}function Wo(t){return F({},t,{"data-precedence":t.precedence,precedence:null})}function mm(t,l,u,e){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?e.loading=1:(l=t.createElement("link"),e.preload=l,l.addEventListener("load",function(){return e.loading|=1}),l.addEventListener("error",function(){return e.loading|=2}),bt(l,"link",u),ot(l),t.head.appendChild(l))}function me(t){return'[src="'+Qt(t)+'"]'}function oa(t){return"script[async]"+t}function Fo(t,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var e=t.querySelector('style[data-href~="'+Qt(u.href)+'"]');if(e)return l.instance=e,ot(e),e;var a=F({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return e=(t.ownerDocument||t).createElement("style"),ot(e),bt(e,"style",a),Rn(e,u.precedence,t),l.instance=e;case"stylesheet":a=ve(u.href);var n=t.querySelector(ya(a));if(n)return l.state.loading|=4,l.instance=n,ot(n),n;e=Wo(u),(a=Wt.get(a))&&Ac(e,a),n=(t.ownerDocument||t).createElement("link"),ot(n);var i=n;return i._p=new Promise(function(f,c){i.onload=f,i.onerror=c}),bt(n,"link",e),l.state.loading|=4,Rn(n,u.precedence,t),l.instance=n;case"script":return n=me(u.src),(a=t.querySelector(oa(n)))?(l.instance=a,ot(a),a):(e=u,(a=Wt.get(n))&&(e=F({},u),pc(e,a)),t=t.ownerDocument||t,a=t.createElement("script"),ot(a),bt(a,"link",e),t.head.appendChild(a),l.instance=a);case"void":return null;default:throw Error(g(443,l.type))}else l.type==="stylesheet"&&!(l.state.loading&4)&&(e=l.instance,l.state.loading|=4,Rn(e,u.precedence,t));return l.instance}function Rn(t,l,u){for(var e=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=e.length?e[e.length-1]:null,n=a,i=0;i title"):null)}function rm(t,l,u){if(u===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Po(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function Sm(t,l,u,e){if(u.type==="stylesheet"&&(typeof e.media!="string"||matchMedia(e.media).matches!==!1)&&!(u.state.loading&4)){if(u.instance===null){var a=ve(e.href),n=l.querySelector(ya(a));if(n){l=n._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Cn.bind(t),l.then(t,t)),u.state.loading|=4,u.instance=n,ot(n);return}n=l.ownerDocument||l,e=Wo(e),(a=Wt.get(a))&&Ac(e,a),n=n.createElement("link"),ot(n);var i=n;i._p=new Promise(function(f,c){i.onload=f,i.onerror=c}),bt(n,"link",e),u.instance=n}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(u,l),(l=u.state.preload)&&!(u.state.loading&3)&&(t.count++,u=Cn.bind(t),l.addEventListener("load",u),l.addEventListener("error",u))}}var _c=0;function gm(t,l){return t.stylesheets&&t.count===0&&Yn(t,t.stylesheets),0_c?50:800)+l);return t.unsuspend=u,function(){t.unsuspend=null,clearTimeout(e),clearTimeout(a)}}:null}function Cn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yn(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bn=null;function Yn(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bn=new Map,l.forEach(bm,t),Bn=null,Cn.call(t))}function bm(t,l){if(!(l.state.loading&4)){var u=Bn.get(t);if(u)var e=u.get(null);else{u=new Map,Bn.set(t,u);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(t){console.error(t)}}h0(),Fc.exports=ba;var Nc=Fc.exports;const Mm=eu({__proto__:null,default:tl(Nc)},[Nc]);var v0={exports:{}},Ln={};/** +`+e.stack}}var ri=Object.prototype.hasOwnProperty,Si=st.unstable_scheduleCallback,gi=st.unstable_cancelCallback,fh=st.unstable_shouldYield,ch=st.unstable_requestPaint,Ht=st.unstable_now,sh=st.unstable_getCurrentPriorityLevel,hs=st.unstable_ImmediatePriority,vs=st.unstable_UserBlockingPriority,Oa=st.unstable_NormalPriority,oh=st.unstable_LowPriority,ms=st.unstable_IdlePriority,dh=st.log,yh=st.unstable_setDisableYieldValue,Oe=null,Rt=null;function Rl(t){if(typeof dh=="function"&&yh(t),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(Oe,t)}catch{}}var Nt=Math.clz32?Math.clz32:mh,hh=Math.log,vh=Math.LN2;function mh(t){return t>>>=0,t===0?32:31-(hh(t)/vh|0)|0}var _a=256,Ma=262144,Da=4194304;function fu(t){var l=t&42;if(l!==0)return l;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ua(t,l,u){var e=t.pendingLanes;if(e===0)return 0;var a=0,n=t.suspendedLanes,i=t.pingedLanes;t=t.warmLanes;var f=e&134217727;return f!==0?(e=f&~n,e!==0?a=fu(e):(i&=f,i!==0?a=fu(i):u||(u=f&~t,u!==0&&(a=fu(u))))):(f=e&~n,f!==0?a=fu(f):i!==0?a=fu(i):u||(u=e&~t,u!==0&&(a=fu(u)))),a===0?0:l!==0&&l!==a&&!(l&n)&&(n=a&-a,u=l&-l,n>=u||n===32&&(u&4194048)!==0)?l:a}function _e(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function rh(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 rs(){var t=Da;return Da<<=1,!(Da&62914560)&&(Da=4194304),t}function bi(t){for(var l=[],u=0;31>u;u++)l.push(t);return l}function Me(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Sh(t,l,u,e,a,n){var i=t.pendingLanes;t.pendingLanes=u,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=u,t.entangledLanes&=u,t.errorRecoveryDisabledLanes&=u,t.shellSuspendCounter=0;var f=t.entanglements,c=t.expirationTimes,y=t.hiddenUpdates;for(u=i&~u;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ah=/[\n"\\]/g;function Qt(t){return t.replace(Ah,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Oi(t,l,u,e,a,n,i,f){t.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?t.type=i:t.removeAttribute("type"),l!=null?i==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+Xt(l)):t.value!==""+Xt(l)&&(t.value=""+Xt(l)):i!=="submit"&&i!=="reset"||t.removeAttribute("value"),l!=null?_i(t,i,Xt(l)):u!=null?_i(t,i,Xt(u)):e!=null&&t.removeAttribute("value"),a==null&&n!=null&&(t.defaultChecked=!!n),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+Xt(f):t.removeAttribute("name")}function Us(t,l,u,e,a,n,i,f){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(t.type=n),l!=null||u!=null){if(!(n!=="submit"&&n!=="reset"||l!=null)){pi(t);return}u=u!=null?""+Xt(u):"",l=l!=null?""+Xt(l):u,f||l===t.value||(t.value=l),t.defaultValue=l}e=e??a,e=typeof e!="function"&&typeof e!="symbol"&&!!e,t.checked=f?t.checked:!!e,t.defaultChecked=!!e,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.name=i),pi(t)}function _i(t,l,u){l==="number"&&Na(t.ownerDocument)===t||t.defaultValue===""+u||(t.defaultValue=""+u)}function ju(t,l,u,e){if(t=t.options,l){l={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ri=!1;if(yl)try{var Re={};Object.defineProperty(Re,"passive",{get:function(){Ri=!0}}),window.addEventListener("test",Re,Re),window.removeEventListener("test",Re,Re)}catch{Ri=!1}var Cl=null,Ni=null,Ba=null;function qs(){if(Ba)return Ba;var t,l=Ni,u=l.length,e,a="value"in Cl?Cl.value:Cl.textContent,n=a.length;for(t=0;t=Be),Zs=" ",xs=!1;function Ls(t,l){switch(t){case"keyup":return kh.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ks(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zu=!1;function Ph(t,l){switch(t){case"compositionend":return Ks(l);case"keypress":return l.which!==32?null:(xs=!0,Zs);case"textInput":return t=l.data,t===Zs&&xs?null:t;default:return null}}function tv(t,l){if(Zu)return t==="compositionend"||!Vi&&Ls(t,l)?(t=qs(),Ba=Ni=Cl=null,Zu=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:u,offset:l-t};t=e}t:{for(;u;){if(u.nextSibling){u=u.nextSibling;break t}u=u.parentNode}u=void 0}u=Ps(u)}}function lo(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?lo(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function uo(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Na(t.document);l instanceof t.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)t=l.contentWindow;else break;l=Na(t.document)}return l}function Xi(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var cv=yl&&"documentMode"in document&&11>=document.documentMode,xu=null,Qi=null,je=null,Zi=!1;function eo(t,l,u){var e=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Zi||xu==null||xu!==Na(e)||(e=xu,"selectionStart"in e&&Xi(e)?e={start:e.selectionStart,end:e.selectionEnd}:(e=(e.ownerDocument&&e.ownerDocument.defaultView||window).getSelection(),e={anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset}),je&&Ve(je,e)||(je=e,e=Dn(Qi,"onSelect"),0>=i,a-=i,el=1<<32-Nt(l)+a|u<p?(M=z,z=null):M=z.sibling;var R=d(o,z,h[p],S);if(R===null){z===null&&(z=M);break}t&&z&&R.alternate===null&&l(o,z),s=n(R,s,p),_===null?E=R:_.sibling=R,_=R,z=M}if(p===h.length)return u(o,z),V&&vl(o,p),E;if(z===null){for(;pp?(M=z,z=null):M=z.sibling;var Ft=d(o,z,R.value,S);if(Ft===null){z===null&&(z=M);break}t&&z&&Ft.alternate===null&&l(o,z),s=n(Ft,s,p),_===null?E=Ft:_.sibling=Ft,_=Ft,z=M}if(R.done)return u(o,z),V&&vl(o,p),E;if(z===null){for(;!R.done;p++,R=h.next())R=r(o,R.value,S),R!==null&&(s=n(R,s,p),_===null?E=R:_.sibling=R,_=R);return V&&vl(o,p),E}for(z=e(z);!R.done;p++,R=h.next())R=m(z,o,p,R.value,S),R!==null&&(t&&R.alternate!==null&&z.delete(R.key===null?p:R.key),s=n(R,s,p),_===null?E=R:_.sibling=R,_=R);return t&&z.forEach(function(uu){return l(o,uu)}),V&&vl(o,p),E}function H(o,s,h,S){if(typeof h=="object"&&h!==null&&h.type===Hu&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case za:t:{for(var E=h.key;s!==null;){if(s.key===E){if(E=h.type,E===Hu){if(s.tag===7){u(o,s.sibling),S=a(s,h.props.children),S.return=o,o=S;break t}}else if(s.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ul&&gu(E)===s.type){u(o,s.sibling),S=a(s,h.props),Le(S,h),S.return=o,o=S;break t}u(o,s);break}else l(o,s);s=s.sibling}h.type===Hu?(S=hu(h.props.children,o.mode,S,h.key),S.return=o,o=S):(S=La(h.type,h.key,h.props,null,o.mode,S),Le(S,h),S.return=o,o=S)}return i(o);case ze:t:{for(E=h.key;s!==null;){if(s.key===E)if(s.tag===4&&s.stateNode.containerInfo===h.containerInfo&&s.stateNode.implementation===h.implementation){u(o,s.sibling),S=a(s,h.children||[]),S.return=o,o=S;break t}else{u(o,s);break}else l(o,s);s=s.sibling}S=Wi(h,o.mode,S),S.return=o,o=S}return i(o);case Ul:return h=gu(h),H(o,s,h,S)}if(Ae(h))return b(o,s,h,S);if(Te(h)){if(E=Te(h),typeof E!="function")throw Error(g(150));return h=E.call(h),A(o,s,h,S)}if(typeof h.then=="function")return H(o,s,ka(h),S);if(h.$$typeof===sl)return H(o,s,wa(o,h),S);Ia(o,h)}return typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint"?(h=""+h,s!==null&&s.tag===6?(u(o,s.sibling),S=a(s,h),S.return=o,o=S):(u(o,s),S=$i(h,o.mode,S),S.return=o,o=S),i(o)):u(o,s)}return function(o,s,h,S){try{xe=0;var E=H(o,s,h,S);return te=null,E}catch(z){if(z===Pu||z===Wa)throw z;var _=Bt(29,z,null,o.mode);return _.lanes=S,_.return=o,_}finally{}}}var Eu=Mo(!0),Do=Mo(!1),jl=!1;function cf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Gl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xl(t,l,u){var e=t.updateQueue;if(e===null)return null;if(e=e.shared,X&2){var a=e.pending;return a===null?l.next=l:(l.next=a.next,a.next=l),e.pending=l,l=xa(t),oo(t,null,u),l}return Za(t,e,l,u),xa(t)}function Ke(t,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var e=l.lanes;e&=t.pendingLanes,u|=e,l.lanes=u,gs(t,u)}}function of(t,l){var u=t.updateQueue,e=t.alternate;if(e!==null&&(e=e.updateQueue,u===e)){var a=null,n=null;if(u=u.firstBaseUpdate,u!==null){do{var i={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};n===null?a=n=i:n=n.next=i,u=u.next}while(u!==null);n===null?a=n=l:n=n.next=l}else a=n=l;u={baseState:e.baseState,firstBaseUpdate:a,lastBaseUpdate:n,shared:e.shared,callbacks:e.callbacks},t.updateQueue=u;return}t=u.lastBaseUpdate,t===null?u.firstBaseUpdate=l:t.next=l,u.lastBaseUpdate=l}var df=!1;function Je(){if(df){var t=Iu;if(t!==null)throw t}}function we(t,l,u,e){df=!1;var a=t.updateQueue;jl=!1;var n=a.firstBaseUpdate,i=a.lastBaseUpdate,f=a.shared.pending;if(f!==null){a.shared.pending=null;var c=f,y=c.next;c.next=null,i===null?n=y:i.next=y,i=c;var v=t.alternate;v!==null&&(v=v.updateQueue,f=v.lastBaseUpdate,f!==i&&(f===null?v.firstBaseUpdate=y:f.next=y,v.lastBaseUpdate=c))}if(n!==null){var r=a.baseState;i=0,v=y=c=null,f=n;do{var d=f.lane&-536870913,m=d!==f.lane;if(m?(q&d)===d:(e&d)===d){d!==0&&d===ku&&(df=!0),v!==null&&(v=v.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var b=t,A=f;d=l;var H=u;switch(A.tag){case 1:if(b=A.payload,typeof b=="function"){r=b.call(H,r,d);break t}r=b;break t;case 3:b.flags=b.flags&-65537|128;case 0:if(b=A.payload,d=typeof b=="function"?b.call(H,r,d):b,d==null)break t;r=F({},r,d);break t;case 2:jl=!0}}d=f.callback,d!==null&&(t.flags|=64,m&&(t.flags|=8192),m=a.callbacks,m===null?a.callbacks=[d]:m.push(d))}else m={lane:d,tag:f.tag,payload:f.payload,callback:f.callback,next:null},v===null?(y=v=m,c=r):v=v.next=m,i|=d;if(f=f.next,f===null){if(f=a.shared.pending,f===null)break;m=f,f=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);v===null&&(c=r),a.baseState=c,a.firstBaseUpdate=y,a.lastBaseUpdate=v,n===null&&(a.shared.lanes=0),Kl|=i,t.lanes=i,t.memoizedState=r}}function Uo(t,l){if(typeof t!="function")throw Error(g(191,t));t.call(l)}function Ho(t,l){var u=t.callbacks;if(u!==null)for(t.callbacks=null,t=0;tn?n:8;var i=O.T,f={};O.T=f,Hf(t,!1,l,u);try{var c=a(),y=O.S;if(y!==null&&y(f,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var v=Sv(c,e);Fe(t,l,v,Gt(t))}else Fe(t,l,e,Gt(t))}catch(r){Fe(t,l,{then:function(){},status:"rejected",reason:r},Gt())}finally{G.p=n,i!==null&&f.types!==null&&(i.types=f.types),O.T=i}}function Av(){}function Df(t,l,u,e){if(t.tag!==5)throw Error(g(476));var a=cd(t).queue;fd(t,a,l,nu,u===null?Av:function(){return sd(t),u(e)})}function cd(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:nu,baseState:nu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:nu},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:u},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function sd(t){var l=cd(t);l.next===null&&(l=t.alternate.memoizedState),Fe(t,l.next.queue,{},Gt())}function Uf(){return St(ha)}function od(){return et().memoizedState}function dd(){return et().memoizedState}function pv(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var u=Gt();t=Gl(u);var e=Xl(l,t,u);e!==null&&(Ut(e,l,u),Ke(e,l,u)),l={cache:ef()},t.payload=l;return}l=l.return}}function Ov(t,l,u){var e=Gt();u={lane:e,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},sn(t)?hd(l,u):(u=Ji(t,l,u,e),u!==null&&(Ut(u,t,e),vd(u,l,e)))}function yd(t,l,u){var e=Gt();Fe(t,l,u,e)}function Fe(t,l,u,e){var a={lane:e,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(sn(t))hd(l,a);else{var n=t.alternate;if(t.lanes===0&&(n===null||n.lanes===0)&&(n=l.lastRenderedReducer,n!==null))try{var i=l.lastRenderedState,f=n(i,u);if(a.hasEagerState=!0,a.eagerState=f,Ct(f,i))return Za(t,l,a,0),K===null&&Qa(),!1}catch{}finally{}if(u=Ji(t,l,a,e),u!==null)return Ut(u,t,e),vd(u,l,e),!0}return!1}function Hf(t,l,u,e){if(e={lane:2,revertLane:cc(),gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},sn(t)){if(l)throw Error(g(479))}else l=Ji(t,u,e,2),l!==null&&Ut(l,t,2)}function sn(t){var l=t.alternate;return t===U||l!==null&&l===U}function hd(t,l){ue=ln=!0;var u=t.pending;u===null?l.next=l:(l.next=u.next,u.next=l),t.pending=l}function vd(t,l,u){if(u&4194048){var e=l.lanes;e&=t.pendingLanes,u|=e,l.lanes=u,gs(t,u)}}var ke={readContext:St,use:an,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};ke.useEffectEvent=tt;var md={readContext:St,use:an,useCallback:function(t,l){return Tt().memoizedState=[t,l===void 0?null:l],t},useContext:St,useEffect:Io,useImperativeHandle:function(t,l,u){u=u!=null?u.concat([t]):null,fn(4194308,4,ud.bind(null,l,t),u)},useLayoutEffect:function(t,l){return fn(4194308,4,t,l)},useInsertionEffect:function(t,l){fn(4,2,t,l)},useMemo:function(t,l){var u=Tt();l=l===void 0?null:l;var e=t();if(zu){Rl(!0);try{t()}finally{Rl(!1)}}return u.memoizedState=[e,l],e},useReducer:function(t,l,u){var e=Tt();if(u!==void 0){var a=u(l);if(zu){Rl(!0);try{u(l)}finally{Rl(!1)}}}else a=l;return e.memoizedState=e.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},e.queue=t,t=t.dispatch=Ov.bind(null,U,t),[e.memoizedState,t]},useRef:function(t){var l=Tt();return t={current:t},l.memoizedState=t},useState:function(t){t=Af(t);var l=t.queue,u=yd.bind(null,U,l);return l.dispatch=u,[t.memoizedState,u]},useDebugValue:_f,useDeferredValue:function(t,l){var u=Tt();return Mf(u,t,l)},useTransition:function(){var t=Af(!1);return t=fd.bind(null,U,t.queue,!0,!1),Tt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,u){var e=U,a=Tt();if(V){if(u===void 0)throw Error(g(407));u=u()}else{if(u=l(),K===null)throw Error(g(349));q&127||qo(e,l,u)}a.memoizedState=u;var n={value:u,getSnapshot:l};return a.queue=n,Io(jo.bind(null,e,n,t),[t]),e.flags|=2048,ae(9,{destroy:void 0},Vo.bind(null,e,n,u,l),null),u},useId:function(){var t=Tt(),l=K.identifierPrefix;if(V){var u=al,e=el;u=(e&~(1<<32-Nt(e)-1)).toString(32)+u,l="_"+l+"R_"+u,u=un++,0<\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof e.is=="string"?i.createElement("select",{is:e.is}):i.createElement("select"),e.multiple?n.multiple=!0:e.size&&(n.size=e.size);break;default:n=typeof e.is=="string"?i.createElement(a,{is:e.is}):i.createElement(a)}}n[mt]=l,n[At]=e;t:for(i=l.child;i!==null;){if(i.tag===5||i.tag===6)n.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break t;for(;i.sibling===null;){if(i.return===null||i.return===l)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}l.stateNode=n;t:switch(bt(n,a,e),a){case"button":case"input":case"select":case"textarea":e=!!e.autoFocus;break t;case"img":e=!0;break t;default:e=!1}e&&El(l)}}return I(l),Lf(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,u),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==e&&El(l);else{if(typeof e!="string"&&l.stateNode===null)throw Error(g(166));if(t=Hl.current,Wu(l)){if(t=l.stateNode,u=l.memoizedProps,e=null,a=rt,a!==null)switch(a.tag){case 27:case 5:e=a.memoizedProps}t[mt]=l,t=!!(t.nodeValue===u||e!==null&&e.suppressHydrationWarning===!0||By(t.nodeValue,u)),t||ql(l,!0)}else t=Un(t).createTextNode(e),t[mt]=l,l.stateNode=t}return I(l),null;case 31:if(u=l.memoizedState,t===null||t.memoizedState!==null){if(e=Wu(l),u!==null){if(t===null){if(!e)throw Error(g(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(g(557));t[mt]=l}else vu(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;I(l),t=!1}else u=Pi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),t=!0;if(!t)return l.flags&256?(qt(l),l):(qt(l),null);if(l.flags&128)throw Error(g(558))}return I(l),null;case 13:if(e=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Wu(l),e!==null&&e.dehydrated!==null){if(t===null){if(!a)throw Error(g(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(g(317));a[mt]=l}else vu(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;I(l),a=!1}else a=Pi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return l.flags&256?(qt(l),l):(qt(l),null)}return qt(l),l.flags&128?(l.lanes=u,l):(u=e!==null,t=t!==null&&t.memoizedState!==null,u&&(e=l.child,a=null,e.alternate!==null&&e.alternate.memoizedState!==null&&e.alternate.memoizedState.cachePool!==null&&(a=e.alternate.memoizedState.cachePool.pool),n=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),n!==a&&(e.flags|=2048)),u!==t&&u&&(l.child.flags|=8192),vn(l,l.updateQueue),I(l),null);case 4:return Nu(),t===null&&yc(l.stateNode.containerInfo),I(l),null;case 10:return rl(l.type),I(l),null;case 19:if(dt(ut),e=l.memoizedState,e===null)return I(l),null;if(a=(l.flags&128)!==0,n=e.rendering,n===null)if(a)Pe(e,!1);else{if(lt!==0||t!==null&&t.flags&128)for(t=l.child;t!==null;){if(n=tn(t),n!==null){for(l.flags|=128,Pe(e,!1),t=n.updateQueue,l.updateQueue=t,vn(l,t),l.subtreeFlags=0,t=u,u=l.child;u!==null;)yo(u,t),u=u.sibling;return w(ut,ut.current&1|2),V&&vl(l,e.treeForkCount),l.child}t=t.sibling}e.tail!==null&&Ht()>bn&&(l.flags|=128,a=!0,Pe(e,!1),l.lanes=4194304)}else{if(!a)if(t=tn(n),t!==null){if(l.flags|=128,a=!0,t=t.updateQueue,l.updateQueue=t,vn(l,t),Pe(e,!0),e.tail===null&&e.tailMode==="hidden"&&!n.alternate&&!V)return I(l),null}else 2*Ht()-e.renderingStartTime>bn&&u!==536870912&&(l.flags|=128,a=!0,Pe(e,!1),l.lanes=4194304);e.isBackwards?(n.sibling=l.child,l.child=n):(t=e.last,t!==null?t.sibling=n:l.child=n,e.last=n)}return e.tail!==null?(t=e.tail,e.rendering=t,e.tail=t.sibling,e.renderingStartTime=Ht(),t.sibling=null,u=ut.current,w(ut,a?u&1|2:u&1),V&&vl(l,e.treeForkCount),t):(I(l),null);case 22:case 23:return qt(l),hf(),e=l.memoizedState!==null,t!==null?t.memoizedState!==null!==e&&(l.flags|=8192):e&&(l.flags|=8192),e?u&536870912&&!(l.flags&128)&&(I(l),l.subtreeFlags&6&&(l.flags|=8192)):I(l),u=l.updateQueue,u!==null&&vn(l,u.retryQueue),u=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(u=t.memoizedState.cachePool.pool),e=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(e=l.memoizedState.cachePool.pool),e!==u&&(l.flags|=2048),t!==null&&dt(Su),null;case 24:return u=null,t!==null&&(u=t.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),rl(nt),I(l),null;case 25:return null;case 30:return null}throw Error(g(156,l.tag))}function Hv(t,l){switch(ki(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return rl(nt),Nu(),t=l.flags,t&65536&&!(t&128)?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return pa(l),null;case 31:if(l.memoizedState!==null){if(qt(l),l.alternate===null)throw Error(g(340));vu()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(qt(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(g(340));vu()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return dt(ut),null;case 4:return Nu(),null;case 10:return rl(l.type),null;case 22:case 23:return qt(l),hf(),t!==null&&dt(Su),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return rl(nt),null;case 25:return null;default:return null}}function Gd(t,l){switch(ki(l),l.tag){case 3:rl(nt),Nu();break;case 26:case 27:case 5:pa(l);break;case 4:Nu();break;case 31:l.memoizedState!==null&&qt(l);break;case 13:qt(l);break;case 19:dt(ut);break;case 10:rl(l.type);break;case 22:case 23:qt(l),hf(),t!==null&&dt(Su);break;case 24:rl(nt)}}function ta(t,l){try{var u=l.updateQueue,e=u!==null?u.lastEffect:null;if(e!==null){var a=e.next;u=a;do{if((u.tag&t)===t){e=void 0;var n=u.create,i=u.inst;e=n(),i.destroy=e}u=u.next}while(u!==a)}}catch(f){Z(l,l.return,f)}}function xl(t,l,u){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){var i=e.inst,f=i.destroy;if(f!==void 0){i.destroy=void 0,a=l;var c=u,y=f;try{y()}catch(v){Z(a,c,v)}}}e=e.next}while(e!==n)}}catch(v){Z(l,l.return,v)}}function Xd(t){var l=t.updateQueue;if(l!==null){var u=t.stateNode;try{Ho(l,u)}catch(e){Z(t,t.return,e)}}}function Qd(t,l,u){u.props=Tu(t.type,t.memoizedProps),u.state=t.memoizedState;try{u.componentWillUnmount()}catch(e){Z(t,l,e)}}function la(t,l){try{var u=t.ref;if(u!==null){switch(t.tag){case 26:case 27:case 5:var e=t.stateNode;break;case 30:e=t.stateNode;break;default:e=t.stateNode}typeof u=="function"?t.refCleanup=u(e):u.current=e}}catch(a){Z(t,l,a)}}function nl(t,l){var u=t.ref,e=t.refCleanup;if(u!==null)if(typeof e=="function")try{e()}catch(a){Z(t,l,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(a){Z(t,l,a)}else u.current=null}function Zd(t){var l=t.type,u=t.memoizedProps,e=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&e.focus();break t;case"img":u.src?e.src=u.src:u.srcSet&&(e.srcset=u.srcSet)}}catch(a){Z(t,t.return,a)}}function Kf(t,l,u){try{var e=t.stateNode;Iv(e,t.type,u,l),e[At]=l}catch(a){Z(t,t.return,a)}}function xd(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Fl(t.type)||t.tag===4}function Jf(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||xd(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Fl(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function wf(t,l,u){var e=t.tag;if(e===5||e===6)t=t.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(t,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(t),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=dl));else if(e!==4&&(e===27&&Fl(t.type)&&(u=t.stateNode,l=null),t=t.child,t!==null))for(wf(t,l,u),t=t.sibling;t!==null;)wf(t,l,u),t=t.sibling}function mn(t,l,u){var e=t.tag;if(e===5||e===6)t=t.stateNode,l?u.insertBefore(t,l):u.appendChild(t);else if(e!==4&&(e===27&&Fl(t.type)&&(u=t.stateNode),t=t.child,t!==null))for(mn(t,l,u),t=t.sibling;t!==null;)mn(t,l,u),t=t.sibling}function Ld(t){var l=t.stateNode,u=t.memoizedProps;try{for(var e=t.type,a=l.attributes;a.length;)l.removeAttributeNode(a[0]);bt(l,e,u),l[mt]=t,l[At]=u}catch(n){Z(t,t.return,n)}}var zl=!1,ct=!1,$f=!1,Kd=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Rv(t,l){if(t=t.containerInfo,mc=qn,t=uo(t),Xi(t)){if("selectionStart"in t)var u={start:t.selectionStart,end:t.selectionEnd};else t:{u=(u=t.ownerDocument)&&u.defaultView||window;var e=u.getSelection&&u.getSelection();if(e&&e.rangeCount!==0){u=e.anchorNode;var a=e.anchorOffset,n=e.focusNode;e=e.focusOffset;try{u.nodeType,n.nodeType}catch{u=null;break t}var i=0,f=-1,c=-1,y=0,v=0,r=t,d=null;l:for(;;){for(var m;r!==u||a!==0&&r.nodeType!==3||(f=i+a),r!==n||e!==0&&r.nodeType!==3||(c=i+e),r.nodeType===3&&(i+=r.nodeValue.length),(m=r.firstChild)!==null;)d=r,r=m;for(;;){if(r===t)break l;if(d===u&&++y===a&&(f=i),d===n&&++v===e&&(c=i),(m=r.nextSibling)!==null)break;r=d,d=r.parentNode}r=m}u=f===-1||c===-1?null:{start:f,end:c}}else u=null}u=u||{start:0,end:0}}else u=null;for(rc={focusedElem:t,selectionRange:u},qn=!1,ht=l;ht!==null;)if(l=ht,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,ht=t;else for(;ht!==null;){switch(l=ht,n=l.alternate,t=l.flags,l.tag){case 0:if(t&4&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(u=0;u title"))),bt(n,e,u),n[mt]=t,yt(n),e=n;break t;case"link":var i=ky("link","href",a).get(e+(u.href||""));if(i){for(var f=0;fH&&(i=H,H=A,A=i);var o=to(f,A),s=to(f,H);if(o&&s&&(m.rangeCount!==1||m.anchorNode!==o.node||m.anchorOffset!==o.offset||m.focusNode!==s.node||m.focusOffset!==s.offset)){var h=r.createRange();h.setStart(o.node,o.offset),m.removeAllRanges(),A>H?(m.addRange(h),m.extend(s.node,s.offset)):(h.setEnd(s.node,s.offset),m.addRange(h))}}}}for(r=[],m=f;m=m.parentNode;)m.nodeType===1&&r.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fu?32:u,O.T=null,u=lc,lc=null;var n=wl,i=_l;if(ot=0,se=wl=null,_l=0,X&6)throw Error(g(331));var f=X;if(X|=4,uy(n.current),Pd(n,n.current,i,u),X=f,fa(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(Oe,n)}catch{}return!0}finally{G.p=a,O.T=e,Ey(t,l)}}function Ty(t,l,u){l=xt(u,l),l=Bf(t.stateNode,l,2),t=Xl(t,l,2),t!==null&&(Me(t,2),il(t))}function Z(t,l,u){if(t.tag===3)Ty(t,t,u);else for(;l!==null;){if(l.tag===3){Ty(l,t,u);break}else if(l.tag===1){var e=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof e.componentDidCatch=="function"&&(Jl===null||!Jl.has(e))){t=xt(u,t),u=Ad(2),e=Xl(l,u,2),e!==null&&(pd(u,e,l,t),Me(e,2),il(e));break}}l=l.return}}function nc(t,l,u){var e=t.pingCache;if(e===null){e=t.pingCache=new Bv;var a=new Set;e.set(l,a)}else a=e.get(l),a===void 0&&(a=new Set,e.set(l,a));a.has(u)||(kf=!0,a.add(u),t=Gv.bind(null,t,l,u),l.then(t,t))}function Gv(t,l,u){var e=t.pingCache;e!==null&&e.delete(l),t.pingedLanes|=t.suspendedLanes&u,t.warmLanes&=~u,K===t&&(q&u)===u&&(lt===4||lt===3&&(q&62914560)===q&&300>Ht()-gn?!(X&2)&&oe(t,0):If|=u,ce===q&&(ce=0)),il(t)}function Ay(t,l){l===0&&(l=rs()),t=yu(t,l),t!==null&&(Me(t,l),il(t))}function Xv(t){var l=t.memoizedState,u=0;l!==null&&(u=l.retryLane),Ay(t,u)}function Qv(t,l){var u=0;switch(t.tag){case 31:case 13:var e=t.stateNode,a=t.memoizedState;a!==null&&(u=a.retryLane);break;case 19:e=t.stateNode;break;case 22:e=t.stateNode._retryCache;break;default:throw Error(g(314))}e!==null&&e.delete(l),Ay(t,u)}function Zv(t,l){return Si(t,l)}var On=null,ye=null,ic=!1,_n=!1,fc=!1,Wl=0;function il(t){t!==ye&&t.next===null&&(ye===null?On=ye=t:ye=ye.next=t),_n=!0,ic||(ic=!0,Lv())}function fa(t,l){if(!fc&&_n){fc=!0;do for(var u=!1,e=On;e!==null;){if(t!==0){var a=e.pendingLanes;if(a===0)var n=0;else{var i=e.suspendedLanes,f=e.pingedLanes;n=(1<<31-Nt(42|t)+1)-1,n&=a&~(i&~f),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(u=!0,My(e,n))}else n=q,n=Ua(e,e===K?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),!(n&3)||_e(e,n)||(u=!0,My(e,n));e=e.next}while(u);fc=!1}}function xv(){py()}function py(){_n=ic=!1;var t=0;Wl!==0&&tm()&&(t=Wl);for(var l=Ht(),u=null,e=On;e!==null;){var a=e.next,n=Oy(e,l);n===0?(e.next=null,u===null?On=a:u.next=a,a===null&&(ye=u)):(u=e,(t!==0||n&3)&&(_n=!0)),e=a}ot!==0&&ot!==5||fa(t),Wl!==0&&(Wl=0)}function Oy(t,l){for(var u=t.suspendedLanes,e=t.pingedLanes,a=t.expirationTimes,n=t.pendingLanes&-62914561;0f)break;var v=c.transferSize,r=c.initiatorType;v&&Yy(r)&&(c=c.responseEnd,i+=v*(c"u"?null:document;function wy(t,l,u){var e=he;if(e&&typeof l=="string"&&l){var a=Qt(l);a='link[rel="'+t+'"][href="'+a+'"]',typeof u=="string"&&(a+='[crossorigin="'+u+'"]'),Jy.has(a)||(Jy.add(a),t={rel:t,crossOrigin:u,href:l},e.querySelector(a)===null&&(l=e.createElement("link"),bt(l,"link",t),yt(l),e.head.appendChild(l)))}}function sm(t){Ml.D(t),wy("dns-prefetch",t,null)}function om(t,l){Ml.C(t,l),wy("preconnect",t,l)}function dm(t,l,u){Ml.L(t,l,u);var e=he;if(e&&t&&l){var a='link[rel="preload"][as="'+Qt(l)+'"]';l==="image"&&u&&u.imageSrcSet?(a+='[imagesrcset="'+Qt(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(a+='[imagesizes="'+Qt(u.imageSizes)+'"]')):a+='[href="'+Qt(t)+'"]';var n=a;switch(l){case"style":n=ve(t);break;case"script":n=me(t)}Wt.has(n)||(t=F({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:t,as:l},u),Wt.set(n,t),e.querySelector(a)!==null||l==="style"&&e.querySelector(da(n))||l==="script"&&e.querySelector(ya(n))||(l=e.createElement("link"),bt(l,"link",t),yt(l),e.head.appendChild(l)))}}function ym(t,l){Ml.m(t,l);var u=he;if(u&&t){var e=l&&typeof l.as=="string"?l.as:"script",a='link[rel="modulepreload"][as="'+Qt(e)+'"][href="'+Qt(t)+'"]',n=a;switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=me(t)}if(!Wt.has(n)&&(t=F({rel:"modulepreload",href:t},l),Wt.set(n,t),u.querySelector(a)===null)){switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ya(n)))return}e=u.createElement("link"),bt(e,"link",t),yt(e),u.head.appendChild(e)}}}function hm(t,l,u){Ml.S(t,l,u);var e=he;if(e&&t){var a=qu(e).hoistableStyles,n=ve(t);l=l||"default";var i=a.get(n);if(!i){var f={loading:0,preload:null};if(i=e.querySelector(da(n)))f.loading=5;else{t=F({rel:"stylesheet",href:t,"data-precedence":l},u),(u=Wt.get(n))&&Ac(t,u);var c=i=e.createElement("link");yt(c),bt(c,"link",t),c._p=new Promise(function(y,v){c.onload=y,c.onerror=v}),c.addEventListener("load",function(){f.loading|=1}),c.addEventListener("error",function(){f.loading|=2}),f.loading|=4,Rn(i,l,e)}i={type:"stylesheet",instance:i,count:1,state:f},a.set(n,i)}}}function vm(t,l){Ml.X(t,l);var u=he;if(u&&t){var e=qu(u).hoistableScripts,a=me(t),n=e.get(a);n||(n=u.querySelector(ya(a)),n||(t=F({src:t,async:!0},l),(l=Wt.get(a))&&pc(t,l),n=u.createElement("script"),yt(n),bt(n,"link",t),u.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},e.set(a,n))}}function mm(t,l){Ml.M(t,l);var u=he;if(u&&t){var e=qu(u).hoistableScripts,a=me(t),n=e.get(a);n||(n=u.querySelector(ya(a)),n||(t=F({src:t,async:!0,type:"module"},l),(l=Wt.get(a))&&pc(t,l),n=u.createElement("script"),yt(n),bt(n,"link",t),u.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},e.set(a,n))}}function $y(t,l,u,e){var a=(a=Hl.current)?Hn(a):null;if(!a)throw Error(g(446));switch(t){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=ve(u.href),u=qu(a).hoistableStyles,e=u.get(l),e||(e={type:"style",instance:null,count:0,state:null},u.set(l,e)),e):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){t=ve(u.href);var n=qu(a).hoistableStyles,i=n.get(t);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(t,i),(n=a.querySelector(da(t)))&&!n._p&&(i.instance=n,i.state.loading=5),Wt.has(t)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Wt.set(t,u),n||rm(a,t,u,i.state))),l&&e===null)throw Error(g(528,""));return i}if(l&&e!==null)throw Error(g(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=me(u),u=qu(a).hoistableScripts,e=u.get(l),e||(e={type:"script",instance:null,count:0,state:null},u.set(l,e)),e):{type:"void",instance:null,count:0,state:null};default:throw Error(g(444,t))}}function ve(t){return'href="'+Qt(t)+'"'}function da(t){return'link[rel="stylesheet"]['+t+"]"}function Wy(t){return F({},t,{"data-precedence":t.precedence,precedence:null})}function rm(t,l,u,e){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?e.loading=1:(l=t.createElement("link"),e.preload=l,l.addEventListener("load",function(){return e.loading|=1}),l.addEventListener("error",function(){return e.loading|=2}),bt(l,"link",u),yt(l),t.head.appendChild(l))}function me(t){return'[src="'+Qt(t)+'"]'}function ya(t){return"script[async]"+t}function Fy(t,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var e=t.querySelector('style[data-href~="'+Qt(u.href)+'"]');if(e)return l.instance=e,yt(e),e;var a=F({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return e=(t.ownerDocument||t).createElement("style"),yt(e),bt(e,"style",a),Rn(e,u.precedence,t),l.instance=e;case"stylesheet":a=ve(u.href);var n=t.querySelector(da(a));if(n)return l.state.loading|=4,l.instance=n,yt(n),n;e=Wy(u),(a=Wt.get(a))&&Ac(e,a),n=(t.ownerDocument||t).createElement("link"),yt(n);var i=n;return i._p=new Promise(function(f,c){i.onload=f,i.onerror=c}),bt(n,"link",e),l.state.loading|=4,Rn(n,u.precedence,t),l.instance=n;case"script":return n=me(u.src),(a=t.querySelector(ya(n)))?(l.instance=a,yt(a),a):(e=u,(a=Wt.get(n))&&(e=F({},u),pc(e,a)),t=t.ownerDocument||t,a=t.createElement("script"),yt(a),bt(a,"link",e),t.head.appendChild(a),l.instance=a);case"void":return null;default:throw Error(g(443,l.type))}else l.type==="stylesheet"&&!(l.state.loading&4)&&(e=l.instance,l.state.loading|=4,Rn(e,u.precedence,t));return l.instance}function Rn(t,l,u){for(var e=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=e.length?e[e.length-1]:null,n=a,i=0;i title"):null)}function Sm(t,l,u){if(u===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Py(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function gm(t,l,u,e){if(u.type==="stylesheet"&&(typeof e.media!="string"||matchMedia(e.media).matches!==!1)&&!(u.state.loading&4)){if(u.instance===null){var a=ve(e.href),n=l.querySelector(da(a));if(n){l=n._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Cn.bind(t),l.then(t,t)),u.state.loading|=4,u.instance=n,yt(n);return}n=l.ownerDocument||l,e=Wy(e),(a=Wt.get(a))&&Ac(e,a),n=n.createElement("link"),yt(n);var i=n;i._p=new Promise(function(f,c){i.onload=f,i.onerror=c}),bt(n,"link",e),u.instance=n}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(u,l),(l=u.state.preload)&&!(u.state.loading&3)&&(t.count++,u=Cn.bind(t),l.addEventListener("load",u),l.addEventListener("error",u))}}var Oc=0;function bm(t,l){return t.stylesheets&&t.count===0&&Yn(t,t.stylesheets),0Oc?50:800)+l);return t.unsuspend=u,function(){t.unsuspend=null,clearTimeout(e),clearTimeout(a)}}:null}function Cn(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yn(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bn=null;function Yn(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bn=new Map,l.forEach(Em,t),Bn=null,Cn.call(t))}function Em(t,l){if(!(l.state.loading&4)){var u=Bn.get(t);if(u)var e=u.get(null);else{u=new Map,Bn.set(t,u);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(t){console.error(t)}}h0(),Fc.exports=ba;var Nc=Fc.exports;const Dm=eu({__proto__:null,default:tl(Nc)},[Nc]);var v0={exports:{}},xn={};/** * @license React * react-jsx-runtime.production.js * @@ -46,4 +46,4 @@ Error generating stack: `+e.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Dm=Symbol.for("react.transitional.element"),Um=Symbol.for("react.fragment");function m0(t,l,u){var e=null;if(u!==void 0&&(e=""+u),l.key!==void 0&&(e=""+l.key),"key"in l){u={};for(var a in l)a!=="key"&&(u[a]=l[a])}else u=l;return l=u.ref,{$$typeof:Dm,type:t,key:e,ref:l!==void 0?l:null,props:u}}Ln.Fragment=Um,Ln.jsx=m0,Ln.jsxs=m0,v0.exports=Ln;var _u=v0.exports;const r0=G.createContext(null);function S0({namespace:t,children:l}){return _u.jsx(r0.Provider,{value:t,children:l})}function Hm(){return G.useContext(r0)}function Rm(t,l){return l?`${l}-${t}`:t}function lu(t,l){const u=Hm();return Rm(t,l!==void 0?l:u)}function Nm({id:t,tagName:l="div",namespace:u,...e}){const a=lu(t,u),n=G.useRef(null);return G.useEffect(()=>{var o;const i=n.current,f=i==null?void 0:i.parentElement;if(!i||!f||!((o=window.Shiny)!=null&&o.bindAll))return;const c=(v,r)=>{console.error(`[shinyreact] ShinyOutput "${a}" ${r} failed:`,{id:a,phase:r,error:v})};try{const v=window.Shiny.bindAll(f);v&&typeof v.catch=="function"&&v.catch(r=>c(r,"bindAll"))}catch(v){c(v,"bindAll")}return()=>{var v,r;try{(r=(v=window.Shiny)==null?void 0:v.unbindAll)==null||r.call(v,i,!0)}catch(y){c(y,"unbindAll")}}},[a,l]),Wc.createElement(l,{id:a,ref:n,...e})}const Se=Symbol("MISSING");function Cm(t){const l=typeof window<"u"?window:globalThis,u=l.shinyreact=l.shinyreact||{},e=u._restore,a=Object.create(null);if(e&&typeof e=="object"&&!e["-applied"]){for(const[n,i]of Object.entries(e))t.add(n,i),a[n]=i;u._restore={"-applied":!0,"-values":a};return}e&&typeof e=="object"&&e["-applied"]||(u._restore={"-applied":!0,"-values":a})}function fl(){return window.Shiny}let Cc=!1,xn=!1;const Bc=new Set;let g0=!1,b0,E0,z0;function T0(){for(const t of Bc)t()}function A0(){Cc||(Cc=!0,T0())}function p0(t){xn!==t&&(xn=t,T0())}function Bm(){if(g0||typeof document>"u")return;g0=!0,document.documentElement.classList.contains("shiny-busy")&&(xn=!0),b0=()=>p0(!0),E0=()=>p0(!1),document.addEventListener("shiny:busy",b0),document.addEventListener("shiny:idle",E0);const t=fl();if(t){t.initializedPromise.then(A0);return}z0=()=>{const l=fl();l&&l.initializedPromise.then(A0)},document.addEventListener("shiny:connected",z0,{once:!0})}function _0(t){return Bm(),Bc.add(t),()=>{Bc.delete(t)}}function O0(){return Cc}function M0(){return xn}class Ym{constructor(){J(this,"messageHandlers",new Map);J(this,"initialized",!1)}init(){if(this.initialized)return;const l=fl();l&&(l.addCustomMessageHandler("shinyReactMessage",u=>{this.dispatchMessage(u.type,u.data)}),this.initialized=!0)}addHandler(l,u){this.init(),this.messageHandlers.has(l)||this.messageHandlers.set(l,new Set),this.messageHandlers.get(l).add(u)}removeHandler(l,u){const e=this.messageHandlers.get(l);e&&(e.delete(u),e.size===0&&this.messageHandlers.delete(l))}dispatchMessage(l,u){const e=this.messageHandlers.get(l);e&&e.forEach(a=>a(u))}getHandlerCount(l){const u=this.messageHandlers.get(l);return u?u.size:0}getActiveMessageTypes(){return Array.from(this.messageHandlers.keys())}}const qm=new Ym;function jm(){const t=fl();t&&(t.messageRegistry=qm)}class Gm{constructor(l){J(this,"id");J(this,"status","pending");J(this,"hasValue",!1);J(this,"lastValue");J(this,"lastError",null);J(this,"useStateSetValueFns");J(this,"useStateSetStatusFns");J(this,"useStateSetErrorFns");this.id=l,this.useStateSetValueFns=new Set,this.useStateSetStatusFns=new Set,this.useStateSetErrorFns=new Set}hasReceivedValue(){return this.hasValue}getLastValue(){return this.lastValue}getLastError(){return this.lastError}addUseStateSetValueFn(l){this.useStateSetValueFns.add(l)}removeUseStateSetValueFn(l){this.useStateSetValueFns.delete(l)}addUseStateSetStatusFn(l){this.useStateSetStatusFns.add(l)}removeUseStateSetStatusFn(l){this.useStateSetStatusFns.delete(l)}addUseStateSetErrorFn(l){this.useStateSetErrorFns.add(l)}removeUseStateSetErrorFn(l){this.useStateSetErrorFns.delete(l)}getStatus(){return this.status}setStatus(l){this.status!==l&&(this.status=l,this.useStateSetStatusFns.forEach(u=>u(l)))}setValue(l){this.hasValue=!0,this.lastValue=l,this.useStateSetValueFns.forEach(u=>u(l)),this.status==="error"&&(this.lastError=null,this.useStateSetErrorFns.forEach(u=>u(null))),this.setStatus("ready")}setRecalculating(l){l?this.hasValue&&(this.status==="error"&&(this.lastError=null,this.useStateSetErrorFns.forEach(u=>u(null))),this.setStatus("recalculating")):this.hasValue&&this.status==="recalculating"&&this.setStatus("ready")}setError(l){this.lastError=l,this.useStateSetErrorFns.forEach(u=>u(l)),this.setStatus("error")}isEmpty(){return this.useStateSetValueFns.size===0&&this.useStateSetStatusFns.size===0&&this.useStateSetErrorFns.size===0}}class Vm{constructor(){J(this,"outputs",new Map);J(this,"bindAllScheduled",!1);J(this,"container");const l=document.createElement("div");l.className="shiny-react-output-container",l.style.visibility="hidden",this.container=l,document.body.appendChild(this.container)}add(l,u,e,a){let n=this.get(l);if(!n){const i=document.createElement("div");i.className="shiny-react-output",i.id=l,i.textContent=`This is the output div for ${l}`,this.container.appendChild(i),n=new Gm(l),this.outputs.set(l,n),this.scheduleBindAll()}return n.addUseStateSetValueFn(u),n.addUseStateSetStatusFn(e),n.addUseStateSetErrorFn(a),n.hasReceivedValue()&&u(n.getLastValue()),e(n.getStatus()),n.getStatus()==="error"&&a(n.getLastError()),()=>{n.removeUseStateSetValueFn(u),n.removeUseStateSetStatusFn(e),n.removeUseStateSetErrorFn(a),this.scheduleCleanup(l)}}has(l){return this.outputs.has(l)}get(l){return this.outputs.get(l)}scheduleCleanup(l){requestAnimationFrame(()=>{const u=this.outputs.get(l);if(!u||!u.isEmpty())return;this.outputs.delete(l);const e=document.getElementById(l);e&&e.remove(),this.scheduleBindAll()})}scheduleBindAll(){const l=fl();l&&(this.bindAllScheduled||(this.bindAllScheduled=!0,requestAnimationFrame(()=>{var u,e;(u=l.unbindAll)==null||u.call(l,this.container),(e=l.bindAll)==null||e.call(l,this.container),this.bindAllScheduled=!1})))}}function Xm(){const t=fl();if(!t)return;class l extends t.OutputBinding{find(e){return $(e).find(".shiny-react-output")}renderValue(e,a){var i;const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);if(!n){console.error(`Output ${e.id} not found`);return}n.setValue(a)}renderError(e,a){var i;console.error(`Error for ${e.id}:`,a);const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);n&&n.setError(a)}showProgress(e,a){var i;const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);if(!n){console.error(`Output ${e.id} not found`);return}n.setRecalculating(a)}}t.outputBindings.register(new l,"shiny.reactOutput")}function Yc(t,l){let u=null;const e=function(...a){const n=()=>{u=null,t(...a)};u!==null&&clearTimeout(u),u=setTimeout(n,l)};return e.setDelay=a=>{l=a},e.getDelay=()=>l,e.cancel=()=>{u!==null&&(clearTimeout(u),u=null)},e}const Sa=class Sa{constructor(l,u){J(this,"id");J(this,"value");J(this,"useStateSetValueFns");J(this,"shinySetInputValueDebounced");J(this,"opts",{debounceMs:100});J(this,"type");J(this,"typeFinalized",!1);this.id=l,this.value=u,this.useStateSetValueFns=new Set,this.shinySetInputValueDebounced=Yc(this.setShinyInputValue.bind(this),this.opts.debounceMs)}isEmpty(){return this.useStateSetValueFns.size===0}setShinyInputValue(l){var e,a;const u=`${this.id}:${this.type??Sa.DEFAULT_TYPE}`;(a=(e=fl())==null?void 0:e.setInputValue)==null||a.call(e,u,l,this.opts)}updateDebounceDelay(l){this.shinySetInputValueDebounced.setDelay(l)}updatePriority(l){this.opts.priority=l}updateType(l){if(!this.typeFinalized){this.type=l,this.typeFinalized=!0;return}if(l!==void 0&&this.type!==l)throw new Error(`Input "${this.id}" is already registered with type=${this.type===void 0?`undefined (wire id "${this.id}:${Sa.DEFAULT_TYPE}")`:JSON.stringify(this.type)}. A second mount requested type=${JSON.stringify(l)}. An input's handler type changes server-side semantics and must be consistent across every useShinyInput / useSetShinyInput call for the same id.`)}addUseStateSetValueFn(l){this.useStateSetValueFns.add(l)}removeUseStateSetValueFn(l){this.useStateSetValueFns.delete(l)}setValue(l){const u=typeof l=="function"?l(this.value):l;this.value=u,this.useStateSetValueFns.forEach(e=>e(u)),u!==Se&&this.shinySetInputValueDebounced(u)}getValue(){return this.value}};J(Sa,"DEFAULT_TYPE","shinyreact.default");let qc=Sa;class Qm{constructor(){J(this,"inputs",new Map);J(this,"pendingSubscribers",new Map)}get(l){return this.inputs.get(l)}has(l){return this.inputs.has(l)}add(l,u){if(this.inputs.has(l))throw new Error(`Input ${l} already exists`);const e=new qc(l,u);this.inputs.set(l,e);const a=this.pendingSubscribers.get(l);return a&&(a.forEach(n=>{e.addUseStateSetValueFn(n),n(e.getValue())}),this.pendingSubscribers.delete(l)),e}getOrCreate(l,u){let e=this.get(l);return e||(e=this.add(l,u)),e}subscribe(l,u){const e=this.get(l);if(e)return e.addUseStateSetValueFn(u),u(e.getValue()),()=>{const n=this.get(l);n&&n.removeUseStateSetValueFn(u)};let a=this.pendingSubscribers.get(l);return a||(a=new Set,this.pendingSubscribers.set(l,a)),a.add(u),()=>{const n=this.get(l);if(n){n.removeUseStateSetValueFn(u);return}const i=this.pendingSubscribers.get(l);i&&(i.delete(u),i.size===0&&this.pendingSubscribers.delete(l))}}remove(l){const u=this.inputs.get(l);return u&&u.shinySetInputValueDebounced.cancel(),this.inputs.delete(l)}keys(){return this.inputs.keys()}size(){return this.inputs.size}}let Kn;function Zm(){Kn={inputs:new Qm,outputs:new Vm};const t=fl();t&&(t.reactRegistry=Kn)}function cl(){const t=fl();if(!t){if(!Kn)throw new Error("React registry not initialized");return Kn}return t.reactRegistry}function Jn(t,l,{debounceMs:u=100,priority:e,namespace:a,type:n}={}){if(ge(),n!==void 0&&!/^[^\s:]+$/.test(n))throw new Error(`useShinyInput("${t}"): invalid type=${JSON.stringify(n)}. Must be non-empty and contain no whitespace or ':' characters.`);const i=lu(t,a),c=G.useRef(l).current;let o=c;const r=cl().inputs.get(i);r&&(o=r.getValue());const[y,m]=G.useState(o),b=Ou();G.useEffect(()=>{if(!b)return;const d=cl().inputs.getOrCreate(i,c);return u!==void 0&&d.updateDebounceDelay(u),e&&d.updatePriority(e),d.updateType(n),d.addUseStateSetValueFn(m),d.setValue(d.getValue()),()=>{d.removeUseStateSetValueFn(m)}},[i,b,u,e,c,n]);const A=G.useCallback(H=>{if(!b)return;const s=cl().inputs.get(i);if(!s){console.error(`Input ${i} not found`);return}s.setValue(H)},[i,b]);return[y,A]}const wn=()=>{};function D0(t,l=void 0,{namespace:u}={}){const[e,a]=G.useState(l),n=Ou();ge();const i=lu(t,u);return G.useEffect(()=>n?cl().outputs.add(i,a,wn,wn):void 0,[i,n]),e}function U0(t,{namespace:l}={}){const[u,e]=G.useState("pending"),a=Ou();ge();const n=lu(t,l);return G.useEffect(()=>a?cl().outputs.add(n,wn,e,wn):void 0,[n,a]),u}function Lm(t,{namespace:l}={}){ge();const u=lu(t,l),[e,a]=G.useState(()=>{const i=cl().inputs.get(u);if(!i)return;const f=i.getValue();return f===Se?void 0:f}),n=Ou();return G.useEffect(()=>n?cl().inputs.subscribe(u,c=>{a(c===Se?void 0:c)}):void 0,[u,n]),e}function xm(t,l,{debounceMs:u=100,priority:e,namespace:a,type:n}={}){if(ge(),n!==void 0&&!/^[^\s:]+$/.test(n))throw new Error(`useSetShinyInput("${t}"): invalid type=${JSON.stringify(n)}. Must be non-empty and contain no whitespace or ':' characters.`);const i=lu(t,a),c=G.useRef(l).current,o=Ou();return G.useEffect(()=>{if(!o)return;const r=cl().inputs.getOrCreate(i,c);u!==void 0&&r.updateDebounceDelay(u),e&&r.updatePriority(e),r.updateType(n),r.setValue(r.getValue())},[i,o,u,e,c,n]),G.useCallback(v=>{if(!o)return;const y=cl().inputs.get(i);if(!y){console.error(`Input ${i} not found`);return}y.setValue(v)},[i,o])}function Km(t,l,{namespace:u}={}){const e=Ou();ge();const a=lu(t,u),n=G.useRef(l);n.current=l,G.useEffect(()=>{if(!e||!a)return;const i=fl();if(!i)return;const f=c=>n.current(c);return i.messageRegistry.addHandler(a,f),()=>{i.messageRegistry.removeHandler(a,f)}},[e,a])}function Ou(){return G.useSyncExternalStore(_0,O0,O0)}function Jm(){return G.useSyncExternalStore(_0,M0,M0)}let H0=!1;function ge(){H0||(Zm(),Cm(cl().inputs),Xm(),jm(),H0=!0)}function wm({id:t,className:l,width:u,height:e,debounceMs:a=400,onRecalculating:n,namespace:i}){const f=lu(t,i),c={namespace:null},[o,v]=Jn(`.clientdata_output_${f}_width`,Se,c),[r,y]=Jn(`.clientdata_output_${f}_height`,Se,c),[m]=Jn(`.clientdata_output_${f}_hidden`,!1,c),b=D0(f,void 0,c),A=U0(f,c),H=G.useRef(null),d=G.useRef(null),[s,h]=G.useState(0);G.useEffect(()=>{b&&h(E=>E+1)},[b]),G.useEffect(()=>{n&&n(A==="recalculating")},[A,n]);const S=G.useCallback(()=>{if(H.current){const E=H.current.clientWidth,O=H.current.clientHeight;E>0&&O>0&&(v(E),y(O))}},[v,y]);return G.useEffect(()=>{const E=H.current;if(!E)return;E.addEventListener("load",S);const O=Yc(()=>{E&&E.complete&&S()},a),z=new ResizeObserver(p=>{for(const M of p)M.target===E&&O()});return z.observe(E),()=>{E.removeEventListener("load",S),z.disconnect(),O.cancel()}},[H,s,v,y,a,S]),G.useEffect(()=>{if(b)return;const E=d.current;if(!E)return;const O=()=>{const M=E.clientWidth,R=E.clientHeight;M>0&&R>0&&(v(M),y(R))};O();const z=Yc(O,a),p=new ResizeObserver(()=>z());return p.observe(E),()=>{p.disconnect(),z.cancel()}},[b,v,y,a]),m?null:b?_u.jsx("img",{ref:H,src:b.src,alt:"",className:l,style:{width:u,height:e},onLoad:S}):_u.jsx("div",{ref:d,className:l,style:{width:u,height:e,display:"flex",alignItems:"center",justifyContent:"center",color:"#9ca3af"},children:_u.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",style:{animation:"spin 1s linear infinite"},children:_u.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})})}class R0 extends HTMLElement{constructor(){super(...arguments);J(this,"root",null);J(this,"slotContents",new Map)}captureSlots(u="[data-slot]"){const e=this.querySelectorAll(`:scope > ${u}`),a=new Set(e);e.forEach(i=>{const f=i.getAttribute("data-slot");f&&this.slotContents.set(f,Array.from(i.childNodes))});const n=Array.from(this.childNodes).filter(i=>!a.has(i));return n.length>0&&this.slotContents.set("__children__",n),this.slotContents}async mountSlot(u,e){var n,i;const a=this.slotContents.get(u);a&&e&&(a.forEach(f=>e.appendChild(f)),await((i=(n=window.Shiny)==null?void 0:n.bindAll)==null?void 0:i.call(n,e)))}get onSlotMount(){return this.mountSlot.bind(this)}getConfig(){const u={};for(const[e,a]of Object.entries(this.dataset))if(a!==void 0)try{u[e]=JSON.parse(a)}catch{u[e]=a}return u}get namespace(){return this.id||void 0}render(){const u=this.constructor.component;return u?_u.jsx(u,{...this.getConfig()}):(console.error(`${this.constructor.name}: No static component defined`),null)}wrapWithProvider(u){return this.namespace?_u.jsx(S0,{namespace:this.namespace,children:u}):u}clearContent(){this.innerHTML=""}connectedCallback(){this.captureSlots(),this.clearContent(),this.root=Nc.createRoot(this),this.root.render(this.wrapWithProvider(this.render()))}disconnectedCallback(){var u,e,a;(e=(u=window.Shiny)==null?void 0:u.unbindAll)==null||e.call(u,this),(a=this.root)==null||a.unmount(),this.root=null}}J(R0,"component",null);function $m(){window.shinyreact=Object.assign(window.shinyreact||{},{useSetShinyInput:xm,useShinyBusy:Jm,useShinyInput:Jn,useShinyInputValue:Lm,useShinyOutputStatus:U0,useShinyOutputValue:D0,useShinyMessageHandler:Km,useShinyInitialized:Ou,ImageOutput:wm,MISSING:Se,ShinyModuleProvider:S0,ShinyReactComponentElement:R0,ShinyOutput:Nm,React:Wc,ReactDOM:Mm})}$m()})(); + */var Um=Symbol.for("react.transitional.element"),Hm=Symbol.for("react.fragment");function m0(t,l,u){var e=null;if(u!==void 0&&(e=""+u),l.key!==void 0&&(e=""+l.key),"key"in l){u={};for(var a in l)a!=="key"&&(u[a]=l[a])}else u=l;return l=u.ref,{$$typeof:Um,type:t,key:e,ref:l!==void 0?l:null,props:u}}xn.Fragment=Hm,xn.jsx=m0,xn.jsxs=m0,v0.exports=xn;var Ou=v0.exports;const r0=j.createContext(null);function S0({namespace:t,children:l}){return Ou.jsx(r0.Provider,{value:t,children:l})}function Rm(){return j.useContext(r0)}function Nm(t,l){return l?`${l}-${t}`:t}function lu(t,l){const u=Rm();return Nm(t,l!==void 0?l:u)}function Cm({id:t,tagName:l="div",namespace:u,...e}){const a=lu(t,u),n=j.useRef(null);return j.useEffect(()=>{var y;const i=n.current,f=i==null?void 0:i.parentElement;if(!i||!f||!((y=window.Shiny)!=null&&y.bindAll))return;const c=(v,r)=>{console.error(`[shinyreact] ShinyOutput "${a}" ${r} failed:`,{id:a,phase:r,error:v})};try{const v=window.Shiny.bindAll(f);v&&typeof v.catch=="function"&&v.catch(r=>c(r,"bindAll"))}catch(v){c(v,"bindAll")}return()=>{var v,r;try{(r=(v=window.Shiny)==null?void 0:v.unbindAll)==null||r.call(v,i,!0)}catch(d){c(d,"unbindAll")}}},[a,l]),Wc.createElement(l,{id:a,ref:n,...e})}const Se=Symbol("MISSING"),g0="1.0";function Bm(){if(typeof document>"u")return null;const t=document.getElementById("shinyreact-config"),l=t==null?void 0:t.textContent;if(!l)return null;try{return JSON.parse(l)}catch(u){return console.error("shinyreact: could not parse #shinyreact-config JSON",u),null}}function Ym(t){const l=u=>u.split(".")[0];if(l(t)!==l(g0))throw new Error(`shinyreact protocol mismatch: the server speaks protocol ${t} but this JS client supports ${g0}. Upgrade the older side (the shinyreact R/Python package, or the client bundle) so the major protocol versions match.`)}function qm(t){const l=typeof window<"u"?window:globalThis,u=l.shinyreact=l.shinyreact||{},e=u._restore;if(e&&typeof e=="object"&&e["-applied"])return;const a=Bm();a!=null&&a.protocolVersion&&Ym(a.protocolVersion);const n=a==null?void 0:a.restore,i=Object.create(null);if(n&&typeof n=="object")for(const[f,c]of Object.entries(n))t.add(f,c),i[f]=c;u._restore={"-applied":!0,"-values":i}}function fl(){return window.Shiny}let Cc=!1,Ln=!1;const Bc=new Set;let b0=!1,E0,z0,T0;function A0(){for(const t of Bc)t()}function p0(){Cc||(Cc=!0,A0())}function O0(t){Ln!==t&&(Ln=t,A0())}function Vm(){if(b0||typeof document>"u")return;b0=!0,document.documentElement.classList.contains("shiny-busy")&&(Ln=!0),E0=()=>O0(!0),z0=()=>O0(!1),document.addEventListener("shiny:busy",E0),document.addEventListener("shiny:idle",z0);const t=fl();if(t){t.initializedPromise.then(p0);return}T0=()=>{const l=fl();l&&l.initializedPromise.then(p0)},document.addEventListener("shiny:connected",T0,{once:!0})}function _0(t){return Vm(),Bc.add(t),()=>{Bc.delete(t)}}function M0(){return Cc}function D0(){return Ln}class jm{constructor(){J(this,"messageHandlers",new Map);J(this,"initialized",!1)}init(){if(this.initialized)return;const l=fl();l&&(l.addCustomMessageHandler("shinyReactMessage",u=>{this.dispatchMessage(u.type,u.data)}),this.initialized=!0)}addHandler(l,u){this.init(),this.messageHandlers.has(l)||this.messageHandlers.set(l,new Set),this.messageHandlers.get(l).add(u)}removeHandler(l,u){const e=this.messageHandlers.get(l);e&&(e.delete(u),e.size===0&&this.messageHandlers.delete(l))}dispatchMessage(l,u){const e=this.messageHandlers.get(l);e&&e.forEach(a=>a(u))}getHandlerCount(l){const u=this.messageHandlers.get(l);return u?u.size:0}getActiveMessageTypes(){return Array.from(this.messageHandlers.keys())}}const Gm=new jm;function Xm(){const t=fl();t&&(t.messageRegistry=Gm)}class Qm{constructor(l){J(this,"id");J(this,"status","pending");J(this,"hasValue",!1);J(this,"lastValue");J(this,"lastError",null);J(this,"useStateSetValueFns");J(this,"useStateSetStatusFns");J(this,"useStateSetErrorFns");this.id=l,this.useStateSetValueFns=new Set,this.useStateSetStatusFns=new Set,this.useStateSetErrorFns=new Set}hasReceivedValue(){return this.hasValue}getLastValue(){return this.lastValue}getLastError(){return this.lastError}addUseStateSetValueFn(l){this.useStateSetValueFns.add(l)}removeUseStateSetValueFn(l){this.useStateSetValueFns.delete(l)}addUseStateSetStatusFn(l){this.useStateSetStatusFns.add(l)}removeUseStateSetStatusFn(l){this.useStateSetStatusFns.delete(l)}addUseStateSetErrorFn(l){this.useStateSetErrorFns.add(l)}removeUseStateSetErrorFn(l){this.useStateSetErrorFns.delete(l)}getStatus(){return this.status}setStatus(l){this.status!==l&&(this.status=l,this.useStateSetStatusFns.forEach(u=>u(l)))}setValue(l){this.hasValue=!0,this.lastValue=l,this.useStateSetValueFns.forEach(u=>u(l)),this.status==="error"&&(this.lastError=null,this.useStateSetErrorFns.forEach(u=>u(null))),this.setStatus("ready")}setRecalculating(l){l?this.hasValue&&(this.status==="error"&&(this.lastError=null,this.useStateSetErrorFns.forEach(u=>u(null))),this.setStatus("recalculating")):this.hasValue&&this.status==="recalculating"&&this.setStatus("ready")}setError(l){this.lastError=l,this.useStateSetErrorFns.forEach(u=>u(l)),this.setStatus("error")}isEmpty(){return this.useStateSetValueFns.size===0&&this.useStateSetStatusFns.size===0&&this.useStateSetErrorFns.size===0}}class Zm{constructor(){J(this,"outputs",new Map);J(this,"bindAllScheduled",!1);J(this,"container");const l=document.createElement("div");l.className="shiny-react-output-container",l.style.visibility="hidden",this.container=l,document.body.appendChild(this.container)}add(l,u,e,a){let n=this.get(l);if(!n){const i=document.createElement("div");i.className="shiny-react-output",i.id=l,i.textContent=`This is the output div for ${l}`,this.container.appendChild(i),n=new Qm(l),this.outputs.set(l,n),this.scheduleBindAll()}return n.addUseStateSetValueFn(u),n.addUseStateSetStatusFn(e),n.addUseStateSetErrorFn(a),n.hasReceivedValue()&&u(n.getLastValue()),e(n.getStatus()),n.getStatus()==="error"&&a(n.getLastError()),()=>{n.removeUseStateSetValueFn(u),n.removeUseStateSetStatusFn(e),n.removeUseStateSetErrorFn(a),this.scheduleCleanup(l)}}has(l){return this.outputs.has(l)}get(l){return this.outputs.get(l)}scheduleCleanup(l){requestAnimationFrame(()=>{const u=this.outputs.get(l);if(!u||!u.isEmpty())return;this.outputs.delete(l);const e=document.getElementById(l);e&&e.remove(),this.scheduleBindAll()})}scheduleBindAll(){const l=fl();l&&(this.bindAllScheduled||(this.bindAllScheduled=!0,requestAnimationFrame(()=>{var u,e;(u=l.unbindAll)==null||u.call(l,this.container),(e=l.bindAll)==null||e.call(l,this.container),this.bindAllScheduled=!1})))}}function xm(){const t=fl();if(!t)return;class l extends t.OutputBinding{find(e){return $(e).find(".shiny-react-output")}renderValue(e,a){var i;const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);if(!n){console.error(`Output ${e.id} not found`);return}n.setValue(a)}renderError(e,a){var i;console.error(`Error for ${e.id}:`,a);const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);n&&n.setError(a)}showProgress(e,a){var i;const n=(i=t.reactRegistry)==null?void 0:i.outputs.get(e.id);if(!n){console.error(`Output ${e.id} not found`);return}n.setRecalculating(a)}}t.outputBindings.register(new l,"shiny.reactOutput")}function Yc(t,l){let u=null;const e=function(...a){const n=()=>{u=null,t(...a)};u!==null&&clearTimeout(u),u=setTimeout(n,l)};return e.setDelay=a=>{l=a},e.getDelay=()=>l,e.cancel=()=>{u!==null&&(clearTimeout(u),u=null)},e}const Sa=class Sa{constructor(l,u){J(this,"id");J(this,"value");J(this,"useStateSetValueFns");J(this,"shinySetInputValueDebounced");J(this,"opts",{debounceMs:100});J(this,"type");J(this,"typeFinalized",!1);this.id=l,this.value=u,this.useStateSetValueFns=new Set,this.shinySetInputValueDebounced=Yc(this.setShinyInputValue.bind(this),this.opts.debounceMs)}isEmpty(){return this.useStateSetValueFns.size===0}setShinyInputValue(l){var e,a;const u=`${this.id}:${this.type??Sa.DEFAULT_TYPE}`;(a=(e=fl())==null?void 0:e.setInputValue)==null||a.call(e,u,l,this.opts)}updateDebounceDelay(l){this.shinySetInputValueDebounced.setDelay(l)}updatePriority(l){this.opts.priority=l}updateType(l){if(!this.typeFinalized){this.type=l,this.typeFinalized=!0;return}if(l!==void 0&&this.type!==l)throw new Error(`Input "${this.id}" is already registered with type=${this.type===void 0?`undefined (wire id "${this.id}:${Sa.DEFAULT_TYPE}")`:JSON.stringify(this.type)}. A second mount requested type=${JSON.stringify(l)}. An input's handler type changes server-side semantics and must be consistent across every useShinyInput / useSetShinyInput call for the same id.`)}addUseStateSetValueFn(l){this.useStateSetValueFns.add(l)}removeUseStateSetValueFn(l){this.useStateSetValueFns.delete(l)}setValue(l){const u=typeof l=="function"?l(this.value):l;this.value=u,this.useStateSetValueFns.forEach(e=>e(u)),u!==Se&&this.shinySetInputValueDebounced(u)}getValue(){return this.value}};J(Sa,"DEFAULT_TYPE","shinyreact.default");let qc=Sa;class Lm{constructor(){J(this,"inputs",new Map);J(this,"pendingSubscribers",new Map)}get(l){return this.inputs.get(l)}has(l){return this.inputs.has(l)}add(l,u){if(this.inputs.has(l))throw new Error(`Input ${l} already exists`);const e=new qc(l,u);this.inputs.set(l,e);const a=this.pendingSubscribers.get(l);return a&&(a.forEach(n=>{e.addUseStateSetValueFn(n),n(e.getValue())}),this.pendingSubscribers.delete(l)),e}getOrCreate(l,u){let e=this.get(l);return e||(e=this.add(l,u)),e}subscribe(l,u){const e=this.get(l);if(e)return e.addUseStateSetValueFn(u),u(e.getValue()),()=>{const n=this.get(l);n&&n.removeUseStateSetValueFn(u)};let a=this.pendingSubscribers.get(l);return a||(a=new Set,this.pendingSubscribers.set(l,a)),a.add(u),()=>{const n=this.get(l);if(n){n.removeUseStateSetValueFn(u);return}const i=this.pendingSubscribers.get(l);i&&(i.delete(u),i.size===0&&this.pendingSubscribers.delete(l))}}remove(l){const u=this.inputs.get(l);return u&&u.shinySetInputValueDebounced.cancel(),this.inputs.delete(l)}keys(){return this.inputs.keys()}size(){return this.inputs.size}}let Kn;function Km(){Kn={inputs:new Lm,outputs:new Zm};const t=fl();t&&(t.reactRegistry=Kn)}function cl(){const t=fl();if(!t){if(!Kn)throw new Error("React registry not initialized");return Kn}return t.reactRegistry}function Jn(t,l,{debounceMs:u=100,priority:e,namespace:a,type:n}={}){if(ge(),n!==void 0&&!/^[^\s:]+$/.test(n))throw new Error(`useShinyInput("${t}"): invalid type=${JSON.stringify(n)}. Must be non-empty and contain no whitespace or ':' characters.`);const i=lu(t,a),c=j.useRef(l).current;let y=c;const r=cl().inputs.get(i);r&&(y=r.getValue());const[d,m]=j.useState(y),b=_u();j.useEffect(()=>{if(!b)return;const o=cl().inputs.getOrCreate(i,c);return u!==void 0&&o.updateDebounceDelay(u),e&&o.updatePriority(e),o.updateType(n),o.addUseStateSetValueFn(m),o.setValue(o.getValue()),()=>{o.removeUseStateSetValueFn(m)}},[i,b,u,e,c,n]);const A=j.useCallback(H=>{if(!b)return;const s=cl().inputs.get(i);if(!s){console.error(`Input ${i} not found`);return}s.setValue(H)},[i,b]);return[d,A]}const wn=()=>{};function U0(t,l=void 0,{namespace:u}={}){const[e,a]=j.useState(l),n=_u();ge();const i=lu(t,u);return j.useEffect(()=>n?cl().outputs.add(i,a,wn,wn):void 0,[i,n]),e}function H0(t,{namespace:l}={}){const[u,e]=j.useState("pending"),a=_u();ge();const n=lu(t,l);return j.useEffect(()=>a?cl().outputs.add(n,wn,e,wn):void 0,[n,a]),u}function Jm(t,{namespace:l}={}){ge();const u=lu(t,l),[e,a]=j.useState(()=>{const i=cl().inputs.get(u);if(!i)return;const f=i.getValue();return f===Se?void 0:f}),n=_u();return j.useEffect(()=>n?cl().inputs.subscribe(u,c=>{a(c===Se?void 0:c)}):void 0,[u,n]),e}function wm(t,l,{debounceMs:u=100,priority:e,namespace:a,type:n}={}){if(ge(),n!==void 0&&!/^[^\s:]+$/.test(n))throw new Error(`useSetShinyInput("${t}"): invalid type=${JSON.stringify(n)}. Must be non-empty and contain no whitespace or ':' characters.`);const i=lu(t,a),c=j.useRef(l).current,y=_u();return j.useEffect(()=>{if(!y)return;const r=cl().inputs.getOrCreate(i,c);u!==void 0&&r.updateDebounceDelay(u),e&&r.updatePriority(e),r.updateType(n),r.setValue(r.getValue())},[i,y,u,e,c,n]),j.useCallback(v=>{if(!y)return;const d=cl().inputs.get(i);if(!d){console.error(`Input ${i} not found`);return}d.setValue(v)},[i,y])}function $m(t,l,{namespace:u}={}){const e=_u();ge();const a=lu(t,u),n=j.useRef(l);n.current=l,j.useEffect(()=>{if(!e||!a)return;const i=fl();if(!i)return;const f=c=>n.current(c);return i.messageRegistry.addHandler(a,f),()=>{i.messageRegistry.removeHandler(a,f)}},[e,a])}function _u(){return j.useSyncExternalStore(_0,M0,M0)}function Wm(){return j.useSyncExternalStore(_0,D0,D0)}let R0=!1;function ge(){R0||(Km(),qm(cl().inputs),xm(),Xm(),R0=!0)}function Fm({id:t,className:l,width:u,height:e,debounceMs:a=400,onRecalculating:n,namespace:i}){const f=lu(t,i),c={namespace:null},[y,v]=Jn(`.clientdata_output_${f}_width`,Se,c),[r,d]=Jn(`.clientdata_output_${f}_height`,Se,c),[m]=Jn(`.clientdata_output_${f}_hidden`,!1,c),b=U0(f,void 0,c),A=H0(f,c),H=j.useRef(null),o=j.useRef(null),[s,h]=j.useState(0);j.useEffect(()=>{b&&h(E=>E+1)},[b]),j.useEffect(()=>{n&&n(A==="recalculating")},[A,n]);const S=j.useCallback(()=>{if(H.current){const E=H.current.clientWidth,_=H.current.clientHeight;E>0&&_>0&&(v(E),d(_))}},[v,d]);return j.useEffect(()=>{const E=H.current;if(!E)return;E.addEventListener("load",S);const _=Yc(()=>{E&&E.complete&&S()},a),z=new ResizeObserver(p=>{for(const M of p)M.target===E&&_()});return z.observe(E),()=>{E.removeEventListener("load",S),z.disconnect(),_.cancel()}},[H,s,v,d,a,S]),j.useEffect(()=>{if(b)return;const E=o.current;if(!E)return;const _=()=>{const M=E.clientWidth,R=E.clientHeight;M>0&&R>0&&(v(M),d(R))};_();const z=Yc(_,a),p=new ResizeObserver(()=>z());return p.observe(E),()=>{p.disconnect(),z.cancel()}},[b,v,d,a]),m?null:b?Ou.jsx("img",{ref:H,src:b.src,alt:"",className:l,style:{width:u,height:e},onLoad:S}):Ou.jsx("div",{ref:o,className:l,style:{width:u,height:e,display:"flex",alignItems:"center",justifyContent:"center",color:"#9ca3af"},children:Ou.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",style:{animation:"spin 1s linear infinite"},children:Ou.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})})}class N0 extends HTMLElement{constructor(){super(...arguments);J(this,"root",null);J(this,"slotContents",new Map)}captureSlots(u="[data-slot]"){const e=this.querySelectorAll(`:scope > ${u}`),a=new Set(e);e.forEach(i=>{const f=i.getAttribute("data-slot");f&&this.slotContents.set(f,Array.from(i.childNodes))});const n=Array.from(this.childNodes).filter(i=>!a.has(i));return n.length>0&&this.slotContents.set("__children__",n),this.slotContents}async mountSlot(u,e){var n,i;const a=this.slotContents.get(u);a&&e&&(a.forEach(f=>e.appendChild(f)),await((i=(n=window.Shiny)==null?void 0:n.bindAll)==null?void 0:i.call(n,e)))}get onSlotMount(){return this.mountSlot.bind(this)}getConfig(){const u={};for(const[e,a]of Object.entries(this.dataset))if(a!==void 0)try{u[e]=JSON.parse(a)}catch{u[e]=a}return u}get namespace(){return this.id||void 0}render(){const u=this.constructor.component;return u?Ou.jsx(u,{...this.getConfig()}):(console.error(`${this.constructor.name}: No static component defined`),null)}wrapWithProvider(u){return this.namespace?Ou.jsx(S0,{namespace:this.namespace,children:u}):u}clearContent(){this.innerHTML=""}connectedCallback(){this.captureSlots(),this.clearContent(),this.root=Nc.createRoot(this),this.root.render(this.wrapWithProvider(this.render()))}disconnectedCallback(){var u,e,a;(e=(u=window.Shiny)==null?void 0:u.unbindAll)==null||e.call(u,this),(a=this.root)==null||a.unmount(),this.root=null}}J(N0,"component",null);function km(){window.shinyreact={useSetShinyInput:wm,useShinyBusy:Wm,useShinyInput:Jn,useShinyInputValue:Jm,useShinyOutputStatus:H0,useShinyOutputValue:U0,useShinyMessageHandler:$m,useShinyInitialized:_u,ImageOutput:Fm,MISSING:Se,ShinyModuleProvider:S0,ShinyReactComponentElement:N0,ShinyOutput:Cm,React:Wc,ReactDOM:Dm}}km()})(); diff --git a/pkg-js/package-lock.json b/pkg-js/package-lock.json index 509a12b..8d0e3c9 100644 --- a/pkg-js/package-lock.json +++ b/pkg-js/package-lock.json @@ -14,6 +14,7 @@ "devDependencies": { "@posit/shiny": "^1.11.1", "@testing-library/react": "^16.3.0", + "@types/node": "^26.2.0", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^4.0.0", @@ -1460,6 +1461,16 @@ "@types/sizzle": "*" } }, + "node_modules/@types/node": { + "version": "26.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz", + "integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.3.0" + } + }, "node_modules/@types/react": { "version": "19.2.14", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", @@ -2690,6 +2701,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", diff --git a/pkg-js/package.json b/pkg-js/package.json index 7974b03..8d04344 100644 --- a/pkg-js/package.json +++ b/pkg-js/package.json @@ -15,10 +15,11 @@ }, "devDependencies": { "@posit/shiny": "^1.11.1", + "@testing-library/react": "^16.3.0", + "@types/node": "^26.2.0", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^4.0.0", - "@testing-library/react": "^16.3.0", "jsdom": "^26.1.0", "typescript": "^5.0.0", "vite": "^5.0.0", diff --git a/pkg-js/src/global.ts b/pkg-js/src/global.ts index e5d048a..96de8e4 100644 --- a/pkg-js/src/global.ts +++ b/pkg-js/src/global.ts @@ -48,11 +48,12 @@ declare global { /** * Expose the public global API at `window.shinyreact`. Called once at bundle - * boot. Preserves any pre-bundle assignment (e.g. `window.shinyreact._restore` - * set by the head " }); + }); + + it("logs and returns null on malformed JSON instead of throwing", () => { + const err = vi.spyOn(console, "error").mockImplementation(() => {}); + setConfigTag("{not json"); + expect(readShinyReactConfig()).toBeNull(); + expect(err).toHaveBeenCalled(); + }); +}); + +describe("assertProtocolCompatible", () => { + it("accepts the same major version", () => { + const major = PROTOCOL_VERSION.split(".")[0]; + expect(() => assertProtocolCompatible(`${major}.999`)).not.toThrow(); + }); + + it("throws on a different major version, naming both versions", () => { + expect(() => assertProtocolCompatible("999.0")).toThrowError( + new RegExp(`999\\.0[\\s\\S]*${PROTOCOL_VERSION.replace(".", "\\.")}`), + ); + }); +}); + +describe("PROTOCOL_VERSION parity", () => { + it("matches the Python and R declarations", () => { + // PROTOCOL_VERSION is one contract declared in three languages; this + // parity test pins all three to the same string. Mirrors Python's + // test_protocol_version_matches_js_and_r and R's "protocol version + // matches the JS and Python declarations". + let repoRoot = process.cwd(); + while (!existsSync(join(repoRoot, "pkg-py")) && dirname(repoRoot) !== repoRoot) { + repoRoot = dirname(repoRoot); + } + const pySrc = join(repoRoot, "pkg-py", "src", "shinyreact", "_protocol.py"); + const rSrc = join(repoRoot, "pkg-r", "R", "protocol.R"); + if (!existsSync(pySrc) || !existsSync(rSrc)) { + // Monorepo sources not available — nothing to compare against. + return; + } + const pyMatch = readFileSync(pySrc, "utf8").match( + /PROTOCOL_VERSION = "([^"]+)"/, + ); + const rMatch = readFileSync(rSrc, "utf8").match( + /\.protocol_version <- "([^"]+)"/, + ); + expect(pyMatch?.[1]).toBe(PROTOCOL_VERSION); + expect(rMatch?.[1]).toBe(PROTOCOL_VERSION); + }); +}); diff --git a/pkg-js/src/shiny-react/__tests__/use-shiny-restore.test.tsx b/pkg-js/src/shiny-react/__tests__/use-shiny-restore.test.tsx index ff2a07d..f217441 100644 --- a/pkg-js/src/shiny-react/__tests__/use-shiny-restore.test.tsx +++ b/pkg-js/src/shiny-react/__tests__/use-shiny-restore.test.tsx @@ -17,6 +17,16 @@ function freshWindow(): void { // eslint-disable-next-line @typescript-eslint/no-explicit-any (globalThis as any).window = (globalThis as any).window || {}; delete (globalThis as any).window.shinyreact; + document.getElementById("shinyreact-config")?.remove(); +} + +/** Insert the `#shinyreact-config` tag the way the server emits it. */ +function setConfigTag(payload: object): void { + const el = document.createElement("script"); + el.type = "application/json"; + el.id = "shinyreact-config"; + el.textContent = JSON.stringify(payload).replace(/ { @@ -24,8 +34,8 @@ describe("applyRestoredValues", () => { freshWindow(); }); - it("seeds registry entries from window.shinyreact._restore and replaces it with sentinel", () => { - (window as any).shinyreact = { _restore: { foo: "hello", num: 42 } }; + it("seeds registry entries from the #shinyreact-config tag", () => { + setConfigTag({ protocolVersion: "1.0", restore: { foo: "hello", num: 42 } }); const registry = new InputRegistry(); applyRestoredValues(registry); @@ -38,7 +48,40 @@ describe("applyRestoredValues", () => { }); }); - it("with no _restore set, leaves registry empty and writes empty sentinel", () => { + it("ignores a pre-set window.shinyreact._restore global (config tag is the only channel)", () => { + (window as any).shinyreact = { _restore: { foo: "from-legacy" } }; + const registry = new InputRegistry(); + + applyRestoredValues(registry); + + expect(registry.size()).toBe(0); + expect((window as any).shinyreact._restore).toEqual({ + "-applied": true, + "-values": {}, + }); + }); + + it("config tag without restore writes the empty sentinel", () => { + setConfigTag({ protocolVersion: "1.0" }); + const registry = new InputRegistry(); + + applyRestoredValues(registry); + + expect(registry.size()).toBe(0); + expect((window as any).shinyreact._restore).toEqual({ + "-applied": true, + "-values": {}, + }); + }); + + it("throws on a protocol major-version mismatch, naming both versions", () => { + setConfigTag({ protocolVersion: "999.0", restore: { foo: "hello" } }); + const registry = new InputRegistry(); + + expect(() => applyRestoredValues(registry)).toThrowError(/999\.0/); + }); + + it("with no config tag, leaves registry empty and writes empty sentinel", () => { (window as any).shinyreact = {}; const registry = new InputRegistry(); @@ -61,7 +104,7 @@ describe("applyRestoredValues", () => { }); it("re-running does not clobber the -values snapshot", () => { - (window as any).shinyreact = { _restore: { foo: "hello" } }; + setConfigTag({ protocolVersion: "1.0", restore: { foo: "hello" } }); const registry = new InputRegistry(); applyRestoredValues(registry); @@ -74,7 +117,7 @@ describe("applyRestoredValues", () => { }); it("does not call shiny setInputValue (uses add, not setValue)", () => { - (window as any).shinyreact = { _restore: { foo: "hello" } }; + setConfigTag({ protocolVersion: "1.0", restore: { foo: "hello" } }); const registry = new InputRegistry(); const entry = vi.spyOn(registry, "add"); @@ -87,7 +130,7 @@ describe("applyRestoredValues", () => { }); it("drains pendingSubscribers when seeding via add()", () => { - (window as any).shinyreact = { _restore: { foo: "hello" } }; + setConfigTag({ protocolVersion: "1.0", restore: { foo: "hello" } }); const registry = new InputRegistry(); const subscriber = vi.fn(); // Subscribe before the producer adds — should queue in pendingSubscribers. @@ -100,15 +143,13 @@ describe("applyRestoredValues", () => { }); it("uses a null-prototype object for the -values snapshot to prevent prototype pollution", () => { - // Mirror the wire shape that Python emits via `JSON.parse(...)` — that - // path turns "__proto__" / "constructor" into own data properties, not - // prototype setters. We construct the restore object the same way so - // the test stresses the assignment side of applyRestoredValues, not - // the JS object-literal quirk. - const restore: Record = JSON.parse( - '{"__proto__":"evil","constructor":"x","foo":"ok"}', - ); - (window as any).shinyreact = { _restore: restore }; + // The config tag arrives through JSON.parse, which turns "__proto__" / + // "constructor" into own data properties, not prototype setters. The + // snapshot assignment side of applyRestoredValues must preserve that. + setConfigTag({ + protocolVersion: "1.0", + restore: JSON.parse('{"__proto__":"evil","constructor":"x","foo":"ok"}'), + }); const registry = new InputRegistry(); applyRestoredValues(registry); @@ -166,7 +207,7 @@ describe("useShinyInput + restore", () => { }); it("adopts a restored value as initial render value, ignoring defaultValue", () => { - (window as any).shinyreact = { _restore: { foo: "hello" } }; + setConfigTag({ protocolVersion: "1.0", restore: { foo: "hello" } }); let utils!: ReturnType; act(() => { @@ -187,8 +228,8 @@ describe("useShinyInput + restore", () => { expect(utils.getByTestId("v").textContent).toBe("default"); }); - it("namespaced ids: _restore = {'ns-foo': 'hello'} is adopted by useShinyInput('foo', _, {namespace:'ns'})", () => { - (window as any).shinyreact = { _restore: { "ns-foo": "hello" } }; + it("namespaced ids: restore {'ns-foo': 'hello'} is adopted by useShinyInput('foo', _, {namespace:'ns'})", () => { + setConfigTag({ protocolVersion: "1.0", restore: { "ns-foo": "hello" } }); function NsProbe() { const [v] = useShinyInput("foo", "default", { namespace: "ns" }); diff --git a/pkg-js/src/shiny-react/bookmark.ts b/pkg-js/src/shiny-react/bookmark.ts index 17331a9..524fdc5 100644 --- a/pkg-js/src/shiny-react/bookmark.ts +++ b/pkg-js/src/shiny-react/bookmark.ts @@ -1,49 +1,58 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { type InputRegistry } from "./input-registry"; +import { assertProtocolCompatible, readShinyReactConfig } from "./config"; /** * Adopt bookmarked input values into the input registry. * - * Reads `window.shinyreact._restore` (set by a head "}) - with restore_context_cm(ctx): - dep = _restore_script_tag() - assert dep is not None - head_html = _render_dep_to_head(dep) - # The literal "" sequence inside the JSON payload must be escaped - # so the browser does not see it as ending the script. The escaping replaces - # " (the one closing our injected tag). +def test_config_script_tag_escapes_closing_script_tag() -> None: + values = {"foo": ""} + head_html = _config_html(values) + # Every "<" in the payload is emitted as the JSON escape \\u003c, so the only actual + # is the one closing our injected tag, and no ") == 1 - # And the value still round-trips correctly back through the escape. - assert _extract_restore_payload(head_html) == { - "foo": "" - } + assert "", html, fixed = TRUE))), 1L ) + expect_no_match(html, "