mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
47 lines
268 KiB
JavaScript
47 lines
268 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();var du={exports:{}},Gl={},fu={exports:{}},Y={};/**
|
||
* @license React
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Fr=Symbol.for("react.element"),Od=Symbol.for("react.portal"),Ad=Symbol.for("react.fragment"),Fd=Symbol.for("react.strict_mode"),Md=Symbol.for("react.profiler"),Bd=Symbol.for("react.provider"),Hd=Symbol.for("react.context"),Ud=Symbol.for("react.forward_ref"),Wd=Symbol.for("react.suspense"),Vd=Symbol.for("react.memo"),Qd=Symbol.for("react.lazy"),Wa=Symbol.iterator;function Kd(e){return e===null||typeof e!="object"?null:(e=Wa&&e[Wa]||e["@@iterator"],typeof e=="function"?e:null)}var pu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hu=Object.assign,mu={};function Wn(e,t,n){this.props=e,this.context=t,this.refs=mu,this.updater=n||pu}Wn.prototype.isReactComponent={};Wn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Wn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gu(){}gu.prototype=Wn.prototype;function Ki(e,t,n){this.props=e,this.context=t,this.refs=mu,this.updater=n||pu}var Xi=Ki.prototype=new gu;Xi.constructor=Ki;hu(Xi,Wn.prototype);Xi.isPureReactComponent=!0;var Va=Array.isArray,vu=Object.prototype.hasOwnProperty,Ji={current:null},yu={key:!0,ref:!0,__self:!0,__source:!0};function xu(e,t,n){var r,l={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)vu.call(t,r)&&!yu.hasOwnProperty(r)&&(l[r]=t[r]);var o=arguments.length-2;if(o===1)l.children=n;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];l.children=u}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)l[r]===void 0&&(l[r]=o[r]);return{$$typeof:Fr,type:e,key:i,ref:a,props:l,_owner:Ji.current}}function Xd(e,t){return{$$typeof:Fr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function qi(e){return typeof e=="object"&&e!==null&&e.$$typeof===Fr}function Jd(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Qa=/\/+/g;function Ss(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Jd(""+e.key):t.toString(36)}function fl(e,t,n,r,l){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Fr:case Od:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+Ss(a,0):r,Va(l)?(n="",e!=null&&(n=e.replace(Qa,"$&/")+"/"),fl(l,t,n,"",function(c){return c})):l!=null&&(qi(l)&&(l=Xd(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(Qa,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",Va(e))for(var o=0;o<e.length;o++){i=e[o];var u=r+Ss(i,o);a+=fl(i,t,n,u,l)}else if(u=Kd(e),typeof u=="function")for(e=u.call(e),o=0;!(i=e.next()).done;)i=i.value,u=r+Ss(i,o++),a+=fl(i,t,n,u,l);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Kr(e,t,n){if(e==null)return e;var r=[],l=0;return fl(e,r,"","",function(i){return t.call(n,i,l++)}),r}function qd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Fe={current:null},pl={transition:null},Gd={ReactCurrentDispatcher:Fe,ReactCurrentBatchConfig:pl,ReactCurrentOwner:Ji};function wu(){throw Error("act(...) is not supported in production builds of React.")}Y.Children={map:Kr,forEach:function(e,t,n){Kr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Kr(e,function(){t++}),t},toArray:function(e){return Kr(e,function(t){return t})||[]},only:function(e){if(!qi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Y.Component=Wn;Y.Fragment=Ad;Y.Profiler=Md;Y.PureComponent=Ki;Y.StrictMode=Fd;Y.Suspense=Wd;Y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gd;Y.act=wu;Y.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=hu({},e.props),l=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Ji.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)vu.call(t,u)&&!yu.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:Fr,type:e.type,key:l,ref:i,props:r,_owner:a}};Y.createContext=function(e){return e={$$typeof:Hd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Bd,_context:e},e.Consumer=e};Y.createElement=xu;Y.createFactory=function(e){var t=xu.bind(null,e);return t.type=e,t};Y.createRef=function(){return{current:null}};Y.forwardRef=function(e){return{$$typeof:Ud,render:e}};Y.isValidElement=qi;Y.lazy=function(e){return{$$typeof:Qd,_payload:{_status:-1,_result:e},_init:qd}};Y.memo=function(e,t){return{$$typeof:Vd,type:e,compare:t===void 0?null:t}};Y.startTransition=function(e){var t=pl.transition;pl.transition={};try{e()}finally{pl.transition=t}};Y.unstable_act=wu;Y.useCallback=function(e,t){return Fe.current.useCallback(e,t)};Y.useContext=function(e){return Fe.current.useContext(e)};Y.useDebugValue=function(){};Y.useDeferredValue=function(e){return Fe.current.useDeferredValue(e)};Y.useEffect=function(e,t){return Fe.current.useEffect(e,t)};Y.useId=function(){return Fe.current.useId()};Y.useImperativeHandle=function(e,t,n){return Fe.current.useImperativeHandle(e,t,n)};Y.useInsertionEffect=function(e,t){return Fe.current.useInsertionEffect(e,t)};Y.useLayoutEffect=function(e,t){return Fe.current.useLayoutEffect(e,t)};Y.useMemo=function(e,t){return Fe.current.useMemo(e,t)};Y.useReducer=function(e,t,n){return Fe.current.useReducer(e,t,n)};Y.useRef=function(e){return Fe.current.useRef(e)};Y.useState=function(e){return Fe.current.useState(e)};Y.useSyncExternalStore=function(e,t,n){return Fe.current.useSyncExternalStore(e,t,n)};Y.useTransition=function(){return Fe.current.useTransition()};Y.version="18.3.1";fu.exports=Y;var f=fu.exports;/**
|
||
* @license React
|
||
* react-jsx-runtime.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Yd=f,Zd=Symbol.for("react.element"),ef=Symbol.for("react.fragment"),tf=Object.prototype.hasOwnProperty,nf=Yd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rf={key:!0,ref:!0,__self:!0,__source:!0};function ku(e,t,n){var r,l={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)tf.call(t,r)&&!rf.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:Zd,type:e,key:i,ref:a,props:l,_owner:nf.current}}Gl.Fragment=ef;Gl.jsx=ku;Gl.jsxs=ku;du.exports=Gl;var s=du.exports,ju={exports:{}},Ge={},Su={exports:{}},Nu={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/(function(e){function t(R,T){var F=R.length;R.push(T);e:for(;0<F;){var X=F-1>>>1,H=R[X];if(0<l(H,T))R[X]=T,R[F]=H,F=X;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var T=R[0],F=R.pop();if(F!==T){R[0]=F;e:for(var X=0,H=R.length,N=H>>>1;X<N;){var O=2*(X+1)-1,B=R[O],M=O+1,W=R[M];if(0>l(B,F))M<H&&0>l(W,B)?(R[X]=W,R[M]=F,X=M):(R[X]=B,R[O]=F,X=O);else if(M<H&&0>l(W,F))R[X]=W,R[M]=F,X=M;else break e}}return T}function l(R,T){var F=R.sortIndex-T.sortIndex;return F!==0?F:R.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],g=1,m=null,h=3,y=!1,x=!1,k=!1,j=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(R){for(var T=n(c);T!==null;){if(T.callback===null)r(c);else if(T.startTime<=R)r(c),T.sortIndex=T.expirationTime,t(u,T);else break;T=n(c)}}function w(R){if(k=!1,v(R),!x)if(n(u)!==null)x=!0,ve(S);else{var T=n(c);T!==null&&ie(w,T.startTime-R)}}function S(R,T){x=!1,k&&(k=!1,p(_),_=-1),y=!0;var F=h;try{for(v(T),m=n(u);m!==null&&(!(m.expirationTime>T)||R&&!Q());){var X=m.callback;if(typeof X=="function"){m.callback=null,h=m.priorityLevel;var H=X(m.expirationTime<=T);T=e.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),v(T)}else r(u);m=n(u)}if(m!==null)var N=!0;else{var O=n(c);O!==null&&ie(w,O.startTime-T),N=!1}return N}finally{m=null,h=F,y=!1}}var P=!1,C=null,_=-1,I=5,L=-1;function Q(){return!(e.unstable_now()-L<I)}function ne(){if(C!==null){var R=e.unstable_now();L=R;var T=!0;try{T=C(!0,R)}finally{T?Z():(P=!1,C=null)}}else P=!1}var Z;if(typeof d=="function")Z=function(){d(ne)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,pe=se.port2;se.port1.onmessage=ne,Z=function(){pe.postMessage(null)}}else Z=function(){j(ne,0)};function ve(R){C=R,P||(P=!0,Z())}function ie(R,T){_=j(function(){R(e.unstable_now())},T)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,ve(S))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var T=3;break;default:T=h}var F=h;h=T;try{return R()}finally{h=F}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,T){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var F=h;h=R;try{return T()}finally{h=F}},e.unstable_scheduleCallback=function(R,T,F){var X=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?X+F:X):F=X,R){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=F+H,R={id:g++,callback:T,priorityLevel:R,startTime:F,expirationTime:H,sortIndex:-1},F>X?(R.sortIndex=F,t(c,R),n(u)===null&&R===n(c)&&(k?(p(_),_=-1):k=!0,ie(w,F-X))):(R.sortIndex=H,t(u,R),x||y||(x=!0,ve(S))),R},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(R){var T=h;return function(){var F=h;h=T;try{return R.apply(this,arguments)}finally{h=F}}}})(Nu);Su.exports=Nu;var lf=Su.exports;/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var sf=f,qe=lf;function b(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var _u=new Set,jr={};function dn(e,t){On(e,t),On(e+"Capture",t)}function On(e,t){for(jr[e]=t,e=0;e<t.length;e++)_u.add(t[e])}var St=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zs=Object.prototype.hasOwnProperty,af=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ka={},Xa={};function of(e){return Zs.call(Xa,e)?!0:Zs.call(Ka,e)?!1:af.test(e)?Xa[e]=!0:(Ka[e]=!0,!1)}function uf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function cf(e,t,n,r){if(t===null||typeof t>"u"||uf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Me(e,t,n,r,l,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Le={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Le[e]=new Me(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Le[t]=new Me(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Le[e]=new Me(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Le[e]=new Me(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Le[e]=new Me(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Le[e]=new Me(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Le[e]=new Me(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Le[e]=new Me(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Le[e]=new Me(e,5,!1,e.toLowerCase(),null,!1,!1)});var Gi=/[\-:]([a-z])/g;function Yi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Gi,Yi);Le[t]=new Me(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Gi,Yi);Le[t]=new Me(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Gi,Yi);Le[t]=new Me(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Le[e]=new Me(e,1,!1,e.toLowerCase(),null,!1,!1)});Le.xlinkHref=new Me("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Le[e]=new Me(e,1,!1,e.toLowerCase(),null,!0,!0)});function Zi(e,t,n,r){var l=Le.hasOwnProperty(t)?Le[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(cf(t,n,l,r)&&(n=null),r||l===null?of(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,r=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Et=sf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xr=Symbol.for("react.element"),yn=Symbol.for("react.portal"),xn=Symbol.for("react.fragment"),ea=Symbol.for("react.strict_mode"),ei=Symbol.for("react.profiler"),Cu=Symbol.for("react.provider"),Eu=Symbol.for("react.context"),ta=Symbol.for("react.forward_ref"),ti=Symbol.for("react.suspense"),ni=Symbol.for("react.suspense_list"),na=Symbol.for("react.memo"),bt=Symbol.for("react.lazy"),Tu=Symbol.for("react.offscreen"),Ja=Symbol.iterator;function Yn(e){return e===null||typeof e!="object"?null:(e=Ja&&e[Ja]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Object.assign,Ns;function or(e){if(Ns===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ns=t&&t[1]||""}return`
|
||
`+Ns+e}var _s=!1;function Cs(e,t){if(!e||_s)return"";_s=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var l=c.stack.split(`
|
||
`),i=r.stack.split(`
|
||
`),a=l.length-1,o=i.length-1;1<=a&&0<=o&&l[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(l[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||l[a]!==i[o]){var u=`
|
||
`+l[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{_s=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?or(e):""}function df(e){switch(e.tag){case 5:return or(e.type);case 16:return or("Lazy");case 13:return or("Suspense");case 19:return or("SuspenseList");case 0:case 2:case 15:return e=Cs(e.type,!1),e;case 11:return e=Cs(e.type.render,!1),e;case 1:return e=Cs(e.type,!0),e;default:return""}}function ri(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case xn:return"Fragment";case yn:return"Portal";case ei:return"Profiler";case ea:return"StrictMode";case ti:return"Suspense";case ni:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Eu:return(e.displayName||"Context")+".Consumer";case Cu:return(e._context.displayName||"Context")+".Provider";case ta:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case na:return t=e.displayName||null,t!==null?t:ri(e.type)||"Memo";case bt:t=e._payload,e=e._init;try{return ri(e(t))}catch{}}return null}function ff(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ri(t);case 8:return t===ea?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Wt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pf(e){var t=Pu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jr(e){e._valueTracker||(e._valueTracker=pf(e))}function bu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Pu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function _l(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function li(e,t){var n=t.checked;return ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qa(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Wt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Lu(e,t){t=t.checked,t!=null&&Zi(e,"checked",t,!1)}function si(e,t){Lu(e,t);var n=Wt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ii(e,t.type,n):t.hasOwnProperty("defaultValue")&&ii(e,t.type,Wt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ga(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ii(e,t,n){(t!=="number"||_l(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ur=Array.isArray;function bn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Wt(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,r&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function ai(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(b(91));return ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ya(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(b(92));if(ur(n)){if(1<n.length)throw Error(b(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Wt(n)}}function zu(e,t){var n=Wt(t.value),r=Wt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Za(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ru(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function oi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ru(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var qr,Du=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(qr=qr||document.createElement("div"),qr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=qr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Sr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},hf=["Webkit","ms","Moz","O"];Object.keys(pr).forEach(function(e){hf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pr[t]=pr[e]})});function $u(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||pr.hasOwnProperty(e)&&pr[e]?(""+t).trim():t+"px"}function Iu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=$u(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var mf=ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ui(e,t){if(t){if(mf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(b(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(b(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(b(61))}if(t.style!=null&&typeof t.style!="object")throw Error(b(62))}}function ci(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var di=null;function ra(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fi=null,Ln=null,zn=null;function eo(e){if(e=Hr(e)){if(typeof fi!="function")throw Error(b(280));var t=e.stateNode;t&&(t=ns(t),fi(e.stateNode,e.type,t))}}function Ou(e){Ln?zn?zn.push(e):zn=[e]:Ln=e}function Au(){if(Ln){var e=Ln,t=zn;if(zn=Ln=null,eo(e),t)for(e=0;e<t.length;e++)eo(t[e])}}function Fu(e,t){return e(t)}function Mu(){}var Es=!1;function Bu(e,t,n){if(Es)return e(t,n);Es=!0;try{return Fu(e,t,n)}finally{Es=!1,(Ln!==null||zn!==null)&&(Mu(),Au())}}function Nr(e,t){var n=e.stateNode;if(n===null)return null;var r=ns(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(b(231,t,typeof n));return n}var pi=!1;if(St)try{var Zn={};Object.defineProperty(Zn,"passive",{get:function(){pi=!0}}),window.addEventListener("test",Zn,Zn),window.removeEventListener("test",Zn,Zn)}catch{pi=!1}function gf(e,t,n,r,l,i,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(g){this.onError(g)}}var hr=!1,Cl=null,El=!1,hi=null,vf={onError:function(e){hr=!0,Cl=e}};function yf(e,t,n,r,l,i,a,o,u){hr=!1,Cl=null,gf.apply(vf,arguments)}function xf(e,t,n,r,l,i,a,o,u){if(yf.apply(this,arguments),hr){if(hr){var c=Cl;hr=!1,Cl=null}else throw Error(b(198));El||(El=!0,hi=c)}}function fn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Hu(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function to(e){if(fn(e)!==e)throw Error(b(188))}function wf(e){var t=e.alternate;if(!t){if(t=fn(e),t===null)throw Error(b(188));return t!==e?null:e}for(var n=e,r=t;;){var l=n.return;if(l===null)break;var i=l.alternate;if(i===null){if(r=l.return,r!==null){n=r;continue}break}if(l.child===i.child){for(i=l.child;i;){if(i===n)return to(l),e;if(i===r)return to(l),t;i=i.sibling}throw Error(b(188))}if(n.return!==r.return)n=l,r=i;else{for(var a=!1,o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a)throw Error(b(189))}}if(n.alternate!==r)throw Error(b(190))}if(n.tag!==3)throw Error(b(188));return n.stateNode.current===n?e:t}function Uu(e){return e=wf(e),e!==null?Wu(e):null}function Wu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Wu(e);if(t!==null)return t;e=e.sibling}return null}var Vu=qe.unstable_scheduleCallback,no=qe.unstable_cancelCallback,kf=qe.unstable_shouldYield,jf=qe.unstable_requestPaint,we=qe.unstable_now,Sf=qe.unstable_getCurrentPriorityLevel,la=qe.unstable_ImmediatePriority,Qu=qe.unstable_UserBlockingPriority,Tl=qe.unstable_NormalPriority,Nf=qe.unstable_LowPriority,Ku=qe.unstable_IdlePriority,Yl=null,gt=null;function _f(e){if(gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(Yl,e,void 0,(e.current.flags&128)===128)}catch{}}var ct=Math.clz32?Math.clz32:Tf,Cf=Math.log,Ef=Math.LN2;function Tf(e){return e>>>=0,e===0?32:31-(Cf(e)/Ef|0)|0}var Gr=64,Yr=4194304;function cr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=cr(o):(i&=a,i!==0&&(r=cr(i)))}else a=n&~l,a!==0?r=cr(a):i!==0&&(r=cr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ct(t),l=1<<n,r|=e[n],t&=~l;return r}function Pf(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-ct(i),o=1<<a,u=l[a];u===-1?(!(o&n)||o&r)&&(l[a]=Pf(o,t)):u<=t&&(e.expiredLanes|=o),i&=~o}}function mi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Xu(){var e=Gr;return Gr<<=1,!(Gr&4194240)&&(Gr=64),e}function Ts(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Mr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function Lf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-ct(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function sa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ct(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var le=0;function Ju(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qu,ia,Gu,Yu,Zu,gi=!1,Zr=[],It=null,Ot=null,At=null,_r=new Map,Cr=new Map,zt=[],zf="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ro(e,t){switch(e){case"focusin":case"focusout":It=null;break;case"dragenter":case"dragleave":Ot=null;break;case"mouseover":case"mouseout":At=null;break;case"pointerover":case"pointerout":_r.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cr.delete(t.pointerId)}}function er(e,t,n,r,l,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[l]},t!==null&&(t=Hr(t),t!==null&&ia(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Rf(e,t,n,r,l){switch(t){case"focusin":return It=er(It,e,t,n,r,l),!0;case"dragenter":return Ot=er(Ot,e,t,n,r,l),!0;case"mouseover":return At=er(At,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return _r.set(i,er(_r.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,Cr.set(i,er(Cr.get(i)||null,e,t,n,r,l)),!0}return!1}function ec(e){var t=Zt(e.target);if(t!==null){var n=fn(t);if(n!==null){if(t=n.tag,t===13){if(t=Hu(n),t!==null){e.blockedOn=t,Zu(e.priority,function(){Gu(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function hl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);di=r,n.target.dispatchEvent(r),di=null}else return t=Hr(n),t!==null&&ia(t),e.blockedOn=n,!1;t.shift()}return!0}function lo(e,t,n){hl(e)&&n.delete(t)}function Df(){gi=!1,It!==null&&hl(It)&&(It=null),Ot!==null&&hl(Ot)&&(Ot=null),At!==null&&hl(At)&&(At=null),_r.forEach(lo),Cr.forEach(lo)}function tr(e,t){e.blockedOn===t&&(e.blockedOn=null,gi||(gi=!0,qe.unstable_scheduleCallback(qe.unstable_NormalPriority,Df)))}function Er(e){function t(l){return tr(l,e)}if(0<Zr.length){tr(Zr[0],e);for(var n=1;n<Zr.length;n++){var r=Zr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(It!==null&&tr(It,e),Ot!==null&&tr(Ot,e),At!==null&&tr(At,e),_r.forEach(t),Cr.forEach(t),n=0;n<zt.length;n++)r=zt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<zt.length&&(n=zt[0],n.blockedOn===null);)ec(n),n.blockedOn===null&&zt.shift()}var Rn=Et.ReactCurrentBatchConfig,bl=!0;function $f(e,t,n,r){var l=le,i=Rn.transition;Rn.transition=null;try{le=1,aa(e,t,n,r)}finally{le=l,Rn.transition=i}}function If(e,t,n,r){var l=le,i=Rn.transition;Rn.transition=null;try{le=4,aa(e,t,n,r)}finally{le=l,Rn.transition=i}}function aa(e,t,n,r){if(bl){var l=vi(e,t,n,r);if(l===null)As(e,t,r,Ll,n),ro(e,r);else if(Rf(l,e,t,n,r))r.stopPropagation();else if(ro(e,r),t&4&&-1<zf.indexOf(e)){for(;l!==null;){var i=Hr(l);if(i!==null&&qu(i),i=vi(e,t,n,r),i===null&&As(e,t,r,Ll,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else As(e,t,r,null,n)}}var Ll=null;function vi(e,t,n,r){if(Ll=null,e=ra(r),e=Zt(e),e!==null)if(t=fn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Hu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ll=e,null}function tc(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Sf()){case la:return 1;case Qu:return 4;case Tl:case Nf:return 16;case Ku:return 536870912;default:return 16}default:return 16}}var Dt=null,oa=null,ml=null;function nc(){if(ml)return ml;var e,t=oa,n=t.length,r,l="value"in Dt?Dt.value:Dt.textContent,i=l.length;for(e=0;e<n&&t[e]===l[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===l[i-r];r++);return ml=l.slice(e,1<r?1-r:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function el(){return!0}function so(){return!1}function Ye(e){function t(n,r,l,i,a){this._reactName=n,this._targetInst=l,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?el:so,this.isPropagationStopped=so,this}return ge(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=el)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=el)},persist:function(){},isPersistent:el}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ua=Ye(Vn),Br=ge({},Vn,{view:0,detail:0}),Of=Ye(Br),Ps,bs,nr,Zl=ge({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ca,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nr&&(nr&&e.type==="mousemove"?(Ps=e.screenX-nr.screenX,bs=e.screenY-nr.screenY):bs=Ps=0,nr=e),Ps)},movementY:function(e){return"movementY"in e?e.movementY:bs}}),io=Ye(Zl),Af=ge({},Zl,{dataTransfer:0}),Ff=Ye(Af),Mf=ge({},Br,{relatedTarget:0}),Ls=Ye(Mf),Bf=ge({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Hf=Ye(Bf),Uf=ge({},Vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wf=Ye(Uf),Vf=ge({},Vn,{data:0}),ao=Ye(Vf),Qf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kf={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Xf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Jf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xf[e])?!!t[e]:!1}function ca(){return Jf}var qf=ge({},Br,{key:function(e){if(e.key){var t=Qf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ca,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gf=Ye(qf),Yf=ge({},Zl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oo=Ye(Yf),Zf=ge({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ca}),ep=Ye(Zf),tp=ge({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),np=Ye(tp),rp=ge({},Zl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),lp=Ye(rp),sp=[9,13,27,32],da=St&&"CompositionEvent"in window,mr=null;St&&"documentMode"in document&&(mr=document.documentMode);var ip=St&&"TextEvent"in window&&!mr,rc=St&&(!da||mr&&8<mr&&11>=mr),uo=" ",co=!1;function lc(e,t){switch(e){case"keyup":return sp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wn=!1;function ap(e,t){switch(e){case"compositionend":return sc(t);case"keypress":return t.which!==32?null:(co=!0,uo);case"textInput":return e=t.data,e===uo&&co?null:e;default:return null}}function op(e,t){if(wn)return e==="compositionend"||!da&&lc(e,t)?(e=nc(),ml=oa=Dt=null,wn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return rc&&t.locale!=="ko"?null:t.data;default:return null}}var up={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function fo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!up[e.type]:t==="textarea"}function ic(e,t,n,r){Ou(r),t=zl(t,"onChange"),0<t.length&&(n=new ua("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var gr=null,Tr=null;function cp(e){vc(e,0)}function es(e){var t=Sn(e);if(bu(t))return e}function dp(e,t){if(e==="change")return t}var ac=!1;if(St){var zs;if(St){var Rs="oninput"in document;if(!Rs){var po=document.createElement("div");po.setAttribute("oninput","return;"),Rs=typeof po.oninput=="function"}zs=Rs}else zs=!1;ac=zs&&(!document.documentMode||9<document.documentMode)}function ho(){gr&&(gr.detachEvent("onpropertychange",oc),Tr=gr=null)}function oc(e){if(e.propertyName==="value"&&es(Tr)){var t=[];ic(t,Tr,e,ra(e)),Bu(cp,t)}}function fp(e,t,n){e==="focusin"?(ho(),gr=t,Tr=n,gr.attachEvent("onpropertychange",oc)):e==="focusout"&&ho()}function pp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return es(Tr)}function hp(e,t){if(e==="click")return es(t)}function mp(e,t){if(e==="input"||e==="change")return es(t)}function gp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ft=typeof Object.is=="function"?Object.is:gp;function Pr(e,t){if(ft(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var l=n[r];if(!Zs.call(t,l)||!ft(e[l],t[l]))return!1}return!0}function mo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function go(e,t){var n=mo(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=mo(n)}}function uc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cc(){for(var e=window,t=_l();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=_l(e.document)}return t}function fa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function vp(e){var t=cc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uc(n.ownerDocument.documentElement,n)){if(r!==null&&fa(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=go(n,i);var a=go(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var yp=St&&"documentMode"in document&&11>=document.documentMode,kn=null,yi=null,vr=null,xi=!1;function vo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xi||kn==null||kn!==_l(r)||(r=kn,"selectionStart"in r&&fa(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),vr&&Pr(vr,r)||(vr=r,r=zl(yi,"onSelect"),0<r.length&&(t=new ua("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=kn)))}function tl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jn={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionend:tl("Transition","TransitionEnd")},Ds={},dc={};St&&(dc=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function ts(e){if(Ds[e])return Ds[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dc)return Ds[e]=t[n];return e}var fc=ts("animationend"),pc=ts("animationiteration"),hc=ts("animationstart"),mc=ts("transitionend"),gc=new Map,yo="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Qt(e,t){gc.set(e,t),dn(t,[e])}for(var $s=0;$s<yo.length;$s++){var Is=yo[$s],xp=Is.toLowerCase(),wp=Is[0].toUpperCase()+Is.slice(1);Qt(xp,"on"+wp)}Qt(fc,"onAnimationEnd");Qt(pc,"onAnimationIteration");Qt(hc,"onAnimationStart");Qt("dblclick","onDoubleClick");Qt("focusin","onFocus");Qt("focusout","onBlur");Qt(mc,"onTransitionEnd");On("onMouseEnter",["mouseout","mouseover"]);On("onMouseLeave",["mouseout","mouseover"]);On("onPointerEnter",["pointerout","pointerover"]);On("onPointerLeave",["pointerout","pointerover"]);dn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));dn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));dn("onBeforeInput",["compositionend","keypress","textInput","paste"]);dn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));dn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));dn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),kp=new Set("cancel close invalid load scroll toggle".split(" ").concat(dr));function xo(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,xf(r,t,void 0,e),e.currentTarget=null}function vc(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],l=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==i&&l.isPropagationStopped())break e;xo(l,o,c),i=u}else for(a=0;a<r.length;a++){if(o=r[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==i&&l.isPropagationStopped())break e;xo(l,o,c),i=u}}}if(El)throw e=hi,El=!1,hi=null,e}function ue(e,t){var n=t[Ni];n===void 0&&(n=t[Ni]=new Set);var r=e+"__bubble";n.has(r)||(yc(t,e,2,!1),n.add(r))}function Os(e,t,n){var r=0;t&&(r|=4),yc(n,e,r,t)}var nl="_reactListening"+Math.random().toString(36).slice(2);function br(e){if(!e[nl]){e[nl]=!0,_u.forEach(function(n){n!=="selectionchange"&&(kp.has(n)||Os(n,!1,e),Os(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nl]||(t[nl]=!0,Os("selectionchange",!1,t))}}function yc(e,t,n,r){switch(tc(t)){case 1:var l=$f;break;case 4:l=If;break;default:l=aa}n=l.bind(null,t,n,e),l=void 0,!pi||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),r?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function As(e,t,n,r,l){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===l||o.nodeType===8&&o.parentNode===l)break;if(a===4)for(a=r.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===l||u.nodeType===8&&u.parentNode===l))return;a=a.return}for(;o!==null;){if(a=Zt(o),a===null)return;if(u=a.tag,u===5||u===6){r=i=a;continue e}o=o.parentNode}}r=r.return}Bu(function(){var c=i,g=ra(n),m=[];e:{var h=gc.get(e);if(h!==void 0){var y=ua,x=e;switch(e){case"keypress":if(gl(n)===0)break e;case"keydown":case"keyup":y=Gf;break;case"focusin":x="focus",y=Ls;break;case"focusout":x="blur",y=Ls;break;case"beforeblur":case"afterblur":y=Ls;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":y=io;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Ff;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=ep;break;case fc:case pc:case hc:y=Hf;break;case mc:y=np;break;case"scroll":y=Of;break;case"wheel":y=lp;break;case"copy":case"cut":case"paste":y=Wf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=oo}var k=(t&4)!==0,j=!k&&e==="scroll",p=k?h!==null?h+"Capture":null:h;k=[];for(var d=c,v;d!==null;){v=d;var w=v.stateNode;if(v.tag===5&&w!==null&&(v=w,p!==null&&(w=Nr(d,p),w!=null&&k.push(Lr(d,w,v)))),j)break;d=d.return}0<k.length&&(h=new y(h,x,null,n,g),m.push({event:h,listeners:k}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",h&&n!==di&&(x=n.relatedTarget||n.fromElement)&&(Zt(x)||x[Nt]))break e;if((y||h)&&(h=g.window===g?g:(h=g.ownerDocument)?h.defaultView||h.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=c,x=x?Zt(x):null,x!==null&&(j=fn(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=c),y!==x)){if(k=io,w="onMouseLeave",p="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(k=oo,w="onPointerLeave",p="onPointerEnter",d="pointer"),j=y==null?h:Sn(y),v=x==null?h:Sn(x),h=new k(w,d+"leave",y,n,g),h.target=j,h.relatedTarget=v,w=null,Zt(g)===c&&(k=new k(p,d+"enter",x,n,g),k.target=v,k.relatedTarget=j,w=k),j=w,y&&x)t:{for(k=y,p=x,d=0,v=k;v;v=vn(v))d++;for(v=0,w=p;w;w=vn(w))v++;for(;0<d-v;)k=vn(k),d--;for(;0<v-d;)p=vn(p),v--;for(;d--;){if(k===p||p!==null&&k===p.alternate)break t;k=vn(k),p=vn(p)}k=null}else k=null;y!==null&&wo(m,h,y,k,!1),x!==null&&j!==null&&wo(m,j,x,k,!0)}}e:{if(h=c?Sn(c):window,y=h.nodeName&&h.nodeName.toLowerCase(),y==="select"||y==="input"&&h.type==="file")var S=dp;else if(fo(h))if(ac)S=mp;else{S=pp;var P=fp}else(y=h.nodeName)&&y.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=hp);if(S&&(S=S(e,c))){ic(m,S,n,g);break e}P&&P(e,h,c),e==="focusout"&&(P=h._wrapperState)&&P.controlled&&h.type==="number"&&ii(h,"number",h.value)}switch(P=c?Sn(c):window,e){case"focusin":(fo(P)||P.contentEditable==="true")&&(kn=P,yi=c,vr=null);break;case"focusout":vr=yi=kn=null;break;case"mousedown":xi=!0;break;case"contextmenu":case"mouseup":case"dragend":xi=!1,vo(m,n,g);break;case"selectionchange":if(yp)break;case"keydown":case"keyup":vo(m,n,g)}var C;if(da)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else wn?lc(e,n)&&(_="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(rc&&n.locale!=="ko"&&(wn||_!=="onCompositionStart"?_==="onCompositionEnd"&&wn&&(C=nc()):(Dt=g,oa="value"in Dt?Dt.value:Dt.textContent,wn=!0)),P=zl(c,_),0<P.length&&(_=new ao(_,e,null,n,g),m.push({event:_,listeners:P}),C?_.data=C:(C=sc(n),C!==null&&(_.data=C)))),(C=ip?ap(e,n):op(e,n))&&(c=zl(c,"onBeforeInput"),0<c.length&&(g=new ao("onBeforeInput","beforeinput",null,n,g),m.push({event:g,listeners:c}),g.data=C))}vc(m,t)})}function Lr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zl(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=Nr(e,n),i!=null&&r.unshift(Lr(e,i,l)),i=Nr(e,t),i!=null&&r.push(Lr(e,i,l))),e=e.return}return r}function vn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function wo(e,t,n,r,l){for(var i=t._reactName,a=[];n!==null&&n!==r;){var o=n,u=o.alternate,c=o.stateNode;if(u!==null&&u===r)break;o.tag===5&&c!==null&&(o=c,l?(u=Nr(n,i),u!=null&&a.unshift(Lr(n,u,o))):l||(u=Nr(n,i),u!=null&&a.push(Lr(n,u,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var jp=/\r\n?/g,Sp=/\u0000|\uFFFD/g;function ko(e){return(typeof e=="string"?e:""+e).replace(jp,`
|
||
`).replace(Sp,"")}function rl(e,t,n){if(t=ko(t),ko(e)!==t&&n)throw Error(b(425))}function Rl(){}var wi=null,ki=null;function ji(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Si=typeof setTimeout=="function"?setTimeout:void 0,Np=typeof clearTimeout=="function"?clearTimeout:void 0,jo=typeof Promise=="function"?Promise:void 0,_p=typeof queueMicrotask=="function"?queueMicrotask:typeof jo<"u"?function(e){return jo.resolve(null).then(e).catch(Cp)}:Si;function Cp(e){setTimeout(function(){throw e})}function Fs(e,t){var n=t,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(r===0){e.removeChild(l),Er(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);Er(t)}function Ft(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function So(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Qn=Math.random().toString(36).slice(2),mt="__reactFiber$"+Qn,zr="__reactProps$"+Qn,Nt="__reactContainer$"+Qn,Ni="__reactEvents$"+Qn,Ep="__reactListeners$"+Qn,Tp="__reactHandles$"+Qn;function Zt(e){var t=e[mt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Nt]||n[mt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=So(e);e!==null;){if(n=e[mt])return n;e=So(e)}return t}e=n,n=e.parentNode}return null}function Hr(e){return e=e[mt]||e[Nt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Sn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(b(33))}function ns(e){return e[zr]||null}var _i=[],Nn=-1;function Kt(e){return{current:e}}function ce(e){0>Nn||(e.current=_i[Nn],_i[Nn]=null,Nn--)}function ae(e,t){Nn++,_i[Nn]=e.current,e.current=t}var Vt={},Ie=Kt(Vt),Ue=Kt(!1),sn=Vt;function An(e,t){var n=e.type.contextTypes;if(!n)return Vt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function We(e){return e=e.childContextTypes,e!=null}function Dl(){ce(Ue),ce(Ie)}function No(e,t,n){if(Ie.current!==Vt)throw Error(b(168));ae(Ie,t),ae(Ue,n)}function xc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(b(108,ff(e)||"Unknown",l));return ge({},n,r)}function $l(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vt,sn=Ie.current,ae(Ie,e),ae(Ue,Ue.current),!0}function _o(e,t,n){var r=e.stateNode;if(!r)throw Error(b(169));n?(e=xc(e,t,sn),r.__reactInternalMemoizedMergedChildContext=e,ce(Ue),ce(Ie),ae(Ie,e)):ce(Ue),ae(Ue,n)}var xt=null,rs=!1,Ms=!1;function wc(e){xt===null?xt=[e]:xt.push(e)}function Pp(e){rs=!0,wc(e)}function Xt(){if(!Ms&&xt!==null){Ms=!0;var e=0,t=le;try{var n=xt;for(le=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}xt=null,rs=!1}catch(l){throw xt!==null&&(xt=xt.slice(e+1)),Vu(la,Xt),l}finally{le=t,Ms=!1}}return null}var _n=[],Cn=0,Il=null,Ol=0,et=[],tt=0,an=null,wt=1,kt="";function Gt(e,t){_n[Cn++]=Ol,_n[Cn++]=Il,Il=e,Ol=t}function kc(e,t,n){et[tt++]=wt,et[tt++]=kt,et[tt++]=an,an=e;var r=wt;e=kt;var l=32-ct(r)-1;r&=~(1<<l),n+=1;var i=32-ct(t)+l;if(30<i){var a=l-l%5;i=(r&(1<<a)-1).toString(32),r>>=a,l-=a,wt=1<<32-ct(t)+l|n<<l|r,kt=i+e}else wt=1<<i|n<<l|r,kt=e}function pa(e){e.return!==null&&(Gt(e,1),kc(e,1,0))}function ha(e){for(;e===Il;)Il=_n[--Cn],_n[Cn]=null,Ol=_n[--Cn],_n[Cn]=null;for(;e===an;)an=et[--tt],et[tt]=null,kt=et[--tt],et[tt]=null,wt=et[--tt],et[tt]=null}var Je=null,Xe=null,fe=!1,ut=null;function jc(e,t){var n=nt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Co(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Je=e,Xe=Ft(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Je=e,Xe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=an!==null?{id:wt,overflow:kt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=nt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Je=e,Xe=null,!0):!1;default:return!1}}function Ci(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ei(e){if(fe){var t=Xe;if(t){var n=t;if(!Co(e,t)){if(Ci(e))throw Error(b(418));t=Ft(n.nextSibling);var r=Je;t&&Co(e,t)?jc(r,n):(e.flags=e.flags&-4097|2,fe=!1,Je=e)}}else{if(Ci(e))throw Error(b(418));e.flags=e.flags&-4097|2,fe=!1,Je=e}}}function Eo(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Je=e}function ll(e){if(e!==Je)return!1;if(!fe)return Eo(e),fe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ji(e.type,e.memoizedProps)),t&&(t=Xe)){if(Ci(e))throw Sc(),Error(b(418));for(;t;)jc(e,t),t=Ft(t.nextSibling)}if(Eo(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(b(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Xe=Ft(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Xe=null}}else Xe=Je?Ft(e.stateNode.nextSibling):null;return!0}function Sc(){for(var e=Xe;e;)e=Ft(e.nextSibling)}function Fn(){Xe=Je=null,fe=!1}function ma(e){ut===null?ut=[e]:ut.push(e)}var bp=Et.ReactCurrentBatchConfig;function rr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(b(309));var r=n.stateNode}if(!r)throw Error(b(147,e));var l=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var o=l.refs;a===null?delete o[i]:o[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(b(284));if(!n._owner)throw Error(b(290,e))}return e}function sl(e,t){throw e=Object.prototype.toString.call(t),Error(b(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function To(e){var t=e._init;return t(e._payload)}function Nc(e){function t(p,d){if(e){var v=p.deletions;v===null?(p.deletions=[d],p.flags|=16):v.push(d)}}function n(p,d){if(!e)return null;for(;d!==null;)t(p,d),d=d.sibling;return null}function r(p,d){for(p=new Map;d!==null;)d.key!==null?p.set(d.key,d):p.set(d.index,d),d=d.sibling;return p}function l(p,d){return p=Ut(p,d),p.index=0,p.sibling=null,p}function i(p,d,v){return p.index=v,e?(v=p.alternate,v!==null?(v=v.index,v<d?(p.flags|=2,d):v):(p.flags|=2,d)):(p.flags|=1048576,d)}function a(p){return e&&p.alternate===null&&(p.flags|=2),p}function o(p,d,v,w){return d===null||d.tag!==6?(d=Ks(v,p.mode,w),d.return=p,d):(d=l(d,v),d.return=p,d)}function u(p,d,v,w){var S=v.type;return S===xn?g(p,d,v.props.children,w,v.key):d!==null&&(d.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===bt&&To(S)===d.type)?(w=l(d,v.props),w.ref=rr(p,d,v),w.return=p,w):(w=Sl(v.type,v.key,v.props,null,p.mode,w),w.ref=rr(p,d,v),w.return=p,w)}function c(p,d,v,w){return d===null||d.tag!==4||d.stateNode.containerInfo!==v.containerInfo||d.stateNode.implementation!==v.implementation?(d=Xs(v,p.mode,w),d.return=p,d):(d=l(d,v.children||[]),d.return=p,d)}function g(p,d,v,w,S){return d===null||d.tag!==7?(d=ln(v,p.mode,w,S),d.return=p,d):(d=l(d,v),d.return=p,d)}function m(p,d,v){if(typeof d=="string"&&d!==""||typeof d=="number")return d=Ks(""+d,p.mode,v),d.return=p,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Xr:return v=Sl(d.type,d.key,d.props,null,p.mode,v),v.ref=rr(p,null,d),v.return=p,v;case yn:return d=Xs(d,p.mode,v),d.return=p,d;case bt:var w=d._init;return m(p,w(d._payload),v)}if(ur(d)||Yn(d))return d=ln(d,p.mode,v,null),d.return=p,d;sl(p,d)}return null}function h(p,d,v,w){var S=d!==null?d.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:o(p,d,""+v,w);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Xr:return v.key===S?u(p,d,v,w):null;case yn:return v.key===S?c(p,d,v,w):null;case bt:return S=v._init,h(p,d,S(v._payload),w)}if(ur(v)||Yn(v))return S!==null?null:g(p,d,v,w,null);sl(p,v)}return null}function y(p,d,v,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return p=p.get(v)||null,o(d,p,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Xr:return p=p.get(w.key===null?v:w.key)||null,u(d,p,w,S);case yn:return p=p.get(w.key===null?v:w.key)||null,c(d,p,w,S);case bt:var P=w._init;return y(p,d,v,P(w._payload),S)}if(ur(w)||Yn(w))return p=p.get(v)||null,g(d,p,w,S,null);sl(d,w)}return null}function x(p,d,v,w){for(var S=null,P=null,C=d,_=d=0,I=null;C!==null&&_<v.length;_++){C.index>_?(I=C,C=null):I=C.sibling;var L=h(p,C,v[_],w);if(L===null){C===null&&(C=I);break}e&&C&&L.alternate===null&&t(p,C),d=i(L,d,_),P===null?S=L:P.sibling=L,P=L,C=I}if(_===v.length)return n(p,C),fe&&Gt(p,_),S;if(C===null){for(;_<v.length;_++)C=m(p,v[_],w),C!==null&&(d=i(C,d,_),P===null?S=C:P.sibling=C,P=C);return fe&&Gt(p,_),S}for(C=r(p,C);_<v.length;_++)I=y(C,p,_,v[_],w),I!==null&&(e&&I.alternate!==null&&C.delete(I.key===null?_:I.key),d=i(I,d,_),P===null?S=I:P.sibling=I,P=I);return e&&C.forEach(function(Q){return t(p,Q)}),fe&&Gt(p,_),S}function k(p,d,v,w){var S=Yn(v);if(typeof S!="function")throw Error(b(150));if(v=S.call(v),v==null)throw Error(b(151));for(var P=S=null,C=d,_=d=0,I=null,L=v.next();C!==null&&!L.done;_++,L=v.next()){C.index>_?(I=C,C=null):I=C.sibling;var Q=h(p,C,L.value,w);if(Q===null){C===null&&(C=I);break}e&&C&&Q.alternate===null&&t(p,C),d=i(Q,d,_),P===null?S=Q:P.sibling=Q,P=Q,C=I}if(L.done)return n(p,C),fe&&Gt(p,_),S;if(C===null){for(;!L.done;_++,L=v.next())L=m(p,L.value,w),L!==null&&(d=i(L,d,_),P===null?S=L:P.sibling=L,P=L);return fe&&Gt(p,_),S}for(C=r(p,C);!L.done;_++,L=v.next())L=y(C,p,_,L.value,w),L!==null&&(e&&L.alternate!==null&&C.delete(L.key===null?_:L.key),d=i(L,d,_),P===null?S=L:P.sibling=L,P=L);return e&&C.forEach(function(ne){return t(p,ne)}),fe&&Gt(p,_),S}function j(p,d,v,w){if(typeof v=="object"&&v!==null&&v.type===xn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Xr:e:{for(var S=v.key,P=d;P!==null;){if(P.key===S){if(S=v.type,S===xn){if(P.tag===7){n(p,P.sibling),d=l(P,v.props.children),d.return=p,p=d;break e}}else if(P.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===bt&&To(S)===P.type){n(p,P.sibling),d=l(P,v.props),d.ref=rr(p,P,v),d.return=p,p=d;break e}n(p,P);break}else t(p,P);P=P.sibling}v.type===xn?(d=ln(v.props.children,p.mode,w,v.key),d.return=p,p=d):(w=Sl(v.type,v.key,v.props,null,p.mode,w),w.ref=rr(p,d,v),w.return=p,p=w)}return a(p);case yn:e:{for(P=v.key;d!==null;){if(d.key===P)if(d.tag===4&&d.stateNode.containerInfo===v.containerInfo&&d.stateNode.implementation===v.implementation){n(p,d.sibling),d=l(d,v.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=Xs(v,p.mode,w),d.return=p,p=d}return a(p);case bt:return P=v._init,j(p,d,P(v._payload),w)}if(ur(v))return x(p,d,v,w);if(Yn(v))return k(p,d,v,w);sl(p,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,v),d.return=p,p=d):(n(p,d),d=Ks(v,p.mode,w),d.return=p,p=d),a(p)):n(p,d)}return j}var Mn=Nc(!0),_c=Nc(!1),Al=Kt(null),Fl=null,En=null,ga=null;function va(){ga=En=Fl=null}function ya(e){var t=Al.current;ce(Al),e._currentValue=t}function Ti(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Dn(e,t){Fl=e,ga=En=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(He=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(ga!==e)if(e={context:e,memoizedValue:t,next:null},En===null){if(Fl===null)throw Error(b(308));En=e,Fl.dependencies={lanes:0,firstContext:e}}else En=En.next=e;return t}var en=null;function xa(e){en===null?en=[e]:en.push(e)}function Cc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,xa(t)):(n.next=l.next,l.next=n),t.interleaved=n,_t(e,r)}function _t(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Lt=!1;function wa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function jt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,_t(e,n)}return l=r.interleaved,l===null?(t.next=t,xa(r)):(t.next=l.next,l.next=t),r.interleaved=t,_t(e,n)}function vl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,sa(e,n)}}function Po(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ml(e,t,n,r){var l=e.updateQueue;Lt=!1;var i=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?i=c:a.next=c,a=u;var g=e.alternate;g!==null&&(g=g.updateQueue,o=g.lastBaseUpdate,o!==a&&(o===null?g.firstBaseUpdate=c:o.next=c,g.lastBaseUpdate=u))}if(i!==null){var m=l.baseState;a=0,g=c=u=null,o=i;do{var h=o.lane,y=o.eventTime;if((r&h)===h){g!==null&&(g=g.next={eventTime:y,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var x=e,k=o;switch(h=t,y=n,k.tag){case 1:if(x=k.payload,typeof x=="function"){m=x.call(y,m,h);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=k.payload,h=typeof x=="function"?x.call(y,m,h):x,h==null)break e;m=ge({},m,h);break e;case 2:Lt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[o]:h.push(o))}else y={eventTime:y,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},g===null?(c=g=y,u=m):g=g.next=y,a|=h;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;h=o,o=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(g===null&&(u=m),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=g,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);un|=a,e.lanes=a,e.memoizedState=m}}function bo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],l=r.callback;if(l!==null){if(r.callback=null,r=n,typeof l!="function")throw Error(b(191,l));l.call(r)}}}var Ur={},vt=Kt(Ur),Rr=Kt(Ur),Dr=Kt(Ur);function tn(e){if(e===Ur)throw Error(b(174));return e}function ka(e,t){switch(ae(Dr,t),ae(Rr,e),ae(vt,Ur),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:oi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=oi(t,e)}ce(vt),ae(vt,t)}function Bn(){ce(vt),ce(Rr),ce(Dr)}function Tc(e){tn(Dr.current);var t=tn(vt.current),n=oi(t,e.type);t!==n&&(ae(Rr,e),ae(vt,n))}function ja(e){Rr.current===e&&(ce(vt),ce(Rr))}var he=Kt(0);function Bl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bs=[];function Sa(){for(var e=0;e<Bs.length;e++)Bs[e]._workInProgressVersionPrimary=null;Bs.length=0}var yl=Et.ReactCurrentDispatcher,Hs=Et.ReactCurrentBatchConfig,on=0,me=null,Se=null,Ee=null,Hl=!1,yr=!1,$r=0,Lp=0;function Re(){throw Error(b(321))}function Na(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ft(e[n],t[n]))return!1;return!0}function _a(e,t,n,r,l,i){if(on=i,me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,yl.current=e===null||e.memoizedState===null?$p:Ip,e=n(r,l),yr){i=0;do{if(yr=!1,$r=0,25<=i)throw Error(b(301));i+=1,Ee=Se=null,t.updateQueue=null,yl.current=Op,e=n(r,l)}while(yr)}if(yl.current=Ul,t=Se!==null&&Se.next!==null,on=0,Ee=Se=me=null,Hl=!1,t)throw Error(b(300));return e}function Ca(){var e=$r!==0;return $r=0,e}function ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ee===null?me.memoizedState=Ee=e:Ee=Ee.next=e,Ee}function st(){if(Se===null){var e=me.alternate;e=e!==null?e.memoizedState:null}else e=Se.next;var t=Ee===null?me.memoizedState:Ee.next;if(t!==null)Ee=t,Se=e;else{if(e===null)throw Error(b(310));Se=e,e={memoizedState:Se.memoizedState,baseState:Se.baseState,baseQueue:Se.baseQueue,queue:Se.queue,next:null},Ee===null?me.memoizedState=Ee=e:Ee=Ee.next=e}return Ee}function Ir(e,t){return typeof t=="function"?t(e):t}function Us(e){var t=st(),n=t.queue;if(n===null)throw Error(b(311));n.lastRenderedReducer=e;var r=Se,l=r.baseQueue,i=n.pending;if(i!==null){if(l!==null){var a=l.next;l.next=i.next,i.next=a}r.baseQueue=l=i,n.pending=null}if(l!==null){i=l.next,r=r.baseState;var o=a=null,u=null,c=i;do{var g=c.lane;if((on&g)===g)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var m={lane:g,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=m,a=r):u=u.next=m,me.lanes|=g,un|=g}c=c.next}while(c!==null&&c!==i);u===null?a=r:u.next=o,ft(r,t.memoizedState)||(He=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do i=l.lane,me.lanes|=i,un|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ws(e){var t=st(),n=t.queue;if(n===null)throw Error(b(311));n.lastRenderedReducer=e;var r=n.dispatch,l=n.pending,i=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do i=e(i,a.action),a=a.next;while(a!==l);ft(i,t.memoizedState)||(He=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Pc(){}function bc(e,t){var n=me,r=st(),l=t(),i=!ft(r.memoizedState,l);if(i&&(r.memoizedState=l,He=!0),r=r.queue,Ea(Rc.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ee!==null&&Ee.memoizedState.tag&1){if(n.flags|=2048,Or(9,zc.bind(null,n,r,l,t),void 0,null),Te===null)throw Error(b(349));on&30||Lc(n,t,l)}return l}function Lc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=me.updateQueue,t===null?(t={lastEffect:null,stores:null},me.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zc(e,t,n,r){t.value=n,t.getSnapshot=r,Dc(t)&&$c(e)}function Rc(e,t,n){return n(function(){Dc(t)&&$c(e)})}function Dc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ft(e,n)}catch{return!0}}function $c(e){var t=_t(e,1);t!==null&&dt(t,e,1,-1)}function Lo(e){var t=ht();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:e},t.queue=e,e=e.dispatch=Dp.bind(null,me,e),[t.memoizedState,e]}function Or(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=me.updateQueue,t===null?(t={lastEffect:null,stores:null},me.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Ic(){return st().memoizedState}function xl(e,t,n,r){var l=ht();me.flags|=e,l.memoizedState=Or(1|t,n,void 0,r===void 0?null:r)}function ls(e,t,n,r){var l=st();r=r===void 0?null:r;var i=void 0;if(Se!==null){var a=Se.memoizedState;if(i=a.destroy,r!==null&&Na(r,a.deps)){l.memoizedState=Or(t,n,i,r);return}}me.flags|=e,l.memoizedState=Or(1|t,n,i,r)}function zo(e,t){return xl(8390656,8,e,t)}function Ea(e,t){return ls(2048,8,e,t)}function Oc(e,t){return ls(4,2,e,t)}function Ac(e,t){return ls(4,4,e,t)}function Fc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Mc(e,t,n){return n=n!=null?n.concat([e]):null,ls(4,4,Fc.bind(null,t,e),n)}function Ta(){}function Bc(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Na(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Hc(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Na(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Uc(e,t,n){return on&21?(ft(n,t)||(n=Xu(),me.lanes|=n,un|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,He=!0),e.memoizedState=n)}function zp(e,t){var n=le;le=n!==0&&4>n?n:4,e(!0);var r=Hs.transition;Hs.transition={};try{e(!1),t()}finally{le=n,Hs.transition=r}}function Wc(){return st().memoizedState}function Rp(e,t,n){var r=Ht(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vc(e))Qc(t,n);else if(n=Cc(e,t,n,r),n!==null){var l=Ae();dt(n,e,r,l),Kc(n,t,r)}}function Dp(e,t,n){var r=Ht(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vc(e))Qc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(l.hasEagerState=!0,l.eagerState=o,ft(o,a)){var u=t.interleaved;u===null?(l.next=l,xa(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Cc(e,t,l,r),n!==null&&(l=Ae(),dt(n,e,r,l),Kc(n,t,r))}}function Vc(e){var t=e.alternate;return e===me||t!==null&&t===me}function Qc(e,t){yr=Hl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Kc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,sa(e,n)}}var Ul={readContext:lt,useCallback:Re,useContext:Re,useEffect:Re,useImperativeHandle:Re,useInsertionEffect:Re,useLayoutEffect:Re,useMemo:Re,useReducer:Re,useRef:Re,useState:Re,useDebugValue:Re,useDeferredValue:Re,useTransition:Re,useMutableSource:Re,useSyncExternalStore:Re,useId:Re,unstable_isNewReconciler:!1},$p={readContext:lt,useCallback:function(e,t){return ht().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:zo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xl(4194308,4,Fc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xl(4194308,4,e,t)},useInsertionEffect:function(e,t){return xl(4,2,e,t)},useMemo:function(e,t){var n=ht();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ht();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Rp.bind(null,me,e),[r.memoizedState,e]},useRef:function(e){var t=ht();return e={current:e},t.memoizedState=e},useState:Lo,useDebugValue:Ta,useDeferredValue:function(e){return ht().memoizedState=e},useTransition:function(){var e=Lo(!1),t=e[0];return e=zp.bind(null,e[1]),ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=me,l=ht();if(fe){if(n===void 0)throw Error(b(407));n=n()}else{if(n=t(),Te===null)throw Error(b(349));on&30||Lc(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,zo(Rc.bind(null,r,i,e),[e]),r.flags|=2048,Or(9,zc.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ht(),t=Te.identifierPrefix;if(fe){var n=kt,r=wt;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=$r++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Lp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ip={readContext:lt,useCallback:Bc,useContext:lt,useEffect:Ea,useImperativeHandle:Mc,useInsertionEffect:Oc,useLayoutEffect:Ac,useMemo:Hc,useReducer:Us,useRef:Ic,useState:function(){return Us(Ir)},useDebugValue:Ta,useDeferredValue:function(e){var t=st();return Uc(t,Se.memoizedState,e)},useTransition:function(){var e=Us(Ir)[0],t=st().memoizedState;return[e,t]},useMutableSource:Pc,useSyncExternalStore:bc,useId:Wc,unstable_isNewReconciler:!1},Op={readContext:lt,useCallback:Bc,useContext:lt,useEffect:Ea,useImperativeHandle:Mc,useInsertionEffect:Oc,useLayoutEffect:Ac,useMemo:Hc,useReducer:Ws,useRef:Ic,useState:function(){return Ws(Ir)},useDebugValue:Ta,useDeferredValue:function(e){var t=st();return Se===null?t.memoizedState=e:Uc(t,Se.memoizedState,e)},useTransition:function(){var e=Ws(Ir)[0],t=st().memoizedState;return[e,t]},useMutableSource:Pc,useSyncExternalStore:bc,useId:Wc,unstable_isNewReconciler:!1};function at(e,t){if(e&&e.defaultProps){t=ge({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Pi(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ge({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ss={isMounted:function(e){return(e=e._reactInternals)?fn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ae(),l=Ht(e),i=jt(r,l);i.payload=t,n!=null&&(i.callback=n),t=Mt(e,i,l),t!==null&&(dt(t,e,l,r),vl(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ae(),l=Ht(e),i=jt(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Mt(e,i,l),t!==null&&(dt(t,e,l,r),vl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ae(),r=Ht(e),l=jt(n,r);l.tag=2,t!=null&&(l.callback=t),t=Mt(e,l,r),t!==null&&(dt(t,e,r,n),vl(t,e,r))}};function Ro(e,t,n,r,l,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Pr(n,r)||!Pr(l,i):!0}function Xc(e,t,n){var r=!1,l=Vt,i=t.contextType;return typeof i=="object"&&i!==null?i=lt(i):(l=We(t)?sn:Ie.current,r=t.contextTypes,i=(r=r!=null)?An(e,l):Vt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ss,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function Do(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ss.enqueueReplaceState(t,t.state,null)}function bi(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},wa(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=lt(i):(i=We(t)?sn:Ie.current,l.context=An(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Pi(e,t,i,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&ss.enqueueReplaceState(l,l.state,null),Ml(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Hn(e,t){try{var n="",r=t;do n+=df(r),r=r.return;while(r);var l=n}catch(i){l=`
|
||
Error generating stack: `+i.message+`
|
||
`+i.stack}return{value:e,source:t,stack:l,digest:null}}function Vs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Li(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ap=typeof WeakMap=="function"?WeakMap:Map;function Jc(e,t,n){n=jt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vl||(Vl=!0,Bi=r),Li(e,t)},n}function qc(e,t,n){n=jt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Li(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Li(e,t),typeof r!="function"&&(Bt===null?Bt=new Set([this]):Bt.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function $o(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ap;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Yp.bind(null,e,t,n),t.then(e,e))}function Io(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Oo(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=jt(-1,1),t.tag=2,Mt(n,t,1))),n.lanes|=1),e)}var Fp=Et.ReactCurrentOwner,He=!1;function Oe(e,t,n,r){t.child=e===null?_c(t,null,n,r):Mn(t,e.child,n,r)}function Ao(e,t,n,r,l){n=n.render;var i=t.ref;return Dn(t,l),r=_a(e,t,n,r,i,l),n=Ca(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Ct(e,t,l)):(fe&&n&&pa(t),t.flags|=1,Oe(e,t,r,l),t.child)}function Fo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Ia(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Gc(e,t,i,r,l)):(e=Sl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Pr,n(a,r)&&e.ref===t.ref)return Ct(e,t,l)}return t.flags|=1,e=Ut(i,r),e.ref=t.ref,e.return=t,t.child=e}function Gc(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Pr(i,r)&&e.ref===t.ref)if(He=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(He=!0);else return t.lanes=e.lanes,Ct(e,t,l)}return zi(e,t,n,r,l)}function Yc(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ae(Pn,Ke),Ke|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ae(Pn,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ae(Pn,Ke),Ke|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ae(Pn,Ke),Ke|=r;return Oe(e,t,l,n),t.child}function Zc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zi(e,t,n,r,l){var i=We(n)?sn:Ie.current;return i=An(t,i),Dn(t,l),n=_a(e,t,n,r,i,l),r=Ca(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Ct(e,t,l)):(fe&&r&&pa(t),t.flags|=1,Oe(e,t,n,l),t.child)}function Mo(e,t,n,r,l){if(We(n)){var i=!0;$l(t)}else i=!1;if(Dn(t,l),t.stateNode===null)wl(e,t),Xc(t,n,r),bi(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=lt(c):(c=We(n)?sn:Ie.current,c=An(t,c));var g=n.getDerivedStateFromProps,m=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function";m||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&Do(t,a,r,c),Lt=!1;var h=t.memoizedState;a.state=h,Ml(t,r,a,l),u=t.memoizedState,o!==r||h!==u||Ue.current||Lt?(typeof g=="function"&&(Pi(t,n,g,r),u=t.memoizedState),(o=Lt||Ro(t,n,o,r,h,u,c))?(m||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ec(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:at(t.type,o),a.props=c,m=t.pendingProps,h=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=lt(u):(u=We(n)?sn:Ie.current,u=An(t,u));var y=n.getDerivedStateFromProps;(g=typeof y=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==m||h!==u)&&Do(t,a,r,u),Lt=!1,h=t.memoizedState,a.state=h,Ml(t,r,a,l);var x=t.memoizedState;o!==m||h!==x||Ue.current||Lt?(typeof y=="function"&&(Pi(t,n,y,r),x=t.memoizedState),(c=Lt||Ro(t,n,c,r,h,x,u)||!1)?(g||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,x,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,x,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),a.props=r,a.state=x,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Ri(e,t,n,r,i,l)}function Ri(e,t,n,r,l,i){Zc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&_o(t,n,!1),Ct(e,t,i);r=t.stateNode,Fp.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Mn(t,e.child,null,i),t.child=Mn(t,null,o,i)):Oe(e,t,o,i),t.memoizedState=r.state,l&&_o(t,n,!0),t.child}function ed(e){var t=e.stateNode;t.pendingContext?No(e,t.pendingContext,t.pendingContext!==t.context):t.context&&No(e,t.context,!1),ka(e,t.containerInfo)}function Bo(e,t,n,r,l){return Fn(),ma(l),t.flags|=256,Oe(e,t,n,r),t.child}var Di={dehydrated:null,treeContext:null,retryLane:0};function $i(e){return{baseLanes:e,cachePool:null,transitions:null}}function td(e,t,n){var r=t.pendingProps,l=he.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(l&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),ae(he,l&1),e===null)return Ei(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=os(a,r,0,null),e=ln(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=$i(n),t.memoizedState=Di,e):Pa(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return Mp(e,t,a,r,o,l,n);if(i){i=r.fallback,a=t.mode,l=e.child,o=l.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Ut(l,u),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?i=Ut(o,i):(i=ln(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?$i(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Di,r}return i=e.child,e=i.sibling,r=Ut(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Pa(e,t){return t=os({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,n,r){return r!==null&&ma(r),Mn(t,e.child,null,n),e=Pa(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mp(e,t,n,r,l,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Vs(Error(b(422))),il(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=os({mode:"visible",children:r.children},l,0,null),i=ln(i,l,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Mn(t,e.child,null,a),t.child.memoizedState=$i(a),t.memoizedState=Di,i);if(!(t.mode&1))return il(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(b(419)),r=Vs(i,r,void 0),il(e,t,a,r)}if(o=(a&e.childLanes)!==0,He||o){if(r=Te,r!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|a)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,_t(e,l),dt(r,e,l,-1))}return $a(),r=Vs(Error(b(421))),il(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Zp.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,Xe=Ft(l.nextSibling),Je=t,fe=!0,ut=null,e!==null&&(et[tt++]=wt,et[tt++]=kt,et[tt++]=an,wt=e.id,kt=e.overflow,an=t),t=Pa(t,r.children),t.flags|=4096,t)}function Ho(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ti(e.return,t,n)}function Qs(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function nd(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(Oe(e,t,r.children,n),r=he.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ho(e,n,t);else if(e.tag===19)Ho(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ae(he,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Bl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Qs(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Bl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Qs(t,!0,n,null,i);break;case"together":Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function wl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ct(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),un|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(b(153));if(t.child!==null){for(e=t.child,n=Ut(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ut(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Bp(e,t,n){switch(t.tag){case 3:ed(t),Fn();break;case 5:Tc(t);break;case 1:We(t.type)&&$l(t);break;case 4:ka(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;ae(Al,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ae(he,he.current&1),t.flags|=128,null):n&t.child.childLanes?td(e,t,n):(ae(he,he.current&1),e=Ct(e,t,n),e!==null?e.sibling:null);ae(he,he.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nd(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),ae(he,he.current),r)break;return null;case 22:case 23:return t.lanes=0,Yc(e,t,n)}return Ct(e,t,n)}var rd,Ii,ld,sd;rd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Ii=function(){};ld=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,tn(vt.current);var i=null;switch(n){case"input":l=li(e,l),r=li(e,r),i=[];break;case"select":l=ge({},l,{value:void 0}),r=ge({},r,{value:void 0}),i=[];break;case"textarea":l=ai(e,l),r=ai(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Rl)}ui(n,r);var a;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var o=l[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(jr.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var u=r[c];if(o=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(i||(i=[]),i.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(i=i||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(jr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&ue("scroll",e),i||o===u||(i=[])):(i=i||[]).push(c,u))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};sd=function(e,t,n,r){n!==r&&(t.flags|=4)};function lr(e,t){if(!fe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function De(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Hp(e,t,n){var r=t.pendingProps;switch(ha(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return De(t),null;case 1:return We(t.type)&&Dl(),De(t),null;case 3:return r=t.stateNode,Bn(),ce(Ue),ce(Ie),Sa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ll(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ut!==null&&(Wi(ut),ut=null))),Ii(e,t),De(t),null;case 5:ja(t);var l=tn(Dr.current);if(n=t.type,e!==null&&t.stateNode!=null)ld(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(b(166));return De(t),null}if(e=tn(vt.current),ll(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[mt]=t,r[zr]=i,e=(t.mode&1)!==0,n){case"dialog":ue("cancel",r),ue("close",r);break;case"iframe":case"object":case"embed":ue("load",r);break;case"video":case"audio":for(l=0;l<dr.length;l++)ue(dr[l],r);break;case"source":ue("error",r);break;case"img":case"image":case"link":ue("error",r),ue("load",r);break;case"details":ue("toggle",r);break;case"input":qa(r,i),ue("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ue("invalid",r);break;case"textarea":Ya(r,i),ue("invalid",r)}ui(n,i),l=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];a==="children"?typeof o=="string"?r.textContent!==o&&(i.suppressHydrationWarning!==!0&&rl(r.textContent,o,e),l=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&rl(r.textContent,o,e),l=["children",""+o]):jr.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&ue("scroll",r)}switch(n){case"input":Jr(r),Ga(r,i,!0);break;case"textarea":Jr(r),Za(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Rl)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ru(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[mt]=t,e[zr]=r,rd(e,t,!1,!1),t.stateNode=e;e:{switch(a=ci(n,r),n){case"dialog":ue("cancel",e),ue("close",e),l=r;break;case"iframe":case"object":case"embed":ue("load",e),l=r;break;case"video":case"audio":for(l=0;l<dr.length;l++)ue(dr[l],e);l=r;break;case"source":ue("error",e),l=r;break;case"img":case"image":case"link":ue("error",e),ue("load",e),l=r;break;case"details":ue("toggle",e),l=r;break;case"input":qa(e,r),l=li(e,r),ue("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=ge({},r,{value:void 0}),ue("invalid",e);break;case"textarea":Ya(e,r),l=ai(e,r),ue("invalid",e);break;default:l=r}ui(n,l),o=l;for(i in o)if(o.hasOwnProperty(i)){var u=o[i];i==="style"?Iu(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Du(e,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Sr(e,u):typeof u=="number"&&Sr(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(jr.hasOwnProperty(i)?u!=null&&i==="onScroll"&&ue("scroll",e):u!=null&&Zi(e,i,u,a))}switch(n){case"input":Jr(e),Ga(e,r,!1);break;case"textarea":Jr(e),Za(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Wt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?bn(e,!!r.multiple,i,!1):r.defaultValue!=null&&bn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Rl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return De(t),null;case 6:if(e&&t.stateNode!=null)sd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(b(166));if(n=tn(Dr.current),tn(vt.current),ll(t)){if(r=t.stateNode,n=t.memoizedProps,r[mt]=t,(i=r.nodeValue!==n)&&(e=Je,e!==null))switch(e.tag){case 3:rl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&rl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[mt]=t,t.stateNode=r}return De(t),null;case 13:if(ce(he),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(fe&&Xe!==null&&t.mode&1&&!(t.flags&128))Sc(),Fn(),t.flags|=98560,i=!1;else if(i=ll(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(b(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(b(317));i[mt]=t}else Fn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;De(t),i=!1}else ut!==null&&(Wi(ut),ut=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||he.current&1?Ne===0&&(Ne=3):$a())),t.updateQueue!==null&&(t.flags|=4),De(t),null);case 4:return Bn(),Ii(e,t),e===null&&br(t.stateNode.containerInfo),De(t),null;case 10:return ya(t.type._context),De(t),null;case 17:return We(t.type)&&Dl(),De(t),null;case 19:if(ce(he),i=t.memoizedState,i===null)return De(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)lr(i,!1);else{if(Ne!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Bl(e),a!==null){for(t.flags|=128,lr(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ae(he,he.current&1|2),t.child}e=e.sibling}i.tail!==null&&we()>Un&&(t.flags|=128,r=!0,lr(i,!1),t.lanes=4194304)}else{if(!r)if(e=Bl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),lr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!fe)return De(t),null}else 2*we()-i.renderingStartTime>Un&&n!==1073741824&&(t.flags|=128,r=!0,lr(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=we(),t.sibling=null,n=he.current,ae(he,r?n&1|2:n&1),t):(De(t),null);case 22:case 23:return Da(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&(De(t),t.subtreeFlags&6&&(t.flags|=8192)):De(t),null;case 24:return null;case 25:return null}throw Error(b(156,t.tag))}function Up(e,t){switch(ha(t),t.tag){case 1:return We(t.type)&&Dl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(),ce(Ue),ce(Ie),Sa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ja(t),null;case 13:if(ce(he),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(b(340));Fn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(he),null;case 4:return Bn(),null;case 10:return ya(t.type._context),null;case 22:case 23:return Da(),null;case 24:return null;default:return null}}var al=!1,$e=!1,Wp=typeof WeakSet=="function"?WeakSet:Set,A=null;function Tn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function Oi(e,t,n){try{n()}catch(r){ye(e,t,r)}}var Uo=!1;function Vp(e,t){if(wi=bl,e=cc(),fa(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,g=0,m=e,h=null;t:for(;;){for(var y;m!==n||l!==0&&m.nodeType!==3||(o=a+l),m!==i||r!==0&&m.nodeType!==3||(u=a+r),m.nodeType===3&&(a+=m.nodeValue.length),(y=m.firstChild)!==null;)h=m,m=y;for(;;){if(m===e)break t;if(h===n&&++c===l&&(o=a),h===i&&++g===r&&(u=a),(y=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=y}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(ki={focusedElem:e,selectionRange:n},bl=!1,A=t;A!==null;)if(t=A,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,A=e;else for(;A!==null;){t=A;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var k=x.memoizedProps,j=x.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?k:at(t.type,k),j);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(b(163))}}catch(w){ye(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,A=e;break}A=t.return}return x=Uo,Uo=!1,x}function xr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Oi(t,n,i)}l=l.next}while(l!==r)}}function is(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ai(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function id(e){var t=e.alternate;t!==null&&(e.alternate=null,id(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mt],delete t[zr],delete t[Ni],delete t[Ep],delete t[Tp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ad(e){return e.tag===5||e.tag===3||e.tag===4}function Wo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ad(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Rl));else if(r!==4&&(e=e.child,e!==null))for(Fi(e,t,n),e=e.sibling;e!==null;)Fi(e,t,n),e=e.sibling}function Mi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Mi(e,t,n),e=e.sibling;e!==null;)Mi(e,t,n),e=e.sibling}var Pe=null,ot=!1;function Pt(e,t,n){for(n=n.child;n!==null;)od(e,t,n),n=n.sibling}function od(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(Yl,n)}catch{}switch(n.tag){case 5:$e||Tn(n,t);case 6:var r=Pe,l=ot;Pe=null,Pt(e,t,n),Pe=r,ot=l,Pe!==null&&(ot?(e=Pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Pe.removeChild(n.stateNode));break;case 18:Pe!==null&&(ot?(e=Pe,n=n.stateNode,e.nodeType===8?Fs(e.parentNode,n):e.nodeType===1&&Fs(e,n),Er(e)):Fs(Pe,n.stateNode));break;case 4:r=Pe,l=ot,Pe=n.stateNode.containerInfo,ot=!0,Pt(e,t,n),Pe=r,ot=l;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Oi(n,t,a),l=l.next}while(l!==r)}Pt(e,t,n);break;case 1:if(!$e&&(Tn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ye(n,t,o)}Pt(e,t,n);break;case 21:Pt(e,t,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,Pt(e,t,n),$e=r):Pt(e,t,n);break;default:Pt(e,t,n)}}function Vo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Wp),t.forEach(function(r){var l=eh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var i=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:Pe=o.stateNode,ot=!1;break e;case 3:Pe=o.stateNode.containerInfo,ot=!0;break e;case 4:Pe=o.stateNode.containerInfo,ot=!0;break e}o=o.return}if(Pe===null)throw Error(b(160));od(i,a,l),Pe=null,ot=!1;var u=l.alternate;u!==null&&(u.return=null),l.return=null}catch(c){ye(l,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ud(t,e),t=t.sibling}function ud(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(it(t,e),pt(e),r&4){try{xr(3,e,e.return),is(3,e)}catch(k){ye(e,e.return,k)}try{xr(5,e,e.return)}catch(k){ye(e,e.return,k)}}break;case 1:it(t,e),pt(e),r&512&&n!==null&&Tn(n,n.return);break;case 5:if(it(t,e),pt(e),r&512&&n!==null&&Tn(n,n.return),e.flags&32){var l=e.stateNode;try{Sr(l,"")}catch(k){ye(e,e.return,k)}}if(r&4&&(l=e.stateNode,l!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&Lu(l,i),ci(o,a);var c=ci(o,i);for(a=0;a<u.length;a+=2){var g=u[a],m=u[a+1];g==="style"?Iu(l,m):g==="dangerouslySetInnerHTML"?Du(l,m):g==="children"?Sr(l,m):Zi(l,g,m,c)}switch(o){case"input":si(l,i);break;case"textarea":zu(l,i);break;case"select":var h=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var y=i.value;y!=null?bn(l,!!i.multiple,y,!1):h!==!!i.multiple&&(i.defaultValue!=null?bn(l,!!i.multiple,i.defaultValue,!0):bn(l,!!i.multiple,i.multiple?[]:"",!1))}l[zr]=i}catch(k){ye(e,e.return,k)}}break;case 6:if(it(t,e),pt(e),r&4){if(e.stateNode===null)throw Error(b(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(k){ye(e,e.return,k)}}break;case 3:if(it(t,e),pt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Er(t.containerInfo)}catch(k){ye(e,e.return,k)}break;case 4:it(t,e),pt(e);break;case 13:it(t,e),pt(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(za=we())),r&4&&Vo(e);break;case 22:if(g=n!==null&&n.memoizedState!==null,e.mode&1?($e=(c=$e)||g,it(t,e),$e=c):it(t,e),pt(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!g&&e.mode&1)for(A=e,g=e.child;g!==null;){for(m=A=g;A!==null;){switch(h=A,y=h.child,h.tag){case 0:case 11:case 14:case 15:xr(4,h,h.return);break;case 1:Tn(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(k){ye(r,n,k)}}break;case 5:Tn(h,h.return);break;case 22:if(h.memoizedState!==null){Ko(m);continue}}y!==null?(y.return=h,A=y):Ko(m)}g=g.sibling}e:for(g=null,m=e;;){if(m.tag===5){if(g===null){g=m;try{l=m.stateNode,c?(i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=m.stateNode,u=m.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=$u("display",a))}catch(k){ye(e,e.return,k)}}}else if(m.tag===6){if(g===null)try{m.stateNode.nodeValue=c?"":m.memoizedProps}catch(k){ye(e,e.return,k)}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===e)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===e)break e;for(;m.sibling===null;){if(m.return===null||m.return===e)break e;g===m&&(g=null),m=m.return}g===m&&(g=null),m.sibling.return=m.return,m=m.sibling}}break;case 19:it(t,e),pt(e),r&4&&Vo(e);break;case 21:break;default:it(t,e),pt(e)}}function pt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ad(n)){var r=n;break e}n=n.return}throw Error(b(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(Sr(l,""),r.flags&=-33);var i=Wo(e);Mi(e,i,l);break;case 3:case 4:var a=r.stateNode.containerInfo,o=Wo(e);Fi(e,o,a);break;default:throw Error(b(161))}}catch(u){ye(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qp(e,t,n){A=e,cd(e)}function cd(e,t,n){for(var r=(e.mode&1)!==0;A!==null;){var l=A,i=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||al;if(!a){var o=l.alternate,u=o!==null&&o.memoizedState!==null||$e;o=al;var c=$e;if(al=a,($e=u)&&!c)for(A=l;A!==null;)a=A,u=a.child,a.tag===22&&a.memoizedState!==null?Xo(l):u!==null?(u.return=a,A=u):Xo(l);for(;i!==null;)A=i,cd(i),i=i.sibling;A=l,al=o,$e=c}Qo(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,A=i):Qo(e)}}function Qo(e){for(;A!==null;){var t=A;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$e||is(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!$e)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:at(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&bo(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}bo(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var g=c.memoizedState;if(g!==null){var m=g.dehydrated;m!==null&&Er(m)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(b(163))}$e||t.flags&512&&Ai(t)}catch(h){ye(t,t.return,h)}}if(t===e){A=null;break}if(n=t.sibling,n!==null){n.return=t.return,A=n;break}A=t.return}}function Ko(e){for(;A!==null;){var t=A;if(t===e){A=null;break}var n=t.sibling;if(n!==null){n.return=t.return,A=n;break}A=t.return}}function Xo(e){for(;A!==null;){var t=A;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{is(4,t)}catch(u){ye(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(u){ye(t,l,u)}}var i=t.return;try{Ai(t)}catch(u){ye(t,i,u)}break;case 5:var a=t.return;try{Ai(t)}catch(u){ye(t,a,u)}}}catch(u){ye(t,t.return,u)}if(t===e){A=null;break}var o=t.sibling;if(o!==null){o.return=t.return,A=o;break}A=t.return}}var Kp=Math.ceil,Wl=Et.ReactCurrentDispatcher,ba=Et.ReactCurrentOwner,rt=Et.ReactCurrentBatchConfig,ee=0,Te=null,ke=null,be=0,Ke=0,Pn=Kt(0),Ne=0,Ar=null,un=0,as=0,La=0,wr=null,Be=null,za=0,Un=1/0,yt=null,Vl=!1,Bi=null,Bt=null,ol=!1,$t=null,Ql=0,kr=0,Hi=null,kl=-1,jl=0;function Ae(){return ee&6?we():kl!==-1?kl:kl=we()}function Ht(e){return e.mode&1?ee&2&&be!==0?be&-be:bp.transition!==null?(jl===0&&(jl=Xu()),jl):(e=le,e!==0||(e=window.event,e=e===void 0?16:tc(e.type)),e):1}function dt(e,t,n,r){if(50<kr)throw kr=0,Hi=null,Error(b(185));Mr(e,n,r),(!(ee&2)||e!==Te)&&(e===Te&&(!(ee&2)&&(as|=n),Ne===4&&Rt(e,be)),Ve(e,r),n===1&&ee===0&&!(t.mode&1)&&(Un=we()+500,rs&&Xt()))}function Ve(e,t){var n=e.callbackNode;bf(e,t);var r=Pl(e,e===Te?be:0);if(r===0)n!==null&&no(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&no(n),t===1)e.tag===0?Pp(Jo.bind(null,e)):wc(Jo.bind(null,e)),_p(function(){!(ee&6)&&Xt()}),n=null;else{switch(Ju(r)){case 1:n=la;break;case 4:n=Qu;break;case 16:n=Tl;break;case 536870912:n=Ku;break;default:n=Tl}n=yd(n,dd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function dd(e,t){if(kl=-1,jl=0,ee&6)throw Error(b(327));var n=e.callbackNode;if($n()&&e.callbackNode!==n)return null;var r=Pl(e,e===Te?be:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Kl(e,r);else{t=r;var l=ee;ee|=2;var i=pd();(Te!==e||be!==t)&&(yt=null,Un=we()+500,rn(e,t));do try{qp();break}catch(o){fd(e,o)}while(!0);va(),Wl.current=i,ee=l,ke!==null?t=0:(Te=null,be=0,t=Ne)}if(t!==0){if(t===2&&(l=mi(e),l!==0&&(r=l,t=Ui(e,l))),t===1)throw n=Ar,rn(e,0),Rt(e,r),Ve(e,we()),n;if(t===6)Rt(e,r);else{if(l=e.current.alternate,!(r&30)&&!Xp(l)&&(t=Kl(e,r),t===2&&(i=mi(e),i!==0&&(r=i,t=Ui(e,i))),t===1))throw n=Ar,rn(e,0),Rt(e,r),Ve(e,we()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(b(345));case 2:Yt(e,Be,yt);break;case 3:if(Rt(e,r),(r&130023424)===r&&(t=za+500-we(),10<t)){if(Pl(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){Ae(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Si(Yt.bind(null,e,Be,yt),t);break}Yt(e,Be,yt);break;case 4:if(Rt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-ct(r);i=1<<a,a=t[a],a>l&&(l=a),r&=~i}if(r=l,r=we()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Kp(r/1960))-r,10<r){e.timeoutHandle=Si(Yt.bind(null,e,Be,yt),r);break}Yt(e,Be,yt);break;case 5:Yt(e,Be,yt);break;default:throw Error(b(329))}}}return Ve(e,we()),e.callbackNode===n?dd.bind(null,e):null}function Ui(e,t){var n=wr;return e.current.memoizedState.isDehydrated&&(rn(e,t).flags|=256),e=Kl(e,t),e!==2&&(t=Be,Be=n,t!==null&&Wi(t)),e}function Wi(e){Be===null?Be=e:Be.push.apply(Be,e)}function Xp(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var l=n[r],i=l.getSnapshot;l=l.value;try{if(!ft(i(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rt(e,t){for(t&=~La,t&=~as,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ct(t),r=1<<n;e[n]=-1,t&=~r}}function Jo(e){if(ee&6)throw Error(b(327));$n();var t=Pl(e,0);if(!(t&1))return Ve(e,we()),null;var n=Kl(e,t);if(e.tag!==0&&n===2){var r=mi(e);r!==0&&(t=r,n=Ui(e,r))}if(n===1)throw n=Ar,rn(e,0),Rt(e,t),Ve(e,we()),n;if(n===6)throw Error(b(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Yt(e,Be,yt),Ve(e,we()),null}function Ra(e,t){var n=ee;ee|=1;try{return e(t)}finally{ee=n,ee===0&&(Un=we()+500,rs&&Xt())}}function cn(e){$t!==null&&$t.tag===0&&!(ee&6)&&$n();var t=ee;ee|=1;var n=rt.transition,r=le;try{if(rt.transition=null,le=1,e)return e()}finally{le=r,rt.transition=n,ee=t,!(ee&6)&&Xt()}}function Da(){Ke=Pn.current,ce(Pn)}function rn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Np(n)),ke!==null)for(n=ke.return;n!==null;){var r=n;switch(ha(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Dl();break;case 3:Bn(),ce(Ue),ce(Ie),Sa();break;case 5:ja(r);break;case 4:Bn();break;case 13:ce(he);break;case 19:ce(he);break;case 10:ya(r.type._context);break;case 22:case 23:Da()}n=n.return}if(Te=e,ke=e=Ut(e.current,null),be=Ke=t,Ne=0,Ar=null,La=as=un=0,Be=wr=null,en!==null){for(t=0;t<en.length;t++)if(n=en[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=l,r.next=a}n.pending=r}en=null}return e}function fd(e,t){do{var n=ke;try{if(va(),yl.current=Ul,Hl){for(var r=me.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Hl=!1}if(on=0,Ee=Se=me=null,yr=!1,$r=0,ba.current=null,n===null||n.return===null){Ne=1,Ar=t,ke=null;break}e:{var i=e,a=n.return,o=n,u=t;if(t=be,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,g=o,m=g.tag;if(!(g.mode&1)&&(m===0||m===11||m===15)){var h=g.alternate;h?(g.updateQueue=h.updateQueue,g.memoizedState=h.memoizedState,g.lanes=h.lanes):(g.updateQueue=null,g.memoizedState=null)}var y=Io(a);if(y!==null){y.flags&=-257,Oo(y,a,o,i,t),y.mode&1&&$o(i,c,t),t=y,u=c;var x=t.updateQueue;if(x===null){var k=new Set;k.add(u),t.updateQueue=k}else x.add(u);break e}else{if(!(t&1)){$o(i,c,t),$a();break e}u=Error(b(426))}}else if(fe&&o.mode&1){var j=Io(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Oo(j,a,o,i,t),ma(Hn(u,o));break e}}i=u=Hn(u,o),Ne!==4&&(Ne=2),wr===null?wr=[i]:wr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var p=Jc(i,u,t);Po(i,p);break e;case 1:o=u;var d=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Bt===null||!Bt.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var w=qc(i,o,t);Po(i,w);break e}}i=i.return}while(i!==null)}md(n)}catch(S){t=S,ke===n&&n!==null&&(ke=n=n.return);continue}break}while(!0)}function pd(){var e=Wl.current;return Wl.current=Ul,e===null?Ul:e}function $a(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),Te===null||!(un&268435455)&&!(as&268435455)||Rt(Te,be)}function Kl(e,t){var n=ee;ee|=2;var r=pd();(Te!==e||be!==t)&&(yt=null,rn(e,t));do try{Jp();break}catch(l){fd(e,l)}while(!0);if(va(),ee=n,Wl.current=r,ke!==null)throw Error(b(261));return Te=null,be=0,Ne}function Jp(){for(;ke!==null;)hd(ke)}function qp(){for(;ke!==null&&!kf();)hd(ke)}function hd(e){var t=vd(e.alternate,e,Ke);e.memoizedProps=e.pendingProps,t===null?md(e):ke=t,ba.current=null}function md(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Up(n,t),n!==null){n.flags&=32767,ke=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ne=6,ke=null;return}}else if(n=Hp(n,t,Ke),n!==null){ke=n;return}if(t=t.sibling,t!==null){ke=t;return}ke=t=e}while(t!==null);Ne===0&&(Ne=5)}function Yt(e,t,n){var r=le,l=rt.transition;try{rt.transition=null,le=1,Gp(e,t,n,r)}finally{rt.transition=l,le=r}return null}function Gp(e,t,n,r){do $n();while($t!==null);if(ee&6)throw Error(b(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(b(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Lf(e,i),e===Te&&(ke=Te=null,be=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,yd(Tl,function(){return $n(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=rt.transition,rt.transition=null;var a=le;le=1;var o=ee;ee|=4,ba.current=null,Vp(e,n),ud(n,e),vp(ki),bl=!!wi,ki=wi=null,e.current=n,Qp(n),jf(),ee=o,le=a,rt.transition=i}else e.current=n;if(ol&&(ol=!1,$t=e,Ql=l),i=e.pendingLanes,i===0&&(Bt=null),_f(n.stateNode),Ve(e,we()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],r(l.value,{componentStack:l.stack,digest:l.digest});if(Vl)throw Vl=!1,e=Bi,Bi=null,e;return Ql&1&&e.tag!==0&&$n(),i=e.pendingLanes,i&1?e===Hi?kr++:(kr=0,Hi=e):kr=0,Xt(),null}function $n(){if($t!==null){var e=Ju(Ql),t=rt.transition,n=le;try{if(rt.transition=null,le=16>e?16:e,$t===null)var r=!1;else{if(e=$t,$t=null,Ql=0,ee&6)throw Error(b(331));var l=ee;for(ee|=4,A=e.current;A!==null;){var i=A,a=i.child;if(A.flags&16){var o=i.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for(A=c;A!==null;){var g=A;switch(g.tag){case 0:case 11:case 15:xr(8,g,i)}var m=g.child;if(m!==null)m.return=g,A=m;else for(;A!==null;){g=A;var h=g.sibling,y=g.return;if(id(g),g===c){A=null;break}if(h!==null){h.return=y,A=h;break}A=y}}}var x=i.alternate;if(x!==null){var k=x.child;if(k!==null){x.child=null;do{var j=k.sibling;k.sibling=null,k=j}while(k!==null)}}A=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,A=a;else e:for(;A!==null;){if(i=A,i.flags&2048)switch(i.tag){case 0:case 11:case 15:xr(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,A=p;break e}A=i.return}}var d=e.current;for(A=d;A!==null;){a=A;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,A=v;else e:for(a=d;A!==null;){if(o=A,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:is(9,o)}}catch(S){ye(o,o.return,S)}if(o===a){A=null;break e}var w=o.sibling;if(w!==null){w.return=o.return,A=w;break e}A=o.return}}if(ee=l,Xt(),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(Yl,e)}catch{}r=!0}return r}finally{le=n,rt.transition=t}}return!1}function qo(e,t,n){t=Hn(n,t),t=Jc(e,t,1),e=Mt(e,t,1),t=Ae(),e!==null&&(Mr(e,1,t),Ve(e,t))}function ye(e,t,n){if(e.tag===3)qo(e,e,n);else for(;t!==null;){if(t.tag===3){qo(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Bt===null||!Bt.has(r))){e=Hn(n,e),e=qc(t,e,1),t=Mt(t,e,1),e=Ae(),t!==null&&(Mr(t,1,e),Ve(t,e));break}}t=t.return}}function Yp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ae(),e.pingedLanes|=e.suspendedLanes&n,Te===e&&(be&n)===n&&(Ne===4||Ne===3&&(be&130023424)===be&&500>we()-za?rn(e,0):La|=n),Ve(e,t)}function gd(e,t){t===0&&(e.mode&1?(t=Yr,Yr<<=1,!(Yr&130023424)&&(Yr=4194304)):t=1);var n=Ae();e=_t(e,t),e!==null&&(Mr(e,t,n),Ve(e,n))}function Zp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gd(e,n)}function eh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(b(314))}r!==null&&r.delete(t),gd(e,n)}var vd;vd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)He=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return He=!1,Bp(e,t,n);He=!!(e.flags&131072)}else He=!1,fe&&t.flags&1048576&&kc(t,Ol,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;wl(e,t),e=t.pendingProps;var l=An(t,Ie.current);Dn(t,n),l=_a(null,t,r,e,l,n);var i=Ca();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(r)?(i=!0,$l(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,wa(t),l.updater=ss,t.stateNode=l,l._reactInternals=t,bi(t,r,e,n),t=Ri(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&pa(t),Oe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(wl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=nh(r),e=at(r,e),l){case 0:t=zi(null,t,r,e,n);break e;case 1:t=Mo(null,t,r,e,n);break e;case 11:t=Ao(null,t,r,e,n);break e;case 14:t=Fo(null,t,r,at(r.type,e),n);break e}throw Error(b(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:at(r,l),zi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:at(r,l),Mo(e,t,r,l,n);case 3:e:{if(ed(t),e===null)throw Error(b(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Ec(e,t),Ml(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=Hn(Error(b(423)),t),t=Bo(e,t,r,n,l);break e}else if(r!==l){l=Hn(Error(b(424)),t),t=Bo(e,t,r,n,l);break e}else for(Xe=Ft(t.stateNode.containerInfo.firstChild),Je=t,fe=!0,ut=null,n=_c(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fn(),r===l){t=Ct(e,t,n);break e}Oe(e,t,r,n)}t=t.child}return t;case 5:return Tc(t),e===null&&Ei(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,ji(r,l)?a=null:i!==null&&ji(r,i)&&(t.flags|=32),Zc(e,t),Oe(e,t,a,n),t.child;case 6:return e===null&&Ei(t),null;case 13:return td(e,t,n);case 4:return ka(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Mn(t,null,r,n):Oe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:at(r,l),Ao(e,t,r,l,n);case 7:return Oe(e,t,t.pendingProps,n),t.child;case 8:return Oe(e,t,t.pendingProps.children,n),t.child;case 12:return Oe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,a=l.value,ae(Al,r._currentValue),r._currentValue=a,i!==null)if(ft(i.value,a)){if(i.children===l.children&&!Ue.current){t=Ct(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=jt(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var g=c.pending;g===null?u.next=u:(u.next=g.next,g.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Ti(i.return,n,t),o.lanes|=n;break}u=u.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(b(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Ti(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Oe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Dn(t,n),l=lt(l),r=r(l),t.flags|=1,Oe(e,t,r,n),t.child;case 14:return r=t.type,l=at(r,t.pendingProps),l=at(r.type,l),Fo(e,t,r,l,n);case 15:return Gc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:at(r,l),wl(e,t),t.tag=1,We(r)?(e=!0,$l(t)):e=!1,Dn(t,n),Xc(t,r,l),bi(t,r,l,n),Ri(null,t,r,!0,e,n);case 19:return nd(e,t,n);case 22:return Yc(e,t,n)}throw Error(b(156,t.tag))};function yd(e,t){return Vu(e,t)}function th(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nt(e,t,n,r){return new th(e,t,n,r)}function Ia(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nh(e){if(typeof e=="function")return Ia(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ta)return 11;if(e===na)return 14}return 2}function Ut(e,t){var n=e.alternate;return n===null?(n=nt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Sl(e,t,n,r,l,i){var a=2;if(r=e,typeof e=="function")Ia(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case xn:return ln(n.children,l,i,t);case ea:a=8,l|=8;break;case ei:return e=nt(12,n,t,l|2),e.elementType=ei,e.lanes=i,e;case ti:return e=nt(13,n,t,l),e.elementType=ti,e.lanes=i,e;case ni:return e=nt(19,n,t,l),e.elementType=ni,e.lanes=i,e;case Tu:return os(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cu:a=10;break e;case Eu:a=9;break e;case ta:a=11;break e;case na:a=14;break e;case bt:a=16,r=null;break e}throw Error(b(130,e==null?e:typeof e,""))}return t=nt(a,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function ln(e,t,n,r){return e=nt(7,e,r,t),e.lanes=n,e}function os(e,t,n,r){return e=nt(22,e,r,t),e.elementType=Tu,e.lanes=n,e.stateNode={isHidden:!1},e}function Ks(e,t,n){return e=nt(6,e,null,t),e.lanes=n,e}function Xs(e,t,n){return t=nt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ts(0),this.expirationTimes=Ts(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ts(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Oa(e,t,n,r,l,i,a,o,u){return e=new rh(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=nt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},wa(i),e}function lh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function xd(e){if(!e)return Vt;e=e._reactInternals;e:{if(fn(e)!==e||e.tag!==1)throw Error(b(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(We(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(b(171))}if(e.tag===1){var n=e.type;if(We(n))return xc(e,n,t)}return t}function wd(e,t,n,r,l,i,a,o,u){return e=Oa(n,r,!0,e,l,i,a,o,u),e.context=xd(null),n=e.current,r=Ae(),l=Ht(n),i=jt(r,l),i.callback=t??null,Mt(n,i,l),e.current.lanes=l,Mr(e,l,r),Ve(e,r),e}function us(e,t,n,r){var l=t.current,i=Ae(),a=Ht(l);return n=xd(n),t.context===null?t.context=n:t.pendingContext=n,t=jt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Mt(l,t,a),e!==null&&(dt(e,l,a,i),vl(e,l,a)),a}function Xl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Go(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Aa(e,t){Go(e,t),(e=e.alternate)&&Go(e,t)}function sh(){return null}var kd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Fa(e){this._internalRoot=e}cs.prototype.render=Fa.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(b(409));us(e,t,null,null)};cs.prototype.unmount=Fa.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cn(function(){us(null,e,null,null)}),t[Nt]=null}};function cs(e){this._internalRoot=e}cs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zt.length&&t!==0&&t<zt[n].priority;n++);zt.splice(n,0,e),n===0&&ec(e)}};function Ma(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ds(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yo(){}function ih(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var c=Xl(a);i.call(c)}}var a=wd(t,r,e,0,null,!1,!1,"",Yo);return e._reactRootContainer=a,e[Nt]=a.current,br(e.nodeType===8?e.parentNode:e),cn(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var o=r;r=function(){var c=Xl(u);o.call(c)}}var u=Oa(e,0,!1,null,null,!1,!1,"",Yo);return e._reactRootContainer=u,e[Nt]=u.current,br(e.nodeType===8?e.parentNode:e),cn(function(){us(t,u,n,r)}),u}function fs(e,t,n,r,l){var i=n._reactRootContainer;if(i){var a=i;if(typeof l=="function"){var o=l;l=function(){var u=Xl(a);o.call(u)}}us(t,a,e,l)}else a=ih(n,t,e,l,r);return Xl(a)}qu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=cr(t.pendingLanes);n!==0&&(sa(t,n|1),Ve(t,we()),!(ee&6)&&(Un=we()+500,Xt()))}break;case 13:cn(function(){var r=_t(e,1);if(r!==null){var l=Ae();dt(r,e,1,l)}}),Aa(e,1)}};ia=function(e){if(e.tag===13){var t=_t(e,134217728);if(t!==null){var n=Ae();dt(t,e,134217728,n)}Aa(e,134217728)}};Gu=function(e){if(e.tag===13){var t=Ht(e),n=_t(e,t);if(n!==null){var r=Ae();dt(n,e,t,r)}Aa(e,t)}};Yu=function(){return le};Zu=function(e,t){var n=le;try{return le=e,t()}finally{le=n}};fi=function(e,t,n){switch(t){case"input":if(si(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var l=ns(r);if(!l)throw Error(b(90));bu(r),si(r,l)}}}break;case"textarea":zu(e,n);break;case"select":t=n.value,t!=null&&bn(e,!!n.multiple,t,!1)}};Fu=Ra;Mu=cn;var ah={usingClientEntryPoint:!1,Events:[Hr,Sn,ns,Ou,Au,Ra]},sr={findFiberByHostInstance:Zt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},oh={bundleType:sr.bundleType,version:sr.version,rendererPackageName:sr.rendererPackageName,rendererConfig:sr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Et.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Uu(e),e===null?null:e.stateNode},findFiberByHostInstance:sr.findFiberByHostInstance||sh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ul.isDisabled&&ul.supportsFiber)try{Yl=ul.inject(oh),gt=ul}catch{}}Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ah;Ge.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ma(t))throw Error(b(200));return lh(e,t,null,n)};Ge.createRoot=function(e,t){if(!Ma(e))throw Error(b(299));var n=!1,r="",l=kd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=Oa(e,1,!1,null,null,n,!1,r,l),e[Nt]=t.current,br(e.nodeType===8?e.parentNode:e),new Fa(t)};Ge.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(b(188)):(e=Object.keys(e).join(","),Error(b(268,e)));return e=Uu(t),e=e===null?null:e.stateNode,e};Ge.flushSync=function(e){return cn(e)};Ge.hydrate=function(e,t,n){if(!ds(t))throw Error(b(200));return fs(null,e,t,!0,n)};Ge.hydrateRoot=function(e,t,n){if(!Ma(e))throw Error(b(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",a=kd;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=wd(t,null,e,1,n??null,l,!1,i,a),e[Nt]=t.current,br(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new cs(t)};Ge.render=function(e,t,n){if(!ds(t))throw Error(b(200));return fs(null,e,t,!1,n)};Ge.unmountComponentAtNode=function(e){if(!ds(e))throw Error(b(40));return e._reactRootContainer?(cn(function(){fs(null,null,e,!1,function(){e._reactRootContainer=null,e[Nt]=null})}),!0):!1};Ge.unstable_batchedUpdates=Ra;Ge.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ds(n))throw Error(b(200));if(e==null||e._reactInternals===void 0)throw Error(b(38));return fs(e,t,n,!1,r)};Ge.version="18.3.1-next-f1338f8080-20240426";function jd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jd)}catch(e){console.error(e)}}jd(),ju.exports=Ge;var uh=ju.exports,Sd,Zo=uh;Sd=Zo.createRoot,Zo.hydrateRoot;async function _e(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function ch(){return _e("/api/archives")}async function dh(e){return _e(`/api/archives/${e}/entries`)}async function fh(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),_e(`/api/archives/${e}/entries/search?${r}`)}async function Vi(e,t){return _e(`/api/archives/${e}/entries/${t}`)}function ph(e,t,n){return Promise.all(n.map(r=>_e(`/api/archives/${e}/entries/${t}/artifacts/${r}`)))}async function hh(e){if(!e||e.length===0)return{};const t=await fetch("/api/util/resolve-tco",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return t.ok?t.json():{}}async function mh(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n??null})});if(!r.ok)throw new Error(await r.text())}async function cl(e,t){return _e(`/api/archives/${e}/entries/${t}/tags`)}async function eu(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_path:n})});if(!r.ok)throw new Error(`Failed to add tag (${r.status})`)}async function gh(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`Remove failed (${r.status})`)}async function tu(e,t){const n=await fetch(`/api/archives/${e}/entries/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Delete failed (${n.status})`)}async function vh(e,t,n){const r=await fetch(`/api/archives/${e}/tags/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!r.ok)throw new Error(await r.text());return r.json()}async function yh(e,t){const n=await fetch(`/api/archives/${e}/tags/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(await n.text())}async function Js(e){return _e(`/api/archives/${e}/runs`)}async function dl(e){return _e(`/api/archives/${e}/tags`)}async function xh(e,t,n=null,r=null){const l={locator:t};n&&n!=="best"&&(l.quality=n),r&&(typeof r.ublock_enabled=="boolean"&&(l.ublock_enabled=r.ublock_enabled),typeof r.reader_mode=="boolean"&&(l.reader_mode=r.reader_mode),typeof r.cookie_ext_enabled=="boolean"&&(l.cookie_ext_enabled=r.cookie_ext_enabled),typeof r.modal_closer_enabled=="boolean"&&(l.modal_closer_enabled=r.modal_closer_enabled));const i=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!i.ok){const a=await i.json().catch(()=>({}));throw new Error(a.error||`HTTP ${i.status}`)}return i.json()}async function wh(e,t){return _e(`/api/archives/${e}/captures/probe?locator=${encodeURIComponent(t)}`)}async function Nd(e,t){return _e(`/api/archives/${e}/capture_jobs/${t}`)}async function kh(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function jh(e,t){const n=await fetch("/api/auth/setup",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Setup failed");return n.json()}async function Sh(e,t){const n=await fetch("/api/auth/login",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Login failed");return n.json()}async function Nh(){await fetch("/api/auth/logout",{method:"POST"})}async function _h(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function Ch(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display_name:e})});if(!t.ok)throw new Error(await t.text())}async function Eh(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function Th(e,t){const n=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_password:e,new_password:t})});if(!n.ok){let r=await n.text();try{r=JSON.parse(r).error??r}catch{}throw new Error(r)}}async function Ph(){return _e("/api/auth/tokens")}async function bh(e){const t=await fetch("/api/auth/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error(await t.text());return t.json()}async function Lh(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function Ba(){return _e("/api/admin/instance-settings")}async function Nl(e){const t=await fetch("/api/admin/instance-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function zh(){return _e("/api/admin/users")}async function Rh(e,t,n){const r=await fetch("/api/admin/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:n||void 0})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error||`HTTP ${r.status}`)}return r.json()}async function Dh(e,t){const n=await fetch(`/api/admin/users/${e}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function $h(){return _e("/api/admin/roles")}async function Ih(e,t){const n=await fetch("/api/admin/roles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,name:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function _d(e){return _e(`/api/archives/${e}/collections`)}async function Oh(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}return l.json()}async function Ah(e,t){return _e(`/api/archives/${e}/collections/${t}`)}async function Cd(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections/${t}/entries`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({entry_uid:n,visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Fh(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"DELETE"});if(!r.ok){const l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error||r.statusText)}}async function Mh(e,t,n,r){const l=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Bh(e,t){return _e(`/api/archives/${e}/entries/${t}/collections`)}async function nu(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error??r.statusText)}}async function Hh(e,t){const n=await fetch(`/api/archives/${e}/collections/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??n.statusText)}}async function Uh(e){return _e(`/api/archives/${e}/blob-cleanup`)}async function Wh(e){const t=await fetch(`/api/archives/${e}/blob-cleanup`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error??t.statusText)}return t.json()}async function Vh(e,t){const n=await fetch(`/api/archives/${e}/entries/${t}/rearchive`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`rearchive failed: ${n.status}`)}return n.json()}async function Qh(){return _e("/api/admin/cookie-rules")}async function Kh(e,t,n){const r=await fetch("/api/admin/cookie-rules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url_pattern:e||null,pattern_kind:t,cookies_json:n})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.message||`HTTP ${r.status}`)}return r.json()}async function Xh(e,t){const n=await fetch(`/api/admin/cookie-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`HTTP ${n.status}`)}}async function Jh(e){const t=await fetch(`/api/admin/cookie-rules/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message||`HTTP ${t.status}`)}}const qh=window.fetch;window.fetch=async(...e)=>{var n;const t=await qh(...e);return t.status===401&&((typeof e[0]=="string"?e[0]:((n=e[0])==null?void 0:n.url)??"").includes("/api/auth/")||window.dispatchEvent(new CustomEvent("auth:expired"))),t};function Gh({onLogin:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(null),[o,u]=f.useState(!1);async function c(g){g.preventDefault(),a(null),u(!0);try{const m=await Sh(t,r);e(m)}catch(m){a(m.message)}finally{u(!1)}}return s.jsx("div",{className:"login-page",children:s.jsxs("div",{className:"login-card",children:[s.jsx("h1",{className:"login-brand",children:"Archivr"}),s.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),s.jsxs("form",{onSubmit:c,children:[s.jsxs("div",{className:"login-field",children:[s.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),s.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:g=>n(g.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),s.jsxs("div",{className:"login-field",children:[s.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),s.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:g=>l(g.target.value),required:!0,autoComplete:"current-password"})]}),i&&s.jsx("p",{className:"login-error",children:i}),s.jsx("button",{className:"login-submit",type:"submit",disabled:o,children:o?"Signing in…":"Sign in"})]})]})})}function Yh({onComplete:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(""),[o,u]=f.useState(null),[c,g]=f.useState(!1);async function m(h){if(h.preventDefault(),r!==i){u("Passwords do not match");return}if(r.length<8){u("Password must be at least 8 characters");return}u(null),g(!0);try{await jh(t,r),e()}catch(y){u(y.message)}finally{g(!1)}}return s.jsx("div",{className:"setup-page",children:s.jsxs("div",{className:"setup-card",children:[s.jsx("h1",{className:"setup-brand",children:"Archivr"}),s.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),s.jsxs("form",{onSubmit:m,children:[s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),s.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:h=>n(h.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),s.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:h=>l(h.target.value),required:!0,autoComplete:"new-password"})]}),s.jsxs("div",{className:"setup-field",children:[s.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),s.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:h=>a(h.target.value),required:!0,autoComplete:"new-password"})]}),o&&s.jsx("p",{className:"setup-error",children:o}),s.jsx("button",{className:"setup-submit",type:"submit",disabled:c,children:c?"Creating account…":"Create account"})]})]})})}function Zh({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:a,setCurrentUser:o}=f.useContext(ps)??{},[u,c]=f.useState(!1);async function g(){c(!0),await Nh(),o(null),window.location.reload()}return s.jsxs("header",{className:"topbar",children:[s.jsx("div",{className:"brand",children:"Archivr"}),s.jsx("div",{className:"switcher",children:s.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>s.jsx("option",{value:m.id,children:m.label},m.id))})}),s.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","tags","collections","runs","admin","settings"].map(m=>s.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),s.jsx("button",{className:"capture-button",onClick:i,children:"Capture"}),a&&s.jsxs("div",{className:"user-menu",children:[s.jsx("span",{className:"user-name",children:a.display_name||a.username}),s.jsx("button",{className:"logout-btn",onClick:g,disabled:u,children:u?"Logging out…":"Log out"})]})]})}let Qi=1;function Ed(e){const t=e.trim(),n=t.toLowerCase();for(const r of["yt:","youtube:"])if(n.startsWith(r)){const l=n.slice(r.length);return l.startsWith("video/")||l.startsWith("short/")||l.startsWith("shorts/")}if(n.startsWith("ytm:"))return!n.slice(4).startsWith("playlist/");for(const r of["x:","twitter:","tweet:"])if(n.startsWith(r))return n.slice(r.length).startsWith("media:");if(n.startsWith("spotify:"))return!1;if(n.startsWith("instagram:")||n.startsWith("facebook:")||n.startsWith("tiktok:")||n.startsWith("reddit:")||n.startsWith("snapchat:"))return!0;if(n.startsWith("http://")||n.startsWith("https://")){if(/^https?:\/\/music\.youtube\.com\/watch/.test(n)||/^https?:\/\/(?:www\.)?(?:youtu\.be\/[0-9A-Za-z_-]+|youtube\.com\/watch\?v=[0-9A-Za-z_-]+|youtube\.com\/shorts\/[0-9A-Za-z_-]+)/.test(t)||n.startsWith("https://x.com/")||n.startsWith("http://x.com/")||/^https?:\/\/(?:www\.)?instagram\.com\//.test(n)||/^https?:\/\/(?:www\.)?facebook\.com\//.test(n)||n.startsWith("https://fb.watch/")||n.startsWith("http://fb.watch/")||/^https?:\/\/(?:www\.)?tiktok\.com\//.test(n)||/^https?:\/\/(?:www\.)?reddit\.com\//.test(n)||n.startsWith("https://redd.it/")||n.startsWith("http://redd.it/")||/^https?:\/\/(?:www\.)?snapchat\.com\//.test(n))return!0;if(n.startsWith("https://open.spotify.com/")||n.startsWith("http://open.spotify.com/"))return!1}return!1}function ir(e=""){return{id:Qi++,locator:e,quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,status:"idle",error:null,jobUid:null,archiveId:null}}function ru(e){return e.some(t=>t.status==="submitting"||t.status==="running")}function em({open:e,archiveId:t,onClose:n,onCaptured:r,onToast:l}){const i=f.useRef(null),a=f.useRef(!0),o=f.useRef(new Map),u=f.useRef(new Map),c=f.useRef(new Map),g=f.useRef(t);f.useEffect(()=>{g.current=t},[t]);const m=f.useRef(r),h=f.useRef(l);f.useEffect(()=>{m.current=r},[r]),f.useEffect(()=>{h.current=l},[l]);const[y,x]=f.useState(()=>{try{const N=JSON.parse(sessionStorage.getItem("captureItems")||"null");if(Array.isArray(N)&&N.length>0)return N.forEach(O=>{O.id>=Qi&&(Qi=O.id+1)}),N}catch{}return[ir()]});f.useEffect(()=>{sessionStorage.setItem("captureItems",JSON.stringify(y))},[y]);const[k,j]=f.useState(!1),[p,d]=f.useState(null),[v,w]=f.useState(null),[S,P]=f.useState(!0),[C,_]=f.useState(!0);f.useEffect(()=>{Ba().then(N=>{w(N),P(N.cookie_ext_enabled??!0),_(N.modal_closer_enabled??!0)}).catch(()=>w({}))},[]);const I=p!==null?p:(v==null?void 0:v.ublock_enabled)??!0,[L,Q]=f.useState(!1);f.useEffect(()=>{["captureDialogLocator","captureDialogError","captureDialogBusy","captureDialogJobStatus","captureDialogJobUid"].forEach(N=>sessionStorage.removeItem(N)),x(N=>N.map(O=>O.status==="submitting"?{...O,status:"idle",error:null}:O)),y.forEach(N=>{N.status==="running"&&N.jobUid&&N.archiveId&&!o.current.has(N.jobUid)&&ne(N.id,N.jobUid,N.locator,N.archiveId)})},[]),f.useEffect(()=>{const N=i.current;if(!N)return;const O=()=>{u.current.forEach(B=>clearTimeout(B)),u.current.clear(),n()};return N.addEventListener("close",O),()=>N.removeEventListener("close",O)},[n]),f.useEffect(()=>{const N=i.current;N&&(e?(!a.current&&!ru(y)&&x([ir()]),a.current=!1,N.open||N.showModal()):(u.current.forEach(O=>clearTimeout(O)),u.current.clear(),N.open&&N.close()))},[e]),f.useEffect(()=>()=>{o.current.forEach(N=>clearInterval(N)),u.current.forEach(N=>clearTimeout(N))},[]);function ne(N,O,B,M,W=null){if(o.current.has(O))return;const de=setInterval(async()=>{try{const J=await Nd(M,O);if(J.status==="completed"){clearInterval(o.current.get(O)),o.current.delete(O),x(q=>q.map(G=>G.id===N?{...G,status:"completed"}:G)),setTimeout(()=>{x(q=>{const G=q.filter(oe=>oe.id!==N);return G.length===0?[ir()]:G})},1400),m.current();try{const q=J.notes_json?JSON.parse(J.notes_json):null;if(q!=null&&q.ublock_skipped||q!=null&&q.cookie_ext_skipped){const oe=q.ublock_skipped&&q.cookie_ext_skipped?"Captured without ad-blocking or cookie-consent extension. Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config.":q.ublock_skipped?"Captured without ad-blocking. ARCHIVR_UBLOCK=true but ARCHIVR_UBLOCK_EXT is not set or the path is invalid.":"Captured without cookie-consent extension. ARCHIVR_COOKIE_EXT is not set or the path is invalid.";h.current(oe,B,"warning"),Z(W,"warning",B)}else W||h.current(null,B,"success"),Z(W,"archived")}catch{W||h.current(null,B,"success"),Z(W,"archived")}}else if(J.status==="failed"){clearInterval(o.current.get(O)),o.current.delete(O);const q=J.error_text||"Capture failed.";x(G=>G.map(oe=>oe.id===N?{...oe,status:"failed",error:q}:oe)),h.current(q,B),Z(W,"failed",B)}}catch(J){clearInterval(o.current.get(O)),o.current.delete(O);const q=J.message||"Network error";x(G=>G.map(oe=>oe.id===N?{...oe,status:"failed",error:q}:oe)),h.current(q,B),Z(W,"failed",B)}},500);o.current.set(O,de)}function Z(N,O,B=null){if(!N)return;const M=c.current.get(N);if(!M||(O==="archived"||O==="warning"?(M.archived++,O==="warning"&&(M.warnings++,B&&M.warningLocators.push(B))):(M.failed++,B&&M.failedLocators.push(B)),M.archived+M.failed<M.total))return;c.current.delete(N);const{archived:W,warnings:de,failed:J,failedLocators:q,warningLocators:G}=M;let oe;if(W===0)oe=`${J} failed`;else{const xe=de>0?`${W} archived (${de} with warnings)`:`${W} archived`;oe=J>0?`${xe}, ${J} failed`:xe}const D=W===0?"error":J>0||de>0?"warning":"success",V=[];q.length>0&&V.push(`Failed:
|
||
${q.map(xe=>` ${xe}`).join(`
|
||
`)}`),G.length>0&&V.push(`With warnings:
|
||
${G.map(xe=>` ${xe}`).join(`
|
||
`)}`);const Ce=V.length>0?V.join(`
|
||
`):null;h.current(Ce,null,D,oe)}async function se(N,O=null){if(!N.locator.trim())return;const B=t,M=N.locator.trim(),W=N.quality||"best";x(de=>de.map(J=>J.id===N.id?{...J,status:"submitting",error:null}:J));try{const J=await xh(B,M,W,{ublock_enabled:I,reader_mode:L,cookie_ext_enabled:S,modal_closer_enabled:C});x(q=>q.map(G=>G.id===N.id?{...G,status:"running",jobUid:J.job_uid,archiveId:B}:G)),ne(N.id,J.job_uid,M,B,O)}catch(de){const J=de.message||"Submission failed.";x(q=>q.map(G=>G.id===N.id?{...G,status:"failed",error:J}:G)),h.current(J,M),Z(O,"failed",M)}}function pe(){var B,M;const N=y.filter(W=>W.status==="idle"&&W.locator.trim());if(N.length===0)return;const O=N.length>1?((B=crypto.randomUUID)==null?void 0:B.call(crypto))??`batch-${Date.now()}`:null;O&&c.current.set(O,{total:N.length,archived:0,warnings:0,failed:0,failedLocators:[],warningLocators:[]}),N.forEach(W=>se(W,O)),(M=i.current)==null||M.close()}function ve(){x(N=>[...N,ir()])}function ie(N){clearTimeout(u.current.get(N)),u.current.delete(N),x(O=>{const B=O.filter(M=>M.id!==N);return B.length===0?[ir()]:B})}function R(N){x(O=>O.map(B=>B.id===N?{...B,status:"idle",error:null}:B))}function T(N,O){if(clearTimeout(u.current.get(N)),x(M=>M.map(W=>W.id===N?{...W,locator:O,probeState:"idle",probeQualities:null,probeHasAudio:!1,quality:"best"}:W)),!Ed(O))return;const B=setTimeout(async()=>{u.current.delete(N),x(M=>M.map(W=>W.id===N?{...W,probeState:"probing"}:W));try{const M=await wh(g.current,O.trim());x(W=>W.map(de=>{if(de.id!==N||de.locator!==O)return de;const J=M.qualities??[],q=M.has_audio??!1,G=J.length===0&&q?"audio":"best";return{...de,probeState:"done",probeQualities:J,probeHasAudio:q,quality:G}}))}catch{x(M=>M.map(W=>W.id===N?{...W,probeState:"idle",probeQualities:null}:W))}},600);u.current.set(N,B)}function F(N,O){x(B=>B.map(M=>M.id===N?{...M,quality:O}:M))}const X=y.filter(N=>N.status==="idle"&&N.locator.trim()).length,H=ru(y);return s.jsx("dialog",{ref:i,className:"capture-dialog",children:s.jsxs("div",{className:"capture-dialog-inner",children:[s.jsxs("div",{className:"capture-dialog-header",children:[s.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),s.jsx("button",{type:"button",className:"capture-dialog-close",onClick:()=>{var N;return(N=i.current)==null?void 0:N.close()},"aria-label":"Close",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),s.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),s.jsx("div",{className:"capture-rows",children:y.map((N,O)=>s.jsx(tm,{item:N,autoFocus:O===y.length-1&&N.status==="idle",onLocatorChange:B=>T(N.id,B),onQualityChange:B=>F(N.id,B),onRemove:()=>ie(N.id),onReset:()=>R(N.id),onSubmit:pe},N.id))}),s.jsxs("button",{type:"button",className:"capture-add-row",onClick:ve,children:[s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"14"}),s.jsx("line",{x1:"2",y1:"8",x2:"14",y2:"8"})]}),"Add another"]}),s.jsxs("div",{className:"capture-advanced",children:[s.jsxs("button",{type:"button",className:"capture-advanced-toggle",onClick:()=>j(N=>!N),"aria-expanded":k,children:[s.jsx("svg",{className:`capture-chevron${k?" capture-chevron--open":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"4 6 8 10 12 6"})}),"Advanced options"]}),k&&s.jsxs("div",{className:"capture-advanced-panel",children:[s.jsxs("label",{className:"capture-ext-row",children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"uBlock Origin Lite"}),s.jsx("span",{className:"capture-ext-desc",children:"Block ads during this capture"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":I,className:`ext-toggle ext-toggle--sm${I?" ext-toggle--on":""}`,onClick:()=>d(N=>N===null?!I:!N),"aria-label":"Toggle uBlock for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Block cookie banners"}),s.jsx("span",{className:"capture-ext-desc",children:"Dismiss cookie consent banners during this capture"}),!(v!=null&&v.cookie_ext_available)&&s.jsxs("span",{className:"capture-ext-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":S,className:`ext-toggle ext-toggle--sm${S?" ext-toggle--on":""}`,onClick:()=>P(N=>!N),"aria-label":"Toggle cookie banner blocking for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Reader mode"}),s.jsx("span",{className:"capture-ext-desc",children:"Distil to article text via Readability (off by default)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":L,className:`ext-toggle ext-toggle--sm${L?" ext-toggle--on":""}`,onClick:()=>Q(N=>!N),"aria-label":"Toggle reader mode for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]}),s.jsxs("label",{className:"capture-ext-row",style:{marginTop:8},children:[s.jsxs("span",{className:"capture-ext-label",children:[s.jsx("span",{className:"capture-ext-name",children:"Close modals and dialogs"}),s.jsx("span",{className:"capture-ext-desc",children:"Auto-dismiss cookie banners and overlays during this capture"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":C,className:`ext-toggle ext-toggle--sm${C?" ext-toggle--on":""}`,onClick:()=>_(N=>!N),"aria-label":"Toggle modal closer for this capture",children:s.jsx("span",{className:"ext-toggle-knob"})})]})]})]}),s.jsxs("div",{className:"capture-actions",children:[s.jsx("button",{type:"button",className:"capture-submit",onClick:pe,disabled:X===0,children:X>1?`Archive ${X}`:"Archive"}),s.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var N;return(N=i.current)==null?void 0:N.close()},children:H?"Close":"Cancel"})]})]})})}function tm({item:e,autoFocus:t,onLocatorChange:n,onQualityChange:r,onRemove:l,onReset:i,onSubmit:a}){const o=f.useRef(null),u=e.status==="submitting"||e.status==="running";f.useEffect(()=>{var g;t&&e.status==="idle"&&((g=o.current)==null||g.focus())},[t]);const c=(()=>{if(e.status==="completed"||u||!Ed(e.locator))return null;if(e.probeState==="probing")return s.jsx("span",{className:"capture-quality-probing","aria-label":"Checking available qualities",children:"…"});if(e.probeState==="done"){const g=e.probeQualities??[],m=e.probeHasAudio??!1;return g.length===0&&!m?s.jsx("span",{className:"capture-quality-hint",children:"No media detected"}):g.length===0&&m?s.jsx("select",{className:"capture-quality",value:"audio",onChange:h=>r(h.target.value),"aria-label":"Video quality",children:s.jsx("option",{value:"audio",children:"Audio only"})}):s.jsxs("select",{className:"capture-quality",value:e.quality||"best",onChange:h=>r(h.target.value),"aria-label":"Video quality",children:[s.jsx("option",{value:"best",children:"Best quality"}),g.map(h=>s.jsx("option",{value:h,children:h},h)),m&&s.jsx("option",{value:"audio",children:"Audio only"})]})}return null})();return s.jsxs("div",{className:`capture-row capture-row--${e.status}`,children:[s.jsxs("div",{className:"capture-row-main",children:[s.jsx(nm,{status:e.status}),s.jsx("input",{ref:o,className:"capture-input",type:"text",placeholder:"https://… · yt:ID · ytm:ID · tweet:ID · x:ID",value:e.locator,onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&a()},disabled:u||e.status==="completed",autoComplete:"off",spellCheck:!1}),c,e.status==="failed"&&s.jsx("button",{type:"button",className:"capture-row-action",onClick:i,title:"Retry",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M13 2.5A7 7 0 1 1 6.5 1"}),s.jsx("polyline",{points:"6.5 1 4 3.5 6.5 6"})]})}),!u&&e.status!=="completed"&&e.status!=="failed"&&s.jsx("button",{type:"button",className:"capture-row-action capture-row-remove",onClick:l,"aria-label":"Remove",children:s.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("line",{x1:"3",y1:"3",x2:"13",y2:"13"}),s.jsx("line",{x1:"13",y1:"3",x2:"3",y2:"13"})]})})]}),e.error&&s.jsx("p",{className:"capture-row-error",children:e.error})]})}function nm({status:e}){return e==="submitting"||e==="running"?s.jsx("span",{className:"cap-dot cap-dot--running","aria-label":"Running",children:s.jsx("span",{className:"cap-spinner"})}):e==="completed"?s.jsx("span",{className:"cap-dot cap-dot--ok","aria-label":"Done",children:"✓"}):e==="failed"?s.jsx("span",{className:"cap-dot cap-dot--err","aria-label":"Failed",children:"✕"}):s.jsx("span",{className:"cap-dot cap-dot--idle","aria-hidden":"true"})}function Jl(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function rm(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}function nn(e){return rm(e)??""}function Td(e){if(!e)return"";const t=new Date(e);if(isNaN(t))return e;const n=r=>String(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const lu={youtube:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FF0000" d="M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1C24 15.9 24 12 24 12s0-3.9-.5-5.8z"/><polygon fill="#fff" points="9.6,15.6 15.8,12 9.6,8.4"/></svg>',youtube_music:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0000"/><polygon fill="#fff" points="9.6,15.6 15.8,12 9.6,8.4"/></svg>',spotify:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1DB954"/><path fill="#fff" d="M17.9 10.9c-3.2-1.9-8.5-2.1-11.6-1.1-.5.1-1-.2-1.1-.6-.1-.5.2-1 .6-1.1 3.5-1.1 9.4-.9 13 1.3.4.2.6.8.3 1.2-.2.5-.8.6-1.2.3zm-.1 2.9c-.2.4-.7.5-1.1.3-2.7-1.6-6.7-2.1-9.9-1.1-.4.1-.9-.1-1-.5-.1-.4.1-.9.5-1 3.6-1.1 8-.5 11.1 1.3.4.2.5.7.4 1zm-1.3 2.8c-.2.3-.6.4-.9.2-2.3-1.4-5.2-1.7-8.6-.9-.3.1-.7-.1-.8-.5-.1-.3.1-.7.4-.8 3.7-.9 7-.5 9.6 1 .4.2.5.6.3.9z"/></svg>',x:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.2 2h3.3l-7.2 8.2L23 22h-6.6l-5.2-6.8L5 22H1.7l7.7-8.8L1 2h6.8l4.7 6.2zm-1.1 18h1.8L6.9 3.9H5z"/></svg>',instagram:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="ig" x1="0%" y1="100%" x2="100%" y2="0%"><stop offset="0%" stop-color="#f09433"/><stop offset="25%" stop-color="#e6683c"/><stop offset="50%" stop-color="#dc2743"/><stop offset="75%" stop-color="#cc2366"/><stop offset="100%" stop-color="#bc1888"/></linearGradient></defs><rect width="24" height="24" rx="5" fill="url(#ig)"/><rect x="2.5" y="2.5" width="19" height="19" rx="4" fill="none" stroke="#fff" stroke-width="1.5"/><circle cx="12" cy="12" r="4" fill="none" stroke="#fff" stroke-width="1.5"/><circle cx="17.5" cy="6.5" r="1" fill="#fff"/></svg>',facebook:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect width="24" height="24" rx="4" fill="#1877F2"/><path fill="#fff" d="M16 8h-2c-.6 0-1 .4-1 1v2h3l-.4 3H13v8h-3v-8H8v-3h2V9a4 4 0 0 1 4-4h2v3z"/></svg>',tiktok:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.6 5.4a4.8 4.8 0 0 1-4.8-4.8h-3v14.7a2 2 0 1 1-2-2l.1-3a5 5 0 1 0 4.9 5V8.4a8 8 0 0 0 4.8 1.6V6.7a4.8 4.8 0 0 1-0-.2l0 0 .1.9z" fill="#000"/><path d="M18.6 4.4a4.8 4.8 0 0 1-4.8-4.8h-3v14.7a2 2 0 1 1-2-2l.1-3a5 5 0 1 0 4.9 5V7.4a8 8 0 0 0 4.8 1.6V5.7" fill="none" stroke="#69C9D0" stroke-width="1.5"/></svg>',reddit:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF4500"/><path fill="#fff" d="M20 12a2 2 0 0 0-2-2 2 2 0 0 0-1.3.5c-1.3-.9-3-.9-4.6-.9l.8-3.7 2.6.5a1.4 1.4 0 1 0 1.4-1.3 1.4 1.4 0 0 0-1.3.8l-2.9-.5a.3.3 0 0 0-.4.3l-.9 4.1c-1.6 0-3.1.1-4.3.9A2 2 0 0 0 4 12a2 2 0 0 0 1 1.7 3.3 3.3 0 0 0 0 .5c0 2.6 3 4.8 6.8 4.8s6.8-2.1 6.8-4.8a3.3 3.3 0 0 0 0-.5A2 2 0 0 0 20 12zm-13.6 1a1.1 1.1 0 1 1 1.1 1.1A1.1 1.1 0 0 1 6.4 13zm6.2 3.1a3.5 3.5 0 0 1-2.3.7 3.5 3.5 0 0 1-2.3-.7.3.3 0 0 1 .4-.4 3 3 0 0 0 1.9.5 3 3 0 0 0 1.9-.5.3.3 0 0 1 .4.4zm-.3-2a1.1 1.1 0 1 1 1.1-1.1A1.1 1.1 0 0 1 12.3 14.1z"/></svg>',snapchat:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect width="24" height="24" rx="4" fill="#FFFC00"/><path d="M12 3.5c-2.4 0-4.4 2-4.4 4.4v1.3l-.8.1c-.3 0-.5.2-.5.5s.3.5.6.6c.3.1.5.3.5.8 0 .3-.1.5-.3.7-.6.8-1.5 1.3-2.2 1.4-.1.7.7 1 1.7 1.2.1.6.3.8.8.8.6 0 1.1.4 2.7.4 1.5 0 2.1-.4 2.7-.4.5 0 .7-.2.8-.8 1-.2 1.8-.5 1.7-1.2-.7-.1-1.6-.6-2.2-1.4-.2-.2-.3-.4-.3-.7 0-.5.2-.7.5-.8.3-.1.6-.3.6-.6s-.2-.5-.5-.5l-.8-.1V7.9C16.4 5.5 14.4 3.5 12 3.5z"/></svg>',local:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#666" stroke-width="1.5" stroke-linejoin="round" d="M4 4h7l2 2h7v14H4z"/></svg>',web:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="none" stroke="#555" stroke-width="1.5"/><ellipse cx="12" cy="12" rx="4" ry="10" fill="none" stroke="#555" stroke-width="1.5"/><line x1="2" y1="9" x2="22" y2="9" stroke="#555" stroke-width="1.5"/><line x1="2" y1="15" x2="22" y2="15" stroke="#555" stroke-width="1.5"/></svg>',other:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="none" stroke="#999" stroke-width="1.5"/><text x="12" y="16" text-anchor="middle" font-size="12" fill="#999">?</text></svg>'};function Ha(e){return lu[e]??lu.other}function Pd(e){return e.split("/").map(t=>t?t.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"").join("/")}function lm({entry:e,archiveId:t,isSelected:n,isMultiSelected:r,onRowClick:l}){const[i,a]=f.useState(!1),u=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!i?s.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>a(!0),style:{objectFit:"contain"}}):s.jsx("span",{dangerouslySetInnerHTML:{__html:Ha(e.source_kind)}}),c=n||r;function g(m){m.stopPropagation(),l(e,{ctrlKey:!0,metaKey:!1,shiftKey:!1,preventDefault(){}})}return s.jsxs("div",{className:[n&&"is-selected",r&&"is-multi-selected"].filter(Boolean).join(" ")||void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onMouseDown:m=>{m.shiftKey&&m.preventDefault()},onClick:m=>l(e,m),onKeyDown:m=>{m.key==="Enter"&&l(e,m)},children:[s.jsx("div",{className:"col-check",children:s.jsx("button",{type:"button",className:`row-checkbox${c?" is-checked":""}`,"aria-pressed":c,"aria-label":c?"Deselect entry":"Select entry",onClick:g,onKeyDown:m=>m.stopPropagation()})}),s.jsx("div",{className:"col-added",children:Td(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[s.jsx("span",{className:"source-icon",children:u}),s.jsx("span",{className:"entry-title",children:nn(e.title)||nn(e.entry_uid)})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:nn(e.entity_kind)})}),s.jsxs("div",{className:"col-size",children:[s.jsx("span",{className:"size-total",children:Jl(e.total_artifact_bytes)}),e.cached_bytes>0&&e.total_artifact_bytes>0&&s.jsxs("span",{className:"size-cached-pct",title:`${Jl(e.cached_bytes)} already on disk from an earlier entry`,children:[Math.round(e.cached_bytes/e.total_artifact_bytes*100),"% cached"]})]}),s.jsx("div",{className:"url-cell col-url",children:nn(e.original_url)})]})}function sm({entries:e,selectedUids:t,onRowClick:n,archiveId:r}){return s.jsx("section",{id:"archive-view",className:"view is-active",children:s.jsxs("div",{className:"entry-table",children:[s.jsxs("div",{className:"entry-header-row",children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:"Added"}),s.jsx("div",{className:"col-title",children:"Title"}),s.jsx("div",{className:"col-type",children:"Type"}),s.jsx("div",{className:"col-size",children:"Size"}),s.jsx("div",{className:"col-url",children:"Original URL"})]}),s.jsx("div",{id:"entries-body",children:e.map(l=>s.jsx(lm,{entry:l,archiveId:r,isSelected:t.size===1&&t.has(l.entry_uid),isMultiSelected:t.size>=2&&t.has(l.entry_uid),onRowClick:n},l.entry_uid))})]})})}function im(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function am({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="in_progress"?"run-status--in-progress":"",n=e?e.replace(/_/g," "):"—";return s.jsx("span",{className:`run-status ${t}`,children:n})}function om({runs:e}){const[t,n]=f.useState(null);function r(l){n(i=>i===l?null:l)}return s.jsx("section",{id:"runs-view",className:"view is-active",children:s.jsxs("table",{className:"entry-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Requested"}),s.jsx("th",{children:"Completed"}),s.jsx("th",{children:"Failed"})]})}),s.jsx("tbody",{children:e.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map(l=>{const i=l.status==="failed"&&l.error_summary,a=t===l.run_uid;return[s.jsxs("tr",{className:i?"run-row run-row--failed":"run-row",onClick:i?()=>r(l.run_uid):void 0,title:i?a?"Click to hide error":"Click to view error":void 0,children:[s.jsx("td",{children:im(l.started_at)}),s.jsxs("td",{children:[s.jsx(am,{status:l.status}),i&&s.jsx("span",{className:"run-expand-hint","aria-hidden":"true",children:a?"▴":"▾"})]}),s.jsx("td",{children:l.requested_count??"—"}),s.jsx("td",{children:l.completed_count??"—"}),s.jsx("td",{children:l.failed_count??"—"})]},l.run_uid),i&&a&&s.jsx("tr",{className:"run-error-row",children:s.jsx("td",{colSpan:5,children:s.jsx("pre",{className:"run-error-detail",children:l.error_summary})})},`${l.run_uid}-detail`)]})})]})})}const um=4;function cm({archives:e}){const{currentUser:t}=f.useContext(ps)??{},n=t&&(t.role_bits&um)!==0,[r,l]=f.useState("users"),[i,a]=f.useState([]),[o,u]=f.useState([]),[c,g]=f.useState(!1),[m,h]=f.useState(null),[y,x]=f.useState(""),[k,j]=f.useState(""),[p,d]=f.useState(""),[v,w]=f.useState(null),[S,P]=f.useState(!1),[C,_]=f.useState(""),[I,L]=f.useState(""),[Q,ne]=f.useState(null),[Z,se]=f.useState(!1),pe=f.useCallback(async()=>{if(n){g(!0),h(null);try{const[T,F]=await Promise.all([zh(),$h()]);a(T),u(F)}catch(T){h(T.message)}finally{g(!1)}}},[n]);f.useEffect(()=>{pe()},[pe]);async function ve(T){const F=T.status==="active"?"disabled":"active";try{await Dh(T.user_uid,F),a(X=>X.map(H=>H.user_uid===T.user_uid?{...H,status:F}:H))}catch(X){h(X.message)}}async function ie(T){if(T.preventDefault(),!y.trim()||!k){w("Username and password required");return}P(!0),w(null);try{await Rh(y.trim(),k,p.trim()||void 0),x(""),j(""),d(""),await pe()}catch(F){w(F.message)}finally{P(!1)}}async function R(T){if(T.preventDefault(),!C.trim()||!I.trim()){ne("Slug and name required");return}se(!0),ne(null);try{await Ih(C.trim(),I.trim()),_(""),L(""),await pe()}catch(F){ne(F.message)}finally{se(!1)}}return n?s.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[s.jsx("h1",{children:"Admin"}),s.jsxs("div",{className:"view-tabs",children:[s.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),s.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),s.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&s.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Users"}),c?s.jsx("p",{className:"muted",children:"Loading…"}):s.jsxs("table",{className:"admin-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Username"}),s.jsx("th",{children:"Email"}),s.jsx("th",{children:"Roles"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:i.map(T=>s.jsxs("tr",{className:T.status==="disabled"?"admin-row-disabled":"",children:[s.jsx("td",{children:T.username}),s.jsx("td",{className:"muted",children:T.email||"—"}),s.jsx("td",{children:T.role_slugs.join(", ")||"—"}),s.jsx("td",{children:s.jsx("span",{className:`status-badge status-${T.status}`,children:T.status})}),s.jsx("td",{children:s.jsx("button",{className:"admin-action-btn",onClick:()=>ve(T),children:T.status==="active"?"Ban":"Unban"})})]},T.user_uid))})]}),s.jsx("h3",{children:"Create User"}),s.jsxs("form",{className:"admin-form",onSubmit:ie,children:[s.jsx("input",{className:"admin-input",placeholder:"Username",value:y,onChange:T=>x(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:k,onChange:T=>j(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:T=>d(T.target.value)}),v&&s.jsx("div",{className:"form-msg form-msg--err",children:v}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:S,children:S?"Creating…":"Create User"})]})]}),r==="roles"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Roles"}),c?s.jsx("p",{className:"muted",children:"Loading…"}):s.jsxs("table",{className:"admin-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Slug"}),s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Level"}),s.jsx("th",{children:"Bit"}),s.jsx("th",{children:"Built-in"})]})}),s.jsx("tbody",{children:o.map(T=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:T.slug})}),s.jsx("td",{children:T.name}),s.jsx("td",{children:T.level}),s.jsx("td",{children:T.bit_position}),s.jsx("td",{children:T.is_builtin?"✓":""})]},T.role_uid))})]}),s.jsx("h3",{children:"Create Custom Role"}),s.jsxs("form",{className:"admin-form",onSubmit:R,children:[s.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:C,onChange:T=>_(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:I,onChange:T=>L(T.target.value),required:!0}),Q&&s.jsx("div",{className:"form-msg form-msg--err",children:Q}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:Z,children:Z?"Creating…":"Create Role"})]})]}),r==="archives"&&s.jsxs("div",{className:"admin-section",children:[s.jsx("h2",{children:"Mounted Archives"}),s.jsx("div",{className:"admin-list",children:e.map(T=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:T.label}),s.jsx("div",{className:"muted",children:T.archive_path})]},T.id))})]})]}):s.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[s.jsx("h1",{children:"Admin"}),s.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),s.jsx("h2",{children:"Mounted Archives"}),s.jsx("div",{className:"admin-list",children:e.map(T=>s.jsxs("div",{className:"admin-archive",children:[s.jsx("strong",{children:T.label}),s.jsx("div",{className:"muted",children:T.archive_path})]},T.id))})]})}function bd({node:e,archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){var w;const c=n===e.tag.full_path,[g,m]=f.useState(!1),[h,y]=f.useState(""),x=f.useRef(!1);function k(){if(g)return;const S=c?null:e.tag.full_path;r(S),l("archive")}function j(S){S.stopPropagation(),y(e.tag.slug),m(!0)}async function p(){const S=h.trim();if(!S||S===e.tag.slug){m(!1);return}try{const P=await vh(t,e.tag.tag_uid,S);i(e.tag.full_path,P.full_path),o()}catch{}finally{m(!1)}}async function d(S){var C;S.stopPropagation();const P=((C=e.children)==null?void 0:C.length)>0?`Delete tag "${e.tag.full_path}" and all its child tags? This cannot be undone.`:`Delete tag "${e.tag.full_path}"? This cannot be undone.`;if(window.confirm(P))try{await yh(t,e.tag.tag_uid),a(e.tag.full_path),o()}catch{}}const v={archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u};return s.jsxs("li",{children:[s.jsxs("div",{className:"tag-node-row",children:[g?s.jsx("input",{className:"tag-rename-input",autoFocus:!0,value:h,onChange:S=>y(S.target.value),onKeyDown:S=>{S.key==="Enter"&&S.currentTarget.blur(),S.key==="Escape"&&(x.current=!0,S.currentTarget.blur())},onBlur:()=>{x.current?(x.current=!1,m(!1)):p()}}):s.jsxs("button",{className:`tag-node-btn${c?" is-active":""}`,title:e.tag.full_path,onClick:k,onDoubleClick:j,children:[u?e.tag.name:e.tag.slug,s.jsx("svg",{className:"edit-icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",onClick:S=>{S.stopPropagation(),j(S)},children:s.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),s.jsx("button",{className:"remove tag-node-delete",title:`Delete tag ${e.tag.full_path}`,onClick:d,"aria-label":`Delete tag ${e.tag.full_path}`,children:"×"})]}),((w=e.children)==null?void 0:w.length)>0&&s.jsx("div",{className:"tag-children",children:s.jsx("ul",{className:"tag-tree-list",children:e.children.map(S=>s.jsx(bd,{node:S,...v},S.tag.tag_uid))})})]})}function dm({archiveId:e,tagNodes:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u}){return s.jsx("section",{id:"tags-view",className:"view is-active",children:s.jsxs("div",{className:"tag-tree",children:[s.jsxs("div",{className:"tag-tree-header",children:[s.jsx("span",{className:"tag-tree-title",children:"Tags"}),n&&s.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",n]})]}),t.length===0?s.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):s.jsx("ul",{className:"tag-tree-list",children:t.map(c=>s.jsx(bd,{node:c,archiveId:e,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:o,humanizeTags:u},c.tag.tag_uid))})]})})}const fr=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],fm=e=>{var t;return((t=fr.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function pm({archiveId:e}){const[t,n]=f.useState([]),[r,l]=f.useState(!1),[i,a]=f.useState(null),[o,u]=f.useState(null),[c,g]=f.useState(null),[m,h]=f.useState(!1),[y,x]=f.useState(null),[k,j]=f.useState(""),[p,d]=f.useState(""),[v,w]=f.useState(2),[S,P]=f.useState(!1),[C,_]=f.useState(null),[I,L]=f.useState(""),[Q,ne]=f.useState(2),[Z,se]=f.useState(!1),[pe,ve]=f.useState(null),[ie,R]=f.useState(!1),[T,F]=f.useState(""),X=f.useRef(null),H=t.find(D=>D.collection_uid===o)??null,N=(H==null?void 0:H.slug)==="_default_",O=f.useCallback(async()=>{if(e){l(!0),a(null);try{const D=await _d(e);n(D)}catch(D){a(D.message)}finally{l(!1)}}},[e]),B=f.useCallback(async D=>{if(!D){g(null);return}h(!0),x(null);try{const V=await Ah(e,D);g(V)}catch(V){x(V.message)}finally{h(!1)}},[e]);f.useEffect(()=>{O()},[O]),f.useEffect(()=>{B(o)},[o,B]),f.useEffect(()=>{ie&&X.current&&X.current.focus()},[ie]);async function M(D){D.preventDefault();const V=k.trim(),Ce=p.trim();if(!(!V||!Ce)){P(!0),_(null);try{const xe=await Oh(e,V,Ce,v);j(""),d(""),w(2),await O(),u(xe.collection_uid)}catch(xe){_(xe.message)}finally{P(!1)}}}async function W(){const D=T.trim();if(!D||!H){R(!1);return}try{await nu(e,H.collection_uid,{name:D}),await O(),g(V=>V&&{...V,name:D})}catch(V){a(V.message)}finally{R(!1)}}async function de(D){if(H)try{await nu(e,H.collection_uid,{default_visibility_bits:D}),await O(),g(V=>V&&{...V,default_visibility_bits:D})}catch(V){a(V.message)}}async function J(){if(H&&window.confirm(`Delete collection "${H.name}"? Entries will not be deleted.`))try{await Hh(e,H.collection_uid),u(null),g(null),await O()}catch(D){a(D.message)}}async function q(D){D.preventDefault();const V=I.trim();if(!(!V||!H)){se(!0),ve(null);try{await Cd(e,H.collection_uid,V,Q),L(""),await B(H.collection_uid)}catch(Ce){ve(Ce.message)}finally{se(!1)}}}async function G(D){if(H)try{await Fh(e,H.collection_uid,D),await B(H.collection_uid)}catch(V){x(V.message)}}async function oe(D,V){if(H)try{await Mh(e,H.collection_uid,D,V),g(Ce=>Ce&&{...Ce,entries:Ce.entries.map(xe=>xe.entry_uid===D?{...xe,collection_visibility_bits:V}:xe)})}catch(Ce){x(Ce.message)}}return e?s.jsxs("div",{className:"collections-view",children:[s.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&s.jsx("div",{className:"muted",children:"Loading…"}),i&&s.jsxs("div",{className:"collections-error",children:[i," ",s.jsx("button",{onClick:()=>a(null),className:"coll-dismiss",children:"×"})]}),s.jsxs("div",{className:"collections-layout",children:[s.jsxs("div",{className:"collections-sidebar",children:[t.map(D=>s.jsxs("button",{className:`coll-sidebar-row${o===D.collection_uid?" is-active":""}`,onClick:()=>u(D.collection_uid),children:[s.jsx("span",{className:"coll-row-name",children:D.name}),s.jsx("span",{className:"coll-row-meta",children:fm(D.default_visibility_bits)})]},D.collection_uid)),t.length===0&&!r&&s.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),H?s.jsxs("div",{className:"coll-detail",children:[s.jsxs("div",{className:"coll-detail-header",children:[ie?s.jsx("input",{ref:X,className:"coll-rename-input",value:T,onChange:D=>F(D.target.value),onBlur:W,onKeyDown:D=>{D.key==="Enter"&&W(),D.key==="Escape"&&R(!1)}}):s.jsxs("h3",{className:`coll-detail-name${N?"":" coll-detail-name--editable"}`,title:N?void 0:"Click to rename",onClick:()=>{N||(F(H.name),R(!0))},children:[(c==null?void 0:c.name)??H.name,!N&&s.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!N&&s.jsx("button",{className:"coll-delete-btn",onClick:J,title:"Delete collection",children:"Delete"})]}),s.jsxs("div",{className:"coll-detail-vis",children:[s.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),s.jsx("select",{className:"coll-vis-select",value:(c==null?void 0:c.default_visibility_bits)??H.default_visibility_bits,onChange:D=>de(Number(D.target.value)),disabled:N,children:fr.map(D=>s.jsx("option",{value:D.value,children:D.label},D.value))})]}),s.jsxs("div",{className:"coll-entries-section",children:[s.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&s.jsx("div",{className:"muted",children:"Loading…"}),y&&s.jsx("div",{className:"collections-error",children:y}),!m&&c&&(c.entries.length===0?s.jsx("div",{className:"muted",children:"No entries in this collection."}):s.jsx("ul",{className:"coll-entries-list",children:c.entries.map(D=>s.jsxs("li",{className:"coll-entry-row",children:[s.jsxs("div",{className:"coll-entry-info",children:[s.jsx("span",{className:"coll-entry-title",children:D.title||D.entry_uid}),s.jsx("span",{className:"coll-entry-kind muted",children:D.source_kind})]}),s.jsxs("div",{className:"coll-entry-actions",children:[s.jsx("select",{className:"coll-entry-vis-select",value:D.collection_visibility_bits,onChange:V=>oe(D.entry_uid,Number(V.target.value)),children:fr.map(V=>s.jsx("option",{value:V.value,children:V.label},V.value))}),!N&&s.jsx("button",{className:"coll-entry-remove",onClick:()=>G(D.entry_uid),title:"Remove from collection",children:"×"})]})]},D.entry_uid))}))]}),!N&&s.jsxs("form",{className:"coll-add-entry-form",onSubmit:q,children:[s.jsx("div",{className:"coll-section-heading",children:"Add entry"}),s.jsxs("div",{className:"coll-add-entry-row",children:[s.jsx("input",{className:"coll-add-entry-input",type:"text",value:I,onChange:D=>L(D.target.value),placeholder:"entry_uid",required:!0}),s.jsx("select",{className:"coll-vis-select",value:Q,onChange:D=>ne(Number(D.target.value)),children:fr.map(D=>s.jsx("option",{value:D.value,children:D.label},D.value))}),s.jsx("button",{className:"coll-add-btn",type:"submit",disabled:Z,children:Z?"…":"Add"})]}),pe&&s.jsx("div",{className:"collections-error",style:{marginTop:4},children:pe})]})]}):s.jsx("div",{className:"coll-detail coll-detail--empty",children:s.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),s.jsxs("details",{className:"coll-create-details",children:[s.jsx("summary",{children:"+ Create collection"}),s.jsxs("form",{className:"coll-create-form",onSubmit:M,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),s.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:k,onChange:D=>{j(D.target.value),p||d(D.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),s.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:D=>d(D.target.value),placeholder:"my-collection",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),s.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:v,onChange:D=>w(Number(D.target.value)),children:fr.map(D=>s.jsx("option",{value:D.value,children:D.label},D.value))})]}),C&&s.jsx("div",{className:"collections-error",children:C}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:S,children:S?"Creating…":"Create collection"})]})]})]}):s.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const hm=4;function mm({tab:e,onTabChange:t,archiveId:n}){const{currentUser:r,setCurrentUser:l}=f.useContext(ps)??{},i=r&&(r.role_bits&hm)!==0,a=["profile","tokens",...i?["instance","cookies","extensions","storage"]:[]],o={profile:"Profile",tokens:"API Tokens",instance:"Instance",cookies:"Cookies",extensions:"Extensions",storage:"Storage"};return s.jsxs("section",{className:"admin-view",children:[s.jsx("h1",{children:"Settings"}),s.jsx("div",{className:"view-tabs",children:a.map(u=>s.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:o[u]},u))}),e==="profile"&&s.jsx(gm,{currentUser:r,setCurrentUser:l}),e==="tokens"&&s.jsx(vm,{}),e==="instance"&&i&&s.jsx(ym,{}),e==="cookies"&&i&&s.jsx(wm,{}),e==="extensions"&&i&&s.jsx(km,{}),e==="storage"&&i&&s.jsx(xm,{archiveId:n})]})}function gm({currentUser:e,setCurrentUser:t}){const[n,r]=f.useState((e==null?void 0:e.display_name)??""),[l,i]=f.useState(!1),[a,o]=f.useState(null),[u,c]=f.useState(""),[g,m]=f.useState(""),[h,y]=f.useState(""),[x,k]=f.useState(!1),[j,p]=f.useState(null);async function d(w){w.preventDefault(),i(!0),o(null);try{await Ch(n),t(S=>({...S,display_name:n||null})),o({ok:!0,text:"Saved."})}catch(S){o({ok:!1,text:S.message})}finally{i(!1)}}async function v(w){if(w.preventDefault(),g!==h){p({ok:!1,text:"Passwords do not match."});return}k(!0),p(null);try{await Th(u,g),c(""),m(""),y(""),p({ok:!0,text:"Password changed."})}catch(S){p({ok:!1,text:S.message})}finally{k(!1)}}return s.jsxs("div",{style:{maxWidth:440},children:[s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Display Name"}),s.jsxs("form",{onSubmit:d,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),s.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:w=>r(w.target.value)})]}),a&&s.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Display Preferences"}),s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:(e==null?void 0:e.humanize_slugs)??!1,onChange:async w=>{const S=w.target.checked;try{await Eh({humanize_slugs:S}),t(P=>({...P,humanize_slugs:S}))}catch{}}}),s.jsx("span",{className:"form-label",style:{margin:0},children:"Humanize tag display"})]}),s.jsx("p",{className:"muted",style:{fontSize:13,margin:"4px 0 0"},children:'When on, tag paths show as "X / Articles" instead of "x/articles".'})]}),s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Change Password"}),s.jsxs("form",{onSubmit:v,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),s.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:u,onChange:w=>c(w.target.value),required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),s.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:g,onChange:w=>m(w.target.value),required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),s.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:h,onChange:w=>y(w.target.value),required:!0})]}),j&&s.jsx("div",{className:`form-msg form-msg--${j.ok?"ok":"err"}`,children:j.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function vm(){const[e,t]=f.useState([]),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState(""),[u,c]=f.useState(!1),[g,m]=f.useState(null),h=f.useCallback(async()=>{r(!0),i(null);try{t(await Ph())}catch(k){i(k.message)}finally{r(!1)}},[]);f.useEffect(()=>{h()},[h]);async function y(k){if(k.preventDefault(),!!a.trim()){c(!0);try{const j=await bh(a.trim());m(j),o(""),h()}catch(j){i(j.message)}finally{c(!1)}}}async function x(k){try{await Lh(k),t(j=>j.filter(p=>p.token_uid!==k))}catch(j){i(j.message)}}return s.jsx("div",{style:{maxWidth:600},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"API Tokens"}),g&&s.jsxs("div",{className:"token-banner",children:[s.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",s.jsx("code",{children:g.raw_token}),s.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),s.jsxs("form",{className:"token-create-row",onSubmit:y,children:[s.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:a,onChange:k=>o(k.target.value),required:!0}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:u,children:u?"Creating…":"Create token"})]}),l&&s.jsx("div",{className:"form-msg form-msg--err",children:l}),n?s.jsx("div",{className:"muted",children:"Loading…"}):s.jsxs("div",{children:[e.length===0&&s.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(k=>s.jsxs("div",{className:"token-row",children:[s.jsxs("div",{className:"token-row-info",children:[s.jsx("strong",{children:k.name}),s.jsxs("div",{className:"muted",children:["Created ",k.created_at.slice(0,10),k.last_used_at&&` · Last used ${k.last_used_at.slice(0,10)}`]})]}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(k.token_uid),children:"Revoke"})]},k.token_uid))]})]})})}function ym(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState(!1),[u,c]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Ba())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function g(m){m.preventDefault(),o(!0),c(null);try{await Nl(e),c({ok:!0,text:"Saved."})}catch(h){c({ok:!1,text:h.message})}finally{o(!1)}}return n?s.jsx("div",{className:"muted",children:"Loading…"}):l?s.jsx("div",{className:"form-msg form-msg--err",children:l}):e?s.jsx("div",{style:{maxWidth:440},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Instance Settings"}),s.jsxs("form",{onSubmit:g,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,h])=>s.jsxs("label",{className:"checkbox-row",children:[s.jsx("input",{type:"checkbox",checked:!!e[m],onChange:y=>t(x=>({...x,[m]:y.target.checked}))}),h]},m)),s.jsxs("div",{className:"form-field",style:{marginTop:4},children:[s.jsx("label",{className:"form-label",children:"Default entry visibility"}),s.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(h=>({...h,default_entry_visibility:Number(m.target.value)})),children:[s.jsx("option",{value:0,children:"Private"}),s.jsx("option",{value:2,children:"Unlisted"}),s.jsx("option",{value:3,children:"Public"})]})]}),u&&s.jsx("div",{className:`form-msg form-msg--${u.ok?"ok":"err"}`,children:u.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Saving…":"Save Settings"})]})]})}):null}function qs(e){if(e===0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,n)).toFixed(n===0?0:1)} ${t[n]}`}function xm({archiveId:e}){const[t,n]=f.useState("idle"),[r,l]=f.useState(null),[i,a]=f.useState(null),[o,u]=f.useState(null);function c(){n("idle"),l(null),a(null),u(null)}async function g(){n("scanning"),u(null),l(null);try{const y=await Uh(e);l(y),n("scanned")}catch(y){u(y.message),n("error")}}async function m(){n("deleting"),u(null);try{const y=await Wh(e);a(y),n("done")}catch(y){u(y.message),n("error")}}const h=r&&r.deletable_files===0&&r.orphaned_blob_rows===0;return s.jsx("div",{style:{maxWidth:440},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Orphan Cleanup"}),s.jsxs("p",{className:"muted",style:{marginBottom:16},children:["Scan for blob files and database records that are no longer referenced by any archive entry and safely delete them."," ",s.jsx("strong",{children:"Cleanup is blocked while captures are running."})]}),!e&&s.jsx("div",{className:"muted",children:"No archive selected."}),e&&t==="idle"&&s.jsx("button",{className:"btn-ghost",onClick:g,children:"Scan for orphaned blobs"}),t==="scanning"&&s.jsx("div",{className:"muted",children:"Scanning…"}),t==="scanned"&&r&&h&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"form-msg form-msg--ok",children:"Archive is clean — nothing to remove."}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Done"})]}),t==="scanned"&&r&&!h&&s.jsxs("div",{children:[s.jsxs("div",{style:{marginBottom:14,lineHeight:1.6},children:["Found ",s.jsx("strong",{children:r.deletable_files})," unreferenced file",r.deletable_files!==1?"s":""," ","and ",s.jsx("strong",{children:r.orphaned_blob_rows})," orphaned DB record",r.orphaned_blob_rows!==1?"s":""," ","— ",s.jsx("strong",{children:qs(r.total_bytes)})," recoverable."]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsxs("button",{className:"btn-danger",onClick:m,children:["Delete (",qs(r.total_bytes),")"]}),s.jsx("button",{className:"btn-ghost",onClick:c,children:"Cancel"})]})]}),t==="deleting"&&s.jsx("div",{className:"muted",children:"Deleting…"}),t==="done"&&i&&s.jsxs("div",{children:[s.jsxs("div",{className:"form-msg form-msg--ok",children:["Freed ",s.jsx("strong",{children:qs(i.freed_bytes)})," ","— removed ",i.deleted_files," file",i.deleted_files!==1?"s":""," ","and ",i.deleted_blob_rows," DB record",i.deleted_blob_rows!==1?"s":"","."]}),i.errors&&i.errors.length>0&&s.jsxs("div",{className:"form-msg form-msg--err",style:{marginTop:6},children:[i.errors.length," file",i.errors.length!==1?"s":""," could not be deleted."]}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Scan again"})]}),t==="error"&&s.jsxs("div",{children:[s.jsx("div",{className:"form-msg form-msg--err",children:o}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Try again"})]})]})})}function wm(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,o]=f.useState("global"),[u,c]=f.useState(""),[g,m]=f.useState("{}"),[h,y]=f.useState(null),[x,k]=f.useState(!1),[j,p]=f.useState({});f.useEffect(()=>{d()},[]);async function d(){r(!0),i(null);try{t(await Qh())}catch(_){i(_.message)}finally{r(!1)}}async function v(_){_.preventDefault();try{JSON.parse(g)}catch{y({ok:!1,text:'cookies must be valid JSON, e.g. {"session": "abc"}'});return}k(!0),y(null);try{await Kh(a==="global"?null:u.trim(),a,g),c(""),m("{}"),o("global"),y({ok:!0,text:"Rule added."}),await d()}catch(I){y({ok:!1,text:I.message})}finally{k(!1)}}async function w(_){try{await Jh(_),await d()}catch(I){i(I.message)}}function S(_){p(I=>({...I,[_.rule_uid]:{cookiesInput:_.cookies_json,saving:!1,msg:null}}))}function P(_){p(I=>{const L={...I};return delete L[_],L})}async function C(_){const I=j[_.rule_uid];try{JSON.parse(I.cookiesInput)}catch{p(L=>({...L,[_.rule_uid]:{...L[_.rule_uid],msg:{ok:!1,text:"Invalid JSON"}}}));return}p(L=>({...L,[_.rule_uid]:{...L[_.rule_uid],saving:!0,msg:null}}));try{await Xh(_.rule_uid,{cookies_json:I.cookiesInput}),P(_.rule_uid),await d()}catch(L){p(Q=>({...Q,[_.rule_uid]:{...Q[_.rule_uid],saving:!1,msg:{ok:!1,text:L.message}}}))}}return n?s.jsx("div",{className:"muted",children:"Loading…"}):l?s.jsx("div",{className:"form-msg form-msg--err",children:l}):s.jsx("div",{style:{maxWidth:560},children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Cookie Rules"}),s.jsx("p",{className:"muted",style:{marginBottom:12},children:"Cookies are injected into every capture network request (yt-dlp, HTTP downloads, web-page snapshots). Global rules apply to all URLs; wildcard and regex rules apply only to matching URLs."}),e&&e.length>0?s.jsxs("table",{className:"data-table",style:{width:"100%",marginBottom:16},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Pattern"}),s.jsx("th",{children:"Cookies"}),s.jsx("th",{style:{width:100},children:"Actions"})]})}),s.jsx("tbody",{children:e.map(_=>{const I=j[_.rule_uid],L=_.url_pattern?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted",children:[_.pattern_kind,":"]})," ",s.jsx("code",{children:_.url_pattern})]}):s.jsx("span",{className:"muted",children:"global (all URLs)"});return s.jsxs("tr",{children:[s.jsx("td",{children:L}),s.jsx("td",{children:I?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:12,width:"100%",minHeight:60},value:I.cookiesInput,onChange:Q=>p(ne=>({...ne,[_.rule_uid]:{...ne[_.rule_uid],cookiesInput:Q.target.value}}))}),I.msg&&s.jsx("div",{className:`form-msg form-msg--${I.msg.ok?"ok":"err"}`,children:I.msg.text}),s.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[s.jsx("button",{className:"btn-primary",style:{fontSize:12,padding:"2px 8px"},disabled:I.saving,onClick:()=>C(_),children:I.saving?"Saving…":"Save"}),s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>P(_.rule_uid),children:"Cancel"})]})]}):s.jsx("code",{style:{fontSize:12,wordBreak:"break-all"},children:_.cookies_json})}),s.jsx("td",{children:!I&&s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>S(_),children:"Edit"}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"2px 8px"},onClick:()=>w(_.rule_uid),children:"Del"})]})})]},_.rule_uid)})})]}):s.jsx("p",{className:"muted",style:{marginBottom:16},children:"No cookie rules defined."}),s.jsx("h3",{style:{marginBottom:8},children:"Add Rule"}),s.jsxs("form",{onSubmit:v,children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:"Pattern type"}),s.jsxs("select",{className:"field-input",value:a,onChange:_=>o(_.target.value),children:[s.jsx("option",{value:"global",children:"Global (all URLs)"}),s.jsx("option",{value:"wildcard",children:"Wildcard (e.g. *.youtube.com)"}),s.jsx("option",{value:"regex",children:"Regex (matched against full URL)"})]})]}),a!=="global"&&s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:a==="wildcard"?"URL/hostname pattern":"Regex pattern"}),s.jsx("input",{className:"field-input",type:"text",value:u,onChange:_=>c(_.target.value),placeholder:a==="wildcard"?"*.youtube.com or https://example.com/*":".*\\.youtube\\.com.*",required:!0})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{className:"form-label",children:"Cookies (JSON object)"}),s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:13,minHeight:70},value:g,onChange:_=>m(_.target.value),placeholder:'{"SESSION": "abc123", "token": "xyz"}',required:!0})]}),h&&s.jsx("div",{className:`form-msg form-msg--${h.ok?"ok":"err"}`,children:h.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Adding…":"Add Rule"})]})]})})}function km(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(!1),[a,o]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Ba())}catch(j){o({ok:!1,text:j.message})}finally{r(!1)}})()},[]);async function u(j){i(!0),o(null);try{await Nl({ublock_enabled:j}),t(p=>({...p,ublock_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function c(j){i(!0),o(null);try{await Nl({cookie_ext_enabled:j}),t(p=>({...p,cookie_ext_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}async function g(j){i(!0),o(null);try{await Nl({modal_closer_enabled:j}),t(p=>({...p,modal_closer_enabled:j})),o({ok:!0,text:"Saved."})}catch(p){o({ok:!1,text:p.message})}finally{i(!1)}}if(n)return s.jsx("div",{className:"muted",children:"Loading\\u2026"});const m=(e==null?void 0:e.ublock_ext_available)??!1,h=(e==null?void 0:e.ublock_enabled)??!0,y=(e==null?void 0:e.cookie_ext_available)??!1,x=(e==null?void 0:e.cookie_ext_enabled)??!0,k=(e==null?void 0:e.modal_closer_enabled)??!0;return s.jsx("div",{children:s.jsxs("div",{className:"form-section",children:[s.jsx("h2",{children:"Extensions"}),s.jsx("p",{className:"form-hint",style:{marginBottom:20},children:"Extensions run inside the browser during WebPage captures and can block ads, accept cookie banners, and more. Changes take effect on the next capture."}),s.jsxs("div",{className:"ext-grid",children:[s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"uBlock Origin Lite"}),s.jsx("span",{className:"ext-card-desc",children:"Blocks ads, trackers, and other page clutter during archiving via Chrome’s declarativeNetRequest API (Manifest V3)."}),!m&&s.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_UBLOCK_EXT"})," to the unpacked extension directory to enable."]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":h,className:`ext-toggle${h?" ext-toggle--on":""}`,onClick:()=>u(!h),disabled:l,"aria-label":"Toggle uBlock Origin Lite",children:s.jsx("span",{className:"ext-toggle-knob"})})]})}),s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"I Still Don’t Care About Cookies"}),s.jsx("span",{className:"ext-card-desc",children:"Dismiss cookie consent banners during archiving."}),!y&&s.jsxs("span",{className:"ext-card-hint",children:["Not configured — set ",s.jsx("code",{children:"ARCHIVR_COOKIE_EXT"})," to the unpacked extension directory to enable."]})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":x,className:`ext-toggle${x?" ext-toggle--on":""}`,onClick:()=>c(!x),disabled:l,"aria-label":"Toggle I Still Don't Care About Cookies",children:s.jsx("span",{className:"ext-toggle-knob"})})]})}),s.jsx("div",{className:"ext-card",children:s.jsxs("div",{className:"ext-card-header",children:[s.jsxs("div",{className:"ext-card-info",children:[s.jsx("span",{className:"ext-card-name",children:"Modal & Dialog Closer"}),s.jsx("span",{className:"ext-card-desc",children:"Auto-dismiss cookie banners, consent overlays, and other modal dialogs before a WebPage capture is taken. Implemented as an injected browser script; no external extension required."})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":k,className:`ext-toggle${k?" ext-toggle--on":""}`,onClick:()=>g(!k),disabled:l,"aria-label":"Toggle Modal and Dialog Closer",children:s.jsx("span",{className:"ext-toggle-knob"})})]})})]}),a&&s.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text})]})})}const su={0:"Private",1:"Public",2:"Users only",3:"Public"},jm=()=>s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function Sm({archiveId:e,selectedEntry:t,selectedUids:n,selectedEntries:r,detail:l,onTagFilterSet:i,tagNodes:a,onTagsRefresh:o,onEntryTitleChange:u,onEntryDeleted:c,onBulkDeleted:g,humanizeTags:m,onDetailRefresh:h,onOpenPreview:y,onPlay:x}){var Tt;const[k,j]=f.useState([]),[p,d]=f.useState(""),[v,w]=f.useState([]),[S,P]=f.useState(""),C=f.useRef(0),_=f.useRef(!1),[I,L]=f.useState(!1),[Q,ne]=f.useState(""),[Z,se]=f.useState("idle"),[pe,ve]=f.useState(""),ie=f.useRef(null),[R,T]=f.useState(!1);f.useEffect(()=>{T(!1)},[(Tt=l==null?void 0:l.summary)==null?void 0:Tt.entry_uid]);const F=(n==null?void 0:n.size)>=2,[X,H]=f.useState(""),[N,O]=f.useState("idle"),[B,M]=f.useState(""),[W,de]=f.useState([]),[J,q]=f.useState(""),[G,oe]=f.useState("idle"),[D,V]=f.useState(""),[Ce,xe]=f.useState("idle");f.useEffect(()=>{const $=++C.current;if(ie.current&&(clearInterval(ie.current),ie.current=null),se("idle"),ve(""),!t||!e){j([]),w([]);return}L(!1),ne(""),_.current=!1,j([]),Promise.all([cl(e,t.entry_uid),Bh(e,t.entry_uid)]).then(([re,Qe])=>{$===C.current&&(j(re),w(Qe))}).catch(()=>{})},[t,e]),f.useEffect(()=>()=>{clearInterval(ie.current)},[]),f.useEffect(()=>{if(!F||!e){de([]);return}_d(e).then(de).catch(()=>de([]))},[F,e]),f.useEffect(()=>{H(""),O("idle"),M(""),q(""),oe("idle"),V(""),xe("idle")},[n]);async function hs(){const $=n.size;if(!window.confirm(`Delete ${$} entr${$===1?"y":"ies"}? This cannot be undone.`))return;xe("running");const re=new Set;for(const Qe of n)try{await tu(e,Qe),re.add(Qe)}catch{}xe("idle"),g==null||g(re)}async function Kn(){const $=X.trim();if($){O("running"),M("");try{for(const re of n)await eu(e,re,$);H(""),O("done"),o==null||o(),setTimeout(()=>O("idle"),1800)}catch(re){M(re.message),O("error")}}}async function ms(){if(!J)return;oe("running"),V("");const $=[];for(const re of n)try{await Cd(e,J,re)}catch{$.push(re)}$.length>0?(V(`Failed for ${$.length} entr${$.length===1?"y":"ies"}.`),oe("error")):(oe("done"),setTimeout(()=>oe("idle"),1800))}async function gs(){const $=Q.trim()||null;try{await mh(e,t.entry_uid,$),u==null||u(t.entry_uid,$)}catch{}finally{L(!1)}}async function Wr(){const $=p.trim();if(!(!$||!t))try{await eu(e,t.entry_uid,$),d(""),P("");const re=await cl(e,t.entry_uid);j(re),o()}catch(re){P(re.message)}}async function vs($){try{await gh(e,t.entry_uid,$);const re=await cl(e,t.entry_uid);j(re),o()}catch{}}async function ys(){if(!(!t||!e)&&window.confirm("Delete this entry? This cannot be undone."))try{await tu(e,t.entry_uid),c==null||c(t.entry_uid)}catch{}}async function xs(){if(!t||!e||Z==="running")return;const $=C.current,re=t.entry_uid;se("running"),ve("");try{const{job_uid:Qe}=await Vh(e,re);if(C.current!==$)return;ie.current=setInterval(async()=>{try{const Jt=await Nd(e,Qe);if(Jt.status==="completed"){if(clearInterval(ie.current),ie.current=null,C.current!==$)return;se("done");const Jn=await cl(e,re);if(C.current!==$)return;j(Jn),h==null||h()}else if(Jt.status==="failed"){if(clearInterval(ie.current),ie.current=null,C.current!==$)return;se("error"),ve(Jt.error_text||"Re-archive failed.")}}catch{if(clearInterval(ie.current),ie.current=null,C.current!==$)return;se("error"),ve("Network error while polling.")}},500)}catch(Qe){if(C.current!==$)return;se("error"),ve(Qe.message||"Failed to start re-archive.")}}const ws=l?[["Added",Td(l.summary.archived_at)],["Source",l.summary.source_kind],["Type",l.summary.entity_kind],["Visibility",su[l.summary.visibility]??l.summary.visibility],["Root",l.structured_root_relpath]]:[],ks=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),js=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv","pdf","html","htm","jpg","jpeg","png","gif","webp","avif","svg","bmp"]),pn=l?l.artifacts.findIndex($=>$.artifact_role==="primary_media"):-1,hn=pn>=0?l.artifacts[pn]:null,Vr=hn?hn.relpath.split(".").pop().toLowerCase():"",Qr=hn&&ks.has(Vr),mn=pn>=0&&t?`/api/archives/${e}/entries/${t.entry_uid}/artifacts/${pn}`:null,Xn=l&&!Qr&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread"||hn&&js.has(Vr));return s.jsxs("aside",{className:"context-rail",children:[s.jsx("div",{className:"rail-eyebrow",children:"Context"}),F?s.jsxs("div",{className:"bulk-panel",children:[s.jsxs("p",{className:"bulk-count",children:[s.jsx("span",{className:"bulk-count-num",children:n.size})," entries selected"]}),s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Assign tag"}),B&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:B}),s.jsxs("div",{className:"tag-input-wrap",children:[s.jsx("span",{className:"hash",children:"/"}),s.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:X,onChange:$=>H($.target.value),onKeyDown:$=>{$.key==="Enter"&&Kn()}}),s.jsx("button",{className:"tag-add-btn",onClick:Kn,disabled:N==="running"||!X.trim(),children:N==="running"?"…":N==="done"?"✓":"Add"})]})]}),W.length>0&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Add to collection"}),s.jsxs("div",{className:"bulk-coll-row",children:[s.jsxs("select",{className:"bulk-coll-select",value:J,onChange:$=>q($.target.value),children:[s.jsx("option",{value:"",children:"Pick a collection…"}),W.map($=>s.jsx("option",{value:$.collection_uid,children:$.name},$.collection_uid))]}),s.jsx("button",{className:"tag-add-btn",onClick:ms,disabled:!J||G==="running",children:G==="running"?"…":G==="done"?"✓":G==="error"?"!":"Add"})]}),D&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"6px 0 0"},children:D})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:hs,disabled:Ce==="running",children:Ce==="running"?"Deleting…":`Delete ${n.size} entr${n.size===1?"y":"ies"}`})})]}):t?l?s.jsxs(s.Fragment,{children:[I?s.jsx("input",{className:"rail-title-input",autoFocus:!0,value:Q,onChange:$=>ne($.target.value),onKeyDown:$=>{$.key==="Enter"&&$.currentTarget.blur(),$.key==="Escape"&&(_.current=!0,$.currentTarget.blur())},onBlur:()=>{_.current?L(!1):gs(),_.current=!1}}):s.jsxs("h2",{className:"rail-title rail-title--editable",title:"Click to rename",onClick:()=>{ne(l.summary.title??""),L(!0)},children:[nn(l.summary.title)||nn(l.summary.entry_uid),s.jsx("svg",{className:"edit-icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M11.5 2.5a1.5 1.5 0 0 1 2 2L5 13l-3 1 1-3 8.5-8.5z"})})]}),l.summary.original_url&&s.jsxs("a",{className:"url-tile",href:l.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[s.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Ha(l.summary.source_kind)}}),s.jsx("span",{className:"u-text",children:l.summary.original_url}),s.jsx("span",{className:"ext",children:s.jsx(jm,{})})]}),Qr&&x&&s.jsx("button",{className:"rail-preview-btn",onClick:()=>x(mn,t),children:"▶ Play"}),Xn&&y&&s.jsx("button",{className:"rail-preview-btn",onClick:y,children:"Preview"}),s.jsx("div",{className:"meta-list",children:ws.filter(([,$])=>$!=null&&$!=="").map(([$,re])=>s.jsxs("div",{className:"meta-item",children:[s.jsx("span",{className:"meta-k",children:$}),s.jsx("span",{className:`meta-v${$==="Root"?" mono":""}`,children:nn(re)})]},$))}),l.artifacts.length>0&&(()=>{const $=l.artifacts.map((z,U)=>({...z,_idx:U})),re=$.filter(z=>z.artifact_role==="font"),Qe=$.filter(z=>z.artifact_role!=="font"),Jt=re.reduce((z,U)=>z+(U.byte_size||0),0),Jn=l.summary.entry_uid,E=z=>s.jsx("li",{children:s.jsxs("a",{href:`/api/archives/${e}/entries/${Jn}/artifacts/${z._idx}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[s.jsx("span",{className:"artifact-name",children:z.artifact_role==="font"?z.relpath.split("/").pop():z.artifact_role.replace(/_/g," ")}),s.jsx("span",{className:"artifact-size",children:z.byte_size!=null?Jl(z.byte_size):"—"})]})},z._idx);return s.jsxs("div",{className:"rail-section",children:[s.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",s.jsx("span",{className:"num",children:l.artifacts.length})]}),s.jsxs("ul",{className:"artifact-list",children:[Qe.map(E),re.length>0&&s.jsxs("li",{className:"artifact-group",children:[s.jsxs("button",{type:"button",className:"artifact-group-header artifact-link","aria-expanded":R,onClick:()=>T(z=>!z),children:[s.jsxs("span",{className:"artifact-name",children:[s.jsx("span",{"aria-hidden":"true",className:`artifact-group-chevron${R?" open":""}`,children:"›"}),` fonts (${re.length})`]}),s.jsx("span",{className:"artifact-size",children:Jl(Jt)})]}),R&&s.jsx("ul",{className:"artifact-list artifact-group-body",children:re.map(E)})]})]})]})})()]}):s.jsx("p",{className:"tags-empty",children:"Loading\\u2026"}):s.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&!F&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Tags"}),k.length===0?s.jsx("p",{className:"tags-empty",children:"No tags yet."}):s.jsx("div",{className:"tags-wrap",children:k.map($=>s.jsxs("span",{className:"tag-pill",title:$.full_path,children:[m?Pd($.full_path):$.full_path,s.jsx("button",{className:"remove",title:`Remove tag ${$.full_path}`,onClick:()=>vs($.tag_uid),children:"×"})]},$.tag_uid))}),S&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:S}),s.jsxs("div",{className:"tag-input-wrap",children:[s.jsx("span",{className:"hash",children:"/"}),s.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:p,onChange:$=>d($.target.value),onKeyDown:$=>{$.key==="Enter"&&Wr()}}),s.jsx("button",{className:"tag-add-btn",onClick:Wr,children:"Add"})]})]}),v.length>0&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Collections"}),v.map($=>s.jsxs("div",{className:"coll-row",children:[s.jsx("span",{className:"coll-name",children:$.collection_uid}),s.jsx("span",{className:"vis-badge",children:su[$.visibility_bits]??`bits:${$.visibility_bits}`})]},$.collection_uid))]}),l&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread")&&s.jsxs("div",{className:"rail-section",children:[s.jsx("div",{className:"rail-section-heading",children:"Actions"}),s.jsx("button",{className:"rail-rearchive-btn",onClick:xs,disabled:Z==="running",children:Z==="running"?"Re-archiving…":"Re-archive"}),Z==="done"&&s.jsx("p",{className:"form-msg form-msg--ok",style:{marginTop:"6px"},children:"Re-archived successfully."}),Z==="error"&&s.jsx("p",{className:"form-msg form-msg--err",style:{marginTop:"6px"},children:pe})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:ys,children:"Delete entry"})})]})]})}function Nm({src:e}){const t=f.useRef(null);return f.useEffect(()=>{t.current&&t.current.load()},[e]),s.jsx("div",{className:"preview-video-wrap",style:{background:"#111",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:"240px"},children:e?s.jsxs("video",{ref:t,controls:!0,autoPlay:!1,style:{width:"100%",maxHeight:"100%",display:"block"},children:[s.jsx("source",{src:e}),"Your browser does not support the video element."]}):s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No video available"})})}function iu({src:e,type:t,title:n,originalUrl:r}){const l=r||e,i=n||null;return s.jsxs("div",{className:"preview-iframe-wrap",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{className:"preview-iframe-toolbar",style:{display:"flex",flexDirection:"column",gap:"2px",padding:"6px 12px",borderBottom:"1px solid var(--line-soft)",background:"var(--paper-2)",flexShrink:0},children:[i&&s.jsx("span",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--ink)",fontFamily:"var(--sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.78rem",color:"var(--muted)",fontFamily:"var(--sans)"},children:l}),s.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",style:{fontSize:"0.78rem",color:"var(--accent)",textDecoration:"none",whiteSpace:"nowrap",fontFamily:"var(--sans)",flexShrink:0},children:t==="pdf"?"Open PDF ↗":"Open in new tab ↗"})]})]}),s.jsx("iframe",{src:e,sandbox:"allow-same-origin allow-popups",allow:"autoplay 'none'",referrerPolicy:"no-referrer",style:{flex:1,border:"none",width:"100%",minHeight:0},title:i||(t==="pdf"?"PDF preview":"Page preview")})]})}function _m({src:e,alt:t}){return s.jsx("div",{className:"preview-image-wrap",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",background:"var(--paper-2)",overflow:"hidden"},children:s.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",style:{display:"contents"},children:s.jsx("img",{src:e,alt:t||"",style:{objectFit:"contain",maxHeight:"100%",maxWidth:"100%",display:"block",cursor:"pointer"}})})})}function Ld(e){return e?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e*1e3)):""}function au(e){return!e||!e.includes("&")?e:e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}const K={card:{background:"var(--paper)",border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",maxWidth:"560px",margin:"0 auto",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},threadOuter:{border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",maxWidth:"560px",margin:"0 auto",background:"var(--paper)",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},tweetRow:{display:"flex",gap:"10px",padding:"10px 12px"},tweetRowThread:{display:"flex",gap:"10px",padding:"10px 12px 0"},leftCol:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0,width:"36px"},rightCol:{flex:1,minWidth:0,paddingBottom:"8px"},avatar:{width:"36px",height:"36px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},avatarPh:{width:"36px",height:"36px",borderRadius:"50%",background:"var(--line)",flexShrink:0},threadLine:{flex:1,width:"2px",background:"var(--line-soft, var(--line))",margin:"4px 0",minHeight:"12px",borderRadius:"1px"},authorRow:{display:"flex",alignItems:"baseline",gap:"4px",flexWrap:"wrap",marginBottom:"4px",lineHeight:"1.3"},authorName:{fontWeight:"700",fontSize:"14px",color:"var(--ink)"},authorHandle:{fontSize:"13px",color:"var(--muted)"},datePart:{fontSize:"13px",color:"var(--muted)"},tweetText:{fontSize:"14px",lineHeight:"1.5",color:"var(--ink)",whiteSpace:"pre-line",marginBottom:"8px",wordBreak:"break-word"},stats:{display:"flex",gap:"12px",fontSize:"13px",color:"var(--muted)"},link:{color:"var(--accent)",textDecoration:"none"},loading:{padding:"24px 16px",textAlign:"center",color:"var(--muted)",fontSize:"14px"},error:{padding:"24px 16px",textAlign:"center",color:"var(--alert)",fontSize:"14px"},mediaGrid:{marginBottom:"8px",borderRadius:"10px",overflow:"hidden",border:"1px solid var(--line)"},mediaImg:{display:"block",width:"100%",objectFit:"cover",maxHeight:"260px"},mediaVideo:{display:"block",width:"100%",maxHeight:"260px",background:"#000"},article:{maxWidth:"560px",margin:"0 auto",border:"1px solid var(--line)",borderRadius:"12px",overflow:"hidden",background:"var(--paper)",fontFamily:'var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)'},aCover:{width:"100%",display:"block",objectFit:"cover",maxHeight:"280px"},aMeta:{padding:"10px 14px 0"},aTweetTitle:{fontSize:"20px",fontWeight:"800",letterSpacing:"-0.3px",color:"var(--ink)",lineHeight:"1.3",marginBottom:"8px"},aAuthorRow:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},aAvatar:{width:"36px",height:"36px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},aAvatarPh:{width:"36px",height:"36px",borderRadius:"50%",background:"var(--line)",flexShrink:0},aAuthorName:{fontSize:"14px",fontWeight:"700",color:"var(--ink)",lineHeight:"1.3"},aAuthorSub:{fontSize:"13px",color:"var(--muted)",lineHeight:"1.3"},aDivider:{border:"none",borderTop:"1px solid var(--line)",margin:"0"},aBody:{padding:"4px 14px 16px"},bH1:{fontSize:"22px",fontWeight:"800",letterSpacing:"-0.4px",color:"var(--ink)",lineHeight:"1.25",margin:"16px 0 6px"},bH2:{fontSize:"18px",fontWeight:"700",letterSpacing:"-0.2px",color:"var(--ink)",lineHeight:"1.3",margin:"14px 0 4px"},bP:{fontSize:"15px",color:"var(--ink)",lineHeight:"1.65",marginBottom:"12px",marginTop:"0"},bSpacer:{height:"4px",display:"block"},bQuote:{borderLeft:"3px solid var(--line)",padding:"2px 12px",margin:"12px 0",color:"var(--muted)",fontSize:"15px",lineHeight:"1.6"},bHr:{border:"none",borderTop:"1px solid var(--line)",margin:"14px 0"},bImg:{width:"100%",display:"block",borderRadius:"8px",margin:"12px 0"},bUl:{margin:"8px 0 12px",paddingLeft:"24px"},bOl:{margin:"8px 0 12px",paddingLeft:"24px"},bLi:{fontSize:"15px",color:"var(--ink)",lineHeight:"1.6",marginBottom:"4px"},bTweet:{display:"flex",alignItems:"center",gap:"10px",border:"1px solid var(--line)",borderRadius:"10px",padding:"10px 14px",margin:"12px 0",color:"var(--muted)",fontSize:"14px",textDecoration:"none"},bMdPre:{borderRadius:"8px",margin:"10px 0",overflow:"auto",background:"var(--paper-3, var(--field))",padding:"12px 14px"},bMdCode:{fontFamily:"ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace",fontSize:"12px",lineHeight:"1.6",color:"var(--ink)",background:"transparent",display:"block"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:"var(--paper-3, var(--field))",padding:"1px 5px",borderRadius:"4px",color:"var(--ink)"},qtBadge:{fontSize:"11px",color:"var(--muted)",display:"inline-flex",alignItems:"center",gap:"2px",marginLeft:"4px",letterSpacing:"0.03em",flexShrink:0},lightboxBackdrop:{position:"fixed",inset:0,zIndex:500,background:"rgba(0,0,0,0.92)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},lightboxContent:{display:"flex",flexDirection:"column",alignItems:"center",gap:"10px",maxWidth:"90vw",maxHeight:"90vh"},lightboxToolbar:{display:"flex",alignItems:"center",gap:"10px",alignSelf:"flex-end"},lightboxImg:{maxWidth:"88vw",maxHeight:"80vh",objectFit:"contain",borderRadius:"6px",display:"block"},lightboxNav:{display:"flex",gap:"12px",alignItems:"center"},lightboxNavBtn:{background:"rgba(255,255,255,0.18)",border:"none",color:"#fff",fontSize:"20px",cursor:"pointer",borderRadius:"50%",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,flexShrink:0},lightboxBtn:{background:"rgba(255,255,255,0.18)",border:"none",color:"#fff",fontSize:"16px",cursor:"pointer",borderRadius:"50%",width:"30px",height:"30px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,flexShrink:0},lightboxLink:{color:"rgba(255,255,255,0.7)",textDecoration:"none",fontSize:"14px"},lightboxCounter:{color:"rgba(255,255,255,0.6)",fontSize:"13px"}},je={bg:"#000000",border:"#2f3336",text:"#e7e9ea",dim:"#71767b",accent:"#1d9bf0",codeBg:"#16181c"},Gs={article:{background:je.bg,color:je.text,minHeight:"100%",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},articleInner:{maxWidth:"598px",margin:"0 auto",paddingBottom:"80px"},aCover:{width:"100%",display:"block",objectFit:"cover",maxHeight:"420px"},aMeta:{padding:"20px 16px 0"},aTweetTitle:{fontSize:"34px",fontWeight:"800",letterSpacing:"-0.5px",color:je.text,lineHeight:"44px",marginBottom:"16px"},aAuthorRow:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},aAvatar:{width:"40px",height:"40px",borderRadius:"50%",objectFit:"cover",flexShrink:0,display:"block"},aAvatarPh:{width:"40px",height:"40px",borderRadius:"50%",background:je.border,flexShrink:0},aAuthorName:{fontSize:"15px",fontWeight:"700",color:je.text,lineHeight:"1.3"},aAuthorSub:{fontSize:"15px",color:je.dim,lineHeight:"1.3"},aDivider:{border:"none",borderTop:`1px solid ${je.border}`,margin:"0"},aBody:{padding:"4px 16px 0"},bH1:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:je.text,lineHeight:"36px",margin:"24px 0 10px"},bH2:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:je.text,lineHeight:"36px",margin:"24px 0 10px"},bP:{fontSize:"17px",color:je.text,lineHeight:"1.5",marginBottom:"16px",marginTop:"0"},bSpacer:{height:"6px",display:"block"},bQuote:{borderLeft:`3px solid ${je.border}`,padding:"2px 14px",margin:"14px 0",color:je.dim,fontSize:"17px",lineHeight:"1.5"},bHr:{border:"none",borderTop:`1px solid ${je.border}`,margin:"28px 0"},bImg:{width:"100%",display:"block",borderRadius:"12px",margin:"16px 0"},bUl:{margin:"10px 0 16px",paddingLeft:"28px"},bOl:{margin:"10px 0 16px",paddingLeft:"28px"},bLi:{fontSize:"17px",color:je.text,lineHeight:"1.5",marginBottom:"6px"},bTweet:{display:"flex",alignItems:"center",gap:"12px",border:`1px solid ${je.border}`,borderRadius:"12px",padding:"14px 16px",margin:"14px 0",color:je.dim,fontSize:"15px",textDecoration:"none"},bMdPre:{borderRadius:"12px",margin:"12px 0",overflow:"auto",background:"#1e2029"},bMdCode:{fontFamily:"ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace",fontSize:"13px",lineHeight:"1.65",padding:"18px 20px",display:"block",color:je.text,background:"transparent"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:je.codeBg,padding:"2px 6px",borderRadius:"4px",color:"#e6edf3"},link:{color:je.accent,textDecoration:"none"}};function Cm(e,t,n){const r={};return n&&n.forEach((l,i)=>{l.relpath&&(r[l.relpath]=`/api/archives/${e}/entries/${t}/artifacts/${i}`)}),r}function In(e,t,n){return e&&n[e]?n[e]:t||null}function zd(){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{flexShrink:0,color:"var(--ink)"},children:s.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.748l7.73-8.835L1.254 2.25H8.08l4.259 5.63L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z"})})}function Ua(e,t,...n){var r;if(e.fromIndex!=null&&e.toIndex!=null)return{s:e.fromIndex,e:e.toIndex};if(((r=e.indices)==null?void 0:r.length)===2)return{s:e.indices[0],e:e.indices[1]};if(t)for(const l of n){if(!l)continue;const i=t.indexOf(l);if(i!==-1)return{s:i,e:i+l.length}}return null}function Rd(e,t){const n=e.expanded_url||e.url||e.text||"",r=e.display_url||e.expanded_url||e.url||e.text||"",l=Ua(e,t,e.url,e.text,e.display_url,e.expanded_url);return!l||!n?null:{...l,kind:"url",href:n,display:r}}function Dd(e,t){const n=e.screen_name||e.name||e.text||"",r=n?`@${n}`:null,l=Ua(e,t,r);return!l||!n?null:{...l,kind:"mention",screen_name:n}}const ou=/https?:\/\/[^\s<>"'\])]+/g,Em=/[.,;:!?)()]+$/;function ql(e,t){const n=[];let r=0,l;for(ou.lastIndex=0;(l=ou.exec(e))!==null;){l.index>r&&n.push(e.slice(r,l.index));let i=l[0].replace(Em,"");n.push(s.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:t,children:i},l.index));const a=l[0].slice(i.length);a&&n.push(a),r=l.index+l[0].length}return r===0?e:(r<e.length&&n.push(e.slice(r)),n)}function Tm(e,t,n=[]){if(!e)return null;const r=[...(t.urls||[]).map(o=>Rd(o,e)).filter(Boolean),...(t.user_mentions||[]).map(o=>Dd(o,e)).filter(Boolean)];if(r.length===0&&n.length===0)return ql(au(e),K.link);const l=new Set([0,e.length]);for(const o of r)o.s>=0&&o.s<=e.length&&l.add(o.s),o.e>=0&&o.e<=e.length&&l.add(o.e);for(const[o,u]of n)o>=0&&o<=e.length&&l.add(o),u>=0&&u<=e.length&&l.add(u);const i=(o,u)=>n.some(([c,g])=>c<=o&&g>=u),a=[...l].sort((o,u)=>o-u);return a.slice(0,-1).map((o,u)=>{const c=a[u+1];if(i(o,c))return null;const g=e.slice(o,c),m=r.filter(x=>x.s<=o&&x.e>=c),h=m.find(x=>x.kind==="url");if(h)return s.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer",style:K.link,children:h.display||g},u);const y=m.find(x=>x.kind==="mention");return y?s.jsx("a",{href:`https://x.com/${y.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:K.link,children:g},u):s.jsx("span",{children:ql(au(g),K.link)},u)}).filter(o=>o!==null)}function Pm(e,t,n,r,l=K){if(!e)return null;t=t||[],n=n||[],r=r||[];const i=[];for(const u of t)u.length>0&&i.push({s:u.offset,e:u.offset+u.length,kind:"style",style:u.style});for(const u of n){const c=Rd(u,e);c&&i.push(c)}for(const u of r){const c=Dd(u,e);c&&i.push(c)}if(i.length===0)return ql(e,l.link);const a=new Set([0,e.length]);for(const u of i)u.s>=0&&u.s<=e.length&&a.add(u.s),u.e>=0&&u.e<=e.length&&a.add(u.e);const o=[...a].sort((u,c)=>u-c);return o.slice(0,-1).map((u,c)=>{const g=o[c+1],m=i.filter(j=>j.s<=u&&j.e>=g),h=e.slice(u,g);let y;if(h.includes(`
|
||
`)){const j=h.split(`
|
||
`);y=j.flatMap((p,d)=>d<j.length-1?[p,s.jsx("br",{},d)]:[p])}else y=h;m.some(j=>j.kind==="style"&&j.style==="Code")&&(y=s.jsx("code",{style:l.iCode,children:y})),m.some(j=>j.kind==="style"&&j.style==="Bold")&&(y=s.jsx("strong",{children:y})),m.some(j=>j.kind==="style"&&j.style==="Italic")&&(y=s.jsx("em",{children:y})),m.some(j=>j.kind==="style"&&j.style==="Underline")&&(y=s.jsx("u",{children:y})),m.some(j=>j.kind==="style"&&j.style==="Strikethrough")&&(y=s.jsx("s",{children:y}));const x=m.find(j=>j.kind==="url");if(x){const j=/^https?:\/\/t\.co\//i.test(y);y=s.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",style:l.link,children:j?x.display:y})}const k=m.find(j=>j.kind==="mention");return k&&(y=s.jsx("a",{href:`https://x.com/${k.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:l.link,children:y})),s.jsx("span",{children:typeof y=="string"?ql(y,l.link):y},c)})}function bm(e,t,n){const r=(n==null?void 0:n.st)||K,l=e.resolved_entities||[];return l.length===0?null:l.map((i,a)=>{var o;switch(i.type){case"divider":return s.jsx("hr",{style:r.bHr},a);case"media":{const u=In(i.local_path,i.url,t);return u?s.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:c=>{var g;!c.metaKey&&!c.ctrlKey&&(c.preventDefault(),(g=n==null?void 0:n.onImgClick)==null||g.call(n,u))},children:s.jsx("img",{src:u,style:r.bImg,loading:"lazy",alt:""})},a):null}case"tweet":return i.tweet_id?s.jsxs("a",{href:`https://x.com/i/status/${i.tweet_id}`,target:"_blank",rel:"noopener noreferrer",style:r.bTweet,children:[s.jsx(zd,{}),"View post on X"]},a):null;case"link":return i.url?s.jsx("p",{style:r.bP,children:s.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",style:r.link,children:i.url})},a):null;case"markdown":{const u=i.markdown??((o=i.data)==null?void 0:o.markdown)??"";return s.jsx("pre",{style:r.bMdPre,children:s.jsx("code",{style:r.bMdCode,children:u})},a)}case"emoji":return i.url?s.jsx("img",{src:i.url,alt:"",style:{height:"1.2em",verticalAlign:"middle",margin:"0 1px"}},a):null;default:return null}})}function Ys(e,t,n,r){const l=(r==null?void 0:r.st)||K,i=e.type||"",a=e.text||"",o=e.inline_style_ranges||[],u=e.data||{},c=Pm(a,o,u.urls||[],u.mentions||[],l);switch(i){case"header-one":return s.jsx("h1",{style:l.bH1,children:c},t);case"header-two":{const g=a.match(/(?:x\.com|twitter\.com)\/i\/status\/(\d+)/);return g?s.jsxs("a",{href:`https://x.com/i/status/${g[1]}`,target:"_blank",rel:"noopener noreferrer",style:l.bTweet,children:[s.jsx(zd,{}),"View post on X"]},t):s.jsx("h2",{style:l.bH2,children:c},t)}case"unstyled":return a.trim()?s.jsx("p",{style:l.bP,children:c},t):s.jsx("span",{style:l.bSpacer},t);case"blockquote":return s.jsx("blockquote",{style:l.bQuote,children:c},t);case"unordered-list-item":case"ordered-list-item":return s.jsx("li",{style:l.bLi,children:c},t);case"atomic":return s.jsx("span",{children:bm(e,n,r)},t);default:return a?s.jsx("p",{style:l.bP,children:c},t):null}}function Lm(e,t,n){const r=(n==null?void 0:n.st)||K,l=[];let i=0;for(;i<e.length;){const a=e[i];if(a.type==="unordered-list-item"){const o=i,u=[];for(;i<e.length&&e[i].type==="unordered-list-item";)u.push(Ys(e[i],i,t,n)),i++;l.push(s.jsx("ul",{style:r.bUl,children:u},`ul-${o}`))}else if(a.type==="ordered-list-item"){const o=i,u=[];for(;i<e.length&&e[i].type==="ordered-list-item";)u.push(Ys(e[i],i,t,n)),i++;l.push(s.jsx("ol",{style:r.bOl,children:u},`ol-${o}`))}else l.push(Ys(a,i,t,n)),i++}return l}function zm({article:e,tweetAuthor:t,artifactMap:n,fullPage:r,onXArticle:l}){const[i,a]=f.useState(null);f.useEffect(()=>{r&&(l==null||l(!0))},[r,l]);const o=r?Gs:K,u=e.cover_media||{},c=e.author||t||{},g=e.first_published_at_secs?Ld(e.first_published_at_secs):"",h=[c.screen_name?`@${c.screen_name}`:"",g].filter(Boolean).join(" · "),y=In(u.local_path,u.url,n),x=In(c.avatar_local_path,c.avatar_url,n),k=s.jsxs(s.Fragment,{children:[i&&s.jsx($d,{items:[{src:i,alt:""}],startIndex:0,onClose:()=>a(null)}),y&&s.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",style:{display:"block",cursor:"zoom-in"},onClick:j=>{!j.metaKey&&!j.ctrlKey&&(j.preventDefault(),a(y))},children:s.jsx("img",{src:y,style:o.aCover,alt:"Article cover"})}),s.jsxs("div",{style:o.aMeta,children:[e.title&&s.jsx("div",{style:o.aTweetTitle,children:e.title}),s.jsxs("div",{style:o.aAuthorRow,children:[x?s.jsx("img",{src:x,style:o.aAvatar,alt:c.name||""}):s.jsx("div",{style:o.aAvatarPh}),s.jsxs("div",{children:[s.jsx("div",{style:o.aAuthorName,children:c.name||c.screen_name||"Unknown"}),h&&s.jsx("div",{style:o.aAuthorSub,children:h})]})]})]}),s.jsx("hr",{style:o.aDivider}),s.jsx("div",{style:o.aBody,children:Lm(e.blocks||[],n,{onImgClick:a,st:o})})]});return r?s.jsx("div",{style:Gs.article,children:s.jsx("div",{style:Gs.articleInner,children:k})}):s.jsx("div",{style:K.article,children:k})}function Rm({photos:e,onOpen:t}){const n=e.length;if(n===0)return null;if(n===1)return s.jsx("a",{href:e[0].src,target:"_blank",rel:"noopener noreferrer",style:{display:"block"},onClick:l=>{!l.metaKey&&!l.ctrlKey&&(l.preventDefault(),t(0))},children:s.jsx("img",{src:e[0].src,alt:e[0].alt||"",style:K.mediaImg,loading:"lazy"})});const r=n<=2?"180px":"140px";return s.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:n===2?r:`${r} ${r}`,gap:"2px"},children:e.map((l,i)=>s.jsx("a",{href:l.src,target:"_blank",rel:"noopener noreferrer",style:{display:"block",overflow:"hidden",gridRow:n===3&&i===0?"span 2":void 0},onClick:a=>{!a.metaKey&&!a.ctrlKey&&(a.preventDefault(),t(i))},children:s.jsx("img",{src:l.src,alt:l.alt||"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},i))})}function $d({items:e,startIndex:t,onClose:n}){const[r,l]=f.useState(t);f.useEffect(()=>{const a=o=>{(o.key==="Escape"||o.key==="ArrowLeft"||o.key==="ArrowRight")&&(o.stopPropagation(),o.preventDefault()),o.key==="Escape"&&n(),o.key==="ArrowRight"&&l(u=>Math.min(u+1,e.length-1)),o.key==="ArrowLeft"&&l(u=>Math.max(u-1,0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[n,e.length]);const i=e[r];return s.jsx("div",{style:K.lightboxBackdrop,onClick:n,children:s.jsxs("div",{style:K.lightboxContent,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{style:K.lightboxToolbar,children:[e.length>1&&s.jsxs("span",{style:K.lightboxCounter,children:[r+1," / ",e.length]}),s.jsx("a",{href:i.src,target:"_blank",rel:"noopener noreferrer",style:K.lightboxLink,title:"Open in new tab",children:"↗"}),s.jsx("button",{style:K.lightboxBtn,onClick:n,"aria-label":"Close",children:"×"})]}),s.jsx("img",{src:i.src,alt:i.alt||"",style:K.lightboxImg}),e.length>1&&s.jsxs("div",{style:K.lightboxNav,children:[s.jsx("button",{style:K.lightboxNavBtn,onClick:()=>l(a=>Math.max(a-1,0)),disabled:r===0,children:"‹"}),s.jsx("button",{style:K.lightboxNavBtn,onClick:()=>l(a=>Math.min(a+1,e.length-1)),disabled:r===e.length-1,children:"›"})]})]})})}function uu({tweet:e,isInThread:t,isLast:n,artifactMap:r}){var d,v;const[l,i]=f.useState(null),a=e.author||{},o=e.created_at_secs?Ld(e.created_at_secs):"",u=e.entities||{},c=In(a.avatar_local_path,a.avatar_url,r),g=t&&!n,m=e.is_quote_status===!0,h=t?K.tweetRowThread:K.tweetRow,y=e.full_text||"",x=((v=(d=e.extended_entities)==null?void 0:d.media)!=null&&v.length?e.extended_entities.media:u.media)||[],k=[],j=[];for(const w of x)if(w.type==="photo"){const S=In(w.local_path,w.media_url_https,r);S&&k.push({kind:"photo",src:S,alt:w.alt_text||""})}else if(w.type==="video"||w.type==="animated_gif"){const S=w.local_path&&r[w.local_path]||(()=>{var C,_;return(_=(((C=w.video_info)==null?void 0:C.variants)||[]).filter(I=>I.content_type==="video/mp4").sort((I,L)=>(L.bitrate||0)-(I.bitrate||0))[0])==null?void 0:_.url})();S&&j.push({kind:w.type==="animated_gif"?"gif":"video",src:S})}const p=[];for(const w of x){if(!w.url||!(w.type==="photo"?k.some(C=>C.src===In(w.local_path,w.media_url_https,r)):j.length>0))continue;const P=Ua(w,y,w.url);P&&p.push([P.s,P.e])}return s.jsxs(s.Fragment,{children:[l!==null&&s.jsx($d,{items:k,startIndex:l,onClose:()=>i(null)}),s.jsxs("div",{style:h,children:[s.jsxs("div",{style:K.leftCol,children:[c?s.jsx("img",{src:c,style:K.avatar,alt:a.name||""}):s.jsx("div",{style:K.avatarPh}),g&&s.jsx("div",{style:K.threadLine})]}),s.jsxs("div",{style:K.rightCol,children:[s.jsxs("div",{style:K.authorRow,children:[s.jsx("span",{style:K.authorName,children:a.name||a.screen_name||"Unknown"}),a.screen_name&&s.jsxs("span",{style:K.authorHandle,children:["@",a.screen_name]}),o&&s.jsxs("span",{style:K.datePart,children:["· ",o]}),m&&s.jsx("span",{style:K.qtBadge,title:"Quote tweet",children:"↻ QT"})]}),s.jsx("div",{style:K.tweetText,children:Tm(y,u,p)}),k.length>0&&s.jsx("div",{style:K.mediaGrid,children:s.jsx(Rm,{photos:k,onOpen:w=>i(w)})}),j.map((w,S)=>s.jsx("div",{style:K.mediaGrid,children:s.jsx("video",{src:w.src,style:K.mediaVideo,controls:!0,loop:w.kind==="gif",muted:w.kind==="gif",autoPlay:w.kind==="gif"})},S)),(e.retweet_count>0||e.favorite_count>0)&&s.jsxs("div",{style:K.stats,children:[e.favorite_count>0&&s.jsxs("span",{children:["❤️ ",e.favorite_count.toLocaleString()]}),e.retweet_count>0&&s.jsxs("span",{children:["🔁 ",e.retweet_count.toLocaleString()]})]})]})]})]})}function Dm({archiveId:e,entryUid:t,artifacts:n,entityKind:r,fullPage:l,onXArticle:i}){const[a,o]=f.useState(!0),[u,c]=f.useState(null),[g,m]=f.useState([]);if(f.useEffect(()=>{if(o(!0),c(null),m([]),!n||!e||!t){o(!1);return}const x=n.map((j,p)=>({...j,index:p})).filter(j=>j.artifact_role==="raw_tweet_json");if(x.length===0){c("No tweet data found."),o(!1);return}let k=!1;return ph(e,t,x.map(j=>j.index)).then(async j=>{if(k)return;const p=/https?:\/\/t\.co\/[A-Za-z0-9]+/g,d=C=>{var I;const _=C.full_text||"";return(((I=C.entities)==null?void 0:I.urls)||[]).map(L=>{var Q;if(L.fromIndex!=null&&L.toIndex!=null)return[L.fromIndex,L.toIndex];if(((Q=L.indices)==null?void 0:Q.length)===2)return[L.indices[0],L.indices[1]];if(L.url){const ne=_.indexOf(L.url);if(ne!==-1)return[ne,ne+L.url.length]}return null}).filter(Boolean)},v=(C,_,I)=>C.some(([L,Q])=>L<=_&&Q>=I),w=new Set;for(const C of j){const _=C.full_text||"",I=d(C);let L;for(p.lastIndex=0;(L=p.exec(_))!==null;)v(I,L.index,L.index+L[0].length)||w.add(L[0])}const S=w.size>0?await hh([...w]).catch(()=>({})):{},P=j.map(C=>{var ne;const _=C.full_text||"",I=d(C),L=[];let Q;for(p.lastIndex=0;(Q=p.exec(_))!==null;){const Z=Q[0],se=S[Z];se&&se!==Z&&!v(I,Q.index,Q.index+Z.length)&&L.push({url:Z,expanded_url:se,display_url:(()=>{try{const pe=new URL(se);return pe.hostname+(pe.pathname.length>1?"/…":"")}catch{return se}})(),fromIndex:Q.index,toIndex:Q.index+Z.length})}return L.length===0?C:{...C,entities:{...C.entities||{},urls:[...((ne=C.entities)==null?void 0:ne.urls)||[],...L]}}});k||m(P)}).catch(j=>{k||c(j.message||"Failed to load tweet.")}).finally(()=>{k||o(!1)}),()=>{k=!0}},[e,t,n]),a)return s.jsx("div",{style:K.loading,children:"Loading…"});if(u)return s.jsxs("div",{style:K.error,children:["Error: ",u]});if(g.length===0)return null;const h=Cm(e,t,n);if(r==="tweet_thread")return s.jsx("div",{style:K.threadOuter,children:g.map((x,k)=>s.jsx(uu,{tweet:x,isInThread:!0,isLast:k===g.length-1,artifactMap:h},x.id||k))});const y=g[0];return y.is_article&&y.article?s.jsx(zm,{article:y.article,tweetAuthor:y.author,artifactMap:h,fullPage:l,onXArticle:i}):s.jsx("div",{style:K.card,children:s.jsx(uu,{tweet:y,isInThread:!1,isLast:!0,artifactMap:h})})}const $m=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv"]),Im=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Om=new Set(["jpg","jpeg","png","gif","webp","avif","svg","bmp"]);function Id({archiveId:e,entry:t,detail:n,fullPage:r,onXArticle:l}){if(!t)return s.jsx("div",{className:"preview-panel preview-panel--empty",children:s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Select an entry to preview"})});if(!n)return s.jsx("div",{className:"preview-panel preview-panel--loading",children:s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"Loading…"})});const{summary:i,artifacts:a}=n,o=i.entry_uid,u=i.entity_kind;if(u==="tweet"||u==="tweet_thread"){const y=s.jsx(Dm,{archiveId:e,entryUid:o,artifacts:a,entityKind:u,fullPage:r,onXArticle:l});return r?y:s.jsx("div",{className:"preview-tweet-wrap",children:y})}const c=a.findIndex(y=>y.artifact_role==="primary_media");if(c===-1)return s.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),a.length>0&&s.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:a.map((y,x)=>s.jsxs("li",{children:[y.artifact_role,": ",y.relpath]},x))})]});const g=a[c],m=`/api/archives/${e}/entries/${o}/artifacts/${c}`,h=g.relpath.split(".").pop().toLowerCase();return $m.has(h)?s.jsx("div",{className:"preview-panel",children:s.jsx(Nm,{src:m})}):Im.has(h)?s.jsxs("div",{className:"preview-panel preview-panel--audio",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"24px",fontFamily:"var(--sans)"},children:[s.jsx("span",{style:{fontSize:"2rem"},children:"🎵"}),s.jsx("span",{style:{color:"var(--ink)",fontSize:"0.95rem",fontWeight:600},children:i.title||o}),s.jsx("audio",{src:m,controls:!0,style:{marginTop:"8px",width:"100%",maxWidth:"400px"}})]}):h==="pdf"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(iu,{src:m,type:"pdf",title:i.title,originalUrl:i.original_url})}):h==="html"||h==="htm"?s.jsx("div",{className:"preview-panel",style:{flex:1,minHeight:0},children:s.jsx(iu,{src:m,type:"page",title:i.title,originalUrl:i.original_url})}):Om.has(h)?s.jsx("div",{className:"preview-panel",style:{height:"100%"},children:s.jsx(_m,{src:m,alt:i.title||"Image"})}):s.jsxs("div",{className:"preview-panel preview-panel--no-preview",children:[s.jsx("span",{style:{color:"var(--muted)",fontFamily:"var(--sans)",fontSize:"0.9rem"},children:"No preview available"}),s.jsx("ul",{style:{marginTop:"12px",paddingLeft:"20px",fontSize:"0.8rem",color:"var(--muted-2)",fontFamily:"var(--sans)"},children:a.map((y,x)=>s.jsxs("li",{children:[y.artifact_role,": ",y.relpath]},x))})]})}function Am({archiveId:e,entry:t,detail:n,onClose:r}){var l,i;return f.useEffect(()=>{const a=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),s.jsx("div",{className:"preview-modal-backdrop",onClick:r,children:s.jsxs("div",{className:`preview-modal${((l=n==null?void 0:n.summary)==null?void 0:l.entity_kind)==="tweet"||((i=n==null?void 0:n.summary)==null?void 0:i.entity_kind)==="tweet_thread"?"":" preview-modal--full"}`,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{className:"preview-modal-header",children:[s.jsx("span",{className:"preview-modal-title",children:(t==null?void 0:t.title)||(t==null?void 0:t.entry_uid)||"Preview"}),s.jsx("a",{className:"preview-modal-newtab",href:`/preview/${e}/${t==null?void 0:t.entry_uid}`,target:"_blank",rel:"noopener noreferrer",title:"Open in new tab",children:"↗"}),s.jsx("button",{className:"preview-modal-close",onClick:r,"aria-label":"Close preview",children:"×"})]}),s.jsx("div",{className:"preview-modal-body",children:s.jsx(Id,{archiveId:e,entry:t,detail:n})})]})})}function cu(e){if(!isFinite(e)||isNaN(e))return"--:--";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}function Fm({entry:e,src:t,archiveId:n,onClose:r}){const l=f.useRef(null),[i,a]=f.useState(!1),[o,u]=f.useState(0),[c,g]=f.useState(NaN),[m,h]=f.useState(1);f.useEffect(()=>{!l.current||!t||(l.current.load(),u(0),g(NaN),a(!1))},[t]),f.useEffect(()=>{l.current&&(l.current.volume=m)},[m]);function y(){const d=l.current;d&&(i?d.pause():d.play().catch(()=>{}))}function x(d){const v=l.current;if(!v||!isFinite(c))return;const w=Number(d.target.value);v.currentTime=w,u(w)}function k(d){h(Number(d.target.value))}const j=(e==null?void 0:e.title)||(e==null?void 0:e.entry_uid)||"Unknown",p=(e==null?void 0:e.source_kind)||"other";return s.jsxs(s.Fragment,{children:[s.jsx("audio",{ref:l,src:t||void 0,preload:"auto",onPlay:()=>a(!0),onPause:()=>a(!1),onEnded:()=>a(!1),onTimeUpdate:()=>{var d;return u(((d=l.current)==null?void 0:d.currentTime)??0)},onLoadedMetadata:()=>{var d;return g(((d=l.current)==null?void 0:d.duration)??NaN)},onDurationChange:()=>{var d;return g(((d=l.current)==null?void 0:d.duration)??NaN)},style:{display:"none"}}),s.jsxs("div",{className:"audio-bar",style:{position:"fixed",bottom:0,left:0,right:0,zIndex:100,background:"var(--paper-3)",borderTop:"1px solid var(--line)",display:"flex",alignItems:"center",gap:"16px",padding:"0 16px",height:"56px",fontFamily:"var(--sans)"},children:[s.jsxs("div",{className:"audio-bar-info",style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:"0 1 220px",overflow:"hidden"},children:[s.jsx("span",{className:"source-icon",style:{flexShrink:0,width:"18px",height:"18px",display:"flex",alignItems:"center"},dangerouslySetInnerHTML:{__html:Ha(p)}}),s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.85rem",color:"var(--ink)"},title:j,children:j})]}),s.jsxs("div",{className:"audio-bar-controls",style:{display:"flex",alignItems:"center",gap:"10px",flex:"1 1 0",minWidth:0},children:[s.jsx("button",{onClick:y,"aria-label":i?"Pause":"Play",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--ink)",flexShrink:0,fontSize:"1.2rem",lineHeight:1},children:i?"⏸":"▶"}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:cu(o)}),s.jsx("input",{type:"range",min:0,max:isFinite(c)?c:0,step:.1,value:isFinite(o)?o:0,onChange:x,"aria-label":"Seek",style:{flex:1,minWidth:0,accentColor:"var(--accent)"}}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:cu(c)})]}),s.jsxs("div",{className:"audio-bar-right",style:{display:"flex",alignItems:"center",gap:"8px",flex:"0 1 160px"},children:[s.jsx("span",{style:{fontSize:"0.85rem",color:"var(--muted)",flexShrink:0},children:"🔊"}),s.jsx("input",{type:"range",min:0,max:1,step:.01,value:m,onChange:k,"aria-label":"Volume",style:{width:"80px",accentColor:"var(--accent)"}}),s.jsx("button",{onClick:r,"aria-label":"Close audio player",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--muted)",fontSize:"1rem",lineHeight:1,marginLeft:"4px"},children:"✕"})]})]})]})}function Mm({archiveId:e,entryUid:t}){var h,y;const[n,r]=f.useState(null),[l,i]=f.useState(!0),[a,o]=f.useState(null),[u,c]=f.useState(!1);f.useEffect(()=>{if(!u)return;const x=document.documentElement,k=document.body,j=x.style.colorScheme,p=k.style.background;return x.style.colorScheme="dark",k.style.background="#000",()=>{x.style.colorScheme=j,k.style.background=p}},[u]),f.useEffect(()=>{c(!1),Vi(e,t).then(x=>{r(x),i(!1)}).catch(x=>{o((x==null?void 0:x.message)||"Failed to load entry"),i(!1)})},[e,t]);const g=((h=n==null?void 0:n.summary)==null?void 0:h.title)||t,m=(y=n==null?void 0:n.summary)==null?void 0:y.original_url;return s.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:u?"#000":"var(--paper)",fontFamily:"var(--sans)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:u?"8px 12px":"10px 16px",borderBottom:u?"none":"1px solid var(--line)",flexShrink:0,position:u?"sticky":"relative",top:0,zIndex:20,background:u?"rgba(0,0,0,0.82)":"var(--paper-2)",backdropFilter:u?"blur(12px)":"none",WebkitBackdropFilter:u?"blur(12px)":"none"},children:[s.jsx("a",{href:"/",style:{color:u?"#1d9bf0":"var(--accent)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"← Archive"}),s.jsx("span",{style:{flex:1,fontSize:"14px",fontWeight:600,color:u?"#e7e9ea":"var(--ink)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g}),m&&s.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",style:{color:u?"#71767b":"var(--muted)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"Original ↗"})]}),s.jsxs("div",{style:u?{flex:1}:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column"},children:[l&&s.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--muted)",fontSize:"14px"},children:"Loading…"}),a&&s.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--alert)",fontSize:"14px"},children:a}),n&&s.jsx(Id,{archiveId:e,entry:n.summary,detail:n,fullPage:!0,onXArticle:c})]})]})}const Bm=7e3;function Hm({toasts:e,onDismiss:t,onIgnoreUblock:n}){return e.length?s.jsx("div",{className:"toast-stack",role:"log","aria-live":"polite","aria-label":"Notifications",children:e.map(r=>s.jsx(Wm,{toast:r,onDismiss:t,onIgnoreUblock:n},r.id))}):null}function Um(e){if(!e)return null;if(e.length<=52)return e;try{const{hostname:t,pathname:n,search:r}=new URL(e),l=n.split("/").filter(Boolean),i=(l[l.length-1]??"")+r,a=i?`${t}/…/${i}`:t;return a.length<=56?a:a.slice(0,53)+"…"}catch{return"…"+e.slice(-51)}}function Wm({toast:e,onDismiss:t,onIgnoreUblock:n}){const[r,l]=f.useState(!1),i=e.type==="warning",a=e.type==="success";f.useEffect(()=>{if(r)return;const u=setTimeout(()=>t(e.id),Bm);return()=>clearTimeout(u)},[r,e.id,t]);const o=Um(e.locator);return a?s.jsx("div",{className:"toast toast--success",role:"alert","aria-atomic":"true",children:s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✓"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Archived"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsx("div",{className:"toast-btns",children:s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})})]})}):i?s.jsxs("div",{className:"toast toast--warning",role:"alert","aria-atomic":"true",children:[s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"⚠"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Archived with warnings"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),"aria-expanded":r,children:r?"Hide":"Details"}),e.locator&&s.jsx("button",{type:"button",className:"toast-view-btn toast-ignore-btn",onClick:()=>{n==null||n(),t(e.id)},children:"Ignore"}),s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&s.jsx("p",{className:"toast-warning-detail",children:e.text||"The page was captured but one or more browser extensions were unavailable (ad-blocking or cookie-consent). Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config."})]}):s.jsxs("div",{className:"toast toast--error",role:"alert","aria-atomic":"true",children:[s.jsxs("div",{className:"toast-top",children:[s.jsx("span",{className:"toast-icon","aria-hidden":"true",children:"✕"}),s.jsxs("div",{className:"toast-body",children:[s.jsx("span",{className:"toast-headline",children:e.headline||"Capture failed"}),o&&s.jsx("span",{className:"toast-locator",title:e.locator,children:o})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(u=>!u),children:r?"Hide":"View error"}),s.jsx("button",{type:"button",className:"toast-dismiss",onClick:()=>t(e.id),"aria-label":"Dismiss",children:"×"})]})]}),r&&e.text&&s.jsx("pre",{className:"toast-error-detail",children:e.text})]})}const ps=f.createContext(null),ar=(()=>{const e=window.location.pathname.match(/^\/preview\/([^/]+)\/([^/]+)/);return e?{archiveId:e[1],entryUid:e[2]}:null})(),Vm=["archive","tags","collections","runs","admin","settings"],Qm=["profile","tokens","instance","cookies","extensions","storage"];function qt(){const e=window.location.pathname.split("/").filter(Boolean),t=Vm.includes(e[0])?e[0]:"archive",n=t==="settings"&&Qm.includes(e[1])?e[1]:"profile",r=new URLSearchParams(window.location.search),l=r.get("q")??"",i=t==="archive"?r.get("tag")??null:null,a=t==="archive"?r.get("entry")??null:null;return{view:t,settingsTab:n,q:l,tag:i,entry:a}}function Km(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function Xm(){const[e,t]=f.useState("loading"),[n,r]=f.useState(null);f.useEffect(()=>{(async()=>{if(await kh()){t("setup");return}const z=await _h();if(!z){t("login");return}r(z),t("authenticated")})()},[]),f.useEffect(()=>{const E=()=>{r(null),t("login")};return window.addEventListener("auth:expired",E),()=>window.removeEventListener("auth:expired",E)},[]),f.useEffect(()=>{const E=()=>{const{view:z,settingsTab:U,q:te,tag:ze,entry:Ze}=qt();v(z),S(U),C(te),p(ze),m(Ze),y(null),k(Ze?new Set([Ze]):new Set)};return window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)},[]);const[l,i]=f.useState([]),[a,o]=f.useState(null),[u,c]=f.useState([]),[g,m]=f.useState(()=>qt().entry),[h,y]=f.useState(null),[x,k]=f.useState(()=>{const E=qt().entry;return E?new Set([E]):new Set}),[j,p]=f.useState(()=>qt().tag),[d,v]=f.useState(()=>qt().view),[w,S]=f.useState(()=>qt().settingsTab),[P,C]=f.useState(()=>qt().q),[_,I]=f.useState(""),[L,Q]=f.useState(!1),[ne,Z]=f.useState([]),[se,pe]=f.useState([]),[ve,ie]=f.useState(()=>sessionStorage.getItem("captureDialogOpen")==="true"),[R,T]=f.useState([]),F=f.useRef(0),[X,H]=f.useState(()=>sessionStorage.getItem("ublockWarningIgnored")==="true"),[N,O]=f.useState(null),B=f.useRef(0),M=f.useRef(null),W=f.useRef(!1),de=f.useRef(!0),J=f.useRef(null),q=(n==null?void 0:n.humanize_slugs)??!1;f.useEffect(()=>{const E=++B.current;O(null),!(!h||!a)&&Vi(a,h.entry_uid).then(z=>{E===B.current&&O(z)}).catch(()=>{})},[h,a]),f.useEffect(()=>{sessionStorage.setItem("captureDialogOpen",ve)},[ve]);const G=f.useCallback(async(E,z,U)=>{if(E){Q(!0);try{let te;z||U?te=await fh(E,z,U):te=await dh(E),c(te),k(ze=>{if(ze.size<2)return ze;const Ze=new Set(te.map(gn=>gn.entry_uid)),qn=new Set([...ze].filter(gn=>Ze.has(gn)));return qn.size===ze.size?ze:qn}),I(te.length===0?"No results":`${te.length} result${te.length===1?"":"s"}`)}catch{c([]),I("Search failed. Try again.")}finally{Q(!1)}}},[]);f.useEffect(()=>{e==="authenticated"&&ch().then(E=>{if(i(E),E.length>0){const z=E[0].id;o(z)}})},[e]),f.useEffect(()=>{if(a){if(de.current){de.current=!1,Promise.all([Js(a).then(Z),dl(a).then(pe)]);return}p(null),y(null),m(null),k(new Set),Promise.all([G(a,"",null),Js(a).then(Z),dl(a).then(pe)])}},[a]),f.useEffect(()=>{if(a===null)return;const E=setTimeout(()=>{G(a,P,j)},300);return()=>clearTimeout(E)},[P,a]),f.useEffect(()=>{a!==null&&(j!==null&&v("archive"),G(a,P,j))},[j,a]);const oe=f.useCallback(E=>{o(E)},[]),D=f.useCallback(E=>{v(E),E==="tags"&&a&&dl(a).then(pe)},[a]);f.useEffect(()=>{if(ar)return;const E=Km(d,w);window.location.pathname!==E&&history.pushState(null,"",E+window.location.search)},[d,w]);const V=f.useCallback(E=>{m(E?E.entry_uid:null),y(E)},[]),Ce=f.useCallback((E,z)=>{if(z.shiftKey&&J.current!==null){z.preventDefault();const U=u.findIndex(Gn=>Gn.entry_uid===J.current),te=u.findIndex(Gn=>Gn.entry_uid===E.entry_uid);if(U===-1||te===-1){J.current=E.entry_uid,k(new Set([E.entry_uid])),V(E);return}const ze=Math.min(U,te),Ze=Math.max(U,te),qn=u.slice(ze,Ze+1),gn=new Set(qn.map(Gn=>Gn.entry_uid));k(gn),gn.size===1&&V(qn[0])}else z.ctrlKey||z.metaKey?(J.current=E.entry_uid,k(U=>{const te=new Set(U);return te.has(E.entry_uid)?te.delete(E.entry_uid):te.add(E.entry_uid),te})):(J.current=E.entry_uid,k(new Set([E.entry_uid])),V(E))},[u,V]),xe=f.useCallback(E=>{p(E)},[]),hs=f.useCallback(()=>{p(null)},[]),Kn=f.useCallback(()=>{a&&dl(a).then(pe)},[a]),ms=f.useCallback((E,z)=>{j===E?p(z):j!=null&&j.startsWith(E+"/")&&p(z+j.slice(E.length))},[j]),gs=f.useCallback(E=>{(j===E||j!=null&&j.startsWith(E+"/"))&&p(null)},[j]),Wr=f.useCallback((E,z)=>{c(U=>U.map(te=>te.entry_uid===E?{...te,title:z}:te)),y(U=>U&&U.entry_uid===E?{...U,title:z}:U),O(U=>U&&U.summary.entry_uid===E?{...U,summary:{...U.summary,title:z}}:U)},[]),vs=f.useCallback(()=>{if(!a||!h)return;const E=++B.current;Vi(a,h.entry_uid).then(z=>{E===B.current&&O(z)}).catch(()=>{})},[a,h]),ys=f.useCallback(E=>{c(z=>z.filter(U=>U.entry_uid!==E)),y(z=>(z==null?void 0:z.entry_uid)===E?null:z),m(z=>z===E?null:z),k(z=>{const U=new Set(z);return U.delete(E),U})},[]),xs=f.useCallback(E=>{c(z=>z.filter(U=>!E.has(U.entry_uid))),k(new Set),y(null),m(null)},[]);f.useEffect(()=>{if(x.size>=2)m(null),y(null);else if(x.size===1){const[E]=x;m(E)}else m(null),y(null)},[x]);const ws=f.useMemo(()=>u.filter(E=>x.has(E.entry_uid)),[u,x]);f.useEffect(()=>{if(!g||h)return;const E=u.find(z=>z.entry_uid===g);E&&y(E)},[u,g,h]),f.useEffect(()=>{if(ar)return;const E=new URLSearchParams;P&&E.set("q",P),d==="archive"&&j&&E.set("tag",j),d==="archive"&&g&&E.set("entry",g);const z=E.toString(),U=window.location.pathname+(z?"?"+z:"");window.location.pathname+window.location.search!==U&&history.replaceState(null,"",U)},[P,j,g,d]),f.useEffect(()=>{const E=z=>{var U,te;(z.metaKey||z.ctrlKey)&&z.key==="k"&&(z.preventDefault(),d==="archive"?((U=M.current)==null||U.focus(),(te=M.current)==null||te.select()):(W.current=!0,v("archive")))};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[d]),f.useEffect(()=>{d==="archive"&&W.current&&(W.current=!1,requestAnimationFrame(()=>{var E,z;(E=M.current)==null||E.focus(),(z=M.current)==null||z.select()}))},[d]);const ks=f.useCallback(()=>{ie(!0)},[]),js=f.useCallback(()=>{ie(!1)},[]),pn=f.useCallback(()=>{a&&Promise.all([G(a,P,j),Js(a).then(Z)])},[a,P,j,G]),hn=f.useCallback((E,z,U="error",te=null)=>{if(U==="warning"&&X&&z)return;const ze=++F.current;T(Ze=>[...Ze,{id:ze,text:E,locator:z,type:U,headline:te}])},[X]),Vr=f.useCallback(E=>{T(z=>z.filter(U=>U.id!==E))},[]),Qr=f.useCallback(()=>{sessionStorage.setItem("ublockWarningIgnored","true"),H(!0),T(E=>E.filter(z=>!(z.type==="warning"&&z.locator)))},[]),[mn,Xn]=f.useState(null),[Tt,$]=f.useState(null),re=f.useCallback(()=>{h&&Xn(h.entry_uid)},[h]),Qe=f.useCallback(()=>Xn(null),[]),Jt=f.useCallback((E,z)=>{$({src:E,entry:z})},[]),Jn=f.useCallback(()=>$(null),[]);return f.useEffect(()=>{Xn(null)},[h]),f.useEffect(()=>{const E=z=>{var te,ze,Ze;if(z.key!=="Escape"||ve||mn)return;const U=(te=document.activeElement)==null?void 0:te.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||x.size>0&&(z.preventDefault(),k(new Set),(Ze=(ze=document.activeElement)==null?void 0:ze.blur)==null||Ze.call(ze))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[ve,mn,x]),f.useEffect(()=>(document.body.classList.toggle("has-audio-bar",!!Tt),()=>document.body.classList.remove("has-audio-bar")),[Tt]),e==="loading"?s.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?s.jsx(Yh,{onComplete:()=>t("login")}):e==="login"?s.jsx(Gh,{onLogin:E=>{r(E),t("authenticated")}}):ar?s.jsx(Mm,{archiveId:ar.archiveId,entryUid:ar.entryUid}):s.jsx(ps.Provider,{value:{currentUser:n,setCurrentUser:r},children:s.jsxs(s.Fragment,{children:[s.jsx(Zh,{archives:l,archiveId:a,onArchiveChange:oe,view:d,onViewChange:D,onCaptureClick:ks}),s.jsxs("main",{className:"app-shell",children:[s.jsxs("div",{className:"workspace",children:[d==="archive"&&s.jsxs("div",{className:"toolbar",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("span",{className:"ico","aria-hidden":"true",children:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"7"}),s.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),s.jsx("input",{ref:M,className:"search-input",type:"search","aria-label":"Search archive","aria-busy":L,placeholder:"Search titles, URLs, types, tags…",value:P,onChange:E=>C(E.target.value)}),s.jsx("span",{className:"kbd",children:"⌘K"})]}),s.jsxs("span",{className:"result-count",children:[_&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:_.split(" ")[0]})," ",_.split(" ").slice(1).join(" ")]}),j&&s.jsxs("button",{className:"tag-filter-badge",onClick:hs,children:["× ",q?Pd(j):j]})]})]}),d==="archive"&&s.jsx(sm,{entries:u,selectedUids:x,onRowClick:Ce,archiveId:a}),d==="runs"&&s.jsx(om,{runs:ne}),d==="admin"&&s.jsx(cm,{archives:l}),d==="tags"&&s.jsx(dm,{archiveId:a,tagNodes:se,tagFilter:j,onTagFilterSet:xe,onViewChange:D,onTagRenamed:ms,onTagDeleted:gs,onTagsRefresh:Kn,humanizeTags:q}),d==="collections"&&s.jsx(pm,{archiveId:a}),d==="settings"&&s.jsx(mm,{tab:w,onTabChange:S,archiveId:a})]}),s.jsx(Sm,{archiveId:a,selectedEntry:h,selectedUids:x,selectedEntries:ws,detail:N,onTagFilterSet:xe,tagNodes:se,onTagsRefresh:Kn,onEntryTitleChange:Wr,onEntryDeleted:ys,onBulkDeleted:xs,humanizeTags:q,onDetailRefresh:vs,onOpenPreview:re,onPlay:Jt})]}),mn&&h&&h.entry_uid===mn&&s.jsx(Am,{archiveId:a,entry:h,detail:N,onClose:Qe}),Tt&&s.jsx(Fm,{entry:Tt.entry,src:Tt.src,archiveId:a,onClose:Jn}),s.jsx(em,{open:ve,archiveId:a,onClose:js,onCaptured:pn,onToast:hn}),s.jsx(Hm,{toasts:R,onDismiss:Vr,onIgnoreUblock:Qr})]})})}Sd(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(Xm,{})}));
|