mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
ChildRow now receives onRowClick and selectedUids from EntryRow (which receives selectedUids from EntriesView alongside the existing booleans). Clicking a child row invokes onRowClick(child, e) so it flows through handleRowClick → selectEntry → fetchEntryDetail exactly as a root entry would. Shift-range selection gracefully degrades to single-select since child entries are not in the root entries array. Selected/multi-selected visual state is wired: .child-entry-row.is-selected shows the same #eee2d2 background + accent outline as root rows; hover restores full opacity. Frontend static assets rebuilt.
47 lines
276 KiB
JavaScript
47 lines
276 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 mu={exports:{}},ts={},gu={exports:{}},G={};/**
|
||
* @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 Ur=Symbol.for("react.element"),Ud=Symbol.for("react.portal"),Wd=Symbol.for("react.fragment"),Vd=Symbol.for("react.strict_mode"),Qd=Symbol.for("react.profiler"),Kd=Symbol.for("react.provider"),Xd=Symbol.for("react.context"),Jd=Symbol.for("react.forward_ref"),qd=Symbol.for("react.suspense"),Yd=Symbol.for("react.memo"),Gd=Symbol.for("react.lazy"),Xa=Symbol.iterator;function Zd(e){return e===null||typeof e!="object"?null:(e=Xa&&e[Xa]||e["@@iterator"],typeof e=="function"?e:null)}var vu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yu=Object.assign,xu={};function Jn(e,t,n){this.props=e,this.context=t,this.refs=xu,this.updater=n||vu}Jn.prototype.isReactComponent={};Jn.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")};Jn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wu(){}wu.prototype=Jn.prototype;function Yi(e,t,n){this.props=e,this.context=t,this.refs=xu,this.updater=n||vu}var Gi=Yi.prototype=new wu;Gi.constructor=Yi;yu(Gi,Jn.prototype);Gi.isPureReactComponent=!0;var Ja=Array.isArray,ku=Object.prototype.hasOwnProperty,Zi={current:null},ju={key:!0,ref:!0,__self:!0,__source:!0};function Su(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)ku.call(t,r)&&!ju.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1<u){for(var o=Array(u),c=0;c<u;c++)o[c]=arguments[c+2];l.children=o}if(e&&e.defaultProps)for(r in u=e.defaultProps,u)l[r]===void 0&&(l[r]=u[r]);return{$$typeof:Ur,type:e,key:i,ref:a,props:l,_owner:Zi.current}}function ef(e,t){return{$$typeof:Ur,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ea(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ur}function tf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var qa=/\/+/g;function Es(e,t){return typeof e=="object"&&e!==null&&e.key!=null?tf(""+e.key):t.toString(36)}function vl(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 Ur:case Ud:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+Es(a,0):r,Ja(l)?(n="",e!=null&&(n=e.replace(qa,"$&/")+"/"),vl(l,t,n,"",function(c){return c})):l!=null&&(ea(l)&&(l=ef(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(qa,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",Ja(e))for(var u=0;u<e.length;u++){i=e[u];var o=r+Es(i,u);a+=vl(i,t,n,o,l)}else if(o=Zd(e),typeof o=="function")for(e=o.call(e),u=0;!(i=e.next()).done;)i=i.value,o=r+Es(i,u++),a+=vl(i,t,n,o,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 Gr(e,t,n){if(e==null)return e;var r=[],l=0;return vl(e,r,"","",function(i){return t.call(n,i,l++)}),r}function nf(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 Ue={current:null},yl={transition:null},rf={ReactCurrentDispatcher:Ue,ReactCurrentBatchConfig:yl,ReactCurrentOwner:Zi};function Nu(){throw Error("act(...) is not supported in production builds of React.")}G.Children={map:Gr,forEach:function(e,t,n){Gr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gr(e,function(){t++}),t},toArray:function(e){return Gr(e,function(t){return t})||[]},only:function(e){if(!ea(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};G.Component=Jn;G.Fragment=Wd;G.Profiler=Qd;G.PureComponent=Yi;G.StrictMode=Vd;G.Suspense=qd;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rf;G.act=Nu;G.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=yu({},e.props),l=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Zi.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(o in t)ku.call(t,o)&&!ju.hasOwnProperty(o)&&(r[o]=t[o]===void 0&&u!==void 0?u[o]:t[o])}var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){u=Array(o);for(var c=0;c<o;c++)u[c]=arguments[c+2];r.children=u}return{$$typeof:Ur,type:e.type,key:l,ref:i,props:r,_owner:a}};G.createContext=function(e){return e={$$typeof:Xd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Kd,_context:e},e.Consumer=e};G.createElement=Su;G.createFactory=function(e){var t=Su.bind(null,e);return t.type=e,t};G.createRef=function(){return{current:null}};G.forwardRef=function(e){return{$$typeof:Jd,render:e}};G.isValidElement=ea;G.lazy=function(e){return{$$typeof:Gd,_payload:{_status:-1,_result:e},_init:nf}};G.memo=function(e,t){return{$$typeof:Yd,type:e,compare:t===void 0?null:t}};G.startTransition=function(e){var t=yl.transition;yl.transition={};try{e()}finally{yl.transition=t}};G.unstable_act=Nu;G.useCallback=function(e,t){return Ue.current.useCallback(e,t)};G.useContext=function(e){return Ue.current.useContext(e)};G.useDebugValue=function(){};G.useDeferredValue=function(e){return Ue.current.useDeferredValue(e)};G.useEffect=function(e,t){return Ue.current.useEffect(e,t)};G.useId=function(){return Ue.current.useId()};G.useImperativeHandle=function(e,t,n){return Ue.current.useImperativeHandle(e,t,n)};G.useInsertionEffect=function(e,t){return Ue.current.useInsertionEffect(e,t)};G.useLayoutEffect=function(e,t){return Ue.current.useLayoutEffect(e,t)};G.useMemo=function(e,t){return Ue.current.useMemo(e,t)};G.useReducer=function(e,t,n){return Ue.current.useReducer(e,t,n)};G.useRef=function(e){return Ue.current.useRef(e)};G.useState=function(e){return Ue.current.useState(e)};G.useSyncExternalStore=function(e,t,n){return Ue.current.useSyncExternalStore(e,t,n)};G.useTransition=function(){return Ue.current.useTransition()};G.version="18.3.1";gu.exports=G;var f=gu.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 lf=f,sf=Symbol.for("react.element"),af=Symbol.for("react.fragment"),of=Object.prototype.hasOwnProperty,uf=lf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cf={key:!0,ref:!0,__self:!0,__source:!0};function _u(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)of.call(t,r)&&!cf.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:sf,type:e,key:i,ref:a,props:l,_owner:uf.current}}ts.Fragment=af;ts.jsx=_u;ts.jsxs=_u;mu.exports=ts;var s=mu.exports,Cu={exports:{}},tt={},Eu={exports:{}},Tu={};/**
|
||
* @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 M=R.length;R.push(T);e:for(;0<M;){var q=M-1>>>1,A=R[q];if(0<l(A,T))R[q]=T,R[M]=A,M=q;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],M=R.pop();if(M!==T){R[0]=M;e:for(var q=0,A=R.length,ge=A>>>1;q<ge;){var de=2*(q+1)-1,Re=R[de],we=de+1,Se=R[we];if(0>l(Re,M))we<A&&0>l(Se,Re)?(R[q]=Se,R[we]=M,q=we):(R[q]=Re,R[de]=M,q=de);else if(we<A&&0>l(Se,M))R[q]=Se,R[we]=M,q=we;else break e}}return T}function l(R,T){var M=R.sortIndex-T.sortIndex;return M!==0?M: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,u=a.now();e.unstable_now=function(){return a.now()-u}}var o=[],c=[],g=1,m=null,h=3,y=!1,w=!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(o,T);else break;T=n(c)}}function x(R){if(k=!1,v(R),!w)if(n(o)!==null)w=!0,ie(N);else{var T=n(c);T!==null&&ee(x,T.startTime-R)}}function N(R,T){w=!1,k&&(k=!1,p(S),S=-1),y=!0;var M=h;try{for(v(T),m=n(o);m!==null&&(!(m.expirationTime>T)||R&&!U());){var q=m.callback;if(typeof q=="function"){m.callback=null,h=m.priorityLevel;var A=q(m.expirationTime<=T);T=e.unstable_now(),typeof A=="function"?m.callback=A:m===n(o)&&r(o),v(T)}else r(o);m=n(o)}if(m!==null)var ge=!0;else{var de=n(c);de!==null&&ee(x,de.startTime-T),ge=!1}return ge}finally{m=null,h=M,y=!1}}var P=!1,C=null,S=-1,D=5,L=-1;function U(){return!(e.unstable_now()-L<D)}function F(){if(C!==null){var R=e.unstable_now();L=R;var T=!0;try{T=C(!0,R)}finally{T?W():(P=!1,C=null)}}else P=!1}var W;if(typeof d=="function")W=function(){d(F)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,ce=Y.port2;Y.port1.onmessage=F,W=function(){ce.postMessage(null)}}else W=function(){j(F,0)};function ie(R){C=R,P||(P=!0,W())}function ee(R,T){S=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(){w||y||(w=!0,ie(N))},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"):D=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(o)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var T=3;break;default:T=h}var M=h;h=T;try{return R()}finally{h=M}},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 M=h;h=R;try{return T()}finally{h=M}},e.unstable_scheduleCallback=function(R,T,M){var q=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?q+M:q):M=q,R){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=M+A,R={id:g++,callback:T,priorityLevel:R,startTime:M,expirationTime:A,sortIndex:-1},M>q?(R.sortIndex=M,t(c,R),n(o)===null&&R===n(c)&&(k?(p(S),S=-1):k=!0,ee(x,M-q))):(R.sortIndex=A,t(o,R),w||y||(w=!0,ie(N))),R},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(R){var T=h;return function(){var M=h;h=T;try{return R.apply(this,arguments)}finally{h=M}}}})(Tu);Eu.exports=Tu;var df=Eu.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 ff=f,et=df;function z(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 Pu=new Set,_r={};function gn(e,t){Hn(e,t),Hn(e+"Capture",t)}function Hn(e,t){for(_r[e]=t,e=0;e<t.length;e++)Pu.add(t[e])}var bt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ri=Object.prototype.hasOwnProperty,pf=/^[: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]*$/,Ya={},Ga={};function hf(e){return ri.call(Ga,e)?!0:ri.call(Ya,e)?!1:pf.test(e)?Ga[e]=!0:(Ya[e]=!0,!1)}function mf(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 gf(e,t,n,r){if(t===null||typeof t>"u"||mf(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 We(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 ze={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ze[e]=new We(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ze[t]=new We(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ze[e]=new We(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ze[e]=new We(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){ze[e]=new We(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ze[e]=new We(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ze[e]=new We(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ze[e]=new We(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ze[e]=new We(e,5,!1,e.toLowerCase(),null,!1,!1)});var ta=/[\-:]([a-z])/g;function na(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(ta,na);ze[t]=new We(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(ta,na);ze[t]=new We(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(ta,na);ze[t]=new We(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ze[e]=new We(e,1,!1,e.toLowerCase(),null,!1,!1)});ze.xlinkHref=new We("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ze[e]=new We(e,1,!1,e.toLowerCase(),null,!0,!0)});function ra(e,t,n,r){var l=ze.hasOwnProperty(t)?ze[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(gf(t,n,l,r)&&(n=null),r||l===null?hf(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 Dt=ff.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zr=Symbol.for("react.element"),Sn=Symbol.for("react.portal"),Nn=Symbol.for("react.fragment"),la=Symbol.for("react.strict_mode"),li=Symbol.for("react.profiler"),bu=Symbol.for("react.provider"),Lu=Symbol.for("react.context"),sa=Symbol.for("react.forward_ref"),si=Symbol.for("react.suspense"),ii=Symbol.for("react.suspense_list"),ia=Symbol.for("react.memo"),It=Symbol.for("react.lazy"),zu=Symbol.for("react.offscreen"),Za=Symbol.iterator;function tr(e){return e===null||typeof e!="object"?null:(e=Za&&e[Za]||e["@@iterator"],typeof e=="function"?e:null)}var me=Object.assign,Ts;function dr(e){if(Ts===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ts=t&&t[1]||""}return`
|
||
`+Ts+e}var Ps=!1;function bs(e,t){if(!e||Ps)return"";Ps=!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,u=i.length-1;1<=a&&0<=u&&l[a]!==i[u];)u--;for(;1<=a&&0<=u;a--,u--)if(l[a]!==i[u]){if(a!==1||u!==1)do if(a--,u--,0>u||l[a]!==i[u]){var o=`
|
||
`+l[a].replace(" at new "," at ");return e.displayName&&o.includes("<anonymous>")&&(o=o.replace("<anonymous>",e.displayName)),o}while(1<=a&&0<=u);break}}}finally{Ps=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?dr(e):""}function vf(e){switch(e.tag){case 5:return dr(e.type);case 16:return dr("Lazy");case 13:return dr("Suspense");case 19:return dr("SuspenseList");case 0:case 2:case 15:return e=bs(e.type,!1),e;case 11:return e=bs(e.type.render,!1),e;case 1:return e=bs(e.type,!0),e;default:return""}}function ai(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 Nn:return"Fragment";case Sn:return"Portal";case li:return"Profiler";case la:return"StrictMode";case si:return"Suspense";case ii:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Lu:return(e.displayName||"Context")+".Consumer";case bu:return(e._context.displayName||"Context")+".Provider";case sa:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ia:return t=e.displayName||null,t!==null?t:ai(e.type)||"Memo";case It:t=e._payload,e=e._init;try{return ai(e(t))}catch{}}return null}function yf(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 ai(t);case 8:return t===la?"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 qt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ru(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xf(e){var t=Ru(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 el(e){e._valueTracker||(e._valueTracker=xf(e))}function Du(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ru(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bl(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 oi(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function eo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qt(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 $u(e,t){t=t.checked,t!=null&&ra(e,"checked",t,!1)}function ui(e,t){$u(e,t);var n=qt(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")?ci(e,t.type,n):t.hasOwnProperty("defaultValue")&&ci(e,t.type,qt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function to(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 ci(e,t,n){(t!=="number"||bl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fr=Array.isArray;function $n(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=""+qt(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 di(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(z(91));return me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function no(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(z(92));if(fr(n)){if(1<n.length)throw Error(z(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qt(n)}}function Iu(e,t){var n=qt(t.value),r=qt(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 ro(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ou(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 fi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ou(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var tl,Mu=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(tl=tl||document.createElement("div"),tl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=tl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Cr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gr={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},wf=["Webkit","ms","Moz","O"];Object.keys(gr).forEach(function(e){wf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),gr[t]=gr[e]})});function Fu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||gr.hasOwnProperty(e)&&gr[e]?(""+t).trim():t+"px"}function Au(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Fu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var kf=me({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 pi(e,t){if(t){if(kf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(z(62))}}function hi(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 mi=null;function aa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gi=null,In=null,On=null;function lo(e){if(e=Qr(e)){if(typeof gi!="function")throw Error(z(280));var t=e.stateNode;t&&(t=is(t),gi(e.stateNode,e.type,t))}}function Bu(e){In?On?On.push(e):On=[e]:In=e}function Hu(){if(In){var e=In,t=On;if(On=In=null,lo(e),t)for(e=0;e<t.length;e++)lo(t[e])}}function Uu(e,t){return e(t)}function Wu(){}var Ls=!1;function Vu(e,t,n){if(Ls)return e(t,n);Ls=!0;try{return Uu(e,t,n)}finally{Ls=!1,(In!==null||On!==null)&&(Wu(),Hu())}}function Er(e,t){var n=e.stateNode;if(n===null)return null;var r=is(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(z(231,t,typeof n));return n}var vi=!1;if(bt)try{var nr={};Object.defineProperty(nr,"passive",{get:function(){vi=!0}}),window.addEventListener("test",nr,nr),window.removeEventListener("test",nr,nr)}catch{vi=!1}function jf(e,t,n,r,l,i,a,u,o){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(g){this.onError(g)}}var vr=!1,Ll=null,zl=!1,yi=null,Sf={onError:function(e){vr=!0,Ll=e}};function Nf(e,t,n,r,l,i,a,u,o){vr=!1,Ll=null,jf.apply(Sf,arguments)}function _f(e,t,n,r,l,i,a,u,o){if(Nf.apply(this,arguments),vr){if(vr){var c=Ll;vr=!1,Ll=null}else throw Error(z(198));zl||(zl=!0,yi=c)}}function vn(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 Qu(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 so(e){if(vn(e)!==e)throw Error(z(188))}function Cf(e){var t=e.alternate;if(!t){if(t=vn(e),t===null)throw Error(z(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 so(l),e;if(i===r)return so(l),t;i=i.sibling}throw Error(z(188))}if(n.return!==r.return)n=l,r=i;else{for(var a=!1,u=l.child;u;){if(u===n){a=!0,n=l,r=i;break}if(u===r){a=!0,r=l,n=i;break}u=u.sibling}if(!a){for(u=i.child;u;){if(u===n){a=!0,n=i,r=l;break}if(u===r){a=!0,r=i,n=l;break}u=u.sibling}if(!a)throw Error(z(189))}}if(n.alternate!==r)throw Error(z(190))}if(n.tag!==3)throw Error(z(188));return n.stateNode.current===n?e:t}function Ku(e){return e=Cf(e),e!==null?Xu(e):null}function Xu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Xu(e);if(t!==null)return t;e=e.sibling}return null}var Ju=et.unstable_scheduleCallback,io=et.unstable_cancelCallback,Ef=et.unstable_shouldYield,Tf=et.unstable_requestPaint,xe=et.unstable_now,Pf=et.unstable_getCurrentPriorityLevel,oa=et.unstable_ImmediatePriority,qu=et.unstable_UserBlockingPriority,Rl=et.unstable_NormalPriority,bf=et.unstable_LowPriority,Yu=et.unstable_IdlePriority,ns=null,St=null;function Lf(e){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(ns,e,void 0,(e.current.flags&128)===128)}catch{}}var vt=Math.clz32?Math.clz32:Df,zf=Math.log,Rf=Math.LN2;function Df(e){return e>>>=0,e===0?32:31-(zf(e)/Rf|0)|0}var nl=64,rl=4194304;function pr(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 Dl(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 u=a&~l;u!==0?r=pr(u):(i&=a,i!==0&&(r=pr(i)))}else a=n&~l,a!==0?r=pr(a):i!==0&&(r=pr(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-vt(t),l=1<<n,r|=e[n],t&=~l;return r}function $f(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 If(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-vt(i),u=1<<a,o=l[a];o===-1?(!(u&n)||u&r)&&(l[a]=$f(u,t)):o<=t&&(e.expiredLanes|=u),i&=~u}}function xi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Gu(){var e=nl;return nl<<=1,!(nl&4194240)&&(nl=64),e}function zs(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vt(t),e[t]=n}function Of(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-vt(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function ua(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-vt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var se=0;function Zu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var ec,ca,tc,nc,rc,wi=!1,ll=[],Ht=null,Ut=null,Wt=null,Tr=new Map,Pr=new Map,Mt=[],Mf="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 ao(e,t){switch(e){case"focusin":case"focusout":Ht=null;break;case"dragenter":case"dragleave":Ut=null;break;case"mouseover":case"mouseout":Wt=null;break;case"pointerover":case"pointerout":Tr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pr.delete(t.pointerId)}}function rr(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=Qr(t),t!==null&&ca(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Ff(e,t,n,r,l){switch(t){case"focusin":return Ht=rr(Ht,e,t,n,r,l),!0;case"dragenter":return Ut=rr(Ut,e,t,n,r,l),!0;case"mouseover":return Wt=rr(Wt,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return Tr.set(i,rr(Tr.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,Pr.set(i,rr(Pr.get(i)||null,e,t,n,r,l)),!0}return!1}function lc(e){var t=sn(e.target);if(t!==null){var n=vn(t);if(n!==null){if(t=n.tag,t===13){if(t=Qu(n),t!==null){e.blockedOn=t,rc(e.priority,function(){tc(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 xl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ki(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);mi=r,n.target.dispatchEvent(r),mi=null}else return t=Qr(n),t!==null&&ca(t),e.blockedOn=n,!1;t.shift()}return!0}function oo(e,t,n){xl(e)&&n.delete(t)}function Af(){wi=!1,Ht!==null&&xl(Ht)&&(Ht=null),Ut!==null&&xl(Ut)&&(Ut=null),Wt!==null&&xl(Wt)&&(Wt=null),Tr.forEach(oo),Pr.forEach(oo)}function lr(e,t){e.blockedOn===t&&(e.blockedOn=null,wi||(wi=!0,et.unstable_scheduleCallback(et.unstable_NormalPriority,Af)))}function br(e){function t(l){return lr(l,e)}if(0<ll.length){lr(ll[0],e);for(var n=1;n<ll.length;n++){var r=ll[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ht!==null&&lr(Ht,e),Ut!==null&&lr(Ut,e),Wt!==null&&lr(Wt,e),Tr.forEach(t),Pr.forEach(t),n=0;n<Mt.length;n++)r=Mt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Mt.length&&(n=Mt[0],n.blockedOn===null);)lc(n),n.blockedOn===null&&Mt.shift()}var Mn=Dt.ReactCurrentBatchConfig,$l=!0;function Bf(e,t,n,r){var l=se,i=Mn.transition;Mn.transition=null;try{se=1,da(e,t,n,r)}finally{se=l,Mn.transition=i}}function Hf(e,t,n,r){var l=se,i=Mn.transition;Mn.transition=null;try{se=4,da(e,t,n,r)}finally{se=l,Mn.transition=i}}function da(e,t,n,r){if($l){var l=ki(e,t,n,r);if(l===null)Hs(e,t,r,Il,n),ao(e,r);else if(Ff(l,e,t,n,r))r.stopPropagation();else if(ao(e,r),t&4&&-1<Mf.indexOf(e)){for(;l!==null;){var i=Qr(l);if(i!==null&&ec(i),i=ki(e,t,n,r),i===null&&Hs(e,t,r,Il,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else Hs(e,t,r,null,n)}}var Il=null;function ki(e,t,n,r){if(Il=null,e=aa(r),e=sn(e),e!==null)if(t=vn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Qu(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 Il=e,null}function sc(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(Pf()){case oa:return 1;case qu:return 4;case Rl:case bf:return 16;case Yu:return 536870912;default:return 16}default:return 16}}var At=null,fa=null,wl=null;function ic(){if(wl)return wl;var e,t=fa,n=t.length,r,l="value"in At?At.value:At.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 wl=l.slice(e,1<r?1-r:void 0)}function kl(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 sl(){return!0}function uo(){return!1}function nt(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 u in e)e.hasOwnProperty(u)&&(n=e[u],this[u]=n?n(i):i[u]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?sl:uo,this.isPropagationStopped=uo,this}return me(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=sl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=sl)},persist:function(){},isPersistent:sl}),t}var qn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pa=nt(qn),Vr=me({},qn,{view:0,detail:0}),Uf=nt(Vr),Rs,Ds,sr,rs=me({},Vr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ha,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!==sr&&(sr&&e.type==="mousemove"?(Rs=e.screenX-sr.screenX,Ds=e.screenY-sr.screenY):Ds=Rs=0,sr=e),Rs)},movementY:function(e){return"movementY"in e?e.movementY:Ds}}),co=nt(rs),Wf=me({},rs,{dataTransfer:0}),Vf=nt(Wf),Qf=me({},Vr,{relatedTarget:0}),$s=nt(Qf),Kf=me({},qn,{animationName:0,elapsedTime:0,pseudoElement:0}),Xf=nt(Kf),Jf=me({},qn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qf=nt(Jf),Yf=me({},qn,{data:0}),fo=nt(Yf),Gf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Zf={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"},ep={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ep[e])?!!t[e]:!1}function ha(){return tp}var np=me({},Vr,{key:function(e){if(e.key){var t=Gf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=kl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Zf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ha,charCode:function(e){return e.type==="keypress"?kl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?kl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rp=nt(np),lp=me({},rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),po=nt(lp),sp=me({},Vr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ha}),ip=nt(sp),ap=me({},qn,{propertyName:0,elapsedTime:0,pseudoElement:0}),op=nt(ap),up=me({},rs,{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}),cp=nt(up),dp=[9,13,27,32],ma=bt&&"CompositionEvent"in window,yr=null;bt&&"documentMode"in document&&(yr=document.documentMode);var fp=bt&&"TextEvent"in window&&!yr,ac=bt&&(!ma||yr&&8<yr&&11>=yr),ho=" ",mo=!1;function oc(e,t){switch(e){case"keyup":return dp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _n=!1;function pp(e,t){switch(e){case"compositionend":return uc(t);case"keypress":return t.which!==32?null:(mo=!0,ho);case"textInput":return e=t.data,e===ho&&mo?null:e;default:return null}}function hp(e,t){if(_n)return e==="compositionend"||!ma&&oc(e,t)?(e=ic(),wl=fa=At=null,_n=!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 ac&&t.locale!=="ko"?null:t.data;default:return null}}var mp={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 go(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!mp[e.type]:t==="textarea"}function cc(e,t,n,r){Bu(r),t=Ol(t,"onChange"),0<t.length&&(n=new pa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xr=null,Lr=null;function gp(e){kc(e,0)}function ls(e){var t=Tn(e);if(Du(t))return e}function vp(e,t){if(e==="change")return t}var dc=!1;if(bt){var Is;if(bt){var Os="oninput"in document;if(!Os){var vo=document.createElement("div");vo.setAttribute("oninput","return;"),Os=typeof vo.oninput=="function"}Is=Os}else Is=!1;dc=Is&&(!document.documentMode||9<document.documentMode)}function yo(){xr&&(xr.detachEvent("onpropertychange",fc),Lr=xr=null)}function fc(e){if(e.propertyName==="value"&&ls(Lr)){var t=[];cc(t,Lr,e,aa(e)),Vu(gp,t)}}function yp(e,t,n){e==="focusin"?(yo(),xr=t,Lr=n,xr.attachEvent("onpropertychange",fc)):e==="focusout"&&yo()}function xp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ls(Lr)}function wp(e,t){if(e==="click")return ls(t)}function kp(e,t){if(e==="input"||e==="change")return ls(t)}function jp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xt=typeof Object.is=="function"?Object.is:jp;function zr(e,t){if(xt(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(!ri.call(t,l)||!xt(e[l],t[l]))return!1}return!0}function xo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wo(e,t){var n=xo(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=xo(n)}}function pc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hc(){for(var e=window,t=bl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bl(e.document)}return t}function ga(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 Sp(e){var t=hc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&pc(n.ownerDocument.documentElement,n)){if(r!==null&&ga(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=wo(n,i);var a=wo(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 Np=bt&&"documentMode"in document&&11>=document.documentMode,Cn=null,ji=null,wr=null,Si=!1;function ko(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Si||Cn==null||Cn!==bl(r)||(r=Cn,"selectionStart"in r&&ga(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}),wr&&zr(wr,r)||(wr=r,r=Ol(ji,"onSelect"),0<r.length&&(t=new pa("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Cn)))}function il(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var En={animationend:il("Animation","AnimationEnd"),animationiteration:il("Animation","AnimationIteration"),animationstart:il("Animation","AnimationStart"),transitionend:il("Transition","TransitionEnd")},Ms={},mc={};bt&&(mc=document.createElement("div").style,"AnimationEvent"in window||(delete En.animationend.animation,delete En.animationiteration.animation,delete En.animationstart.animation),"TransitionEvent"in window||delete En.transitionend.transition);function ss(e){if(Ms[e])return Ms[e];if(!En[e])return e;var t=En[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in mc)return Ms[e]=t[n];return e}var gc=ss("animationend"),vc=ss("animationiteration"),yc=ss("animationstart"),xc=ss("transitionend"),wc=new Map,jo="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 Gt(e,t){wc.set(e,t),gn(t,[e])}for(var Fs=0;Fs<jo.length;Fs++){var As=jo[Fs],_p=As.toLowerCase(),Cp=As[0].toUpperCase()+As.slice(1);Gt(_p,"on"+Cp)}Gt(gc,"onAnimationEnd");Gt(vc,"onAnimationIteration");Gt(yc,"onAnimationStart");Gt("dblclick","onDoubleClick");Gt("focusin","onFocus");Gt("focusout","onBlur");Gt(xc,"onTransitionEnd");Hn("onMouseEnter",["mouseout","mouseover"]);Hn("onMouseLeave",["mouseout","mouseover"]);Hn("onPointerEnter",["pointerout","pointerover"]);Hn("onPointerLeave",["pointerout","pointerover"]);gn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));gn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));gn("onBeforeInput",["compositionend","keypress","textInput","paste"]);gn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));gn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));gn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hr="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(" "),Ep=new Set("cancel close invalid load scroll toggle".split(" ").concat(hr));function So(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,_f(r,t,void 0,e),e.currentTarget=null}function kc(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 u=r[a],o=u.instance,c=u.currentTarget;if(u=u.listener,o!==i&&l.isPropagationStopped())break e;So(l,u,c),i=o}else for(a=0;a<r.length;a++){if(u=r[a],o=u.instance,c=u.currentTarget,u=u.listener,o!==i&&l.isPropagationStopped())break e;So(l,u,c),i=o}}}if(zl)throw e=yi,zl=!1,yi=null,e}function oe(e,t){var n=t[Ti];n===void 0&&(n=t[Ti]=new Set);var r=e+"__bubble";n.has(r)||(jc(t,e,2,!1),n.add(r))}function Bs(e,t,n){var r=0;t&&(r|=4),jc(n,e,r,t)}var al="_reactListening"+Math.random().toString(36).slice(2);function Rr(e){if(!e[al]){e[al]=!0,Pu.forEach(function(n){n!=="selectionchange"&&(Ep.has(n)||Bs(n,!1,e),Bs(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[al]||(t[al]=!0,Bs("selectionchange",!1,t))}}function jc(e,t,n,r){switch(sc(t)){case 1:var l=Bf;break;case 4:l=Hf;break;default:l=da}n=l.bind(null,t,n,e),l=void 0,!vi||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 Hs(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 u=r.stateNode.containerInfo;if(u===l||u.nodeType===8&&u.parentNode===l)break;if(a===4)for(a=r.return;a!==null;){var o=a.tag;if((o===3||o===4)&&(o=a.stateNode.containerInfo,o===l||o.nodeType===8&&o.parentNode===l))return;a=a.return}for(;u!==null;){if(a=sn(u),a===null)return;if(o=a.tag,o===5||o===6){r=i=a;continue e}u=u.parentNode}}r=r.return}Vu(function(){var c=i,g=aa(n),m=[];e:{var h=wc.get(e);if(h!==void 0){var y=pa,w=e;switch(e){case"keypress":if(kl(n)===0)break e;case"keydown":case"keyup":y=rp;break;case"focusin":w="focus",y=$s;break;case"focusout":w="blur",y=$s;break;case"beforeblur":case"afterblur":y=$s;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=co;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Vf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=ip;break;case gc:case vc:case yc:y=Xf;break;case xc:y=op;break;case"scroll":y=Uf;break;case"wheel":y=cp;break;case"copy":case"cut":case"paste":y=qf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=po}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 x=v.stateNode;if(v.tag===5&&x!==null&&(v=x,p!==null&&(x=Er(d,p),x!=null&&k.push(Dr(d,x,v)))),j)break;d=d.return}0<k.length&&(h=new y(h,w,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!==mi&&(w=n.relatedTarget||n.fromElement)&&(sn(w)||w[Lt]))break e;if((y||h)&&(h=g.window===g?g:(h=g.ownerDocument)?h.defaultView||h.parentWindow:window,y?(w=n.relatedTarget||n.toElement,y=c,w=w?sn(w):null,w!==null&&(j=vn(w),w!==j||w.tag!==5&&w.tag!==6)&&(w=null)):(y=null,w=c),y!==w)){if(k=co,x="onMouseLeave",p="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(k=po,x="onPointerLeave",p="onPointerEnter",d="pointer"),j=y==null?h:Tn(y),v=w==null?h:Tn(w),h=new k(x,d+"leave",y,n,g),h.target=j,h.relatedTarget=v,x=null,sn(g)===c&&(k=new k(p,d+"enter",w,n,g),k.target=v,k.relatedTarget=j,x=k),j=x,y&&w)t:{for(k=y,p=w,d=0,v=k;v;v=jn(v))d++;for(v=0,x=p;x;x=jn(x))v++;for(;0<d-v;)k=jn(k),d--;for(;0<v-d;)p=jn(p),v--;for(;d--;){if(k===p||p!==null&&k===p.alternate)break t;k=jn(k),p=jn(p)}k=null}else k=null;y!==null&&No(m,h,y,k,!1),w!==null&&j!==null&&No(m,j,w,k,!0)}}e:{if(h=c?Tn(c):window,y=h.nodeName&&h.nodeName.toLowerCase(),y==="select"||y==="input"&&h.type==="file")var N=vp;else if(go(h))if(dc)N=kp;else{N=xp;var P=yp}else(y=h.nodeName)&&y.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(N=wp);if(N&&(N=N(e,c))){cc(m,N,n,g);break e}P&&P(e,h,c),e==="focusout"&&(P=h._wrapperState)&&P.controlled&&h.type==="number"&&ci(h,"number",h.value)}switch(P=c?Tn(c):window,e){case"focusin":(go(P)||P.contentEditable==="true")&&(Cn=P,ji=c,wr=null);break;case"focusout":wr=ji=Cn=null;break;case"mousedown":Si=!0;break;case"contextmenu":case"mouseup":case"dragend":Si=!1,ko(m,n,g);break;case"selectionchange":if(Np)break;case"keydown":case"keyup":ko(m,n,g)}var C;if(ma)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else _n?oc(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(ac&&n.locale!=="ko"&&(_n||S!=="onCompositionStart"?S==="onCompositionEnd"&&_n&&(C=ic()):(At=g,fa="value"in At?At.value:At.textContent,_n=!0)),P=Ol(c,S),0<P.length&&(S=new fo(S,e,null,n,g),m.push({event:S,listeners:P}),C?S.data=C:(C=uc(n),C!==null&&(S.data=C)))),(C=fp?pp(e,n):hp(e,n))&&(c=Ol(c,"onBeforeInput"),0<c.length&&(g=new fo("onBeforeInput","beforeinput",null,n,g),m.push({event:g,listeners:c}),g.data=C))}kc(m,t)})}function Dr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ol(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=Er(e,n),i!=null&&r.unshift(Dr(e,i,l)),i=Er(e,t),i!=null&&r.push(Dr(e,i,l))),e=e.return}return r}function jn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function No(e,t,n,r,l){for(var i=t._reactName,a=[];n!==null&&n!==r;){var u=n,o=u.alternate,c=u.stateNode;if(o!==null&&o===r)break;u.tag===5&&c!==null&&(u=c,l?(o=Er(n,i),o!=null&&a.unshift(Dr(n,o,u))):l||(o=Er(n,i),o!=null&&a.push(Dr(n,o,u)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Tp=/\r\n?/g,Pp=/\u0000|\uFFFD/g;function _o(e){return(typeof e=="string"?e:""+e).replace(Tp,`
|
||
`).replace(Pp,"")}function ol(e,t,n){if(t=_o(t),_o(e)!==t&&n)throw Error(z(425))}function Ml(){}var Ni=null,_i=null;function Ci(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 Ei=typeof setTimeout=="function"?setTimeout:void 0,bp=typeof clearTimeout=="function"?clearTimeout:void 0,Co=typeof Promise=="function"?Promise:void 0,Lp=typeof queueMicrotask=="function"?queueMicrotask:typeof Co<"u"?function(e){return Co.resolve(null).then(e).catch(zp)}:Ei;function zp(e){setTimeout(function(){throw e})}function Us(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),br(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);br(t)}function Vt(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 Eo(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 Yn=Math.random().toString(36).slice(2),jt="__reactFiber$"+Yn,$r="__reactProps$"+Yn,Lt="__reactContainer$"+Yn,Ti="__reactEvents$"+Yn,Rp="__reactListeners$"+Yn,Dp="__reactHandles$"+Yn;function sn(e){var t=e[jt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Lt]||n[jt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Eo(e);e!==null;){if(n=e[jt])return n;e=Eo(e)}return t}e=n,n=e.parentNode}return null}function Qr(e){return e=e[jt]||e[Lt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Tn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(z(33))}function is(e){return e[$r]||null}var Pi=[],Pn=-1;function Zt(e){return{current:e}}function ue(e){0>Pn||(e.current=Pi[Pn],Pi[Pn]=null,Pn--)}function ae(e,t){Pn++,Pi[Pn]=e.current,e.current=t}var Yt={},Me=Zt(Yt),Ke=Zt(!1),dn=Yt;function Un(e,t){var n=e.type.contextTypes;if(!n)return Yt;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 Xe(e){return e=e.childContextTypes,e!=null}function Fl(){ue(Ke),ue(Me)}function To(e,t,n){if(Me.current!==Yt)throw Error(z(168));ae(Me,t),ae(Ke,n)}function Sc(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(z(108,yf(e)||"Unknown",l));return me({},n,r)}function Al(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yt,dn=Me.current,ae(Me,e),ae(Ke,Ke.current),!0}function Po(e,t,n){var r=e.stateNode;if(!r)throw Error(z(169));n?(e=Sc(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,ue(Ke),ue(Me),ae(Me,e)):ue(Ke),ae(Ke,n)}var Ct=null,as=!1,Ws=!1;function Nc(e){Ct===null?Ct=[e]:Ct.push(e)}function $p(e){as=!0,Nc(e)}function en(){if(!Ws&&Ct!==null){Ws=!0;var e=0,t=se;try{var n=Ct;for(se=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ct=null,as=!1}catch(l){throw Ct!==null&&(Ct=Ct.slice(e+1)),Ju(oa,en),l}finally{se=t,Ws=!1}}return null}var bn=[],Ln=0,Bl=null,Hl=0,st=[],it=0,fn=null,Et=1,Tt="";function rn(e,t){bn[Ln++]=Hl,bn[Ln++]=Bl,Bl=e,Hl=t}function _c(e,t,n){st[it++]=Et,st[it++]=Tt,st[it++]=fn,fn=e;var r=Et;e=Tt;var l=32-vt(r)-1;r&=~(1<<l),n+=1;var i=32-vt(t)+l;if(30<i){var a=l-l%5;i=(r&(1<<a)-1).toString(32),r>>=a,l-=a,Et=1<<32-vt(t)+l|n<<l|r,Tt=i+e}else Et=1<<i|n<<l|r,Tt=e}function va(e){e.return!==null&&(rn(e,1),_c(e,1,0))}function ya(e){for(;e===Bl;)Bl=bn[--Ln],bn[Ln]=null,Hl=bn[--Ln],bn[Ln]=null;for(;e===fn;)fn=st[--it],st[it]=null,Tt=st[--it],st[it]=null,Et=st[--it],st[it]=null}var Ze=null,Ge=null,fe=!1,mt=null;function Cc(e,t){var n=at(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 bo(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,Ze=e,Ge=Vt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ze=e,Ge=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=fn!==null?{id:Et,overflow:Tt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=at(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ze=e,Ge=null,!0):!1;default:return!1}}function bi(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Li(e){if(fe){var t=Ge;if(t){var n=t;if(!bo(e,t)){if(bi(e))throw Error(z(418));t=Vt(n.nextSibling);var r=Ze;t&&bo(e,t)?Cc(r,n):(e.flags=e.flags&-4097|2,fe=!1,Ze=e)}}else{if(bi(e))throw Error(z(418));e.flags=e.flags&-4097|2,fe=!1,Ze=e}}}function Lo(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ze=e}function ul(e){if(e!==Ze)return!1;if(!fe)return Lo(e),fe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ci(e.type,e.memoizedProps)),t&&(t=Ge)){if(bi(e))throw Ec(),Error(z(418));for(;t;)Cc(e,t),t=Vt(t.nextSibling)}if(Lo(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ge=Vt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ge=null}}else Ge=Ze?Vt(e.stateNode.nextSibling):null;return!0}function Ec(){for(var e=Ge;e;)e=Vt(e.nextSibling)}function Wn(){Ge=Ze=null,fe=!1}function xa(e){mt===null?mt=[e]:mt.push(e)}var Ip=Dt.ReactCurrentBatchConfig;function ir(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(z(309));var r=n.stateNode}if(!r)throw Error(z(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 u=l.refs;a===null?delete u[i]:u[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(z(284));if(!n._owner)throw Error(z(290,e))}return e}function cl(e,t){throw e=Object.prototype.toString.call(t),Error(z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zo(e){var t=e._init;return t(e._payload)}function Tc(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=Jt(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 u(p,d,v,x){return d===null||d.tag!==6?(d=Ys(v,p.mode,x),d.return=p,d):(d=l(d,v),d.return=p,d)}function o(p,d,v,x){var N=v.type;return N===Nn?g(p,d,v.props.children,x,v.key):d!==null&&(d.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===It&&zo(N)===d.type)?(x=l(d,v.props),x.ref=ir(p,d,v),x.return=p,x):(x=Tl(v.type,v.key,v.props,null,p.mode,x),x.ref=ir(p,d,v),x.return=p,x)}function c(p,d,v,x){return d===null||d.tag!==4||d.stateNode.containerInfo!==v.containerInfo||d.stateNode.implementation!==v.implementation?(d=Gs(v,p.mode,x),d.return=p,d):(d=l(d,v.children||[]),d.return=p,d)}function g(p,d,v,x,N){return d===null||d.tag!==7?(d=cn(v,p.mode,x,N),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=Ys(""+d,p.mode,v),d.return=p,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Zr:return v=Tl(d.type,d.key,d.props,null,p.mode,v),v.ref=ir(p,null,d),v.return=p,v;case Sn:return d=Gs(d,p.mode,v),d.return=p,d;case It:var x=d._init;return m(p,x(d._payload),v)}if(fr(d)||tr(d))return d=cn(d,p.mode,v,null),d.return=p,d;cl(p,d)}return null}function h(p,d,v,x){var N=d!==null?d.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return N!==null?null:u(p,d,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Zr:return v.key===N?o(p,d,v,x):null;case Sn:return v.key===N?c(p,d,v,x):null;case It:return N=v._init,h(p,d,N(v._payload),x)}if(fr(v)||tr(v))return N!==null?null:g(p,d,v,x,null);cl(p,v)}return null}function y(p,d,v,x,N){if(typeof x=="string"&&x!==""||typeof x=="number")return p=p.get(v)||null,u(d,p,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Zr:return p=p.get(x.key===null?v:x.key)||null,o(d,p,x,N);case Sn:return p=p.get(x.key===null?v:x.key)||null,c(d,p,x,N);case It:var P=x._init;return y(p,d,v,P(x._payload),N)}if(fr(x)||tr(x))return p=p.get(v)||null,g(d,p,x,N,null);cl(d,x)}return null}function w(p,d,v,x){for(var N=null,P=null,C=d,S=d=0,D=null;C!==null&&S<v.length;S++){C.index>S?(D=C,C=null):D=C.sibling;var L=h(p,C,v[S],x);if(L===null){C===null&&(C=D);break}e&&C&&L.alternate===null&&t(p,C),d=i(L,d,S),P===null?N=L:P.sibling=L,P=L,C=D}if(S===v.length)return n(p,C),fe&&rn(p,S),N;if(C===null){for(;S<v.length;S++)C=m(p,v[S],x),C!==null&&(d=i(C,d,S),P===null?N=C:P.sibling=C,P=C);return fe&&rn(p,S),N}for(C=r(p,C);S<v.length;S++)D=y(C,p,S,v[S],x),D!==null&&(e&&D.alternate!==null&&C.delete(D.key===null?S:D.key),d=i(D,d,S),P===null?N=D:P.sibling=D,P=D);return e&&C.forEach(function(U){return t(p,U)}),fe&&rn(p,S),N}function k(p,d,v,x){var N=tr(v);if(typeof N!="function")throw Error(z(150));if(v=N.call(v),v==null)throw Error(z(151));for(var P=N=null,C=d,S=d=0,D=null,L=v.next();C!==null&&!L.done;S++,L=v.next()){C.index>S?(D=C,C=null):D=C.sibling;var U=h(p,C,L.value,x);if(U===null){C===null&&(C=D);break}e&&C&&U.alternate===null&&t(p,C),d=i(U,d,S),P===null?N=U:P.sibling=U,P=U,C=D}if(L.done)return n(p,C),fe&&rn(p,S),N;if(C===null){for(;!L.done;S++,L=v.next())L=m(p,L.value,x),L!==null&&(d=i(L,d,S),P===null?N=L:P.sibling=L,P=L);return fe&&rn(p,S),N}for(C=r(p,C);!L.done;S++,L=v.next())L=y(C,p,S,L.value,x),L!==null&&(e&&L.alternate!==null&&C.delete(L.key===null?S:L.key),d=i(L,d,S),P===null?N=L:P.sibling=L,P=L);return e&&C.forEach(function(F){return t(p,F)}),fe&&rn(p,S),N}function j(p,d,v,x){if(typeof v=="object"&&v!==null&&v.type===Nn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Zr:e:{for(var N=v.key,P=d;P!==null;){if(P.key===N){if(N=v.type,N===Nn){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===N||typeof N=="object"&&N!==null&&N.$$typeof===It&&zo(N)===P.type){n(p,P.sibling),d=l(P,v.props),d.ref=ir(p,P,v),d.return=p,p=d;break e}n(p,P);break}else t(p,P);P=P.sibling}v.type===Nn?(d=cn(v.props.children,p.mode,x,v.key),d.return=p,p=d):(x=Tl(v.type,v.key,v.props,null,p.mode,x),x.ref=ir(p,d,v),x.return=p,p=x)}return a(p);case Sn: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=Gs(v,p.mode,x),d.return=p,p=d}return a(p);case It:return P=v._init,j(p,d,P(v._payload),x)}if(fr(v))return w(p,d,v,x);if(tr(v))return k(p,d,v,x);cl(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=Ys(v,p.mode,x),d.return=p,p=d),a(p)):n(p,d)}return j}var Vn=Tc(!0),Pc=Tc(!1),Ul=Zt(null),Wl=null,zn=null,wa=null;function ka(){wa=zn=Wl=null}function ja(e){var t=Ul.current;ue(Ul),e._currentValue=t}function zi(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 Fn(e,t){Wl=e,wa=zn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Qe=!0),e.firstContext=null)}function ut(e){var t=e._currentValue;if(wa!==e)if(e={context:e,memoizedValue:t,next:null},zn===null){if(Wl===null)throw Error(z(308));zn=e,Wl.dependencies={lanes:0,firstContext:e}}else zn=zn.next=e;return t}var an=null;function Sa(e){an===null?an=[e]:an.push(e)}function bc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Sa(t)):(n.next=l.next,l.next=n),t.interleaved=n,zt(e,r)}function zt(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 Ot=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Lc(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 Pt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Z&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,zt(e,n)}return l=r.interleaved,l===null?(t.next=t,Sa(r)):(t.next=l.next,l.next=t),r.interleaved=t,zt(e,n)}function jl(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,ua(e,n)}}function Ro(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 Vl(e,t,n,r){var l=e.updateQueue;Ot=!1;var i=l.firstBaseUpdate,a=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var o=u,c=o.next;o.next=null,a===null?i=c:a.next=c,a=o;var g=e.alternate;g!==null&&(g=g.updateQueue,u=g.lastBaseUpdate,u!==a&&(u===null?g.firstBaseUpdate=c:u.next=c,g.lastBaseUpdate=o))}if(i!==null){var m=l.baseState;a=0,g=c=o=null,u=i;do{var h=u.lane,y=u.eventTime;if((r&h)===h){g!==null&&(g=g.next={eventTime:y,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=e,k=u;switch(h=t,y=n,k.tag){case 1:if(w=k.payload,typeof w=="function"){m=w.call(y,m,h);break e}m=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=k.payload,h=typeof w=="function"?w.call(y,m,h):w,h==null)break e;m=me({},m,h);break e;case 2:Ot=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else y={eventTime:y,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},g===null?(c=g=y,o=m):g=g.next=y,a|=h;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;h=u,u=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(g===null&&(o=m),l.baseState=o,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);hn|=a,e.lanes=a,e.memoizedState=m}}function Do(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(z(191,l));l.call(r)}}}var Kr={},Nt=Zt(Kr),Ir=Zt(Kr),Or=Zt(Kr);function on(e){if(e===Kr)throw Error(z(174));return e}function _a(e,t){switch(ae(Or,t),ae(Ir,e),ae(Nt,Kr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=fi(t,e)}ue(Nt),ae(Nt,t)}function Qn(){ue(Nt),ue(Ir),ue(Or)}function zc(e){on(Or.current);var t=on(Nt.current),n=fi(t,e.type);t!==n&&(ae(Ir,e),ae(Nt,n))}function Ca(e){Ir.current===e&&(ue(Nt),ue(Ir))}var pe=Zt(0);function Ql(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 Vs=[];function Ea(){for(var e=0;e<Vs.length;e++)Vs[e]._workInProgressVersionPrimary=null;Vs.length=0}var Sl=Dt.ReactCurrentDispatcher,Qs=Dt.ReactCurrentBatchConfig,pn=0,he=null,Ce=null,Te=null,Kl=!1,kr=!1,Mr=0,Op=0;function $e(){throw Error(z(321))}function Ta(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xt(e[n],t[n]))return!1;return!0}function Pa(e,t,n,r,l,i){if(pn=i,he=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Sl.current=e===null||e.memoizedState===null?Bp:Hp,e=n(r,l),kr){i=0;do{if(kr=!1,Mr=0,25<=i)throw Error(z(301));i+=1,Te=Ce=null,t.updateQueue=null,Sl.current=Up,e=n(r,l)}while(kr)}if(Sl.current=Xl,t=Ce!==null&&Ce.next!==null,pn=0,Te=Ce=he=null,Kl=!1,t)throw Error(z(300));return e}function ba(){var e=Mr!==0;return Mr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Te===null?he.memoizedState=Te=e:Te=Te.next=e,Te}function ct(){if(Ce===null){var e=he.alternate;e=e!==null?e.memoizedState:null}else e=Ce.next;var t=Te===null?he.memoizedState:Te.next;if(t!==null)Te=t,Ce=e;else{if(e===null)throw Error(z(310));Ce=e,e={memoizedState:Ce.memoizedState,baseState:Ce.baseState,baseQueue:Ce.baseQueue,queue:Ce.queue,next:null},Te===null?he.memoizedState=Te=e:Te=Te.next=e}return Te}function Fr(e,t){return typeof t=="function"?t(e):t}function Ks(e){var t=ct(),n=t.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=e;var r=Ce,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 u=a=null,o=null,c=i;do{var g=c.lane;if((pn&g)===g)o!==null&&(o=o.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};o===null?(u=o=m,a=r):o=o.next=m,he.lanes|=g,hn|=g}c=c.next}while(c!==null&&c!==i);o===null?a=r:o.next=u,xt(r,t.memoizedState)||(Qe=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=o,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do i=l.lane,he.lanes|=i,hn|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xs(e){var t=ct(),n=t.queue;if(n===null)throw Error(z(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);xt(i,t.memoizedState)||(Qe=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Rc(){}function Dc(e,t){var n=he,r=ct(),l=t(),i=!xt(r.memoizedState,l);if(i&&(r.memoizedState=l,Qe=!0),r=r.queue,La(Oc.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Te!==null&&Te.memoizedState.tag&1){if(n.flags|=2048,Ar(9,Ic.bind(null,n,r,l,t),void 0,null),Pe===null)throw Error(z(349));pn&30||$c(n,t,l)}return l}function $c(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ic(e,t,n,r){t.value=n,t.getSnapshot=r,Mc(t)&&Fc(e)}function Oc(e,t,n){return n(function(){Mc(t)&&Fc(e)})}function Mc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xt(e,n)}catch{return!0}}function Fc(e){var t=zt(e,1);t!==null&&yt(t,e,1,-1)}function $o(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:e},t.queue=e,e=e.dispatch=Ap.bind(null,he,e),[t.memoizedState,e]}function Ar(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.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 Ac(){return ct().memoizedState}function Nl(e,t,n,r){var l=kt();he.flags|=e,l.memoizedState=Ar(1|t,n,void 0,r===void 0?null:r)}function os(e,t,n,r){var l=ct();r=r===void 0?null:r;var i=void 0;if(Ce!==null){var a=Ce.memoizedState;if(i=a.destroy,r!==null&&Ta(r,a.deps)){l.memoizedState=Ar(t,n,i,r);return}}he.flags|=e,l.memoizedState=Ar(1|t,n,i,r)}function Io(e,t){return Nl(8390656,8,e,t)}function La(e,t){return os(2048,8,e,t)}function Bc(e,t){return os(4,2,e,t)}function Hc(e,t){return os(4,4,e,t)}function Uc(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 Wc(e,t,n){return n=n!=null?n.concat([e]):null,os(4,4,Uc.bind(null,t,e),n)}function za(){}function Vc(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ta(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qc(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ta(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Kc(e,t,n){return pn&21?(xt(n,t)||(n=Gu(),he.lanes|=n,hn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Qe=!0),e.memoizedState=n)}function Mp(e,t){var n=se;se=n!==0&&4>n?n:4,e(!0);var r=Qs.transition;Qs.transition={};try{e(!1),t()}finally{se=n,Qs.transition=r}}function Xc(){return ct().memoizedState}function Fp(e,t,n){var r=Xt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jc(e))qc(t,n);else if(n=bc(e,t,n,r),n!==null){var l=He();yt(n,e,r,l),Yc(n,t,r)}}function Ap(e,t,n){var r=Xt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jc(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,u=i(a,n);if(l.hasEagerState=!0,l.eagerState=u,xt(u,a)){var o=t.interleaved;o===null?(l.next=l,Sa(t)):(l.next=o.next,o.next=l),t.interleaved=l;return}}catch{}finally{}n=bc(e,t,l,r),n!==null&&(l=He(),yt(n,e,r,l),Yc(n,t,r))}}function Jc(e){var t=e.alternate;return e===he||t!==null&&t===he}function qc(e,t){kr=Kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Yc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}var Xl={readContext:ut,useCallback:$e,useContext:$e,useEffect:$e,useImperativeHandle:$e,useInsertionEffect:$e,useLayoutEffect:$e,useMemo:$e,useReducer:$e,useRef:$e,useState:$e,useDebugValue:$e,useDeferredValue:$e,useTransition:$e,useMutableSource:$e,useSyncExternalStore:$e,useId:$e,unstable_isNewReconciler:!1},Bp={readContext:ut,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:ut,useEffect:Io,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Nl(4194308,4,Uc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Nl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Nl(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();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=Fp.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:za,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=Mp.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=he,l=kt();if(fe){if(n===void 0)throw Error(z(407));n=n()}else{if(n=t(),Pe===null)throw Error(z(349));pn&30||$c(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Io(Oc.bind(null,r,i,e),[e]),r.flags|=2048,Ar(9,Ic.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=kt(),t=Pe.identifierPrefix;if(fe){var n=Tt,r=Et;n=(r&~(1<<32-vt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Mr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Op++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hp={readContext:ut,useCallback:Vc,useContext:ut,useEffect:La,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:Qc,useReducer:Ks,useRef:Ac,useState:function(){return Ks(Fr)},useDebugValue:za,useDeferredValue:function(e){var t=ct();return Kc(t,Ce.memoizedState,e)},useTransition:function(){var e=Ks(Fr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:Rc,useSyncExternalStore:Dc,useId:Xc,unstable_isNewReconciler:!1},Up={readContext:ut,useCallback:Vc,useContext:ut,useEffect:La,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:Qc,useReducer:Xs,useRef:Ac,useState:function(){return Xs(Fr)},useDebugValue:za,useDeferredValue:function(e){var t=ct();return Ce===null?t.memoizedState=e:Kc(t,Ce.memoizedState,e)},useTransition:function(){var e=Xs(Fr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:Rc,useSyncExternalStore:Dc,useId:Xc,unstable_isNewReconciler:!1};function pt(e,t){if(e&&e.defaultProps){t=me({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ri(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var us={isMounted:function(e){return(e=e._reactInternals)?vn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=He(),l=Xt(e),i=Pt(r,l);i.payload=t,n!=null&&(i.callback=n),t=Qt(e,i,l),t!==null&&(yt(t,e,l,r),jl(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=He(),l=Xt(e),i=Pt(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Qt(e,i,l),t!==null&&(yt(t,e,l,r),jl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=He(),r=Xt(e),l=Pt(n,r);l.tag=2,t!=null&&(l.callback=t),t=Qt(e,l,r),t!==null&&(yt(t,e,r,n),jl(t,e,r))}};function Oo(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?!zr(n,r)||!zr(l,i):!0}function Gc(e,t,n){var r=!1,l=Yt,i=t.contextType;return typeof i=="object"&&i!==null?i=ut(i):(l=Xe(t)?dn:Me.current,r=t.contextTypes,i=(r=r!=null)?Un(e,l):Yt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=us,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function Mo(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&&us.enqueueReplaceState(t,t.state,null)}function Di(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},Na(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=ut(i):(i=Xe(t)?dn:Me.current,l.context=Un(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ri(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&&us.enqueueReplaceState(l,l.state,null),Vl(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Kn(e,t){try{var n="",r=t;do n+=vf(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 Js(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $i(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Wp=typeof WeakMap=="function"?WeakMap:Map;function Zc(e,t,n){n=Pt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ql||(ql=!0,Vi=r),$i(e,t)},n}function ed(e,t,n){n=Pt(-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(){$i(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){$i(e,t),typeof r!="function"&&(Kt===null?Kt=new Set([this]):Kt.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Fo(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Wp;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=lh.bind(null,e,t,n),t.then(e,e))}function Ao(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 Bo(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=Pt(-1,1),t.tag=2,Qt(n,t,1))),n.lanes|=1),e)}var Vp=Dt.ReactCurrentOwner,Qe=!1;function Be(e,t,n,r){t.child=e===null?Pc(t,null,n,r):Vn(t,e.child,n,r)}function Ho(e,t,n,r,l){n=n.render;var i=t.ref;return Fn(t,l),r=Pa(e,t,n,r,i,l),n=ba(),e!==null&&!Qe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Rt(e,t,l)):(fe&&n&&va(t),t.flags|=1,Be(e,t,r,l),t.child)}function Uo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Aa(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,td(e,t,i,r,l)):(e=Tl(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:zr,n(a,r)&&e.ref===t.ref)return Rt(e,t,l)}return t.flags|=1,e=Jt(i,r),e.ref=t.ref,e.return=t,t.child=e}function td(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(zr(i,r)&&e.ref===t.ref)if(Qe=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(Qe=!0);else return t.lanes=e.lanes,Rt(e,t,l)}return Ii(e,t,n,r,l)}function nd(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(Dn,Ye),Ye|=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(Dn,Ye),Ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ae(Dn,Ye),Ye|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ae(Dn,Ye),Ye|=r;return Be(e,t,l,n),t.child}function rd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ii(e,t,n,r,l){var i=Xe(n)?dn:Me.current;return i=Un(t,i),Fn(t,l),n=Pa(e,t,n,r,i,l),r=ba(),e!==null&&!Qe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Rt(e,t,l)):(fe&&r&&va(t),t.flags|=1,Be(e,t,n,l),t.child)}function Wo(e,t,n,r,l){if(Xe(n)){var i=!0;Al(t)}else i=!1;if(Fn(t,l),t.stateNode===null)_l(e,t),Gc(t,n,r),Di(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,u=t.memoizedProps;a.props=u;var o=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=ut(c):(c=Xe(n)?dn:Me.current,c=Un(t,c));var g=n.getDerivedStateFromProps,m=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function";m||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(u!==r||o!==c)&&Mo(t,a,r,c),Ot=!1;var h=t.memoizedState;a.state=h,Vl(t,r,a,l),o=t.memoizedState,u!==r||h!==o||Ke.current||Ot?(typeof g=="function"&&(Ri(t,n,g,r),o=t.memoizedState),(u=Ot||Oo(t,n,u,r,h,o,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=o),a.props=r,a.state=o,a.context=c,r=u):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Lc(e,t),u=t.memoizedProps,c=t.type===t.elementType?u:pt(t.type,u),a.props=c,m=t.pendingProps,h=a.context,o=n.contextType,typeof o=="object"&&o!==null?o=ut(o):(o=Xe(n)?dn:Me.current,o=Un(t,o));var y=n.getDerivedStateFromProps;(g=typeof y=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(u!==m||h!==o)&&Mo(t,a,r,o),Ot=!1,h=t.memoizedState,a.state=h,Vl(t,r,a,l);var w=t.memoizedState;u!==m||h!==w||Ke.current||Ot?(typeof y=="function"&&(Ri(t,n,y,r),w=t.memoizedState),(c=Ot||Oo(t,n,c,r,h,w,o)||!1)?(g||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,w,o),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,w,o)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),a.props=r,a.state=w,a.context=o,r=c):(typeof a.componentDidUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Oi(e,t,n,r,i,l)}function Oi(e,t,n,r,l,i){rd(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&Po(t,n,!1),Rt(e,t,i);r=t.stateNode,Vp.current=t;var u=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Vn(t,e.child,null,i),t.child=Vn(t,null,u,i)):Be(e,t,u,i),t.memoizedState=r.state,l&&Po(t,n,!0),t.child}function ld(e){var t=e.stateNode;t.pendingContext?To(e,t.pendingContext,t.pendingContext!==t.context):t.context&&To(e,t.context,!1),_a(e,t.containerInfo)}function Vo(e,t,n,r,l){return Wn(),xa(l),t.flags|=256,Be(e,t,n,r),t.child}var Mi={dehydrated:null,treeContext:null,retryLane:0};function Fi(e){return{baseLanes:e,cachePool:null,transitions:null}}function sd(e,t,n){var r=t.pendingProps,l=pe.current,i=!1,a=(t.flags&128)!==0,u;if((u=a)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),ae(pe,l&1),e===null)return Li(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=fs(a,r,0,null),e=cn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Fi(n),t.memoizedState=Mi,e):Ra(t,a));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return Qp(e,t,a,r,u,l,n);if(i){i=r.fallback,a=t.mode,l=e.child,u=l.sibling;var o={mode:"hidden",children:r.children};return!(a&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=o,t.deletions=null):(r=Jt(l,o),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?i=Jt(u,i):(i=cn(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?Fi(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Mi,r}return i=e.child,e=i.sibling,r=Jt(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 Ra(e,t){return t=fs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function dl(e,t,n,r){return r!==null&&xa(r),Vn(t,e.child,null,n),e=Ra(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qp(e,t,n,r,l,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Js(Error(z(422))),dl(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=fs({mode:"visible",children:r.children},l,0,null),i=cn(i,l,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Vn(t,e.child,null,a),t.child.memoizedState=Fi(a),t.memoizedState=Mi,i);if(!(t.mode&1))return dl(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,i=Error(z(419)),r=Js(i,r,void 0),dl(e,t,a,r)}if(u=(a&e.childLanes)!==0,Qe||u){if(r=Pe,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,zt(e,l),yt(r,e,l,-1))}return Fa(),r=Js(Error(z(421))),dl(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=sh.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,Ge=Vt(l.nextSibling),Ze=t,fe=!0,mt=null,e!==null&&(st[it++]=Et,st[it++]=Tt,st[it++]=fn,Et=e.id,Tt=e.overflow,fn=t),t=Ra(t,r.children),t.flags|=4096,t)}function Qo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),zi(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 id(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(Be(e,t,r.children,n),r=pe.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&&Qo(e,n,t);else if(e.tag===19)Qo(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(pe,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&&Ql(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&&Ql(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 _l(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Rt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),hn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(z(153));if(t.child!==null){for(e=t.child,n=Jt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Jt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Kp(e,t,n){switch(t.tag){case 3:ld(t),Wn();break;case 5:zc(t);break;case 1:Xe(t.type)&&Al(t);break;case 4:_a(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;ae(Ul,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ae(pe,pe.current&1),t.flags|=128,null):n&t.child.childLanes?sd(e,t,n):(ae(pe,pe.current&1),e=Rt(e,t,n),e!==null?e.sibling:null);ae(pe,pe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return id(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),ae(pe,pe.current),r)break;return null;case 22:case 23:return t.lanes=0,nd(e,t,n)}return Rt(e,t,n)}var ad,Ai,od,ud;ad=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}};Ai=function(){};od=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,on(Nt.current);var i=null;switch(n){case"input":l=oi(e,l),r=oi(e,r),i=[];break;case"select":l=me({},l,{value:void 0}),r=me({},r,{value:void 0}),i=[];break;case"textarea":l=di(e,l),r=di(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ml)}pi(n,r);var a;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var u=l[c];for(a in u)u.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(_r.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var o=r[c];if(u=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&o!==u&&(o!=null||u!=null))if(c==="style")if(u){for(a in u)!u.hasOwnProperty(a)||o&&o.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in o)o.hasOwnProperty(a)&&u[a]!==o[a]&&(n||(n={}),n[a]=o[a])}else n||(i||(i=[]),i.push(c,n)),n=o;else c==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,u=u?u.__html:void 0,o!=null&&u!==o&&(i=i||[]).push(c,o)):c==="children"?typeof o!="string"&&typeof o!="number"||(i=i||[]).push(c,""+o):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(_r.hasOwnProperty(c)?(o!=null&&c==="onScroll"&&oe("scroll",e),i||u===o||(i=[])):(i=i||[]).push(c,o))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};ud=function(e,t,n,r){n!==r&&(t.flags|=4)};function ar(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 Ie(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 Xp(e,t,n){var r=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Xe(t.type)&&Fl(),Ie(t),null;case 3:return r=t.stateNode,Qn(),ue(Ke),ue(Me),Ea(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ul(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mt!==null&&(Xi(mt),mt=null))),Ai(e,t),Ie(t),null;case 5:Ca(t);var l=on(Or.current);if(n=t.type,e!==null&&t.stateNode!=null)od(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(z(166));return Ie(t),null}if(e=on(Nt.current),ul(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[jt]=t,r[$r]=i,e=(t.mode&1)!==0,n){case"dialog":oe("cancel",r),oe("close",r);break;case"iframe":case"object":case"embed":oe("load",r);break;case"video":case"audio":for(l=0;l<hr.length;l++)oe(hr[l],r);break;case"source":oe("error",r);break;case"img":case"image":case"link":oe("error",r),oe("load",r);break;case"details":oe("toggle",r);break;case"input":eo(r,i),oe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},oe("invalid",r);break;case"textarea":no(r,i),oe("invalid",r)}pi(n,i),l=null;for(var a in i)if(i.hasOwnProperty(a)){var u=i[a];a==="children"?typeof u=="string"?r.textContent!==u&&(i.suppressHydrationWarning!==!0&&ol(r.textContent,u,e),l=["children",u]):typeof u=="number"&&r.textContent!==""+u&&(i.suppressHydrationWarning!==!0&&ol(r.textContent,u,e),l=["children",""+u]):_r.hasOwnProperty(a)&&u!=null&&a==="onScroll"&&oe("scroll",r)}switch(n){case"input":el(r),to(r,i,!0);break;case"textarea":el(r),ro(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Ml)}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=Ou(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[jt]=t,e[$r]=r,ad(e,t,!1,!1),t.stateNode=e;e:{switch(a=hi(n,r),n){case"dialog":oe("cancel",e),oe("close",e),l=r;break;case"iframe":case"object":case"embed":oe("load",e),l=r;break;case"video":case"audio":for(l=0;l<hr.length;l++)oe(hr[l],e);l=r;break;case"source":oe("error",e),l=r;break;case"img":case"image":case"link":oe("error",e),oe("load",e),l=r;break;case"details":oe("toggle",e),l=r;break;case"input":eo(e,r),l=oi(e,r),oe("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=me({},r,{value:void 0}),oe("invalid",e);break;case"textarea":no(e,r),l=di(e,r),oe("invalid",e);break;default:l=r}pi(n,l),u=l;for(i in u)if(u.hasOwnProperty(i)){var o=u[i];i==="style"?Au(e,o):i==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,o!=null&&Mu(e,o)):i==="children"?typeof o=="string"?(n!=="textarea"||o!=="")&&Cr(e,o):typeof o=="number"&&Cr(e,""+o):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(_r.hasOwnProperty(i)?o!=null&&i==="onScroll"&&oe("scroll",e):o!=null&&ra(e,i,o,a))}switch(n){case"input":el(e),to(e,r,!1);break;case"textarea":el(e),ro(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?$n(e,!!r.multiple,i,!1):r.defaultValue!=null&&$n(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Ml)}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 Ie(t),null;case 6:if(e&&t.stateNode!=null)ud(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(z(166));if(n=on(Or.current),on(Nt.current),ul(t)){if(r=t.stateNode,n=t.memoizedProps,r[jt]=t,(i=r.nodeValue!==n)&&(e=Ze,e!==null))switch(e.tag){case 3:ol(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ol(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[jt]=t,t.stateNode=r}return Ie(t),null;case 13:if(ue(pe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(fe&&Ge!==null&&t.mode&1&&!(t.flags&128))Ec(),Wn(),t.flags|=98560,i=!1;else if(i=ul(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(z(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(z(317));i[jt]=t}else Wn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ie(t),i=!1}else mt!==null&&(Xi(mt),mt=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||pe.current&1?Ee===0&&(Ee=3):Fa())),t.updateQueue!==null&&(t.flags|=4),Ie(t),null);case 4:return Qn(),Ai(e,t),e===null&&Rr(t.stateNode.containerInfo),Ie(t),null;case 10:return ja(t.type._context),Ie(t),null;case 17:return Xe(t.type)&&Fl(),Ie(t),null;case 19:if(ue(pe),i=t.memoizedState,i===null)return Ie(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)ar(i,!1);else{if(Ee!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ql(e),a!==null){for(t.flags|=128,ar(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(pe,pe.current&1|2),t.child}e=e.sibling}i.tail!==null&&xe()>Xn&&(t.flags|=128,r=!0,ar(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ql(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ar(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!fe)return Ie(t),null}else 2*xe()-i.renderingStartTime>Xn&&n!==1073741824&&(t.flags|=128,r=!0,ar(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=xe(),t.sibling=null,n=pe.current,ae(pe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Ma(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ye&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(z(156,t.tag))}function Jp(e,t){switch(ya(t),t.tag){case 1:return Xe(t.type)&&Fl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qn(),ue(Ke),ue(Me),Ea(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ca(t),null;case 13:if(ue(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(z(340));Wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ue(pe),null;case 4:return Qn(),null;case 10:return ja(t.type._context),null;case 22:case 23:return Ma(),null;case 24:return null;default:return null}}var fl=!1,Oe=!1,qp=typeof WeakSet=="function"?WeakSet:Set,O=null;function Rn(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 Bi(e,t,n){try{n()}catch(r){ye(e,t,r)}}var Ko=!1;function Yp(e,t){if(Ni=$l,e=hc(),ga(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,u=-1,o=-1,c=0,g=0,m=e,h=null;t:for(;;){for(var y;m!==n||l!==0&&m.nodeType!==3||(u=a+l),m!==i||r!==0&&m.nodeType!==3||(o=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&&(u=a),h===i&&++g===r&&(o=a),(y=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=y}n=u===-1||o===-1?null:{start:u,end:o}}else n=null}n=n||{start:0,end:0}}else n=null;for(_i={focusedElem:e,selectionRange:n},$l=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var k=w.memoizedProps,j=w.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?k:pt(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(z(163))}}catch(x){ye(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return w=Ko,Ko=!1,w}function jr(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&&Bi(t,n,i)}l=l.next}while(l!==r)}}function cs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Hi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function cd(e){var t=e.alternate;t!==null&&(e.alternate=null,cd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jt],delete t[$r],delete t[Ti],delete t[Rp],delete t[Dp])),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 dd(e){return e.tag===5||e.tag===3||e.tag===4}function Xo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dd(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 Ui(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=Ml));else if(r!==4&&(e=e.child,e!==null))for(Ui(e,t,n),e=e.sibling;e!==null;)Ui(e,t,n),e=e.sibling}function Wi(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(Wi(e,t,n),e=e.sibling;e!==null;)Wi(e,t,n),e=e.sibling}var be=null,ht=!1;function $t(e,t,n){for(n=n.child;n!==null;)fd(e,t,n),n=n.sibling}function fd(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(ns,n)}catch{}switch(n.tag){case 5:Oe||Rn(n,t);case 6:var r=be,l=ht;be=null,$t(e,t,n),be=r,ht=l,be!==null&&(ht?(e=be,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):be.removeChild(n.stateNode));break;case 18:be!==null&&(ht?(e=be,n=n.stateNode,e.nodeType===8?Us(e.parentNode,n):e.nodeType===1&&Us(e,n),br(e)):Us(be,n.stateNode));break;case 4:r=be,l=ht,be=n.stateNode.containerInfo,ht=!0,$t(e,t,n),be=r,ht=l;break;case 0:case 11:case 14:case 15:if(!Oe&&(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)&&Bi(n,t,a),l=l.next}while(l!==r)}$t(e,t,n);break;case 1:if(!Oe&&(Rn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ye(n,t,u)}$t(e,t,n);break;case 21:$t(e,t,n);break;case 22:n.mode&1?(Oe=(r=Oe)||n.memoizedState!==null,$t(e,t,n),Oe=r):$t(e,t,n);break;default:$t(e,t,n)}}function Jo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qp),t.forEach(function(r){var l=ih.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ft(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,u=a;e:for(;u!==null;){switch(u.tag){case 5:be=u.stateNode,ht=!1;break e;case 3:be=u.stateNode.containerInfo,ht=!0;break e;case 4:be=u.stateNode.containerInfo,ht=!0;break e}u=u.return}if(be===null)throw Error(z(160));fd(i,a,l),be=null,ht=!1;var o=l.alternate;o!==null&&(o.return=null),l.return=null}catch(c){ye(l,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)pd(t,e),t=t.sibling}function pd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ft(t,e),wt(e),r&4){try{jr(3,e,e.return),cs(3,e)}catch(k){ye(e,e.return,k)}try{jr(5,e,e.return)}catch(k){ye(e,e.return,k)}}break;case 1:ft(t,e),wt(e),r&512&&n!==null&&Rn(n,n.return);break;case 5:if(ft(t,e),wt(e),r&512&&n!==null&&Rn(n,n.return),e.flags&32){var l=e.stateNode;try{Cr(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,u=e.type,o=e.updateQueue;if(e.updateQueue=null,o!==null)try{u==="input"&&i.type==="radio"&&i.name!=null&&$u(l,i),hi(u,a);var c=hi(u,i);for(a=0;a<o.length;a+=2){var g=o[a],m=o[a+1];g==="style"?Au(l,m):g==="dangerouslySetInnerHTML"?Mu(l,m):g==="children"?Cr(l,m):ra(l,g,m,c)}switch(u){case"input":ui(l,i);break;case"textarea":Iu(l,i);break;case"select":var h=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var y=i.value;y!=null?$n(l,!!i.multiple,y,!1):h!==!!i.multiple&&(i.defaultValue!=null?$n(l,!!i.multiple,i.defaultValue,!0):$n(l,!!i.multiple,i.multiple?[]:"",!1))}l[$r]=i}catch(k){ye(e,e.return,k)}}break;case 6:if(ft(t,e),wt(e),r&4){if(e.stateNode===null)throw Error(z(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(k){ye(e,e.return,k)}}break;case 3:if(ft(t,e),wt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(k){ye(e,e.return,k)}break;case 4:ft(t,e),wt(e);break;case 13:ft(t,e),wt(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(Ia=xe())),r&4&&Jo(e);break;case 22:if(g=n!==null&&n.memoizedState!==null,e.mode&1?(Oe=(c=Oe)||g,ft(t,e),Oe=c):ft(t,e),wt(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!g&&e.mode&1)for(O=e,g=e.child;g!==null;){for(m=O=g;O!==null;){switch(h=O,y=h.child,h.tag){case 0:case 11:case 14:case 15:jr(4,h,h.return);break;case 1:Rn(h,h.return);var w=h.stateNode;if(typeof w.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(k){ye(r,n,k)}}break;case 5:Rn(h,h.return);break;case 22:if(h.memoizedState!==null){Yo(m);continue}}y!==null?(y.return=h,O=y):Yo(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"):(u=m.stateNode,o=m.memoizedProps.style,a=o!=null&&o.hasOwnProperty("display")?o.display:null,u.style.display=Fu("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:ft(t,e),wt(e),r&4&&Jo(e);break;case 21:break;default:ft(t,e),wt(e)}}function wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(dd(n)){var r=n;break e}n=n.return}throw Error(z(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(Cr(l,""),r.flags&=-33);var i=Xo(e);Wi(e,i,l);break;case 3:case 4:var a=r.stateNode.containerInfo,u=Xo(e);Ui(e,u,a);break;default:throw Error(z(161))}}catch(o){ye(e,e.return,o)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gp(e,t,n){O=e,hd(e)}function hd(e,t,n){for(var r=(e.mode&1)!==0;O!==null;){var l=O,i=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||fl;if(!a){var u=l.alternate,o=u!==null&&u.memoizedState!==null||Oe;u=fl;var c=Oe;if(fl=a,(Oe=o)&&!c)for(O=l;O!==null;)a=O,o=a.child,a.tag===22&&a.memoizedState!==null?Go(l):o!==null?(o.return=a,O=o):Go(l);for(;i!==null;)O=i,hd(i),i=i.sibling;O=l,fl=u,Oe=c}qo(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,O=i):qo(e)}}function qo(e){for(;O!==null;){var t=O;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Oe||cs(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Oe)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:pt(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Do(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}Do(t,a,n)}break;case 5:var u=t.stateNode;if(n===null&&t.flags&4){n=u;var o=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":o.autoFocus&&n.focus();break;case"img":o.src&&(n.src=o.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&&br(m)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(z(163))}Oe||t.flags&512&&Hi(t)}catch(h){ye(t,t.return,h)}}if(t===e){O=null;break}if(n=t.sibling,n!==null){n.return=t.return,O=n;break}O=t.return}}function Yo(e){for(;O!==null;){var t=O;if(t===e){O=null;break}var n=t.sibling;if(n!==null){n.return=t.return,O=n;break}O=t.return}}function Go(e){for(;O!==null;){var t=O;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{cs(4,t)}catch(o){ye(t,n,o)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(o){ye(t,l,o)}}var i=t.return;try{Hi(t)}catch(o){ye(t,i,o)}break;case 5:var a=t.return;try{Hi(t)}catch(o){ye(t,a,o)}}}catch(o){ye(t,t.return,o)}if(t===e){O=null;break}var u=t.sibling;if(u!==null){u.return=t.return,O=u;break}O=t.return}}var Zp=Math.ceil,Jl=Dt.ReactCurrentDispatcher,Da=Dt.ReactCurrentOwner,ot=Dt.ReactCurrentBatchConfig,Z=0,Pe=null,ke=null,Le=0,Ye=0,Dn=Zt(0),Ee=0,Br=null,hn=0,ds=0,$a=0,Sr=null,Ve=null,Ia=0,Xn=1/0,_t=null,ql=!1,Vi=null,Kt=null,pl=!1,Bt=null,Yl=0,Nr=0,Qi=null,Cl=-1,El=0;function He(){return Z&6?xe():Cl!==-1?Cl:Cl=xe()}function Xt(e){return e.mode&1?Z&2&&Le!==0?Le&-Le:Ip.transition!==null?(El===0&&(El=Gu()),El):(e=se,e!==0||(e=window.event,e=e===void 0?16:sc(e.type)),e):1}function yt(e,t,n,r){if(50<Nr)throw Nr=0,Qi=null,Error(z(185));Wr(e,n,r),(!(Z&2)||e!==Pe)&&(e===Pe&&(!(Z&2)&&(ds|=n),Ee===4&&Ft(e,Le)),Je(e,r),n===1&&Z===0&&!(t.mode&1)&&(Xn=xe()+500,as&&en()))}function Je(e,t){var n=e.callbackNode;If(e,t);var r=Dl(e,e===Pe?Le:0);if(r===0)n!==null&&io(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&io(n),t===1)e.tag===0?$p(Zo.bind(null,e)):Nc(Zo.bind(null,e)),Lp(function(){!(Z&6)&&en()}),n=null;else{switch(Zu(r)){case 1:n=oa;break;case 4:n=qu;break;case 16:n=Rl;break;case 536870912:n=Yu;break;default:n=Rl}n=jd(n,md.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function md(e,t){if(Cl=-1,El=0,Z&6)throw Error(z(327));var n=e.callbackNode;if(An()&&e.callbackNode!==n)return null;var r=Dl(e,e===Pe?Le:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Gl(e,r);else{t=r;var l=Z;Z|=2;var i=vd();(Pe!==e||Le!==t)&&(_t=null,Xn=xe()+500,un(e,t));do try{nh();break}catch(u){gd(e,u)}while(!0);ka(),Jl.current=i,Z=l,ke!==null?t=0:(Pe=null,Le=0,t=Ee)}if(t!==0){if(t===2&&(l=xi(e),l!==0&&(r=l,t=Ki(e,l))),t===1)throw n=Br,un(e,0),Ft(e,r),Je(e,xe()),n;if(t===6)Ft(e,r);else{if(l=e.current.alternate,!(r&30)&&!eh(l)&&(t=Gl(e,r),t===2&&(i=xi(e),i!==0&&(r=i,t=Ki(e,i))),t===1))throw n=Br,un(e,0),Ft(e,r),Je(e,xe()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(z(345));case 2:ln(e,Ve,_t);break;case 3:if(Ft(e,r),(r&130023424)===r&&(t=Ia+500-xe(),10<t)){if(Dl(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){He(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Ei(ln.bind(null,e,Ve,_t),t);break}ln(e,Ve,_t);break;case 4:if(Ft(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-vt(r);i=1<<a,a=t[a],a>l&&(l=a),r&=~i}if(r=l,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Zp(r/1960))-r,10<r){e.timeoutHandle=Ei(ln.bind(null,e,Ve,_t),r);break}ln(e,Ve,_t);break;case 5:ln(e,Ve,_t);break;default:throw Error(z(329))}}}return Je(e,xe()),e.callbackNode===n?md.bind(null,e):null}function Ki(e,t){var n=Sr;return e.current.memoizedState.isDehydrated&&(un(e,t).flags|=256),e=Gl(e,t),e!==2&&(t=Ve,Ve=n,t!==null&&Xi(t)),e}function Xi(e){Ve===null?Ve=e:Ve.push.apply(Ve,e)}function eh(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(!xt(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 Ft(e,t){for(t&=~$a,t&=~ds,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-vt(t),r=1<<n;e[n]=-1,t&=~r}}function Zo(e){if(Z&6)throw Error(z(327));An();var t=Dl(e,0);if(!(t&1))return Je(e,xe()),null;var n=Gl(e,t);if(e.tag!==0&&n===2){var r=xi(e);r!==0&&(t=r,n=Ki(e,r))}if(n===1)throw n=Br,un(e,0),Ft(e,t),Je(e,xe()),n;if(n===6)throw Error(z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ln(e,Ve,_t),Je(e,xe()),null}function Oa(e,t){var n=Z;Z|=1;try{return e(t)}finally{Z=n,Z===0&&(Xn=xe()+500,as&&en())}}function mn(e){Bt!==null&&Bt.tag===0&&!(Z&6)&&An();var t=Z;Z|=1;var n=ot.transition,r=se;try{if(ot.transition=null,se=1,e)return e()}finally{se=r,ot.transition=n,Z=t,!(Z&6)&&en()}}function Ma(){Ye=Dn.current,ue(Dn)}function un(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,bp(n)),ke!==null)for(n=ke.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fl();break;case 3:Qn(),ue(Ke),ue(Me),Ea();break;case 5:Ca(r);break;case 4:Qn();break;case 13:ue(pe);break;case 19:ue(pe);break;case 10:ja(r.type._context);break;case 22:case 23:Ma()}n=n.return}if(Pe=e,ke=e=Jt(e.current,null),Le=Ye=t,Ee=0,Br=null,$a=ds=hn=0,Ve=Sr=null,an!==null){for(t=0;t<an.length;t++)if(n=an[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}an=null}return e}function gd(e,t){do{var n=ke;try{if(ka(),Sl.current=Xl,Kl){for(var r=he.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Kl=!1}if(pn=0,Te=Ce=he=null,kr=!1,Mr=0,Da.current=null,n===null||n.return===null){Ee=1,Br=t,ke=null;break}e:{var i=e,a=n.return,u=n,o=t;if(t=Le,u.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){var c=o,g=u,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=Ao(a);if(y!==null){y.flags&=-257,Bo(y,a,u,i,t),y.mode&1&&Fo(i,c,t),t=y,o=c;var w=t.updateQueue;if(w===null){var k=new Set;k.add(o),t.updateQueue=k}else w.add(o);break e}else{if(!(t&1)){Fo(i,c,t),Fa();break e}o=Error(z(426))}}else if(fe&&u.mode&1){var j=Ao(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Bo(j,a,u,i,t),xa(Kn(o,u));break e}}i=o=Kn(o,u),Ee!==4&&(Ee=2),Sr===null?Sr=[i]:Sr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var p=Zc(i,o,t);Ro(i,p);break e;case 1:u=o;var d=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Kt===null||!Kt.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var x=ed(i,u,t);Ro(i,x);break e}}i=i.return}while(i!==null)}xd(n)}catch(N){t=N,ke===n&&n!==null&&(ke=n=n.return);continue}break}while(!0)}function vd(){var e=Jl.current;return Jl.current=Xl,e===null?Xl:e}function Fa(){(Ee===0||Ee===3||Ee===2)&&(Ee=4),Pe===null||!(hn&268435455)&&!(ds&268435455)||Ft(Pe,Le)}function Gl(e,t){var n=Z;Z|=2;var r=vd();(Pe!==e||Le!==t)&&(_t=null,un(e,t));do try{th();break}catch(l){gd(e,l)}while(!0);if(ka(),Z=n,Jl.current=r,ke!==null)throw Error(z(261));return Pe=null,Le=0,Ee}function th(){for(;ke!==null;)yd(ke)}function nh(){for(;ke!==null&&!Ef();)yd(ke)}function yd(e){var t=kd(e.alternate,e,Ye);e.memoizedProps=e.pendingProps,t===null?xd(e):ke=t,Da.current=null}function xd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Jp(n,t),n!==null){n.flags&=32767,ke=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ee=6,ke=null;return}}else if(n=Xp(n,t,Ye),n!==null){ke=n;return}if(t=t.sibling,t!==null){ke=t;return}ke=t=e}while(t!==null);Ee===0&&(Ee=5)}function ln(e,t,n){var r=se,l=ot.transition;try{ot.transition=null,se=1,rh(e,t,n,r)}finally{ot.transition=l,se=r}return null}function rh(e,t,n,r){do An();while(Bt!==null);if(Z&6)throw Error(z(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(z(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Of(e,i),e===Pe&&(ke=Pe=null,Le=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||pl||(pl=!0,jd(Rl,function(){return An(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ot.transition,ot.transition=null;var a=se;se=1;var u=Z;Z|=4,Da.current=null,Yp(e,n),pd(n,e),Sp(_i),$l=!!Ni,_i=Ni=null,e.current=n,Gp(n),Tf(),Z=u,se=a,ot.transition=i}else e.current=n;if(pl&&(pl=!1,Bt=e,Yl=l),i=e.pendingLanes,i===0&&(Kt=null),Lf(n.stateNode),Je(e,xe()),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(ql)throw ql=!1,e=Vi,Vi=null,e;return Yl&1&&e.tag!==0&&An(),i=e.pendingLanes,i&1?e===Qi?Nr++:(Nr=0,Qi=e):Nr=0,en(),null}function An(){if(Bt!==null){var e=Zu(Yl),t=ot.transition,n=se;try{if(ot.transition=null,se=16>e?16:e,Bt===null)var r=!1;else{if(e=Bt,Bt=null,Yl=0,Z&6)throw Error(z(331));var l=Z;for(Z|=4,O=e.current;O!==null;){var i=O,a=i.child;if(O.flags&16){var u=i.deletions;if(u!==null){for(var o=0;o<u.length;o++){var c=u[o];for(O=c;O!==null;){var g=O;switch(g.tag){case 0:case 11:case 15:jr(8,g,i)}var m=g.child;if(m!==null)m.return=g,O=m;else for(;O!==null;){g=O;var h=g.sibling,y=g.return;if(cd(g),g===c){O=null;break}if(h!==null){h.return=y,O=h;break}O=y}}}var w=i.alternate;if(w!==null){var k=w.child;if(k!==null){w.child=null;do{var j=k.sibling;k.sibling=null,k=j}while(k!==null)}}O=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,O=a;else e:for(;O!==null;){if(i=O,i.flags&2048)switch(i.tag){case 0:case 11:case 15:jr(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,O=p;break e}O=i.return}}var d=e.current;for(O=d;O!==null;){a=O;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,O=v;else e:for(a=d;O!==null;){if(u=O,u.flags&2048)try{switch(u.tag){case 0:case 11:case 15:cs(9,u)}}catch(N){ye(u,u.return,N)}if(u===a){O=null;break e}var x=u.sibling;if(x!==null){x.return=u.return,O=x;break e}O=u.return}}if(Z=l,en(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(ns,e)}catch{}r=!0}return r}finally{se=n,ot.transition=t}}return!1}function eu(e,t,n){t=Kn(n,t),t=Zc(e,t,1),e=Qt(e,t,1),t=He(),e!==null&&(Wr(e,1,t),Je(e,t))}function ye(e,t,n){if(e.tag===3)eu(e,e,n);else for(;t!==null;){if(t.tag===3){eu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Kt===null||!Kt.has(r))){e=Kn(n,e),e=ed(t,e,1),t=Qt(t,e,1),e=He(),t!==null&&(Wr(t,1,e),Je(t,e));break}}t=t.return}}function lh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=He(),e.pingedLanes|=e.suspendedLanes&n,Pe===e&&(Le&n)===n&&(Ee===4||Ee===3&&(Le&130023424)===Le&&500>xe()-Ia?un(e,0):$a|=n),Je(e,t)}function wd(e,t){t===0&&(e.mode&1?(t=rl,rl<<=1,!(rl&130023424)&&(rl=4194304)):t=1);var n=He();e=zt(e,t),e!==null&&(Wr(e,t,n),Je(e,n))}function sh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wd(e,n)}function ih(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(z(314))}r!==null&&r.delete(t),wd(e,n)}var kd;kd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ke.current)Qe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Qe=!1,Kp(e,t,n);Qe=!!(e.flags&131072)}else Qe=!1,fe&&t.flags&1048576&&_c(t,Hl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;_l(e,t),e=t.pendingProps;var l=Un(t,Me.current);Fn(t,n),l=Pa(null,t,r,e,l,n);var i=ba();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,Xe(r)?(i=!0,Al(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Na(t),l.updater=us,t.stateNode=l,l._reactInternals=t,Di(t,r,e,n),t=Oi(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&va(t),Be(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(_l(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=oh(r),e=pt(r,e),l){case 0:t=Ii(null,t,r,e,n);break e;case 1:t=Wo(null,t,r,e,n);break e;case 11:t=Ho(null,t,r,e,n);break e;case 14:t=Uo(null,t,r,pt(r.type,e),n);break e}throw Error(z(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),Wo(e,t,r,l,n);case 3:e:{if(ld(t),e===null)throw Error(z(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Lc(e,t),Vl(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=Kn(Error(z(423)),t),t=Vo(e,t,r,n,l);break e}else if(r!==l){l=Kn(Error(z(424)),t),t=Vo(e,t,r,n,l);break e}else for(Ge=Vt(t.stateNode.containerInfo.firstChild),Ze=t,fe=!0,mt=null,n=Pc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wn(),r===l){t=Rt(e,t,n);break e}Be(e,t,r,n)}t=t.child}return t;case 5:return zc(t),e===null&&Li(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Ci(r,l)?a=null:i!==null&&Ci(r,i)&&(t.flags|=32),rd(e,t),Be(e,t,a,n),t.child;case 6:return e===null&&Li(t),null;case 13:return sd(e,t,n);case 4:return _a(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Vn(t,null,r,n):Be(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),Ho(e,t,r,l,n);case 7:return Be(e,t,t.pendingProps,n),t.child;case 8:return Be(e,t,t.pendingProps.children,n),t.child;case 12:return Be(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(Ul,r._currentValue),r._currentValue=a,i!==null)if(xt(i.value,a)){if(i.children===l.children&&!Ke.current){t=Rt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){a=i.child;for(var o=u.firstContext;o!==null;){if(o.context===r){if(i.tag===1){o=Pt(-1,n&-n),o.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var g=c.pending;g===null?o.next=o:(o.next=g.next,g.next=o),c.pending=o}}i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),zi(i.return,n,t),u.lanes|=n;break}o=o.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(z(341));a.lanes|=n,u=a.alternate,u!==null&&(u.lanes|=n),zi(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}Be(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Fn(t,n),l=ut(l),r=r(l),t.flags|=1,Be(e,t,r,n),t.child;case 14:return r=t.type,l=pt(r,t.pendingProps),l=pt(r.type,l),Uo(e,t,r,l,n);case 15:return td(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),_l(e,t),t.tag=1,Xe(r)?(e=!0,Al(t)):e=!1,Fn(t,n),Gc(t,r,l),Di(t,r,l,n),Oi(null,t,r,!0,e,n);case 19:return id(e,t,n);case 22:return nd(e,t,n)}throw Error(z(156,t.tag))};function jd(e,t){return Ju(e,t)}function ah(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 at(e,t,n,r){return new ah(e,t,n,r)}function Aa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oh(e){if(typeof e=="function")return Aa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sa)return 11;if(e===ia)return 14}return 2}function Jt(e,t){var n=e.alternate;return n===null?(n=at(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 Tl(e,t,n,r,l,i){var a=2;if(r=e,typeof e=="function")Aa(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Nn:return cn(n.children,l,i,t);case la:a=8,l|=8;break;case li:return e=at(12,n,t,l|2),e.elementType=li,e.lanes=i,e;case si:return e=at(13,n,t,l),e.elementType=si,e.lanes=i,e;case ii:return e=at(19,n,t,l),e.elementType=ii,e.lanes=i,e;case zu:return fs(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bu:a=10;break e;case Lu:a=9;break e;case sa:a=11;break e;case ia:a=14;break e;case It:a=16,r=null;break e}throw Error(z(130,e==null?e:typeof e,""))}return t=at(a,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function cn(e,t,n,r){return e=at(7,e,r,t),e.lanes=n,e}function fs(e,t,n,r){return e=at(22,e,r,t),e.elementType=zu,e.lanes=n,e.stateNode={isHidden:!1},e}function Ys(e,t,n){return e=at(6,e,null,t),e.lanes=n,e}function Gs(e,t,n){return t=at(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function uh(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=zs(0),this.expirationTimes=zs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zs(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ba(e,t,n,r,l,i,a,u,o){return e=new uh(e,t,n,u,o),t===1?(t=1,i===!0&&(t|=8)):t=0,i=at(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Na(i),e}function ch(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Sn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Sd(e){if(!e)return Yt;e=e._reactInternals;e:{if(vn(e)!==e||e.tag!==1)throw Error(z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Xe(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(z(171))}if(e.tag===1){var n=e.type;if(Xe(n))return Sc(e,n,t)}return t}function Nd(e,t,n,r,l,i,a,u,o){return e=Ba(n,r,!0,e,l,i,a,u,o),e.context=Sd(null),n=e.current,r=He(),l=Xt(n),i=Pt(r,l),i.callback=t??null,Qt(n,i,l),e.current.lanes=l,Wr(e,l,r),Je(e,r),e}function ps(e,t,n,r){var l=t.current,i=He(),a=Xt(l);return n=Sd(n),t.context===null?t.context=n:t.pendingContext=n,t=Pt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Qt(l,t,a),e!==null&&(yt(e,l,a,i),jl(e,l,a)),a}function Zl(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 tu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ha(e,t){tu(e,t),(e=e.alternate)&&tu(e,t)}function dh(){return null}var _d=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ua(e){this._internalRoot=e}hs.prototype.render=Ua.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(z(409));ps(e,t,null,null)};hs.prototype.unmount=Ua.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mn(function(){ps(null,e,null,null)}),t[Lt]=null}};function hs(e){this._internalRoot=e}hs.prototype.unstable_scheduleHydration=function(e){if(e){var t=nc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Mt.length&&t!==0&&t<Mt[n].priority;n++);Mt.splice(n,0,e),n===0&&lc(e)}};function Wa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ms(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function nu(){}function fh(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var c=Zl(a);i.call(c)}}var a=Nd(t,r,e,0,null,!1,!1,"",nu);return e._reactRootContainer=a,e[Lt]=a.current,Rr(e.nodeType===8?e.parentNode:e),mn(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var u=r;r=function(){var c=Zl(o);u.call(c)}}var o=Ba(e,0,!1,null,null,!1,!1,"",nu);return e._reactRootContainer=o,e[Lt]=o.current,Rr(e.nodeType===8?e.parentNode:e),mn(function(){ps(t,o,n,r)}),o}function gs(e,t,n,r,l){var i=n._reactRootContainer;if(i){var a=i;if(typeof l=="function"){var u=l;l=function(){var o=Zl(a);u.call(o)}}ps(t,a,e,l)}else a=fh(n,t,e,l,r);return Zl(a)}ec=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=pr(t.pendingLanes);n!==0&&(ua(t,n|1),Je(t,xe()),!(Z&6)&&(Xn=xe()+500,en()))}break;case 13:mn(function(){var r=zt(e,1);if(r!==null){var l=He();yt(r,e,1,l)}}),Ha(e,1)}};ca=function(e){if(e.tag===13){var t=zt(e,134217728);if(t!==null){var n=He();yt(t,e,134217728,n)}Ha(e,134217728)}};tc=function(e){if(e.tag===13){var t=Xt(e),n=zt(e,t);if(n!==null){var r=He();yt(n,e,t,r)}Ha(e,t)}};nc=function(){return se};rc=function(e,t){var n=se;try{return se=e,t()}finally{se=n}};gi=function(e,t,n){switch(t){case"input":if(ui(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=is(r);if(!l)throw Error(z(90));Du(r),ui(r,l)}}}break;case"textarea":Iu(e,n);break;case"select":t=n.value,t!=null&&$n(e,!!n.multiple,t,!1)}};Uu=Oa;Wu=mn;var ph={usingClientEntryPoint:!1,Events:[Qr,Tn,is,Bu,Hu,Oa]},or={findFiberByHostInstance:sn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hh={bundleType:or.bundleType,version:or.version,rendererPackageName:or.rendererPackageName,rendererConfig:or.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ku(e),e===null?null:e.stateNode},findFiberByHostInstance:or.findFiberByHostInstance||dh,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 hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hl.isDisabled&&hl.supportsFiber)try{ns=hl.inject(hh),St=hl}catch{}}tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ph;tt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wa(t))throw Error(z(200));return ch(e,t,null,n)};tt.createRoot=function(e,t){if(!Wa(e))throw Error(z(299));var n=!1,r="",l=_d;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=Ba(e,1,!1,null,null,n,!1,r,l),e[Lt]=t.current,Rr(e.nodeType===8?e.parentNode:e),new Ua(t)};tt.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(z(188)):(e=Object.keys(e).join(","),Error(z(268,e)));return e=Ku(t),e=e===null?null:e.stateNode,e};tt.flushSync=function(e){return mn(e)};tt.hydrate=function(e,t,n){if(!ms(t))throw Error(z(200));return gs(null,e,t,!0,n)};tt.hydrateRoot=function(e,t,n){if(!Wa(e))throw Error(z(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",a=_d;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Nd(t,null,e,1,n??null,l,!1,i,a),e[Lt]=t.current,Rr(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 hs(t)};tt.render=function(e,t,n){if(!ms(t))throw Error(z(200));return gs(null,e,t,!1,n)};tt.unmountComponentAtNode=function(e){if(!ms(e))throw Error(z(40));return e._reactRootContainer?(mn(function(){gs(null,null,e,!1,function(){e._reactRootContainer=null,e[Lt]=null})}),!0):!1};tt.unstable_batchedUpdates=Oa;tt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ms(n))throw Error(z(200));if(e==null||e._reactInternals===void 0)throw Error(z(38));return gs(e,t,n,!1,r)};tt.version="18.3.1-next-f1338f8080-20240426";function Cd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cd)}catch(e){console.error(e)}}Cd(),Cu.exports=tt;var mh=Cu.exports,Ed,ru=mh;Ed=ru.createRoot,ru.hydrateRoot;async function je(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function gh(){return je("/api/archives")}async function vh(e){return je(`/api/archives/${e}/entries`)}async function yh(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),je(`/api/archives/${e}/entries/search?${r}`)}async function Ji(e,t){return je(`/api/archives/${e}/entries/${t}`)}async function xh(e,t){return je(`/api/archives/${e}/entries/${t}/children`)}function wh(e,t,n){return Promise.all(n.map(r=>je(`/api/archives/${e}/entries/${t}/artifacts/${r}`)))}async function kh(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 jh(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 ml(e,t){return je(`/api/archives/${e}/entries/${t}/tags`)}async function lu(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 Sh(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 su(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 Nh(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 _h(e,t){const n=await fetch(`/api/archives/${e}/tags/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(await n.text())}async function Ch(e,t){const n=await fetch(`/api/archives/${e}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!n.ok)throw new Error(await n.text());return n.json()}async function Eh(e,t,n){const r=await fetch(`/api/archives/${e}/tags/${t}/move`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent_uid:n??null})});if(!r.ok)throw new Error(await r.text());return r.json()}async function Zs(e){return je(`/api/archives/${e}/runs`)}async function gl(e){return je(`/api/archives/${e}/tags`)}async function Th(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),typeof r.via_freedium=="boolean"&&(l.via_freedium=r.via_freedium));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 Ph(e,t){return je(`/api/archives/${e}/captures/probe?locator=${encodeURIComponent(t)}`)}async function Td(e,t){return je(`/api/archives/${e}/capture_jobs/${t}`)}async function bh(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function Lh(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 zh(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 Rh(){await fetch("/api/auth/logout",{method:"POST"})}async function Dh(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function $h(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 Ih(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 Oh(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 Mh(){return je("/api/auth/tokens")}async function Fh(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 Ah(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function Va(){return je("/api/admin/instance-settings")}async function Pl(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 Bh(){return je("/api/admin/users")}async function Hh(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 Uh(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 Wh(){return je("/api/admin/roles")}async function Vh(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 Pd(e){return je(`/api/archives/${e}/collections`)}async function Qh(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 Kh(e,t){return je(`/api/archives/${e}/collections/${t}`)}async function bd(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 Xh(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 Jh(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 qh(e,t){return je(`/api/archives/${e}/entries/${t}/collections`)}async function iu(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 Yh(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 Gh(e){return je(`/api/archives/${e}/blob-cleanup`)}async function Zh(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 em(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 tm(){return je("/api/admin/cookie-rules")}async function nm(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 rm(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 lm(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 sm=window.fetch;window.fetch=async(...e)=>{var n;const t=await sm(...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 im({onLogin:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(null),[u,o]=f.useState(!1);async function c(g){g.preventDefault(),a(null),o(!0);try{const m=await zh(t,r);e(m)}catch(m){a(m.message)}finally{o(!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:u,children:u?"Signing in…":"Sign in"})]})]})})}function am({onComplete:e}){const[t,n]=f.useState(""),[r,l]=f.useState(""),[i,a]=f.useState(""),[u,o]=f.useState(null),[c,g]=f.useState(!1);async function m(h){if(h.preventDefault(),r!==i){o("Passwords do not match");return}if(r.length<8){o("Password must be at least 8 characters");return}o(null),g(!0);try{await Lh(t,r),e()}catch(y){o(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"})]}),u&&s.jsx("p",{className:"setup-error",children:u}),s.jsx("button",{className:"setup-submit",type:"submit",disabled:c,children:c?"Creating account…":"Create account"})]})]})})}function om({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:a,setCurrentUser:u}=f.useContext(ys)??{},[o,c]=f.useState(!1);async function g(){c(!0),await Rh(),u(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:o,children:o?"Logging out…":"Log out"})]})]})}let qi=1;function Ld(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 ur(e=""){return{id:qi++,locator:e,quality:"best",probeState:"idle",probeQualities:null,probeHasAudio:!1,status:"idle",error:null,jobUid:null,archiveId:null}}function um({open:e,archiveId:t,onClose:n,onCaptured:r,onToast:l,onJobStarted:i,onJobSettled:a,activeJobs:u=[]}){const o=f.useRef(null),c=f.useRef(!0),g=f.useRef(new Map),m=f.useRef(new Map),h=f.useRef(new Map),y=f.useRef(t);f.useEffect(()=>{y.current=t},[t]);const w=f.useRef(r),k=f.useRef(l);f.useEffect(()=>{w.current=r},[r]),f.useEffect(()=>{k.current=l},[l]);const j=f.useRef(i),p=f.useRef(a);f.useEffect(()=>{j.current=i},[i]),f.useEffect(()=>{p.current=a},[a]);const[d,v]=f.useState(()=>{try{const E=JSON.parse(sessionStorage.getItem("captureItems")||"null");if(Array.isArray(E)&&E.length>0){const H=E.filter(K=>!K.status||K.status==="idle");if(H.length>0)return H.forEach(K=>{K.id>=qi&&(qi=K.id+1)}),H}}catch{}return[ur()]});f.useEffect(()=>{sessionStorage.setItem("captureItems",JSON.stringify(d))},[d]);const[x,N]=f.useState(!1),[P,C]=f.useState(null),[S,D]=f.useState(null),[L,U]=f.useState(!0),[F,W]=f.useState(!0),[Y,ce]=f.useState(!0);f.useEffect(()=>{Va().then(E=>{D(E),U(E.cookie_ext_enabled??!0),W(E.modal_closer_enabled??!0)}).catch(()=>D({}))},[]);const ie=P!==null?P:(S==null?void 0:S.ublock_enabled)??!0,[ee,R]=f.useState(!1);f.useEffect(()=>{["captureDialogLocator","captureDialogError","captureDialogBusy","captureDialogJobStatus","captureDialogJobUid"].forEach(E=>sessionStorage.removeItem(E)),u.forEach(E=>{E.jobUid&&!g.current.has(E.jobUid)&&T(E.id,E.jobUid,E.locator,E.archiveId,null)})},[]),f.useEffect(()=>{const E=o.current;if(!E)return;const H=()=>{m.current.forEach(K=>clearTimeout(K)),m.current.clear(),n()};return E.addEventListener("close",H),()=>E.removeEventListener("close",H)},[n]),f.useEffect(()=>{const E=o.current;E&&(e?(c.current||v([ur()]),c.current=!1,E.open||E.showModal()):(m.current.forEach(H=>clearTimeout(H)),m.current.clear(),E.open&&E.close()))},[e]),f.useEffect(()=>()=>{g.current.forEach(E=>clearInterval(E)),m.current.forEach(E=>clearTimeout(E))},[]);function T(E,H,K,V,X=null){if(g.current.has(H))return;const b=setInterval(async()=>{var B,re,le,rt;try{const Fe=await Td(V,H);if(Fe.status==="completed"){clearInterval(g.current.get(H)),g.current.delete(H),await Promise.resolve((B=w.current)==null?void 0:B.call(w)),(re=p.current)==null||re.call(p,E);try{const ve=Fe.notes_json?JSON.parse(Fe.notes_json):null;if(ve!=null&&ve.ublock_skipped||ve!=null&&ve.cookie_ext_skipped){const qe=ve.ublock_skipped&&ve.cookie_ext_skipped?"Captured without ad-blocking or cookie-consent extension. Check ARCHIVR_UBLOCK_EXT and ARCHIVR_COOKIE_EXT in your server config.":ve.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.";k.current(qe,K,"warning"),M(X,"warning",K)}else X||k.current(null,K,"success"),M(X,"archived")}catch{X||k.current(null,K,"success"),M(X,"archived")}}else if(Fe.status==="failed"){clearInterval(g.current.get(H)),g.current.delete(H),(le=p.current)==null||le.call(p,E);const ve=Fe.error_text||"Capture failed.";k.current(ve,K),M(X,"failed",K)}}catch(Fe){clearInterval(g.current.get(H)),g.current.delete(H),(rt=p.current)==null||rt.call(p,E);const ve=Fe.message||"Network error";k.current(ve,K),M(X,"failed",K)}},500);g.current.set(H,b)}function M(E,H,K=null){if(!E)return;const V=h.current.get(E);if(!V||(H==="archived"||H==="warning"?(V.archived++,H==="warning"&&(V.warnings++,K&&V.warningLocators.push(K))):(V.failed++,K&&V.failedLocators.push(K)),V.archived+V.failed<V.total))return;h.current.delete(E);const{archived:X,warnings:b,failed:B,failedLocators:re,warningLocators:le}=V;let rt;if(X===0)rt=`${B} failed`;else{const qe=b>0?`${X} archived (${b} with warnings)`:`${X} archived`;rt=B>0?`${qe}, ${B} failed`:qe}const Fe=X===0?"error":B>0||b>0?"warning":"success",ve=[];re.length>0&&ve.push(`Failed:
|
||
${re.map(qe=>` ${qe}`).join(`
|
||
`)}`),le.length>0&&ve.push(`With warnings:
|
||
${le.map(qe=>` ${qe}`).join(`
|
||
`)}`);const tn=ve.length>0?ve.join(`
|
||
`):null;k.current(tn,null,Fe,rt)}async function q(E,H,K){var B,re;const V=y.current,X=((B=crypto.randomUUID)==null?void 0:B.call(crypto))??`job-${Date.now()}-${Math.random()}`,b={ublock_enabled:ie,reader_mode:ee,cookie_ext_enabled:L,modal_closer_enabled:F,via_freedium:Y};try{const le=await Th(V,E,H,b);(re=j.current)==null||re.call(j,{id:X,jobUid:le.job_uid,locator:E,archiveId:V}),T(X,le.job_uid,E,V,K)}catch(le){const rt=le.message||"Submission failed.";k.current(rt,E),M(K,"failed",E)}}function A(){var V,X;const E=d.filter(b=>b.locator.trim());if(E.length===0)return;const H=E.length>1?((V=crypto.randomUUID)==null?void 0:V.call(crypto))??`batch-${Date.now()}`:null;H&&h.current.set(H,{total:E.length,archived:0,warnings:0,failed:0,failedLocators:[],warningLocators:[]});const K=E.map(b=>b.quality||"best");v([ur()]),(X=o.current)==null||X.close(),E.forEach((b,B)=>q(b.locator.trim(),K[B],H))}function ge(){v(E=>[...E,ur()])}function de(E){clearTimeout(m.current.get(E)),m.current.delete(E),v(H=>{const K=H.filter(V=>V.id!==E);return K.length===0?[ur()]:K})}function Re(E,H){if(clearTimeout(m.current.get(E)),v(V=>V.map(X=>X.id===E?{...X,locator:H,probeState:"idle",probeQualities:null,probeHasAudio:!1,quality:"best"}:X)),!Ld(H))return;const K=setTimeout(async()=>{m.current.delete(E),v(V=>V.map(X=>X.id===E?{...X,probeState:"probing"}:X));try{const V=await Ph(y.current,H.trim());v(X=>X.map(b=>{if(b.id!==E||b.locator!==H)return b;const B=V.qualities??[],re=V.has_audio??!1,le=B.length===0&&re?"audio":"best";return{...b,probeState:"done",probeQualities:B,probeHasAudio:re,quality:le}}))}catch{v(V=>V.map(X=>X.id===E?{...X,probeState:"idle",probeQualities:null}:X))}},600);m.current.set(E,K)}function we(E,H){v(K=>K.map(V=>V.id===E?{...V,quality:H}:V))}const Se=d.filter(E=>E.locator.trim()).length;return s.jsx("dialog",{ref:o,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 E;return(E=o.current)==null?void 0:E.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:d.map((E,H)=>s.jsx(cm,{item:E,autoFocus:H===d.length-1,onLocatorChange:K=>Re(E.id,K),onQualityChange:K=>we(E.id,K),onRemove:()=>de(E.id),onSubmit:A},E.id))}),s.jsxs("button",{type:"button",className:"capture-add-row",onClick:ge,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:()=>N(E=>!E),"aria-expanded":x,children:[s.jsx("svg",{className:`capture-chevron${x?" 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"]}),x&&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":ie,className:`ext-toggle ext-toggle--sm${ie?" ext-toggle--on":""}`,onClick:()=>C(E=>E===null?!ie:!E),"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"}),!(S!=null&&S.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":L,className:`ext-toggle ext-toggle--sm${L?" ext-toggle--on":""}`,onClick:()=>U(E=>!E),"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":ee,className:`ext-toggle ext-toggle--sm${ee?" ext-toggle--on":""}`,onClick:()=>R(E=>!E),"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":F,className:`ext-toggle ext-toggle--sm${F?" ext-toggle--on":""}`,onClick:()=>W(E=>!E),"aria-label":"Toggle modal closer 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:"Freedium mirror"}),s.jsx("span",{className:"capture-ext-desc",children:"Route paywalled articles through a Freedium mirror (Medium, NYT, WaPo, etc.)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":Y,className:`ext-toggle ext-toggle--sm${Y?" ext-toggle--on":""}`,onClick:()=>ce(E=>!E),"aria-label":"Toggle Freedium mirror 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:A,disabled:Se===0,children:Se>1?`Archive ${Se}`:"Archive"}),s.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var E;return(E=o.current)==null?void 0:E.close()},children:"Cancel"})]})]})})}function cm({item:e,autoFocus:t,onLocatorChange:n,onQualityChange:r,onRemove:l,onSubmit:i}){const a=f.useRef(null);f.useEffect(()=>{var o;t&&((o=a.current)==null||o.focus())},[t]);const u=(()=>{if(!Ld(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 o=e.probeQualities??[],c=e.probeHasAudio??!1;return o.length===0&&!c?s.jsx("span",{className:"capture-quality-hint",children:"No media detected"}):o.length===0&&c?s.jsx("select",{className:"capture-quality",value:"audio",onChange:g=>r(g.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:g=>r(g.target.value),"aria-label":"Video quality",children:[s.jsx("option",{value:"best",children:"Best quality"}),o.map(g=>s.jsx("option",{value:g,children:g},g)),c&&s.jsx("option",{value:"audio",children:"Audio only"})]})}return null})();return s.jsxs("div",{className:"capture-row",children:[s.jsxs("div",{className:"capture-row-main",children:[s.jsx("input",{ref:a,className:"capture-input",type:"text",placeholder:"https://… · yt:ID · ytm:ID · tweet:ID · x:ID",value:e.locator,onChange:o=>n(o.target.value),onKeyDown:o=>{o.key==="Enter"&&i()},autoComplete:"off",spellCheck:!1}),u,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 dm(){return s.jsxs("div",{className:"skeleton-row",children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:s.jsx("span",{className:"skeleton-cell",style:{width:108,height:13}})}),s.jsxs("div",{className:"col-title",style:{gap:"0.42em",display:"flex",alignItems:"center"},children:[s.jsx("span",{className:"skeleton-cell",style:{width:14,height:14,borderRadius:"50%",flexShrink:0}}),s.jsx("span",{className:"skeleton-cell",style:{width:"58%",height:13}})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"skeleton-cell",style:{width:58,height:20,borderRadius:99}})}),s.jsx("div",{className:"col-size",children:s.jsx("span",{className:"skeleton-cell",style:{width:44,height:12}})}),s.jsx("div",{className:"col-url",children:s.jsx("span",{className:"skeleton-cell",style:{width:"65%",height:12}})})]})}function Hr(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 fm(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}function gt(e){return fm(e)??""}function Qa(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 au={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 vs(e){return au[e]??au.other}function zd(e){return e.split("/").map(t=>t?t.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"").join("/")}function pm({entry:e,onRowClick:t,selectedUids:n}){const r=(n==null?void 0:n.size)===1&&n.has(e.entry_uid),l=(n==null?void 0:n.size)>=2&&n.has(e.entry_uid),i=["child-entry-row",r&&"is-selected",l&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:i,tabIndex:0,"data-entry-uid":e.entry_uid,onMouseDown:a=>{a.shiftKey&&a.preventDefault()},onClick:a=>t(e,a),onKeyDown:a=>{a.key==="Enter"&&t(e,a)},children:[s.jsx("div",{className:"col-check","aria-hidden":"true"}),s.jsx("div",{className:"col-added",children:Qa(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[s.jsx("span",{className:"source-icon",children:s.jsx("span",{dangerouslySetInnerHTML:{__html:vs(e.source_kind)}})}),s.jsx("span",{className:"entry-title",children:gt(e.title)||gt(e.entry_uid)})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:gt(e.entity_kind)})}),s.jsx("div",{className:"col-size",children:s.jsx("span",{className:"size-total",children:Hr(e.total_artifact_bytes)})}),s.jsx("div",{className:"url-cell col-url",children:gt(e.original_url)})]})}function hm({entry:e,archiveId:t,isSelected:n,isMultiSelected:r,onRowClick:l,selectedUids:i}){const[a,u]=f.useState(!1),[o,c]=f.useState(!1),[g,m]=f.useState(null),[h,y]=f.useState(!1),k=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!a?s.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}):s.jsx("span",{dangerouslySetInnerHTML:{__html:vs(e.source_kind)}}),j=n||r,p=e.child_count>0;function d(N){N.stopPropagation(),l(e,{ctrlKey:!0,metaKey:!1,shiftKey:!1,preventDefault(){}})}async function v(N){if(N.stopPropagation(),o){c(!1);return}if(c(!0),g===null&&!h){y(!0);try{const P=await xh(t,e.entry_uid);m(P)}catch{m([])}finally{y(!1)}}}const x=["entry-row-outer",n&&"is-selected",r&&"is-multi-selected"].filter(Boolean).join(" ");return s.jsxs("div",{className:x,"data-entry-uid":e.entry_uid,children:[s.jsxs("div",{className:"entry-row-main",tabIndex:0,onMouseDown:N=>{N.shiftKey&&N.preventDefault()},onClick:N=>l(e,N),onKeyDown:N=>{N.key==="Enter"&&l(e,N)},children:[s.jsx("div",{className:"col-check",children:s.jsx("button",{type:"button",className:`row-checkbox${j?" is-checked":""}`,"aria-pressed":j,"aria-label":j?"Deselect entry":"Select entry",onClick:d,onKeyDown:N=>N.stopPropagation()})}),s.jsx("div",{className:"col-added",children:Qa(e.archived_at)}),s.jsxs("div",{className:"col-title",children:[p&&s.jsx("button",{type:"button",className:`entry-expand-btn${o?" is-expanded":""}`,"aria-label":o?"Collapse children":`Expand ${e.child_count} items`,"aria-expanded":o,onClick:v,onKeyDown:N=>N.stopPropagation()}),s.jsx("span",{className:"source-icon",children:k}),s.jsx("span",{className:"entry-title",children:gt(e.title)||gt(e.entry_uid)}),p&&s.jsx("span",{className:"child-count-badge","aria-hidden":"true",children:e.child_count})]}),s.jsx("div",{className:"col-type",children:s.jsx("span",{className:"type-pill",children:gt(e.entity_kind)})}),s.jsxs("div",{className:"col-size",children:[s.jsx("span",{className:"size-total",children:Hr(e.total_artifact_bytes)}),e.cached_bytes>0&&e.total_artifact_bytes>0&&s.jsxs("span",{className:"size-cached-pct",title:`${Hr(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:gt(e.original_url)})]}),o&&s.jsxs("div",{className:"child-entries","aria-label":`${e.child_count} child entries`,children:[h&&s.jsx("div",{className:"child-entries-loading",children:"Loading…"}),g&&g.map(N=>s.jsx(pm,{entry:N,onRowClick:l,selectedUids:i},N.entry_uid))]})]})}function mm({entries:e,selectedUids:t,onRowClick:n,archiveId:r,pendingCaptures:l=[]}){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.jsxs("div",{id:"entries-body",children:[l.filter(i=>i.archiveId===r).reverse().map(i=>s.jsx(dm,{},i.id)),e.map(i=>s.jsx(hm,{entry:i,archiveId:r,isSelected:t.size===1&&t.has(i.entry_uid),isMultiSelected:t.size>=2&&t.has(i.entry_uid),onRowClick:n,selectedUids:t},i.entry_uid))]})]})})}function gm(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 vm({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 ym({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:gm(l.started_at)}),s.jsxs("td",{children:[s.jsx(vm,{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 xm=4;function wm({archives:e}){const{currentUser:t}=f.useContext(ys)??{},n=t&&(t.role_bits&xm)!==0,[r,l]=f.useState("users"),[i,a]=f.useState([]),[u,o]=f.useState([]),[c,g]=f.useState(!1),[m,h]=f.useState(null),[y,w]=f.useState(""),[k,j]=f.useState(""),[p,d]=f.useState(""),[v,x]=f.useState(null),[N,P]=f.useState(!1),[C,S]=f.useState(""),[D,L]=f.useState(""),[U,F]=f.useState(null),[W,Y]=f.useState(!1),ce=f.useCallback(async()=>{if(n){g(!0),h(null);try{const[T,M]=await Promise.all([Bh(),Wh()]);a(T),o(M)}catch(T){h(T.message)}finally{g(!1)}}},[n]);f.useEffect(()=>{ce()},[ce]);async function ie(T){const M=T.status==="active"?"disabled":"active";try{await Uh(T.user_uid,M),a(q=>q.map(A=>A.user_uid===T.user_uid?{...A,status:M}:A))}catch(q){h(q.message)}}async function ee(T){if(T.preventDefault(),!y.trim()||!k){x("Username and password required");return}P(!0),x(null);try{await Hh(y.trim(),k,p.trim()||void 0),w(""),j(""),d(""),await ce()}catch(M){x(M.message)}finally{P(!1)}}async function R(T){if(T.preventDefault(),!C.trim()||!D.trim()){F("Slug and name required");return}Y(!0),F(null);try{await Vh(C.trim(),D.trim()),S(""),L(""),await ce()}catch(M){F(M.message)}finally{Y(!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:()=>ie(T),children:T.status==="active"?"Ban":"Unban"})})]},T.user_uid))})]}),s.jsx("h3",{children:"Create User"}),s.jsxs("form",{className:"admin-form",onSubmit:ee,children:[s.jsx("input",{className:"admin-input",placeholder:"Username",value:y,onChange:T=>w(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:N,children:N?"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:u.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=>S(T.target.value),required:!0}),s.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:D,onChange:T=>L(T.target.value),required:!0}),U&&s.jsx("div",{className:"form-msg form-msg--err",children:U}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:W,children:W?"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 Rd({node:e,onPick:t}){var n;return s.jsxs("li",{children:[s.jsx("button",{className:"tag-picker-node-btn",title:e.tag.full_path,onClick:()=>t(e.tag),children:e.tag.slug}),((n=e.children)==null?void 0:n.length)>0&&s.jsx("div",{className:"tag-children",children:s.jsx("ul",{className:"tag-tree-list",children:e.children.map(r=>s.jsx(Rd,{node:r,onPick:t},r.tag.tag_uid))})})]})}function ou({title:e,tagNodes:t,excludeUid:n,onPick:r,onCancel:l}){f.useEffect(()=>{function u(o){o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),l())}return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[l]);function i(u){return u.filter(o=>o.tag.tag_uid!==n).map(o=>({...o,children:i(o.children)}))}const a=n?i(t):t;return s.jsx("div",{className:"tag-picker-backdrop",onClick:u=>{u.target===u.currentTarget&&l()},children:s.jsxs("div",{className:"tag-picker-modal",role:"dialog","aria-modal":"true",children:[s.jsxs("div",{className:"tag-picker-header",children:[s.jsx("span",{className:"tag-picker-title",children:e}),s.jsx("button",{className:"tag-picker-close",onClick:l,title:"Cancel","aria-label":"Cancel",children:"×"})]}),s.jsxs("div",{className:"tag-picker-body",children:[s.jsx("button",{className:"tag-picker-root-btn",onClick:()=>r(null),title:"Place at root level (no parent)",children:"↑ Root tag (no parent)"}),a.length>0?s.jsx("ul",{className:"tag-tree-list tag-picker-tree",children:a.map(u=>s.jsx(Rd,{node:u,onPick:r},u.tag.tag_uid))}):s.jsx("p",{className:"tag-picker-empty",children:"No other tags available."})]})]})})}function Dd({parentPath:e,archiveId:t,onDone:n,onCancel:r}){const[l,i]=f.useState(""),a=f.useRef(!1);async function u(){const o=l.trim();if(!o){r();return}const c=e?`${e}/${o}`:`/${o}`;try{await Ch(t,c),n()}catch(g){alert(g.message||"Create failed"),r()}}return s.jsx("input",{className:"tag-rename-input",autoFocus:!0,placeholder:"tag name",value:l,onChange:o=>i(o.target.value),onKeyDown:o=>{o.key==="Enter"&&o.currentTarget.blur(),o.key==="Escape"&&(a.current=!0,o.currentTarget.blur())},onBlur:()=>{a.current?(a.current=!1,r()):u()}})}function $d({node:e,archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:u,humanizeTags:o,moveSelectMode:c,onMoveSourceSelect:g,pendingCreateParentUid:m,onCreateDone:h,onCreateCancel:y}){var U;const w=n===e.tag.full_path,[k,j]=f.useState(!1),[p,d]=f.useState(""),v=f.useRef(!1);function x(){if(k)return;if(c){g(e);return}const F=w?null:e.tag.full_path;r(F),l("archive")}function N(F){F.stopPropagation(),!c&&(d(e.tag.slug),j(!0))}async function P(){const F=p.trim();if(!F||F===e.tag.slug){j(!1);return}try{const W=await Nh(t,e.tag.tag_uid,F);i(e.tag.full_path,W.full_path),u()}catch{}finally{j(!1)}}async function C(F){var Y;F.stopPropagation();const W=((Y=e.children)==null?void 0:Y.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(W))try{await _h(t,e.tag.tag_uid),a(e.tag.full_path),u()}catch{}}const S={archiveId:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:u,humanizeTags:o,moveSelectMode:c,onMoveSourceSelect:g,pendingCreateParentUid:m,onCreateDone:h,onCreateCancel:y},D=m===e.tag.tag_uid,L=((U=e.children)==null?void 0:U.length)>0;return s.jsxs("li",{children:[s.jsxs("div",{className:`tag-node-row${c?" tag-node-row--move-select":""}`,children:[k?s.jsx("input",{className:"tag-rename-input",autoFocus:!0,value:p,onChange:F=>d(F.target.value),onKeyDown:F=>{F.key==="Enter"&&F.currentTarget.blur(),F.key==="Escape"&&(v.current=!0,F.currentTarget.blur())},onBlur:()=>{v.current?(v.current=!1,j(!1)):P()}}):s.jsxs("button",{className:`tag-node-btn${w?" is-active":""}${c?" tag-node-btn--move-select":""}`,title:c?`Select "${e.tag.full_path}" to move`:e.tag.full_path,onClick:x,onDoubleClick:c?void 0:N,children:[s.jsx("span",{className:"tag-node-label",children:o?e.tag.name:e.tag.slug}),s.jsx("span",{className:"tag-node-count",children:e.children.length===0?`(${e.entry_count})`:`(${e.entry_count}) (${e.subtree_count} Total)`}),!c&&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",title:"Rename tag",onClick:F=>{F.stopPropagation(),N(F)},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"})})]}),!k&&!c&&s.jsx("button",{className:"remove tag-node-delete",title:`Delete "${e.tag.full_path}"`,onClick:C,"aria-label":`Delete "${e.tag.full_path}"`,children:"×"})]}),(L||D)&&s.jsx("div",{className:"tag-children",children:s.jsxs("ul",{className:"tag-tree-list",children:[e.children.map(F=>s.jsx($d,{node:F,...S},F.tag.tag_uid)),D&&s.jsx("li",{children:s.jsx(Dd,{parentPath:e.tag.full_path,archiveId:t,onDone:h,onCancel:y})})]})})]})}function km({archiveId:e,tagNodes:t,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:u,humanizeTags:o}){const[c,g]=f.useState(null),[m,h]=f.useState(null);function y(){g("select-source"),h(null)}function w(){g(null),h(null)}f.useEffect(()=>{if(c!=="select-source")return;function W(Y){Y.key==="Escape"&&(Y.preventDefault(),Y.stopPropagation(),w())}return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[c]);function k(W){h(W),g("select-dest")}async function j(W){const Y=m.tag.full_path,ce=m.tag.tag_uid,ie=(W==null?void 0:W.tag_uid)??null;w();try{const ee=await Eh(e,ce,ie);i(Y,ee.full_path),u()}catch(ee){alert(ee.message||"Move failed")}}const[p,d]=f.useState(null),[v,x]=f.useState(void 0);function N(){d("select-parent"),x(void 0)}function P(){d(null),x(void 0)}function C(W){x(W??null),d("input")}function S(){d(null),x(void 0),u()}const D=c==="select-source",L=p==="input"?v?v.tag_uid:"__root__":void 0,U={archiveId:e,tagFilter:n,onTagFilterSet:r,onViewChange:l,onTagRenamed:i,onTagDeleted:a,onTagsRefresh:u,humanizeTags:o,moveSelectMode:D,onMoveSourceSelect:k,pendingCreateParentUid:L,onCreateDone:S,onCreateCancel:P},F=L==="__root__";return s.jsxs("section",{id:"tags-view",className:"view is-active",children:[s.jsxs("div",{className:"tag-tree",children:[s.jsx("div",{className:"tag-tree-header",children:D?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"tag-tree-title tag-tree-title--move",children:"Select a tag to move"}),s.jsx("button",{className:"tag-tree-action-btn tag-tree-action-btn--cancel",onClick:w,children:"Cancel"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"tag-tree-title",children:"Tags"}),n&&s.jsxs("span",{className:"tag-tree-active",title:n,children:["Filtering: ",n]}),s.jsxs("div",{className:"tag-tree-actions",children:[s.jsx("button",{className:"tag-tree-action-btn",onClick:N,title:"Create a new tag",disabled:!!p||!!c,children:"+ New"}),s.jsx("button",{className:"tag-tree-action-btn",onClick:y,title:"Move a tag to a different parent",disabled:!!p||!!c||t.length===0,children:"Move"})]})]})}),t.length===0&&!F?s.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):s.jsxs("ul",{className:"tag-tree-list",children:[t.map(W=>s.jsx($d,{node:W,...U},W.tag.tag_uid)),F&&s.jsx("li",{children:s.jsx(Dd,{parentPath:null,archiveId:e,onDone:S,onCancel:P})})]})]}),p==="select-parent"&&s.jsx(ou,{title:"Create tag under…",tagNodes:t,excludeUid:null,onPick:C,onCancel:P}),c==="select-dest"&&m&&s.jsx(ou,{title:`Move "${m.tag.slug}" under…`,tagNodes:t,excludeUid:m.tag.tag_uid,onPick:j,onCancel:w})]})}const mr=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],jm=e=>{var t;return((t=mr.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Sm({archiveId:e}){const[t,n]=f.useState([]),[r,l]=f.useState(!1),[i,a]=f.useState(null),[u,o]=f.useState(null),[c,g]=f.useState(null),[m,h]=f.useState(!1),[y,w]=f.useState(null),[k,j]=f.useState(""),[p,d]=f.useState(""),[v,x]=f.useState(2),[N,P]=f.useState(!1),[C,S]=f.useState(null),[D,L]=f.useState(""),[U,F]=f.useState(2),[W,Y]=f.useState(!1),[ce,ie]=f.useState(null),[ee,R]=f.useState(!1),[T,M]=f.useState(""),q=f.useRef(null),A=t.find(b=>b.collection_uid===u)??null,ge=(A==null?void 0:A.slug)==="_default_",de=f.useCallback(async()=>{if(e){l(!0),a(null);try{const b=await Pd(e);n(b)}catch(b){a(b.message)}finally{l(!1)}}},[e]),Re=f.useCallback(async b=>{if(!b){g(null);return}h(!0),w(null);try{const B=await Kh(e,b);g(B)}catch(B){w(B.message)}finally{h(!1)}},[e]);f.useEffect(()=>{de()},[de]),f.useEffect(()=>{Re(u)},[u,Re]),f.useEffect(()=>{ee&&q.current&&q.current.focus()},[ee]);async function we(b){b.preventDefault();const B=k.trim(),re=p.trim();if(!(!B||!re)){P(!0),S(null);try{const le=await Qh(e,B,re,v);j(""),d(""),x(2),await de(),o(le.collection_uid)}catch(le){S(le.message)}finally{P(!1)}}}async function Se(){const b=T.trim();if(!b||!A){R(!1);return}try{await iu(e,A.collection_uid,{name:b}),await de(),g(B=>B&&{...B,name:b})}catch(B){a(B.message)}finally{R(!1)}}async function E(b){if(A)try{await iu(e,A.collection_uid,{default_visibility_bits:b}),await de(),g(B=>B&&{...B,default_visibility_bits:b})}catch(B){a(B.message)}}async function H(){if(A&&window.confirm(`Delete collection "${A.name}"? Entries will not be deleted.`))try{await Yh(e,A.collection_uid),o(null),g(null),await de()}catch(b){a(b.message)}}async function K(b){b.preventDefault();const B=D.trim();if(!(!B||!A)){Y(!0),ie(null);try{await bd(e,A.collection_uid,B,U),L(""),await Re(A.collection_uid)}catch(re){ie(re.message)}finally{Y(!1)}}}async function V(b){if(A)try{await Xh(e,A.collection_uid,b),await Re(A.collection_uid)}catch(B){w(B.message)}}async function X(b,B){if(A)try{await Jh(e,A.collection_uid,b,B),g(re=>re&&{...re,entries:re.entries.map(le=>le.entry_uid===b?{...le,collection_visibility_bits:B}:le)})}catch(re){w(re.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(b=>s.jsxs("button",{className:`coll-sidebar-row${u===b.collection_uid?" is-active":""}`,onClick:()=>o(b.collection_uid),children:[s.jsx("span",{className:"coll-row-name",children:b.name}),s.jsx("span",{className:"coll-row-meta",children:jm(b.default_visibility_bits)})]},b.collection_uid)),t.length===0&&!r&&s.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),A?s.jsxs("div",{className:"coll-detail",children:[s.jsxs("div",{className:"coll-detail-header",children:[ee?s.jsx("input",{ref:q,className:"coll-rename-input",value:T,onChange:b=>M(b.target.value),onBlur:Se,onKeyDown:b=>{b.key==="Enter"&&Se(),b.key==="Escape"&&R(!1)}}):s.jsxs("h3",{className:`coll-detail-name${ge?"":" coll-detail-name--editable"}`,title:ge?void 0:"Click to rename",onClick:()=>{ge||(M(A.name),R(!0))},children:[(c==null?void 0:c.name)??A.name,!ge&&s.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!ge&&s.jsx("button",{className:"coll-delete-btn",onClick:H,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)??A.default_visibility_bits,onChange:b=>E(Number(b.target.value)),disabled:ge,children:mr.map(b=>s.jsx("option",{value:b.value,children:b.label},b.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(b=>s.jsxs("li",{className:"coll-entry-row",children:[s.jsxs("div",{className:"coll-entry-info",children:[s.jsx("span",{className:"coll-entry-title",children:b.title||b.entry_uid}),s.jsx("span",{className:"coll-entry-kind muted",children:b.source_kind})]}),s.jsxs("div",{className:"coll-entry-actions",children:[s.jsx("select",{className:"coll-entry-vis-select",value:b.collection_visibility_bits,onChange:B=>X(b.entry_uid,Number(B.target.value)),children:mr.map(B=>s.jsx("option",{value:B.value,children:B.label},B.value))}),!ge&&s.jsx("button",{className:"coll-entry-remove",onClick:()=>V(b.entry_uid),title:"Remove from collection",children:"×"})]})]},b.entry_uid))}))]}),!ge&&s.jsxs("form",{className:"coll-add-entry-form",onSubmit:K,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:D,onChange:b=>L(b.target.value),placeholder:"entry_uid",required:!0}),s.jsx("select",{className:"coll-vis-select",value:U,onChange:b=>F(Number(b.target.value)),children:mr.map(b=>s.jsx("option",{value:b.value,children:b.label},b.value))}),s.jsx("button",{className:"coll-add-btn",type:"submit",disabled:W,children:W?"…":"Add"})]}),ce&&s.jsx("div",{className:"collections-error",style:{marginTop:4},children:ce})]})]}):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:we,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:b=>{j(b.target.value),p||d(b.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:b=>d(b.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:b=>x(Number(b.target.value)),children:mr.map(b=>s.jsx("option",{value:b.value,children:b.label},b.value))})]}),C&&s.jsx("div",{className:"collections-error",children:C}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:N,children:N?"Creating…":"Create collection"})]})]})]}):s.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Nm=4;function _m({tab:e,onTabChange:t,archiveId:n}){const{currentUser:r,setCurrentUser:l}=f.useContext(ys)??{},i=r&&(r.role_bits&Nm)!==0,a=["profile","tokens",...i?["instance","cookies","extensions","storage"]:[]],u={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(o=>s.jsx("button",{className:`view-tab${e===o?" is-active":""}`,onClick:()=>t(o),children:u[o]},o))}),e==="profile"&&s.jsx(Cm,{currentUser:r,setCurrentUser:l}),e==="tokens"&&s.jsx(Em,{}),e==="instance"&&i&&s.jsx(Tm,{}),e==="cookies"&&i&&s.jsx(bm,{}),e==="extensions"&&i&&s.jsx(Lm,{}),e==="storage"&&i&&s.jsx(Pm,{archiveId:n})]})}function Cm({currentUser:e,setCurrentUser:t}){const[n,r]=f.useState((e==null?void 0:e.display_name)??""),[l,i]=f.useState(!1),[a,u]=f.useState(null),[o,c]=f.useState(""),[g,m]=f.useState(""),[h,y]=f.useState(""),[w,k]=f.useState(!1),[j,p]=f.useState(null);async function d(x){x.preventDefault(),i(!0),u(null);try{await $h(n),t(N=>({...N,display_name:n||null})),u({ok:!0,text:"Saved."})}catch(N){u({ok:!1,text:N.message})}finally{i(!1)}}async function v(x){if(x.preventDefault(),g!==h){p({ok:!1,text:"Passwords do not match."});return}k(!0),p(null);try{await Oh(o,g),c(""),m(""),y(""),p({ok:!0,text:"Password changed."})}catch(N){p({ok:!1,text:N.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:x=>r(x.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 x=>{const N=x.target.checked;try{await Ih({humanize_slugs:N}),t(P=>({...P,humanize_slugs:N}))}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:o,onChange:x=>c(x.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:x=>m(x.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:x=>y(x.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:w,children:w?"Changing…":"Change Password"})]})]})]})}function Em(){const[e,t]=f.useState([]),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,u]=f.useState(""),[o,c]=f.useState(!1),[g,m]=f.useState(null),h=f.useCallback(async()=>{r(!0),i(null);try{t(await Mh())}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 Fh(a.trim());m(j),u(""),h()}catch(j){i(j.message)}finally{c(!1)}}}async function w(k){try{await Ah(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=>u(k.target.value),required:!0}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:o,children:o?"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:()=>w(k.token_uid),children:"Revoke"})]},k.token_uid))]})]})})}function Tm(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,u]=f.useState(!1),[o,c]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Va())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function g(m){m.preventDefault(),u(!0),c(null);try{await Pl(e),c({ok:!0,text:"Saved."})}catch(h){c({ok:!1,text:h.message})}finally{u(!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(w=>({...w,[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"})]})]}),o&&s.jsx("div",{className:`form-msg form-msg--${o.ok?"ok":"err"}`,children:o.text}),s.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Saving…":"Save Settings"})]})]})}):null}function ei(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 Pm({archiveId:e}){const[t,n]=f.useState("idle"),[r,l]=f.useState(null),[i,a]=f.useState(null),[u,o]=f.useState(null);function c(){n("idle"),l(null),a(null),o(null)}async function g(){n("scanning"),o(null),l(null);try{const y=await Gh(e);l(y),n("scanned")}catch(y){o(y.message),n("error")}}async function m(){n("deleting"),o(null);try{const y=await Zh(e);a(y),n("done")}catch(y){o(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:ei(r.total_bytes)})," recoverable."]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsxs("button",{className:"btn-danger",onClick:m,children:["Delete (",ei(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:ei(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:u}),s.jsx("button",{className:"btn-ghost",style:{marginTop:10},onClick:c,children:"Try again"})]})]})})}function bm(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(null),[a,u]=f.useState("global"),[o,c]=f.useState(""),[g,m]=f.useState("{}"),[h,y]=f.useState(null),[w,k]=f.useState(!1),[j,p]=f.useState({});f.useEffect(()=>{d()},[]);async function d(){r(!0),i(null);try{t(await tm())}catch(S){i(S.message)}finally{r(!1)}}async function v(S){S.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 nm(a==="global"?null:o.trim(),a,g),c(""),m("{}"),u("global"),y({ok:!0,text:"Rule added."}),await d()}catch(D){y({ok:!1,text:D.message})}finally{k(!1)}}async function x(S){try{await lm(S),await d()}catch(D){i(D.message)}}function N(S){p(D=>({...D,[S.rule_uid]:{cookiesInput:S.cookies_json,saving:!1,msg:null}}))}function P(S){p(D=>{const L={...D};return delete L[S],L})}async function C(S){const D=j[S.rule_uid];try{JSON.parse(D.cookiesInput)}catch{p(L=>({...L,[S.rule_uid]:{...L[S.rule_uid],msg:{ok:!1,text:"Invalid JSON"}}}));return}p(L=>({...L,[S.rule_uid]:{...L[S.rule_uid],saving:!0,msg:null}}));try{await rm(S.rule_uid,{cookies_json:D.cookiesInput}),P(S.rule_uid),await d()}catch(L){p(U=>({...U,[S.rule_uid]:{...U[S.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(S=>{const D=j[S.rule_uid],L=S.url_pattern?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"muted",children:[S.pattern_kind,":"]})," ",s.jsx("code",{children:S.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:D?s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"field-input",style:{fontFamily:"monospace",fontSize:12,width:"100%",minHeight:60},value:D.cookiesInput,onChange:U=>p(F=>({...F,[S.rule_uid]:{...F[S.rule_uid],cookiesInput:U.target.value}}))}),D.msg&&s.jsx("div",{className:`form-msg form-msg--${D.msg.ok?"ok":"err"}`,children:D.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:D.saving,onClick:()=>C(S),children:D.saving?"Saving…":"Save"}),s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>P(S.rule_uid),children:"Cancel"})]})]}):s.jsx("code",{style:{fontSize:12,wordBreak:"break-all"},children:S.cookies_json})}),s.jsx("td",{children:!D&&s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{className:"btn-secondary",style:{fontSize:12,padding:"2px 8px"},onClick:()=>N(S),children:"Edit"}),s.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"2px 8px"},onClick:()=>x(S.rule_uid),children:"Del"})]})})]},S.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:S=>u(S.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:o,onChange:S=>c(S.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:S=>m(S.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:w,children:w?"Adding…":"Add Rule"})]})]})})}function Lm(){const[e,t]=f.useState(null),[n,r]=f.useState(!0),[l,i]=f.useState(!1),[a,u]=f.useState(null);f.useEffect(()=>{(async()=>{try{t(await Va())}catch(j){u({ok:!1,text:j.message})}finally{r(!1)}})()},[]);async function o(j){i(!0),u(null);try{await Pl({ublock_enabled:j}),t(p=>({...p,ublock_enabled:j})),u({ok:!0,text:"Saved."})}catch(p){u({ok:!1,text:p.message})}finally{i(!1)}}async function c(j){i(!0),u(null);try{await Pl({cookie_ext_enabled:j}),t(p=>({...p,cookie_ext_enabled:j})),u({ok:!0,text:"Saved."})}catch(p){u({ok:!1,text:p.message})}finally{i(!1)}}async function g(j){i(!0),u(null);try{await Pl({modal_closer_enabled:j}),t(p=>({...p,modal_closer_enabled:j})),u({ok:!0,text:"Saved."})}catch(p){u({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,w=(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:()=>o(!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":w,className:`ext-toggle${w?" ext-toggle--on":""}`,onClick:()=>c(!w),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 uu={0:"Private",1:"Public",2:"Users only",3:"Public"},zm=()=>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 Rm({archiveId:e,selectedEntry:t,selectedUids:n,selectedEntries:r,detail:l,onTagFilterSet:i,tagNodes:a,onTagsRefresh:u,onEntryTitleChange:o,onEntryDeleted:c,onBulkDeleted:g,humanizeTags:m,onDetailRefresh:h,onOpenPreview:y,onPlay:w}){var qr;const[k,j]=f.useState([]),[p,d]=f.useState(""),[v,x]=f.useState([]),[N,P]=f.useState(""),C=f.useRef(0),S=f.useRef(!1),[D,L]=f.useState(!1),[U,F]=f.useState(""),[W,Y]=f.useState("idle"),[ce,ie]=f.useState(""),ee=f.useRef(null),[R,T]=f.useState(!1);f.useEffect(()=>{T(!1)},[(qr=l==null?void 0:l.summary)==null?void 0:qr.entry_uid]);const M=(n==null?void 0:n.size)>=2,[q,A]=f.useState(""),[ge,de]=f.useState("idle"),[Re,we]=f.useState(""),[Se,E]=f.useState([]),[H,K]=f.useState(""),[V,X]=f.useState("idle"),[b,B]=f.useState(""),[re,le]=f.useState("idle");f.useEffect(()=>{const $=++C.current;if(ee.current&&(clearInterval(ee.current),ee.current=null),Y("idle"),ie(""),!t||!e){j([]),x([]);return}L(!1),F(""),S.current=!1,j([]),Promise.all([ml(e,t.entry_uid),qh(e,t.entry_uid)]).then(([te,Ae])=>{$===C.current&&(j(te),x(Ae))}).catch(()=>{})},[t,e]),f.useEffect(()=>()=>{clearInterval(ee.current)},[]),f.useEffect(()=>{if(!M||!e){E([]);return}Pd(e).then(E).catch(()=>E([]))},[M,e]),f.useEffect(()=>{A(""),de("idle"),we(""),K(""),X("idle"),B(""),le("idle")},[n]);async function rt(){const $=n.size;if(!window.confirm(`Delete ${$} entr${$===1?"y":"ies"}? This cannot be undone.`))return;le("running");const te=new Set;for(const Ae of n)try{await su(e,Ae),te.add(Ae)}catch{}le("idle"),g==null||g(te)}async function Fe(){const $=q.trim();if($){de("running"),we("");try{for(const te of n)await lu(e,te,$);A(""),de("done"),u==null||u(),setTimeout(()=>de("idle"),1800)}catch(te){we(te.message),de("error")}}}async function ve(){if(!H)return;X("running"),B("");const $=[];for(const te of n)try{await bd(e,H,te)}catch{$.push(te)}$.length>0?(B(`Failed for ${$.length} entr${$.length===1?"y":"ies"}.`),X("error")):(X("done"),setTimeout(()=>X("idle"),1800))}async function tn(){const $=U.trim()||null;try{await jh(e,t.entry_uid,$),o==null||o(t.entry_uid,$)}catch{}finally{L(!1)}}async function qe(){const $=p.trim();if(!(!$||!t))try{await lu(e,t.entry_uid,$),d(""),P("");const te=await ml(e,t.entry_uid);j(te),u()}catch(te){P(te.message)}}async function xs($){try{await Sh(e,t.entry_uid,$);const te=await ml(e,t.entry_uid);j(te),u()}catch{}}async function ws(){if(!(!t||!e)&&window.confirm("Delete this entry? This cannot be undone."))try{await su(e,t.entry_uid),c==null||c(t.entry_uid)}catch{}}async function ks(){if(!t||!e||W==="running")return;const $=C.current,te=t.entry_uid;Y("running"),ie("");try{const{job_uid:Ae}=await em(e,te);if(C.current!==$)return;ee.current=setInterval(async()=>{try{const dt=await Td(e,Ae);if(dt.status==="completed"){if(clearInterval(ee.current),ee.current=null,C.current!==$)return;Y("done");const wn=await ml(e,te);if(C.current!==$)return;j(wn),h==null||h()}else if(dt.status==="failed"){if(clearInterval(ee.current),ee.current=null,C.current!==$)return;Y("error"),ie(dt.error_text||"Re-archive failed.")}}catch{if(clearInterval(ee.current),ee.current=null,C.current!==$)return;Y("error"),ie("Network error while polling.")}},500)}catch(Ae){if(C.current!==$)return;Y("error"),ie(Ae.message||"Failed to start re-archive.")}}const js=l?[["Added",Qa(l.summary.archived_at)],["Source",l.summary.source_kind],["Type",l.summary.entity_kind],["Visibility",uu[l.summary.visibility]??l.summary.visibility],["Root",l.structured_root_relpath]]:[],Ss=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Ns=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv","pdf","html","htm","jpg","jpeg","png","gif","webp","avif","svg","bmp"]),yn=l?l.artifacts.findIndex($=>$.artifact_role==="primary_media"):-1,xn=yn>=0?l.artifacts[yn]:null,Xr=xn?xn.relpath.split(".").pop().toLowerCase():"",Jr=xn&&Ss.has(Xr),_s=yn>=0&&t?`/api/archives/${e}/entries/${t.entry_uid}/artifacts/${yn}`:null,Cs=l&&!Jr&&(l.summary.entity_kind==="tweet"||l.summary.entity_kind==="tweet_thread"||xn&&Ns.has(Xr));return s.jsxs("aside",{className:"context-rail",children:[s.jsx("div",{className:"rail-eyebrow",children:"Context"}),M?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"}),Re&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:Re}),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:q,onChange:$=>A($.target.value),onKeyDown:$=>{$.key==="Enter"&&Fe()}}),s.jsx("button",{className:"tag-add-btn",onClick:Fe,disabled:ge==="running"||!q.trim(),children:ge==="running"?"…":ge==="done"?"✓":"Add"})]})]}),Se.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:H,onChange:$=>K($.target.value),children:[s.jsx("option",{value:"",children:"Pick a collection…"}),Se.map($=>s.jsx("option",{value:$.collection_uid,children:$.name},$.collection_uid))]}),s.jsx("button",{className:"tag-add-btn",onClick:ve,disabled:!H||V==="running",children:V==="running"?"…":V==="done"?"✓":V==="error"?"!":"Add"})]}),b&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"6px 0 0"},children:b})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:rt,disabled:re==="running",children:re==="running"?"Deleting…":`Delete ${n.size} entr${n.size===1?"y":"ies"}`})})]}):t?l?s.jsxs(s.Fragment,{children:[D?s.jsx("input",{className:"rail-title-input",autoFocus:!0,value:U,onChange:$=>F($.target.value),onKeyDown:$=>{$.key==="Enter"&&$.currentTarget.blur(),$.key==="Escape"&&(S.current=!0,$.currentTarget.blur())},onBlur:()=>{S.current?L(!1):tn(),S.current=!1}}):s.jsxs("h2",{className:"rail-title rail-title--editable",title:"Click to rename",onClick:()=>{F(l.summary.title??""),L(!0)},children:[gt(l.summary.title)||gt(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:vs(l.summary.source_kind)}}),s.jsx("span",{className:"u-text",children:l.summary.original_url}),s.jsx("span",{className:"ext",children:s.jsx(zm,{})})]}),Jr&&w&&s.jsx("button",{className:"rail-preview-btn",onClick:()=>w(_s,t),children:"▶ Play"}),Cs&&y&&s.jsx("button",{className:"rail-preview-btn",onClick:y,children:"Preview"}),s.jsx("div",{className:"meta-list",children:js.filter(([,$])=>$!=null&&$!=="").map(([$,te])=>s.jsxs("div",{className:"meta-item",children:[s.jsx("span",{className:"meta-k",children:$}),s.jsx("span",{className:`meta-v${$==="Root"?" mono":""}`,children:gt(te)})]},$))}),l.artifacts.length>0&&(()=>{const $=l.artifacts.map((Ne,Gn)=>({...Ne,_idx:Gn})),te=$.filter(Ne=>Ne.artifact_role==="font"),Ae=$.filter(Ne=>Ne.artifact_role!=="font"),dt=te.reduce((Ne,Gn)=>Ne+(Gn.byte_size||0),0),wn=l.summary.entry_uid,Yr=Ne=>s.jsx("li",{children:s.jsxs("a",{href:`/api/archives/${e}/entries/${wn}/artifacts/${Ne._idx}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[s.jsx("span",{className:"artifact-name",children:Ne.artifact_role==="font"?Ne.relpath.split("/").pop():Ne.artifact_role.replace(/_/g," ")}),s.jsx("span",{className:"artifact-size",children:Ne.byte_size!=null?Hr(Ne.byte_size):"—"})]})},Ne._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:[Ae.map(Yr),te.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(Ne=>!Ne),children:[s.jsxs("span",{className:"artifact-name",children:[s.jsx("span",{"aria-hidden":"true",className:`artifact-group-chevron${R?" open":""}`,children:"›"}),` fonts (${te.length})`]}),s.jsx("span",{className:"artifact-size",children:Hr(dt)})]}),R&&s.jsx("ul",{className:"artifact-list artifact-group-body",children:te.map(Yr)})]})]})]})})()]}):s.jsx("p",{className:"tags-empty",children:"Loading\\u2026"}):s.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&!M&&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?zd($.full_path):$.full_path,s.jsx("button",{className:"remove",title:`Remove tag ${$.full_path}`,onClick:()=>xs($.tag_uid),children:"×"})]},$.tag_uid))}),N&&s.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:N}),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"&&qe()}}),s.jsx("button",{className:"tag-add-btn",onClick:qe,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:uu[$.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:ks,disabled:W==="running",children:W==="running"?"Re-archiving…":"Re-archive"}),W==="done"&&s.jsx("p",{className:"form-msg form-msg--ok",style:{marginTop:"6px"},children:"Re-archived successfully."}),W==="error"&&s.jsx("p",{className:"form-msg form-msg--err",style:{marginTop:"6px"},children:ce})]}),s.jsx("div",{className:"rail-delete-zone",children:s.jsx("button",{className:"rail-delete-btn",onClick:ws,children:"Delete entry"})})]})]})}function Dm({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 cu({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 Id(e){return e?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e*1e3)):""}function du(e){return!e||!e.includes("&")?e:e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'")}const J={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"}},_e={bg:"#000000",border:"#2f3336",text:"#e7e9ea",dim:"#71767b",accent:"#1d9bf0",codeBg:"#16181c"},ti={article:{background:_e.bg,color:_e.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:_e.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:_e.border,flexShrink:0},aAuthorName:{fontSize:"15px",fontWeight:"700",color:_e.text,lineHeight:"1.3"},aAuthorSub:{fontSize:"15px",color:_e.dim,lineHeight:"1.3"},aDivider:{border:"none",borderTop:`1px solid ${_e.border}`,margin:"0"},aBody:{padding:"4px 16px 0"},bH1:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:_e.text,lineHeight:"36px",margin:"24px 0 10px"},bH2:{fontSize:"26px",fontWeight:"800",letterSpacing:"-0.4px",color:_e.text,lineHeight:"36px",margin:"24px 0 10px"},bP:{fontSize:"17px",color:_e.text,lineHeight:"1.5",marginBottom:"16px",marginTop:"0"},bSpacer:{height:"6px",display:"block"},bQuote:{borderLeft:`3px solid ${_e.border}`,padding:"2px 14px",margin:"14px 0",color:_e.dim,fontSize:"17px",lineHeight:"1.5"},bHr:{border:"none",borderTop:`1px solid ${_e.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:_e.text,lineHeight:"1.5",marginBottom:"6px"},bTweet:{display:"flex",alignItems:"center",gap:"12px",border:`1px solid ${_e.border}`,borderRadius:"12px",padding:"14px 16px",margin:"14px 0",color:_e.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:_e.text,background:"transparent"},iCode:{fontFamily:"ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace",fontSize:"0.875em",background:_e.codeBg,padding:"2px 6px",borderRadius:"4px",color:"#e6edf3"},link:{color:_e.accent,textDecoration:"none"}};function Im(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 Bn(e,t,n){return e&&n[e]?n[e]:t||null}function Od(){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 Ka(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 Md(e,t){const n=e.expanded_url||e.url||e.text||"",r=e.display_url||e.expanded_url||e.url||e.text||"",l=Ka(e,t,e.url,e.text,e.display_url,e.expanded_url);return!l||!n?null:{...l,kind:"url",href:n,display:r}}function Fd(e,t){const n=e.screen_name||e.name||e.text||"",r=n?`@${n}`:null,l=Ka(e,t,r);return!l||!n?null:{...l,kind:"mention",screen_name:n}}const fu=/https?:\/\/[^\s<>"'\])]+/g,Om=/[.,;:!?)()]+$/;function es(e,t){const n=[];let r=0,l;for(fu.lastIndex=0;(l=fu.exec(e))!==null;){l.index>r&&n.push(e.slice(r,l.index));let i=l[0].replace(Om,"");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 Mm(e,t,n=[]){if(!e)return null;const r=[...(t.urls||[]).map(u=>Md(u,e)).filter(Boolean),...(t.user_mentions||[]).map(u=>Fd(u,e)).filter(Boolean)];if(r.length===0&&n.length===0)return es(du(e),J.link);const l=new Set([0,e.length]);for(const u of r)u.s>=0&&u.s<=e.length&&l.add(u.s),u.e>=0&&u.e<=e.length&&l.add(u.e);for(const[u,o]of n)u>=0&&u<=e.length&&l.add(u),o>=0&&o<=e.length&&l.add(o);const i=(u,o)=>n.some(([c,g])=>c<=u&&g>=o),a=[...l].sort((u,o)=>u-o);return a.slice(0,-1).map((u,o)=>{const c=a[o+1];if(i(u,c))return null;const g=e.slice(u,c),m=r.filter(w=>w.s<=u&&w.e>=c),h=m.find(w=>w.kind==="url");if(h)return s.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer",style:J.link,children:h.display||g},o);const y=m.find(w=>w.kind==="mention");return y?s.jsx("a",{href:`https://x.com/${y.screen_name}`,target:"_blank",rel:"noopener noreferrer",style:J.link,children:g},o):s.jsx("span",{children:es(du(g),J.link)},o)}).filter(u=>u!==null)}function Fm(e,t,n,r,l=J){if(!e)return null;t=t||[],n=n||[],r=r||[];const i=[];for(const o of t)o.length>0&&i.push({s:o.offset,e:o.offset+o.length,kind:"style",style:o.style});for(const o of n){const c=Md(o,e);c&&i.push(c)}for(const o of r){const c=Fd(o,e);c&&i.push(c)}if(i.length===0)return es(e,l.link);const a=new Set([0,e.length]);for(const o of i)o.s>=0&&o.s<=e.length&&a.add(o.s),o.e>=0&&o.e<=e.length&&a.add(o.e);const u=[...a].sort((o,c)=>o-c);return u.slice(0,-1).map((o,c)=>{const g=u[c+1],m=i.filter(j=>j.s<=o&&j.e>=g),h=e.slice(o,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 w=m.find(j=>j.kind==="url");if(w){const j=/^https?:\/\/t\.co\//i.test(y);y=s.jsx("a",{href:w.href,target:"_blank",rel:"noopener noreferrer",style:l.link,children:j?w.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"?es(y,l.link):y},c)})}function Am(e,t,n){const r=(n==null?void 0:n.st)||J,l=e.resolved_entities||[];return l.length===0?null:l.map((i,a)=>{var u;switch(i.type){case"divider":return s.jsx("hr",{style:r.bHr},a);case"media":{const o=Bn(i.local_path,i.url,t);return o?s.jsx("a",{href:o,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,o))},children:s.jsx("img",{src:o,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(Od,{}),"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 o=i.markdown??((u=i.data)==null?void 0:u.markdown)??"";return s.jsx("pre",{style:r.bMdPre,children:s.jsx("code",{style:r.bMdCode,children:o})},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 ni(e,t,n,r){const l=(r==null?void 0:r.st)||J,i=e.type||"",a=e.text||"",u=e.inline_style_ranges||[],o=e.data||{},c=Fm(a,u,o.urls||[],o.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(Od,{}),"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:Am(e,n,r)},t);default:return a?s.jsx("p",{style:l.bP,children:c},t):null}}function Bm(e,t,n){const r=(n==null?void 0:n.st)||J,l=[];let i=0;for(;i<e.length;){const a=e[i];if(a.type==="unordered-list-item"){const u=i,o=[];for(;i<e.length&&e[i].type==="unordered-list-item";)o.push(ni(e[i],i,t,n)),i++;l.push(s.jsx("ul",{style:r.bUl,children:o},`ul-${u}`))}else if(a.type==="ordered-list-item"){const u=i,o=[];for(;i<e.length&&e[i].type==="ordered-list-item";)o.push(ni(e[i],i,t,n)),i++;l.push(s.jsx("ol",{style:r.bOl,children:o},`ol-${u}`))}else l.push(ni(a,i,t,n)),i++}return l}function Hm({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 u=r?ti:J,o=e.cover_media||{},c=e.author||t||{},g=e.first_published_at_secs?Id(e.first_published_at_secs):"",h=[c.screen_name?`@${c.screen_name}`:"",g].filter(Boolean).join(" · "),y=Bn(o.local_path,o.url,n),w=Bn(c.avatar_local_path,c.avatar_url,n),k=s.jsxs(s.Fragment,{children:[i&&s.jsx(Ad,{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:u.aCover,alt:"Article cover"})}),s.jsxs("div",{style:u.aMeta,children:[e.title&&s.jsx("div",{style:u.aTweetTitle,children:e.title}),s.jsxs("div",{style:u.aAuthorRow,children:[w?s.jsx("img",{src:w,style:u.aAvatar,alt:c.name||""}):s.jsx("div",{style:u.aAvatarPh}),s.jsxs("div",{children:[s.jsx("div",{style:u.aAuthorName,children:c.name||c.screen_name||"Unknown"}),h&&s.jsx("div",{style:u.aAuthorSub,children:h})]})]})]}),s.jsx("hr",{style:u.aDivider}),s.jsx("div",{style:u.aBody,children:Bm(e.blocks||[],n,{onImgClick:a,st:u})})]});return r?s.jsx("div",{style:ti.article,children:s.jsx("div",{style:ti.articleInner,children:k})}):s.jsx("div",{style:J.article,children:k})}function Um({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:J.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 Ad({items:e,startIndex:t,onClose:n}){const[r,l]=f.useState(t);f.useEffect(()=>{const a=u=>{(u.key==="Escape"||u.key==="ArrowLeft"||u.key==="ArrowRight")&&(u.stopPropagation(),u.preventDefault()),u.key==="Escape"&&n(),u.key==="ArrowRight"&&l(o=>Math.min(o+1,e.length-1)),u.key==="ArrowLeft"&&l(o=>Math.max(o-1,0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[n,e.length]);const i=e[r];return s.jsx("div",{style:J.lightboxBackdrop,onClick:n,children:s.jsxs("div",{style:J.lightboxContent,onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{style:J.lightboxToolbar,children:[e.length>1&&s.jsxs("span",{style:J.lightboxCounter,children:[r+1," / ",e.length]}),s.jsx("a",{href:i.src,target:"_blank",rel:"noopener noreferrer",style:J.lightboxLink,title:"Open in new tab",children:"↗"}),s.jsx("button",{style:J.lightboxBtn,onClick:n,"aria-label":"Close",children:"×"})]}),s.jsx("img",{src:i.src,alt:i.alt||"",style:J.lightboxImg}),e.length>1&&s.jsxs("div",{style:J.lightboxNav,children:[s.jsx("button",{style:J.lightboxNavBtn,onClick:()=>l(a=>Math.max(a-1,0)),disabled:r===0,children:"‹"}),s.jsx("button",{style:J.lightboxNavBtn,onClick:()=>l(a=>Math.min(a+1,e.length-1)),disabled:r===e.length-1,children:"›"})]})]})})}function pu({tweet:e,isInThread:t,isLast:n,artifactMap:r}){var d,v;const[l,i]=f.useState(null),a=e.author||{},u=e.created_at_secs?Id(e.created_at_secs):"",o=e.entities||{},c=Bn(a.avatar_local_path,a.avatar_url,r),g=t&&!n,m=e.is_quote_status===!0,h=t?J.tweetRowThread:J.tweetRow,y=e.full_text||"",w=((v=(d=e.extended_entities)==null?void 0:d.media)!=null&&v.length?e.extended_entities.media:o.media)||[],k=[],j=[];for(const x of w)if(x.type==="photo"){const N=Bn(x.local_path,x.media_url_https,r);N&&k.push({kind:"photo",src:N,alt:x.alt_text||""})}else if(x.type==="video"||x.type==="animated_gif"){const N=x.local_path&&r[x.local_path]||(()=>{var C,S;return(S=(((C=x.video_info)==null?void 0:C.variants)||[]).filter(D=>D.content_type==="video/mp4").sort((D,L)=>(L.bitrate||0)-(D.bitrate||0))[0])==null?void 0:S.url})();N&&j.push({kind:x.type==="animated_gif"?"gif":"video",src:N})}const p=[];for(const x of w){if(!x.url||!(x.type==="photo"?k.some(C=>C.src===Bn(x.local_path,x.media_url_https,r)):j.length>0))continue;const P=Ka(x,y,x.url);P&&p.push([P.s,P.e])}return s.jsxs(s.Fragment,{children:[l!==null&&s.jsx(Ad,{items:k,startIndex:l,onClose:()=>i(null)}),s.jsxs("div",{style:h,children:[s.jsxs("div",{style:J.leftCol,children:[c?s.jsx("img",{src:c,style:J.avatar,alt:a.name||""}):s.jsx("div",{style:J.avatarPh}),g&&s.jsx("div",{style:J.threadLine})]}),s.jsxs("div",{style:J.rightCol,children:[s.jsxs("div",{style:J.authorRow,children:[s.jsx("span",{style:J.authorName,children:a.name||a.screen_name||"Unknown"}),a.screen_name&&s.jsxs("span",{style:J.authorHandle,children:["@",a.screen_name]}),u&&s.jsxs("span",{style:J.datePart,children:["· ",u]}),m&&s.jsx("span",{style:J.qtBadge,title:"Quote tweet",children:"↻ QT"})]}),s.jsx("div",{style:J.tweetText,children:Mm(y,o,p)}),k.length>0&&s.jsx("div",{style:J.mediaGrid,children:s.jsx(Um,{photos:k,onOpen:x=>i(x)})}),j.map((x,N)=>s.jsx("div",{style:J.mediaGrid,children:s.jsx("video",{src:x.src,style:J.mediaVideo,controls:!0,loop:x.kind==="gif",muted:x.kind==="gif",autoPlay:x.kind==="gif"})},N)),(e.retweet_count>0||e.favorite_count>0)&&s.jsxs("div",{style:J.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 Wm({archiveId:e,entryUid:t,artifacts:n,entityKind:r,fullPage:l,onXArticle:i}){const[a,u]=f.useState(!0),[o,c]=f.useState(null),[g,m]=f.useState([]);if(f.useEffect(()=>{if(u(!0),c(null),m([]),!n||!e||!t){u(!1);return}const w=n.map((j,p)=>({...j,index:p})).filter(j=>j.artifact_role==="raw_tweet_json");if(w.length===0){c("No tweet data found."),u(!1);return}let k=!1;return wh(e,t,w.map(j=>j.index)).then(async j=>{if(k)return;const p=/https?:\/\/t\.co\/[A-Za-z0-9]+/g,d=C=>{var D;const S=C.full_text||"";return(((D=C.entities)==null?void 0:D.urls)||[]).map(L=>{var U;if(L.fromIndex!=null&&L.toIndex!=null)return[L.fromIndex,L.toIndex];if(((U=L.indices)==null?void 0:U.length)===2)return[L.indices[0],L.indices[1]];if(L.url){const F=S.indexOf(L.url);if(F!==-1)return[F,F+L.url.length]}return null}).filter(Boolean)},v=(C,S,D)=>C.some(([L,U])=>L<=S&&U>=D),x=new Set;for(const C of j){const S=C.full_text||"",D=d(C);let L;for(p.lastIndex=0;(L=p.exec(S))!==null;)v(D,L.index,L.index+L[0].length)||x.add(L[0])}const N=x.size>0?await kh([...x]).catch(()=>({})):{},P=j.map(C=>{var F;const S=C.full_text||"",D=d(C),L=[];let U;for(p.lastIndex=0;(U=p.exec(S))!==null;){const W=U[0],Y=N[W];Y&&Y!==W&&!v(D,U.index,U.index+W.length)&&L.push({url:W,expanded_url:Y,display_url:(()=>{try{const ce=new URL(Y);return ce.hostname+(ce.pathname.length>1?"/…":"")}catch{return Y}})(),fromIndex:U.index,toIndex:U.index+W.length})}return L.length===0?C:{...C,entities:{...C.entities||{},urls:[...((F=C.entities)==null?void 0:F.urls)||[],...L]}}});k||m(P)}).catch(j=>{k||c(j.message||"Failed to load tweet.")}).finally(()=>{k||u(!1)}),()=>{k=!0}},[e,t,n]),a)return s.jsx("div",{style:J.loading,children:"Loading…"});if(o)return s.jsxs("div",{style:J.error,children:["Error: ",o]});if(g.length===0)return null;const h=Im(e,t,n);if(r==="tweet_thread")return s.jsx("div",{style:J.threadOuter,children:g.map((w,k)=>s.jsx(pu,{tweet:w,isInThread:!0,isLast:k===g.length-1,artifactMap:h},w.id||k))});const y=g[0];return y.is_article&&y.article?s.jsx(Hm,{article:y.article,tweetAuthor:y.author,artifactMap:h,fullPage:l,onXArticle:i}):s.jsx("div",{style:J.card,children:s.jsx(pu,{tweet:y,isInThread:!1,isLast:!0,artifactMap:h})})}const Vm=new Set(["mp4","webm","mov","mkv","avi","m4v","ogv"]),Qm=new Set(["mp3","ogg","m4a","opus","wav","flac","aac"]),Km=new Set(["jpg","jpeg","png","gif","webp","avif","svg","bmp"]);function Bd({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,u=i.entry_uid,o=i.entity_kind;if(o==="tweet"||o==="tweet_thread"){const y=s.jsx(Wm,{archiveId:e,entryUid:u,artifacts:a,entityKind:o,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,w)=>s.jsxs("li",{children:[y.artifact_role,": ",y.relpath]},w))})]});const g=a[c],m=`/api/archives/${e}/entries/${u}/artifacts/${c}`,h=g.relpath.split(".").pop().toLowerCase();return Vm.has(h)?s.jsx("div",{className:"preview-panel",children:s.jsx(Dm,{src:m})}):Qm.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||u}),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(cu,{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(cu,{src:m,type:"page",title:i.title,originalUrl:i.original_url})}):Km.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,w)=>s.jsxs("li",{children:[y.artifact_role,": ",y.relpath]},w))})]})}function Xm({archiveId:e,entry:t,detail:n,onClose:r}){var l,i;return f.useEffect(()=>{const a=u=>{u.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(Bd,{archiveId:e,entry:t,detail:n})})]})})}function hu(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 Jm({entry:e,src:t,archiveId:n,onClose:r}){const l=f.useRef(null),[i,a]=f.useState(!1),[u,o]=f.useState(0),[c,g]=f.useState(NaN),[m,h]=f.useState(1);f.useEffect(()=>{!l.current||!t||(l.current.load(),o(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 w(d){const v=l.current;if(!v||!isFinite(c))return;const x=Number(d.target.value);v.currentTime=x,o(x)}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 o(((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:vs(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:hu(u)}),s.jsx("input",{type:"range",min:0,max:isFinite(c)?c:0,step:.1,value:isFinite(u)?u:0,onChange:w,"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:hu(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 qm({archiveId:e,entryUid:t}){var h,y;const[n,r]=f.useState(null),[l,i]=f.useState(!0),[a,u]=f.useState(null),[o,c]=f.useState(!1);f.useEffect(()=>{if(!o)return;const w=document.documentElement,k=document.body,j=w.style.colorScheme,p=k.style.background;return w.style.colorScheme="dark",k.style.background="#000",()=>{w.style.colorScheme=j,k.style.background=p}},[o]),f.useEffect(()=>{c(!1),Ji(e,t).then(w=>{r(w),i(!1)}).catch(w=>{u((w==null?void 0:w.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:o?"#000":"var(--paper)",fontFamily:"var(--sans)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:o?"8px 12px":"10px 16px",borderBottom:o?"none":"1px solid var(--line)",flexShrink:0,position:o?"sticky":"relative",top:0,zIndex:20,background:o?"rgba(0,0,0,0.82)":"var(--paper-2)",backdropFilter:o?"blur(12px)":"none",WebkitBackdropFilter:o?"blur(12px)":"none"},children:[s.jsx("a",{href:"/",style:{color:o?"#1d9bf0":"var(--accent)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"← Archive"}),s.jsx("span",{style:{flex:1,fontSize:"14px",fontWeight:600,color:o?"#e7e9ea":"var(--ink)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g}),m&&s.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",style:{color:o?"#71767b":"var(--muted)",textDecoration:"none",fontSize:"13px",flexShrink:0},children:"Original ↗"})]}),s.jsxs("div",{style:o?{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(Bd,{archiveId:e,entry:n.summary,detail:n,fullPage:!0,onXArticle:c})]})]})}const Ym=7e3;function Gm({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(eg,{toast:r,onDismiss:t,onIgnoreUblock:n},r.id))}):null}function Zm(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 eg({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 o=setTimeout(()=>t(e.id),Ym);return()=>clearTimeout(o)},[r,e.id,t]);const u=Zm(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"}),u&&s.jsx("span",{className:"toast-locator",title:e.locator,children:u})]}),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"}),u&&s.jsx("span",{className:"toast-locator",title:e.locator,children:u})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(o=>!o),"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"}),u&&s.jsx("span",{className:"toast-locator",title:e.locator,children:u})]}),s.jsxs("div",{className:"toast-btns",children:[e.text&&s.jsx("button",{type:"button",className:"toast-view-btn",onClick:()=>l(o=>!o),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 ys=f.createContext(null),cr=(()=>{const e=window.location.pathname.match(/^\/preview\/([^/]+)\/([^/]+)/);return e?{archiveId:e[1],entryUid:e[2]}:null})(),tg=["archive","tags","collections","runs","admin","settings"],ng=["profile","tokens","instance","cookies","extensions","storage"];function nn(){const e=window.location.pathname.split("/").filter(Boolean),t=tg.includes(e[0])?e[0]:"archive",n=t==="settings"&&ng.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 rg(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function lg(){const[e,t]=f.useState("loading"),[n,r]=f.useState(null);f.useEffect(()=>{(async()=>{if(await bh()){t("setup");return}const I=await Dh();if(!I){t("login");return}r(I),t("authenticated")})()},[]),f.useEffect(()=>{const _=()=>{r(null),t("login")};return window.addEventListener("auth:expired",_),()=>window.removeEventListener("auth:expired",_)},[]),f.useEffect(()=>{const _=()=>{const{view:I,settingsTab:Q,q:ne,tag:De,entry:lt}=nn();v(I),N(Q),C(ne),p(De),m(lt),y(null),k(lt?new Set([lt]):new Set)};return window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)},[]);const[l,i]=f.useState([]),[a,u]=f.useState(null),[o,c]=f.useState([]),[g,m]=f.useState(()=>nn().entry),[h,y]=f.useState(null),[w,k]=f.useState(()=>{const _=nn().entry;return _?new Set([_]):new Set}),[j,p]=f.useState(()=>nn().tag),[d,v]=f.useState(()=>nn().view),[x,N]=f.useState(()=>nn().settingsTab),[P,C]=f.useState(()=>nn().q),[S,D]=f.useState(""),[L,U]=f.useState(!1),[F,W]=f.useState([]),[Y,ce]=f.useState([]),[ie,ee]=f.useState(()=>sessionStorage.getItem("captureDialogOpen")==="true"),[R,T]=f.useState([]),M=f.useRef(0),[q,A]=f.useState(()=>{try{const _=JSON.parse(sessionStorage.getItem("pendingCaptures")||"[]");if(Array.isArray(_))return _}catch{}return[]});f.useEffect(()=>{sessionStorage.setItem("pendingCaptures",JSON.stringify(q))},[q]);const[ge,de]=f.useState(()=>sessionStorage.getItem("ublockWarningIgnored")==="true"),[Re,we]=f.useState(null),Se=f.useRef(0),E=f.useRef(null),H=f.useRef(!1),K=f.useRef(!0),V=f.useRef(null),X=(n==null?void 0:n.humanize_slugs)??!1;f.useEffect(()=>{const _=++Se.current;we(null),!(!h||!a)&&Ji(a,h.entry_uid).then(I=>{_===Se.current&&we(I)}).catch(()=>{})},[h,a]),f.useEffect(()=>{sessionStorage.setItem("captureDialogOpen",ie)},[ie]);const b=f.useCallback(async(_,I,Q)=>{if(_){U(!0);try{let ne;I||Q?ne=await yh(_,I,Q):ne=await vh(_),c(ne),k(De=>{if(De.size<2)return De;const lt=new Set(ne.map(kn=>kn.entry_uid)),Zn=new Set([...De].filter(kn=>lt.has(kn)));return Zn.size===De.size?De:Zn}),D(ne.length===0?"No results":`${ne.length} result${ne.length===1?"":"s"}`)}catch{c([]),D("Search failed. Try again.")}finally{U(!1)}}},[]);f.useEffect(()=>{e==="authenticated"&&gh().then(_=>{if(i(_),_.length>0){const I=_[0].id;u(I)}})},[e]),f.useEffect(()=>{if(a){if(K.current){K.current=!1,Promise.all([Zs(a).then(W),gl(a).then(ce)]);return}p(null),y(null),m(null),k(new Set),Promise.all([b(a,"",null),Zs(a).then(W),gl(a).then(ce)])}},[a]),f.useEffect(()=>{if(a===null)return;const _=setTimeout(()=>{b(a,P,j)},300);return()=>clearTimeout(_)},[P,a]),f.useEffect(()=>{a!==null&&(j!==null&&v("archive"),b(a,P,j))},[j,a]);const B=f.useCallback(_=>{u(_)},[]),re=f.useCallback(_=>{v(_),_==="tags"&&a&&gl(a).then(ce)},[a]);f.useEffect(()=>{if(cr)return;const _=rg(d,x);window.location.pathname!==_&&history.pushState(null,"",_+window.location.search)},[d,x]);const le=f.useCallback(_=>{m(_?_.entry_uid:null),y(_)},[]),rt=f.useCallback((_,I)=>{if(I.shiftKey&&V.current!==null){I.preventDefault();const Q=o.findIndex(er=>er.entry_uid===V.current),ne=o.findIndex(er=>er.entry_uid===_.entry_uid);if(Q===-1||ne===-1){V.current=_.entry_uid,k(new Set([_.entry_uid])),le(_);return}const De=Math.min(Q,ne),lt=Math.max(Q,ne),Zn=o.slice(De,lt+1),kn=new Set(Zn.map(er=>er.entry_uid));k(kn),kn.size===1&&le(Zn[0])}else I.ctrlKey||I.metaKey?(V.current=_.entry_uid,k(Q=>{const ne=new Set(Q);return ne.has(_.entry_uid)?ne.delete(_.entry_uid):ne.add(_.entry_uid),ne})):(V.current=_.entry_uid,k(new Set([_.entry_uid])),le(_))},[o,le]),Fe=f.useCallback(_=>{p(_)},[]),ve=f.useCallback(()=>{p(null)},[]),tn=f.useCallback(()=>{a&&gl(a).then(ce)},[a]),qe=f.useCallback((_,I)=>{j===_?p(I):j!=null&&j.startsWith(_+"/")&&p(I+j.slice(_.length))},[j]),xs=f.useCallback(_=>{(j===_||j!=null&&j.startsWith(_+"/"))&&p(null)},[j]),ws=f.useCallback((_,I)=>{c(Q=>Q.map(ne=>ne.entry_uid===_?{...ne,title:I}:ne)),y(Q=>Q&&Q.entry_uid===_?{...Q,title:I}:Q),we(Q=>Q&&Q.summary.entry_uid===_?{...Q,summary:{...Q.summary,title:I}}:Q)},[]),ks=f.useCallback(()=>{if(!a||!h)return;const _=++Se.current;Ji(a,h.entry_uid).then(I=>{_===Se.current&&we(I)}).catch(()=>{})},[a,h]),js=f.useCallback(_=>{c(I=>I.filter(Q=>Q.entry_uid!==_)),y(I=>(I==null?void 0:I.entry_uid)===_?null:I),m(I=>I===_?null:I),k(I=>{const Q=new Set(I);return Q.delete(_),Q})},[]),Ss=f.useCallback(_=>{c(I=>I.filter(Q=>!_.has(Q.entry_uid))),k(new Set),y(null),m(null)},[]);f.useEffect(()=>{if(w.size>=2)m(null),y(null);else if(w.size===1){const[_]=w;m(_)}else m(null),y(null)},[w]);const Ns=f.useMemo(()=>o.filter(_=>w.has(_.entry_uid)),[o,w]);f.useEffect(()=>{if(!g||h)return;const _=o.find(I=>I.entry_uid===g);_&&y(_)},[o,g,h]),f.useEffect(()=>{if(cr)return;const _=new URLSearchParams;P&&_.set("q",P),d==="archive"&&j&&_.set("tag",j),d==="archive"&&g&&_.set("entry",g);const I=_.toString(),Q=window.location.pathname+(I?"?"+I:"");window.location.pathname+window.location.search!==Q&&history.replaceState(null,"",Q)},[P,j,g,d]),f.useEffect(()=>{const _=I=>{var Q,ne;(I.metaKey||I.ctrlKey)&&I.key==="k"&&(I.preventDefault(),d==="archive"?((Q=E.current)==null||Q.focus(),(ne=E.current)==null||ne.select()):(H.current=!0,v("archive")))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]),f.useEffect(()=>{d==="archive"&&H.current&&(H.current=!1,requestAnimationFrame(()=>{var _,I;(_=E.current)==null||_.focus(),(I=E.current)==null||I.select()}))},[d]);const yn=f.useCallback(()=>{ee(!0)},[]),xn=f.useCallback(()=>{ee(!1)},[]),Xr=f.useCallback(()=>{if(a)return Promise.allSettled([b(a,P,j),Zs(a).then(W)])},[a,P,j,b]),Jr=f.useCallback((_,I,Q="error",ne=null)=>{if(Q==="warning"&&ge&&I)return;const De=++M.current;T(lt=>[...lt,{id:De,text:_,locator:I,type:Q,headline:ne}])},[ge]),_s=f.useCallback(_=>{T(I=>I.filter(Q=>Q.id!==_))},[]),Cs=f.useCallback(()=>{sessionStorage.setItem("ublockWarningIgnored","true"),de(!0),T(_=>_.filter(I=>!(I.type==="warning"&&I.locator)))},[]),qr=f.useCallback(_=>{A(I=>[...I,_])},[]),$=f.useCallback(_=>{A(I=>I.filter(Q=>Q.id!==_))},[]),[te,Ae]=f.useState(null),[dt,wn]=f.useState(null),Yr=f.useCallback(()=>{h&&Ae(h.entry_uid)},[h]),Ne=f.useCallback(()=>Ae(null),[]),Gn=f.useCallback((_,I)=>{wn({src:_,entry:I})},[]),Hd=f.useCallback(()=>wn(null),[]);return f.useEffect(()=>{Ae(null)},[h]),f.useEffect(()=>{const _=I=>{var ne,De,lt;if(I.key!=="Escape"||ie||te)return;const Q=(ne=document.activeElement)==null?void 0:ne.tagName;Q==="INPUT"||Q==="TEXTAREA"||Q==="SELECT"||w.size>0&&(I.preventDefault(),k(new Set),(lt=(De=document.activeElement)==null?void 0:De.blur)==null||lt.call(De))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[ie,te,w]),f.useEffect(()=>(document.body.classList.toggle("has-audio-bar",!!dt),()=>document.body.classList.remove("has-audio-bar")),[dt]),e==="loading"?s.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?s.jsx(am,{onComplete:()=>t("login")}):e==="login"?s.jsx(im,{onLogin:_=>{r(_),t("authenticated")}}):cr?s.jsx(qm,{archiveId:cr.archiveId,entryUid:cr.entryUid}):s.jsx(ys.Provider,{value:{currentUser:n,setCurrentUser:r},children:s.jsxs(s.Fragment,{children:[s.jsx(om,{archives:l,archiveId:a,onArchiveChange:B,view:d,onViewChange:re,onCaptureClick:yn}),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:E,className:"search-input",type:"search","aria-label":"Search archive","aria-busy":L,placeholder:"Search titles, URLs, types, tags…",value:P,onChange:_=>C(_.target.value)}),s.jsx("span",{className:"kbd",children:"⌘K"})]}),s.jsxs("span",{className:"result-count",children:[S&&s.jsxs(s.Fragment,{children:[s.jsx("b",{children:S.split(" ")[0]})," ",S.split(" ").slice(1).join(" ")]}),j&&s.jsxs("button",{className:"tag-filter-badge",onClick:ve,children:["× ",X?zd(j):j]})]})]}),d==="archive"&&s.jsx(mm,{entries:o,selectedUids:w,onRowClick:rt,archiveId:a,pendingCaptures:q}),d==="runs"&&s.jsx(ym,{runs:F}),d==="admin"&&s.jsx(wm,{archives:l}),d==="tags"&&s.jsx(km,{archiveId:a,tagNodes:Y,tagFilter:j,onTagFilterSet:Fe,onViewChange:re,onTagRenamed:qe,onTagDeleted:xs,onTagsRefresh:tn,humanizeTags:X}),d==="collections"&&s.jsx(Sm,{archiveId:a}),d==="settings"&&s.jsx(_m,{tab:x,onTabChange:N,archiveId:a})]}),s.jsx(Rm,{archiveId:a,selectedEntry:h,selectedUids:w,selectedEntries:Ns,detail:Re,onTagFilterSet:Fe,tagNodes:Y,onTagsRefresh:tn,onEntryTitleChange:ws,onEntryDeleted:js,onBulkDeleted:Ss,humanizeTags:X,onDetailRefresh:ks,onOpenPreview:Yr,onPlay:Gn})]}),te&&h&&h.entry_uid===te&&s.jsx(Xm,{archiveId:a,entry:h,detail:Re,onClose:Ne}),dt&&s.jsx(Jm,{entry:dt.entry,src:dt.src,archiveId:a,onClose:Hd}),s.jsx(um,{open:ie,archiveId:a,onClose:xn,onCaptured:Xr,onToast:Jr,activeJobs:q,onJobStarted:qr,onJobSettled:$}),s.jsx(Gm,{toasts:R,onDismiss:_s,onIgnoreUblock:Cs})]})})}Ed(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(lg,{})}));
|