diff --git a/crates/archivr-server/static/assets/index-BEbGvi2K.js b/crates/archivr-server/static/assets/index-BEbGvi2K.js new file mode 100644 index 0000000..7859262 --- /dev/null +++ b/crates/archivr-server/static/assets/index-BEbGvi2K.js @@ -0,0 +1,40 @@ +(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 s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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 su={exports:{}},hl={},ou={exports:{}},M={};/** + * @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 cr=Symbol.for("react.element"),Ec=Symbol.for("react.portal"),_c=Symbol.for("react.fragment"),Pc=Symbol.for("react.strict_mode"),Tc=Symbol.for("react.profiler"),Lc=Symbol.for("react.provider"),zc=Symbol.for("react.context"),Rc=Symbol.for("react.forward_ref"),Oc=Symbol.for("react.suspense"),Dc=Symbol.for("react.memo"),Fc=Symbol.for("react.lazy"),Ks=Symbol.iterator;function Mc(e){return e===null||typeof e!="object"?null:(e=Ks&&e[Ks]||e["@@iterator"],typeof e=="function"?e:null)}var uu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},au=Object.assign,cu={};function kn(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||uu}kn.prototype.isReactComponent={};kn.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")};kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function du(){}du.prototype=kn.prototype;function qi(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||uu}var bi=qi.prototype=new du;bi.constructor=qi;au(bi,kn.prototype);bi.isPureReactComponent=!0;var Ys=Array.isArray,fu=Object.prototype.hasOwnProperty,es={current:null},pu={key:!0,ref:!0,__self:!0,__source:!0};function hu(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)fu.call(t,r)&&!pu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,O=E[I];if(0>>1;Il(Ge,R))Dl(re,Ge)?(E[I]=re,E[D]=R,I=D):(E[I]=Ge,E[oe]=R,I=oe);else if(Dl(re,R))E[I]=re,E[D]=R,I=D;else break e}}return k}function l(E,k){var R=E.sortIndex-k.sortIndex;return R!==0?R:E.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],d=[],v=1,m=null,h=3,w=!1,x=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(E){for(var k=n(d);k!==null;){if(k.callback===null)r(d);else if(k.startTime<=E)r(d),k.sortIndex=k.expirationTime,t(a,k);else break;k=n(d)}}function g(E){if(S=!1,f(E),!x)if(n(a)!==null)x=!0,xe(j);else{var k=n(d);k!==null&&Ue(g,k.startTime-E)}}function j(E,k){x=!1,S&&(S=!1,p(z),z=-1),w=!0;var R=h;try{for(f(k),m=n(a);m!==null&&(!(m.expirationTime>k)||E&&!Z());){var I=m.callback;if(typeof I=="function"){m.callback=null,h=m.priorityLevel;var O=I(m.expirationTime<=k);k=e.unstable_now(),typeof O=="function"?m.callback=O:m===n(a)&&r(a),f(k)}else r(a);m=n(a)}if(m!==null)var pe=!0;else{var oe=n(d);oe!==null&&Ue(g,oe.startTime-k),pe=!1}return pe}finally{m=null,h=R,w=!1}}var _=!1,T=null,z=-1,A=5,F=-1;function Z(){return!(e.unstable_now()-FE||125I?(E.sortIndex=R,t(d,E),n(a)===null&&E===n(d)&&(S?(p(z),z=-1):S=!0,Ue(g,R-I))):(E.sortIndex=O,t(a,E),x||w||(x=!0,xe(j))),E},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(E){var k=h;return function(){var R=h;h=k;try{return E.apply(this,arguments)}finally{h=R}}}})(wu);yu.exports=wu;var Yc=yu.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 Xc=y,Te=Yc;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),si=Object.prototype.hasOwnProperty,Gc=/^[: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]*$/,Gs={},Js={};function Jc(e){return si.call(Js,e)?!0:si.call(Gs,e)?!1:Gc.test(e)?Js[e]=!0:(Gs[e]=!0,!1)}function Zc(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 qc(e,t,n,r){if(t===null||typeof t>"u"||Zc(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 ge(e,t,n,r,l,i,s){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=s}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new ge(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new ge(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new ge(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new ge(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){se[e]=new ge(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new ge(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new ge(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new ge(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new ge(e,5,!1,e.toLowerCase(),null,!1,!1)});var ns=/[\-:]([a-z])/g;function rs(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(ns,rs);se[t]=new ge(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(ns,rs);se[t]=new ge(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(ns,rs);se[t]=new ge(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new ge("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!0,!0)});function ls(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2u||l[s]!==i[u]){var a=` +`+l[s].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Ol=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?On(e):""}function bc(e){switch(e.tag){case 5:return On(e.type);case 16:return On("Lazy");case 13:return On("Suspense");case 19:return On("SuspenseList");case 0:case 2:case 15:return e=Dl(e.type,!1),e;case 11:return e=Dl(e.type.render,!1),e;case 1:return e=Dl(e.type,!0),e;default:return""}}function ci(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 Zt:return"Fragment";case Jt:return"Portal";case oi:return"Profiler";case is:return"StrictMode";case ui:return"Suspense";case ai:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ku:return(e.displayName||"Context")+".Consumer";case Su:return(e._context.displayName||"Context")+".Provider";case ss:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case os:return t=e.displayName||null,t!==null?t:ci(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return ci(e(t))}catch{}}return null}function ed(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 ci(t);case 8:return t===is?"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 _t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ju(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function td(e){var t=ju(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(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gr(e){e._valueTracker||(e._valueTracker=td(e))}function Cu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ju(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wr(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 di(e,t){var n=t.checked;return X({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_t(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 Eu(e,t){t=t.checked,t!=null&&ls(e,"checked",t,!1)}function fi(e,t){Eu(e,t);var n=_t(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")?pi(e,t.type,n):t.hasOwnProperty("defaultValue")&&pi(e,t.type,_t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function bs(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 pi(e,t,n){(t!=="number"||Wr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={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},nd=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){nd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Lu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function zu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Lu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rd=X({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 vi(e,t){if(t){if(rd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function gi(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 yi=null;function us(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wi=null,cn=null,dn=null;function no(e){if(e=pr(e)){if(typeof wi!="function")throw Error(N(280));var t=e.stateNode;t&&(t=wl(t),wi(e.stateNode,e.type,t))}}function Ru(e){cn?dn?dn.push(e):dn=[e]:cn=e}function Ou(){if(cn){var e=cn,t=dn;if(dn=cn=null,no(e),t)for(e=0;e>>=0,e===0?32:31-(hd(e)/md|0)|0}var wr=64,xr=4194304;function Fn(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 Xr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var u=s&~l;u!==0?r=Fn(u):(i&=s,i!==0&&(r=Fn(i)))}else s=n&~l,s!==0?r=Fn(s):i!==0&&(r=Fn(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;0n;n++)t.push(e);return t}function dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qe(t),e[t]=n}function wd(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=An),fo=" ",po=!1;function bu(e,t){switch(e){case"keyup":return Yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ea(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qt=!1;function Gd(e,t){switch(e){case"compositionend":return ea(t);case"keypress":return t.which!==32?null:(po=!0,fo);case"textInput":return e=t.data,e===fo&&po?null:e;default:return null}}function Jd(e,t){if(qt)return e==="compositionend"||!vs&&bu(e,t)?(e=Zu(),Fr=ps=gt=null,qt=!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)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=go(n)}}function la(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?la(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ia(){for(var e=window,t=Wr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wr(e.document)}return t}function gs(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 sf(e){var t=ia(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&la(n.ownerDocument.documentElement,n)){if(r!==null&&gs(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=yo(n,i);var s=yo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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=document.documentMode,bt=null,Ci=null,Bn=null,Ei=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ei||bt==null||bt!==Wr(r)||(r=bt,"selectionStart"in r&&gs(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}),Bn&&er(Bn,r)||(Bn=r,r=Zr(Ci,"onSelect"),0nn||(e.current=Ri[nn],Ri[nn]=null,nn--)}function B(e,t){nn++,Ri[nn]=e.current,e.current=t}var Pt={},de=Lt(Pt),Ne=Lt(!1),Vt=Pt;function vn(e,t){var n=e.type.contextTypes;if(!n)return Pt;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 je(e){return e=e.childContextTypes,e!=null}function br(){W(Ne),W(de)}function Eo(e,t,n){if(de.current!==Pt)throw Error(N(168));B(de,t),B(Ne,n)}function ha(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(N(108,ed(e)||"Unknown",l));return X({},n,r)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pt,Vt=de.current,B(de,e),B(Ne,Ne.current),!0}function _o(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=ha(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,W(Ne),W(de),B(de,e)):W(Ne),B(Ne,n)}var nt=null,xl=!1,Xl=!1;function ma(e){nt===null?nt=[e]:nt.push(e)}function yf(e){xl=!0,ma(e)}function zt(){if(!Xl&&nt!==null){Xl=!0;var e=0,t=V;try{var n=nt;for(V=1;e>=s,l-=s,rt=1<<32-Qe(t)+l|n<z?(A=T,T=null):A=T.sibling;var F=h(p,T,f[z],g);if(F===null){T===null&&(T=A);break}e&&T&&F.alternate===null&&t(p,T),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F,T=A}if(z===f.length)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;zz?(A=T,T=null):A=T.sibling;var Z=h(p,T,F.value,g);if(Z===null){T===null&&(T=A);break}e&&T&&Z.alternate===null&&t(p,T),c=i(Z,c,z),_===null?j=Z:_.sibling=Z,_=Z,T=A}if(F.done)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;!F.done;z++,F=f.next())F=m(p,F.value,g),F!==null&&(c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return Q&&Ot(p,z),j}for(T=r(p,T);!F.done;z++,F=f.next())F=w(T,p,z,F.value,g),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?z:F.key),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return e&&T.forEach(function(we){return t(p,we)}),Q&&Ot(p,z),j}function C(p,c,f,g){if(typeof f=="object"&&f!==null&&f.type===Zt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case vr:e:{for(var j=f.key,_=c;_!==null;){if(_.key===j){if(j=f.type,j===Zt){if(_.tag===7){n(p,_.sibling),c=l(_,f.props.children),c.return=p,p=c;break e}}else if(_.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===pt&&Lo(j)===_.type){n(p,_.sibling),c=l(_,f.props),c.ref=Ln(p,_,f),c.return=p,p=c;break e}n(p,_);break}else t(p,_);_=_.sibling}f.type===Zt?(c=At(f.props.children,p.mode,g,f.key),c.return=p,p=c):(g=Hr(f.type,f.key,f.props,null,p.mode,g),g.ref=Ln(p,c,f),g.return=p,p=g)}return s(p);case Jt:e:{for(_=f.key;c!==null;){if(c.key===_)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(p,c.sibling),c=l(c,f.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=ni(f,p.mode,g),c.return=p,p=c}return s(p);case pt:return _=f._init,C(p,c,_(f._payload),g)}if(Dn(f))return x(p,c,f,g);if(Cn(f))return S(p,c,f,g);_r(p,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(p,c.sibling),c=l(c,f),c.return=p,p=c):(n(p,c),c=ti(f,p.mode,g),c.return=p,p=c),s(p)):n(p,c)}return C}var yn=wa(!0),xa=wa(!1),rl=Lt(null),ll=null,sn=null,Ss=null;function ks(){Ss=sn=ll=null}function Ns(e){var t=rl.current;W(rl),e._currentValue=t}function Fi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pn(e,t){ll=e,Ss=sn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ke=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(Ss!==e)if(e={context:e,memoizedValue:t,next:null},sn===null){if(ll===null)throw Error(N(308));sn=e,ll.dependencies={lanes:0,firstContext:e}}else sn=sn.next=e;return t}var Mt=null;function js(e){Mt===null?Mt=[e]:Mt.push(e)}function Sa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,js(t)):(n.next=l.next,l.next=n),t.interleaved=n,ut(e,r)}function ut(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ht=!1;function Cs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ka(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 it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Nt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ut(e,n)}return l=r.interleaved,l===null?(t.next=t,js(r)):(t.next=l.next,l.next=t),r.interleaved=t,ut(e,n)}function $r(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,cs(e,n)}}function zo(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 s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,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 il(e,t,n,r){var l=e.updateQueue;ht=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,d=a.next;a.next=null,s===null?i=d:s.next=d,s=a;var v=e.alternate;v!==null&&(v=v.updateQueue,u=v.lastBaseUpdate,u!==s&&(u===null?v.firstBaseUpdate=d:u.next=d,v.lastBaseUpdate=a))}if(i!==null){var m=l.baseState;s=0,v=d=a=null,u=i;do{var h=u.lane,w=u.eventTime;if((r&h)===h){v!==null&&(v=v.next={eventTime:w,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var x=e,S=u;switch(h=t,w=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){m=x.call(w,m,h);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,m,h):x,h==null)break e;m=X({},m,h);break e;case 2:ht=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else w={eventTime:w,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},v===null?(d=v=w,a=m):v=v.next=w,s|=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(v===null&&(a=m),l.baseState=a,l.firstBaseUpdate=d,l.lastBaseUpdate=v,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Wt|=s,e.lanes=s,e.memoizedState=m}}function Ro(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Jl.transition;Jl.transition={};try{e(!1),t()}finally{V=n,Jl.transition=r}}function Ua(){return Ie().memoizedState}function kf(e,t,n){var r=Ct(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Aa(e))Va(t,n);else if(n=Sa(e,t,n,r),n!==null){var l=me();Ke(n,e,r,l),Ba(n,t,r)}}function Nf(e,t,n){var r=Ct(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Aa(e))Va(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,u=i(s,n);if(l.hasEagerState=!0,l.eagerState=u,Ye(u,s)){var a=t.interleaved;a===null?(l.next=l,js(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Sa(e,t,l,r),n!==null&&(l=me(),Ke(n,e,r,l),Ba(n,t,r))}}function Aa(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function Va(e,t){Hn=ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ba(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cs(e,n)}}var ul={readContext:$e,useCallback:ue,useContext:ue,useEffect:ue,useImperativeHandle:ue,useInsertionEffect:ue,useLayoutEffect:ue,useMemo:ue,useReducer:ue,useRef:ue,useState:ue,useDebugValue:ue,useDeferredValue:ue,useTransition:ue,useMutableSource:ue,useSyncExternalStore:ue,useId:ue,unstable_isNewReconciler:!1},jf={readContext:$e,useCallback:function(e,t){return Ze().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Do,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ur(4194308,4,Da.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ur(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ur(4,2,e,t)},useMemo:function(e,t){var n=Ze();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ze();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=kf.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=Ze();return e={current:e},t.memoizedState=e},useState:Oo,useDebugValue:Os,useDeferredValue:function(e){return Ze().memoizedState=e},useTransition:function(){var e=Oo(!1),t=e[0];return e=Sf.bind(null,e[1]),Ze().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Y,l=Ze();if(Q){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Ht&30||Ea(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Do(Pa.bind(null,r,i,e),[e]),r.flags|=2048,ur(9,_a.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ze(),t=ne.identifierPrefix;if(Q){var n=lt,r=rt;n=(r&~(1<<32-Qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=sr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[qe]=t,e[rr]=r,qa(e,t,!1,!1),t.stateNode=e;e:{switch(s=gi(n,r),n){case"dialog":H("cancel",e),H("close",e),l=r;break;case"iframe":case"object":case"embed":H("load",e),l=r;break;case"video":case"audio":for(l=0;lSn&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304)}else{if(!r)if(e=sl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Q)return ae(t),null}else 2*J()-i.renderingStartTime>Sn&&n!==1073741824&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=J(),t.sibling=null,n=K.current,B(K,r?n&1|2:n&1),t):(ae(t),null);case 22:case 23:return Us(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ee&1073741824&&(ae(t),t.subtreeFlags&6&&(t.flags|=8192)):ae(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Rf(e,t){switch(ws(t),t.tag){case 1:return je(t.type)&&br(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(),W(Ne),W(de),Ps(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _s(t),null;case 13:if(W(K),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));gn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(K),null;case 4:return wn(),null;case 10:return Ns(t.type._context),null;case 22:case 23:return Us(),null;case 24:return null;default:return null}}var Tr=!1,ce=!1,Of=typeof WeakSet=="function"?WeakSet:Set,L=null;function on(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function Wi(e,t,n){try{n()}catch(r){G(e,t,r)}}var Qo=!1;function Df(e,t){if(_i=Gr,e=ia(),gs(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 s=0,u=-1,a=-1,d=0,v=0,m=e,h=null;t:for(;;){for(var w;m!==n||l!==0&&m.nodeType!==3||(u=s+l),m!==i||r!==0&&m.nodeType!==3||(a=s+r),m.nodeType===3&&(s+=m.nodeValue.length),(w=m.firstChild)!==null;)h=m,m=w;for(;;){if(m===e)break t;if(h===n&&++d===l&&(u=s),h===i&&++v===r&&(a=s),(w=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=w}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pi={focusedElem:e,selectionRange:n},Gr=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,C=x.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:Be(t.type,S),C);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(g){G(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return x=Qo,Qo=!1,x}function Wn(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&&Wi(t,n,i)}l=l.next}while(l!==r)}}function Nl(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 Qi(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 tc(e){var t=e.alternate;t!==null&&(e.alternate=null,tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qe],delete t[rr],delete t[zi],delete t[vf],delete t[gf])),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 nc(e){return e.tag===5||e.tag===3||e.tag===4}function Ko(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nc(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 Ki(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=qr));else if(r!==4&&(e=e.child,e!==null))for(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}function Yi(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(Yi(e,t,n),e=e.sibling;e!==null;)Yi(e,t,n),e=e.sibling}var le=null,He=!1;function ft(e,t,n){for(n=n.child;n!==null;)rc(e,t,n),n=n.sibling}function rc(e,t,n){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(ml,n)}catch{}switch(n.tag){case 5:ce||on(n,t);case 6:var r=le,l=He;le=null,ft(e,t,n),le=r,He=l,le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):le.removeChild(n.stateNode));break;case 18:le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?Yl(e.parentNode,n):e.nodeType===1&&Yl(e,n),qn(e)):Yl(le,n.stateNode));break;case 4:r=le,l=He,le=n.stateNode.containerInfo,He=!0,ft(e,t,n),le=r,He=l;break;case 0:case 11:case 14:case 15:if(!ce&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Wi(n,t,s),l=l.next}while(l!==r)}ft(e,t,n);break;case 1:if(!ce&&(on(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){G(n,t,u)}ft(e,t,n);break;case 21:ft(e,t,n);break;case 22:n.mode&1?(ce=(r=ce)||n.memoizedState!==null,ft(e,t,n),ce=r):ft(e,t,n);break;default:ft(e,t,n)}}function Yo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Of),t.forEach(function(r){var l=Hf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ve(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mf(r/1960))-r,10e?16:e,yt===null)var r=!1;else{if(e=yt,yt=null,dl=0,$&6)throw Error(N(331));var l=$;for($|=4,L=e.current;L!==null;){var i=L,s=i.child;if(L.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aJ()-$s?Ut(e,0):Ms|=n),Ce(e,t)}function dc(e,t){t===0&&(e.mode&1?(t=xr,xr<<=1,!(xr&130023424)&&(xr=4194304)):t=1);var n=me();e=ut(e,t),e!==null&&(dr(e,t,n),Ce(e,n))}function Bf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dc(e,n)}function Hf(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(N(314))}r!==null&&r.delete(t),dc(e,n)}var fc;fc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ne.current)ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ke=!1,Lf(e,t,n);ke=!!(e.flags&131072)}else ke=!1,Q&&t.flags&1048576&&va(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ar(e,t),e=t.pendingProps;var l=vn(t,de.current);pn(t,n),l=Ls(null,t,r,e,l,n);var i=zs();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,je(r)?(i=!0,el(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Cs(t),l.updater=kl,t.stateNode=l,l._reactInternals=t,$i(t,r,e,n),t=Ai(null,t,r,!0,i,n)):(t.tag=0,Q&&i&&ys(t),he(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ar(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Qf(r),e=Be(r,e),l){case 0:t=Ui(null,t,r,e,n);break e;case 1:t=Bo(null,t,r,e,n);break e;case 11:t=Ao(null,t,r,e,n);break e;case 14:t=Vo(null,t,r,Be(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ui(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Bo(e,t,r,l,n);case 3:e:{if(Ga(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,ka(e,t),il(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=Ho(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=Ho(e,t,r,n,l);break e}else for(_e=kt(t.stateNode.containerInfo.firstChild),Pe=t,Q=!0,We=null,n=xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(gn(),r===l){t=at(e,t,n);break e}he(e,t,r,n)}t=t.child}return t;case 5:return Na(t),e===null&&Di(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ti(r,l)?s=null:i!==null&&Ti(r,i)&&(t.flags|=32),Xa(e,t),he(e,t,s,n),t.child;case 6:return e===null&&Di(t),null;case 13:return Ja(e,t,n);case 4:return Es(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=yn(t,null,r,n):he(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ao(e,t,r,l,n);case 7:return he(e,t,t.pendingProps,n),t.child;case 8:return he(e,t,t.pendingProps.children,n),t.child;case 12:return he(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,B(rl,r._currentValue),r._currentValue=s,i!==null)if(Ye(i.value,s)){if(i.children===l.children&&!Ne.current){t=at(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=it(-1,n&-n),a.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var v=d.pending;v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Fi(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Fi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}he(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,pn(t,n),l=$e(l),r=r(l),t.flags|=1,he(e,t,r,n),t.child;case 14:return r=t.type,l=Be(r,t.pendingProps),l=Be(r.type,l),Vo(e,t,r,l,n);case 15:return Ka(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ar(e,t),t.tag=1,je(r)?(e=!0,el(t)):e=!1,pn(t,n),Ha(t,r,l),$i(t,r,l,n),Ai(null,t,r,!0,e,n);case 19:return Za(e,t,n);case 22:return Ya(e,t,n)}throw Error(N(156,t.tag))};function pc(e,t){return Au(e,t)}function Wf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fe(e,t,n,r){return new Wf(e,t,n,r)}function Vs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qf(e){if(typeof e=="function")return Vs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ss)return 11;if(e===os)return 14}return 2}function Et(e,t){var n=e.alternate;return n===null?(n=Fe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Hr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Vs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return At(n.children,l,i,t);case is:s=8,l|=8;break;case oi:return e=Fe(12,n,t,l|2),e.elementType=oi,e.lanes=i,e;case ui:return e=Fe(13,n,t,l),e.elementType=ui,e.lanes=i,e;case ai:return e=Fe(19,n,t,l),e.elementType=ai,e.lanes=i,e;case Nu:return Cl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Su:s=10;break e;case ku:s=9;break e;case ss:s=11;break e;case os:s=14;break e;case pt:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Fe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function At(e,t,n,r){return e=Fe(7,e,r,t),e.lanes=n,e}function Cl(e,t,n,r){return e=Fe(22,e,r,t),e.elementType=Nu,e.lanes=n,e.stateNode={isHidden:!1},e}function ti(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function ni(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kf(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=Ml(0),this.expirationTimes=Ml(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ml(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bs(e,t,n,r,l,i,s,u,a){return e=new Kf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Fe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cs(i),e}function Yf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gc)}catch(e){console.error(e)}}gc(),gu.exports=Le;var qf=gu.exports,yc,tu=qf;yc=tu.createRoot,tu.hydrateRoot;async function ye(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function bf(){return ye("/api/archives")}async function ep(e){return ye(`/api/archives/${e}/entries`)}async function tp(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),ye(`/api/archives/${e}/entries/search?${r}`)}async function np(e,t){return ye(`/api/archives/${e}/entries/${t}`)}async function ri(e,t){return ye(`/api/archives/${e}/entries/${t}/tags`)}async function rp(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 lp(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 nu(e){return ye(`/api/archives/${e}/runs`)}async function li(e){return ye(`/api/archives/${e}/tags`)}async function ip(e,t){const n=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function sp(e,t){return ye(`/api/archives/${e}/capture_jobs/${t}`)}async function op(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function up(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 ap(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 cp(){await fetch("/api/auth/logout",{method:"POST"})}async function dp(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function fp(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 pp(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 hp(){return ye("/api/auth/tokens")}async function mp(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 vp(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function gp(){return ye("/api/admin/instance-settings")}async function yp(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 wp(){return ye("/api/admin/users")}async function xp(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 Sp(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 kp(){return ye("/api/admin/roles")}async function Np(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 jp(e){return ye(`/api/archives/${e}/collections`)}async function Cp(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 Ep(e,t){return ye(`/api/archives/${e}/collections/${t}`)}async function _p(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 Pp(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 Tp(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 Lp(e,t){return ye(`/api/archives/${e}/entries/${t}/collections`)}async function ru(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 zp(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)}}const Rp=window.fetch;window.fetch=async(...e)=>{var n;const t=await Rp(...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 Op({onLogin:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(null),[u,a]=y.useState(!1);async function d(v){v.preventDefault(),s(null),a(!0);try{const m=await ap(t,r);e(m)}catch(m){s(m.message)}finally{a(!1)}}return o.jsx("div",{className:"login-page",children:o.jsxs("div",{className:"login-card",children:[o.jsx("h1",{className:"login-brand",children:"Archivr"}),o.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),o.jsxs("form",{onSubmit:d,children:[o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),o.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:v=>n(v.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),o.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:v=>l(v.target.value),required:!0,autoComplete:"current-password"})]}),i&&o.jsx("p",{className:"login-error",children:i}),o.jsx("button",{className:"login-submit",type:"submit",disabled:u,children:u?"Signing in…":"Sign in"})]})]})})}function Dp({onComplete:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1);async function m(h){if(h.preventDefault(),r!==i){a("Passwords do not match");return}if(r.length<8){a("Password must be at least 8 characters");return}a(null),v(!0);try{await up(t,r),e()}catch(w){a(w.message)}finally{v(!1)}}return o.jsx("div",{className:"setup-page",children:o.jsxs("div",{className:"setup-card",children:[o.jsx("h1",{className:"setup-brand",children:"Archivr"}),o.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),o.jsxs("form",{onSubmit:m,children:[o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),o.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:h=>n(h.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),o.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:h=>l(h.target.value),required:!0,autoComplete:"new-password"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),o.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:h=>s(h.target.value),required:!0,autoComplete:"new-password"})]}),u&&o.jsx("p",{className:"setup-error",children:u}),o.jsx("button",{className:"setup-submit",type:"submit",disabled:d,children:d?"Creating account…":"Create account"})]})]})})}function Fp({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:s,setCurrentUser:u}=y.useContext(Ll)??{},[a,d]=y.useState(!1);async function v(){d(!0),await cp(),u(null),window.location.reload()}return o.jsxs("header",{className:"topbar",children:[o.jsx("div",{className:"brand",children:"Archivr"}),o.jsx("div",{className:"switcher",children:o.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>o.jsx("option",{value:m.id,children:m.label},m.id))})}),o.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","runs","admin","tags","collections","settings"].map(m=>o.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),o.jsx("button",{className:"capture-button",onClick:i,children:"+ Capture"}),s&&o.jsxs("div",{className:"user-menu",children:[o.jsx("span",{className:"user-name",children:s.display_name||s.username}),o.jsx("button",{className:"logout-btn",onClick:v,disabled:a,children:a?"Logging out…":"Log out"})]})]})}function Mp({open:e,archiveId:t,onClose:n,onCaptured:r}){const l=y.useRef(null),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1),[m,h]=y.useState(null),w=y.useRef(null);y.useEffect(()=>{const C=l.current;if(!C)return;const p=()=>{clearInterval(w.current),n()};return C.addEventListener("close",p),()=>C.removeEventListener("close",p)},[n]),y.useEffect(()=>{const C=l.current;C&&(e?(s(""),a(null),h(null),v(!1),clearInterval(w.current),C.open||C.showModal()):C.open&&C.close())},[e]);async function x(){if(!i.trim()){a("Enter a locator.");return}v(!0),a(null),h(null);try{const C=await ip(t,i.trim());h("running"),w.current=setInterval(async()=>{var p;try{const c=await sp(t,C.job_uid);c.status==="completed"?(clearInterval(w.current),w.current=null,v(!1),h("completed"),(p=l.current)==null||p.close(),r()):c.status==="failed"&&(clearInterval(w.current),w.current=null,v(!1),h("failed"),a(c.error_text||"Capture failed."))}catch(c){clearInterval(w.current),w.current=null,v(!1),a(c.message)}},500)}catch(C){a(C.message),v(!1)}}function S(){return d?m==="running"?"Running…":"Capturing…":"Capture"}return o.jsx("dialog",{ref:l,className:"capture-dialog",children:o.jsxs("div",{className:"capture-dialog-inner",children:[o.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),o.jsx("label",{htmlFor:"capture-locator",className:"capture-label",children:"Locator"}),o.jsx("input",{id:"capture-locator",className:"capture-input",type:"text",placeholder:"tweet:1234567890 or https://...",value:i,onChange:C=>s(C.target.value),onKeyDown:C=>{C.key==="Enter"&&x()},autoComplete:"off"}),u&&o.jsx("div",{className:"capture-error",children:u}),o.jsxs("div",{className:"capture-actions",children:[o.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var C;return(C=l.current)==null?void 0:C.close()},children:"Cancel"}),o.jsx("button",{type:"button",className:"capture-submit",onClick:x,disabled:d,children:S()})]})]})})}function wc(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&rString(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const lu={youtube:'',x:'',instagram:'',facebook:'',tiktok:'',reddit:'',snapchat:'',local:'',web:'',other:'?'};function Sc(e){return lu[e]??lu.other}function $p({entry:e,archiveId:t,isSelected:n,onSelect:r}){const[l,i]=y.useState(!1),u=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!l?o.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>i(!0),style:{objectFit:"contain"}}):o.jsx("span",{dangerouslySetInnerHTML:{__html:Sc(e.source_kind)}});return o.jsxs("div",{className:n?"is-selected":void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onClick:r,onKeyDown:a=>{a.key==="Enter"&&r()},children:[o.jsx("div",{className:"col-added",children:xc(e.archived_at)}),o.jsxs("div",{className:"col-title",children:[o.jsx("span",{className:"source-icon",children:u}),o.jsx("span",{className:"entry-title",children:It(e.title)||It(e.entry_uid)})]}),o.jsx("div",{className:"col-type",children:o.jsx("span",{className:"type-pill",children:It(e.entity_kind)})}),o.jsx("div",{className:"col-size",children:wc(e.total_artifact_bytes)}),o.jsx("div",{className:"url-cell col-url",children:It(e.original_url)})]})}function Ip({entries:e,selectedEntryUid:t,onSelectEntry:n,archiveId:r}){return o.jsx("section",{id:"archive-view",className:"view is-active",children:o.jsxs("div",{className:"entry-table",children:[o.jsxs("div",{className:"entry-header-row",children:[o.jsx("div",{className:"col-added",children:"Added"}),o.jsx("div",{className:"col-title",children:"Title"}),o.jsx("div",{className:"col-type",children:"Type"}),o.jsx("div",{className:"col-size",children:"Size"}),o.jsx("div",{className:"col-url",children:"Original URL"})]}),o.jsx("div",{id:"entries-body",children:e.map(l=>o.jsx($p,{entry:l,archiveId:r,isSelected:l.entry_uid===t,onSelect:()=>n(l)},l.entry_uid))})]})})}function Up(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 Ap({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="running"?"run-status--running":"";return o.jsx("span",{className:`run-status ${t}`,children:e||"—"})}function Vp({runs:e}){return o.jsx("section",{id:"runs-view",className:"view is-active",children:o.jsxs("table",{className:"entry-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Started"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Requested"}),o.jsx("th",{children:"Completed"}),o.jsx("th",{children:"Failed"})]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map((t,n)=>o.jsxs("tr",{children:[o.jsx("td",{children:Up(t.started_at)}),o.jsx("td",{children:o.jsx(Ap,{status:t.status})}),o.jsx("td",{children:t.requested_count??"—"}),o.jsx("td",{children:t.completed_count??"—"}),o.jsx("td",{children:t.failed_count??"—"})]},n))})]})})}const Bp=4;function Hp({archives:e}){const{currentUser:t}=y.useContext(Ll)??{},n=t&&(t.role_bits&Bp)!==0,[r,l]=y.useState("users"),[i,s]=y.useState([]),[u,a]=y.useState([]),[d,v]=y.useState(!1),[m,h]=y.useState(null),[w,x]=y.useState(""),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(null),[j,_]=y.useState(!1),[T,z]=y.useState(""),[A,F]=y.useState(""),[Z,we]=y.useState(null),[fe,Xe]=y.useState(!1),Re=y.useCallback(async()=>{if(n){v(!0),h(null);try{const[k,R]=await Promise.all([wp(),kp()]);s(k),a(R)}catch(k){h(k.message)}finally{v(!1)}}},[n]);y.useEffect(()=>{Re()},[Re]);async function xe(k){const R=k.status==="active"?"disabled":"active";try{await Sp(k.user_uid,R),s(I=>I.map(O=>O.user_uid===k.user_uid?{...O,status:R}:O))}catch(I){h(I.message)}}async function Ue(k){if(k.preventDefault(),!w.trim()||!S){g("Username and password required");return}_(!0),g(null);try{await xp(w.trim(),S,p.trim()||void 0),x(""),C(""),c(""),await Re()}catch(R){g(R.message)}finally{_(!1)}}async function E(k){if(k.preventDefault(),!T.trim()||!A.trim()){we("Slug and name required");return}Xe(!0),we(null);try{await Np(T.trim(),A.trim()),z(""),F(""),await Re()}catch(R){we(R.message)}finally{Xe(!1)}}return n?o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsxs("div",{className:"view-tabs",children:[o.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),o.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),o.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&o.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Users"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Username"}),o.jsx("th",{children:"Email"}),o.jsx("th",{children:"Roles"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Actions"})]})}),o.jsx("tbody",{children:i.map(k=>o.jsxs("tr",{className:k.status==="disabled"?"admin-row-disabled":"",children:[o.jsx("td",{children:k.username}),o.jsx("td",{className:"muted",children:k.email||"—"}),o.jsx("td",{children:k.role_slugs.join(", ")||"—"}),o.jsx("td",{children:o.jsx("span",{className:`status-badge status-${k.status}`,children:k.status})}),o.jsx("td",{children:o.jsx("button",{className:"admin-action-btn",onClick:()=>xe(k),children:k.status==="active"?"Ban":"Unban"})})]},k.user_uid))})]}),o.jsx("h3",{children:"Create User"}),o.jsxs("form",{className:"admin-form",onSubmit:Ue,children:[o.jsx("input",{className:"admin-input",placeholder:"Username",value:w,onChange:k=>x(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:S,onChange:k=>C(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:k=>c(k.target.value)}),f&&o.jsx("div",{className:"form-msg form-msg--err",children:f}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create User"})]})]}),r==="roles"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Roles"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Slug"}),o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Level"}),o.jsx("th",{children:"Bit"}),o.jsx("th",{children:"Built-in"})]})}),o.jsx("tbody",{children:u.map(k=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("code",{children:k.slug})}),o.jsx("td",{children:k.name}),o.jsx("td",{children:k.level}),o.jsx("td",{children:k.bit_position}),o.jsx("td",{children:k.is_builtin?"✓":""})]},k.role_uid))})]}),o.jsx("h3",{children:"Create Custom Role"}),o.jsxs("form",{className:"admin-form",onSubmit:E,children:[o.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:T,onChange:k=>z(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:A,onChange:k=>F(k.target.value),required:!0}),Z&&o.jsx("div",{className:"form-msg form-msg--err",children:Z}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:fe,children:fe?"Creating…":"Create Role"})]})]}),r==="archives"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})]}):o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})}function kc({node:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){var s;const l=t===e.tag.full_path;function i(){const u=l?null:e.tag.full_path;n(u),r("archive")}return o.jsxs("li",{children:[o.jsx("button",{className:`tag-node-btn${l?" is-active":""}`,title:e.tag.full_path,onClick:i,children:e.tag.name}),((s=e.children)==null?void 0:s.length)>0&&o.jsx("div",{className:"tag-children",children:o.jsx("ul",{className:"tag-tree-list",children:e.children.map(u=>o.jsx(kc,{node:u,tagFilter:t,onTagFilterSet:n,onViewChange:r},u.tag.tag_uid))})})]})}function Wp({tagNodes:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){return o.jsx("section",{id:"tags-view",className:"view is-active",children:o.jsxs("div",{className:"tag-tree",children:[o.jsxs("div",{className:"tag-tree-header",children:[o.jsx("span",{className:"tag-tree-title",children:"Tags"}),t&&o.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",t]})]}),e.length===0?o.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):o.jsx("ul",{className:"tag-tree-list",children:e.map(l=>o.jsx(kc,{node:l,tagFilter:t,onTagFilterSet:n,onViewChange:r},l.tag.tag_uid))})]})})}const $n=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],Qp=e=>{var t;return((t=$n.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Kp({archiveId:e}){const[t,n]=y.useState([]),[r,l]=y.useState(!1),[i,s]=y.useState(null),[u,a]=y.useState(null),[d,v]=y.useState(null),[m,h]=y.useState(!1),[w,x]=y.useState(null),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(2),[j,_]=y.useState(!1),[T,z]=y.useState(null),[A,F]=y.useState(""),[Z,we]=y.useState(2),[fe,Xe]=y.useState(!1),[Re,xe]=y.useState(null),[Ue,E]=y.useState(!1),[k,R]=y.useState(""),I=y.useRef(null),O=t.find(P=>P.collection_uid===u)??null,pe=(O==null?void 0:O.slug)==="_default_",oe=y.useCallback(async()=>{if(e){l(!0),s(null);try{const P=await jp(e);n(P)}catch(P){s(P.message)}finally{l(!1)}}},[e]),Ge=y.useCallback(async P=>{if(!P){v(null);return}h(!0),x(null);try{const U=await Ep(e,P);v(U)}catch(U){x(U.message)}finally{h(!1)}},[e]);y.useEffect(()=>{oe()},[oe]),y.useEffect(()=>{Ge(u)},[u,Ge]),y.useEffect(()=>{Ue&&I.current&&I.current.focus()},[Ue]);async function D(P){P.preventDefault();const U=S.trim(),Ae=p.trim();if(!(!U||!Ae)){_(!0),z(null);try{const Rt=await Cp(e,U,Ae,f);C(""),c(""),g(2),await oe(),a(Rt.collection_uid)}catch(Rt){z(Rt.message)}finally{_(!1)}}}async function re(){const P=k.trim();if(!P||!O){E(!1);return}try{await ru(e,O.collection_uid,{name:P}),await oe(),v(U=>U&&{...U,name:P})}catch(U){s(U.message)}finally{E(!1)}}async function Xt(P){if(O)try{await ru(e,O.collection_uid,{default_visibility_bits:P}),await oe(),v(U=>U&&{...U,default_visibility_bits:P})}catch(U){s(U.message)}}async function dt(){if(O&&window.confirm(`Delete collection "${O.name}"? Entries will not be deleted.`))try{await zp(e,O.collection_uid),a(null),v(null),await oe()}catch(P){s(P.message)}}async function Nc(P){P.preventDefault();const U=A.trim();if(!(!U||!O)){Xe(!0),xe(null);try{await _p(e,O.collection_uid,U,Z),F(""),await Ge(O.collection_uid)}catch(Ae){xe(Ae.message)}finally{Xe(!1)}}}async function jc(P){if(O)try{await Pp(e,O.collection_uid,P),await Ge(O.collection_uid)}catch(U){x(U.message)}}async function Cc(P,U){if(O)try{await Tp(e,O.collection_uid,P,U),v(Ae=>Ae&&{...Ae,entries:Ae.entries.map(Rt=>Rt.entry_uid===P?{...Rt,collection_visibility_bits:U}:Rt)})}catch(Ae){x(Ae.message)}}return e?o.jsxs("div",{className:"collections-view",children:[o.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&o.jsx("div",{className:"muted",children:"Loading…"}),i&&o.jsxs("div",{className:"collections-error",children:[i," ",o.jsx("button",{onClick:()=>s(null),className:"coll-dismiss",children:"×"})]}),o.jsxs("div",{className:"collections-layout",children:[o.jsxs("div",{className:"collections-sidebar",children:[t.map(P=>o.jsxs("button",{className:`coll-sidebar-row${u===P.collection_uid?" is-active":""}`,onClick:()=>a(P.collection_uid),children:[o.jsx("span",{className:"coll-row-name",children:P.name}),o.jsx("span",{className:"coll-row-meta",children:Qp(P.default_visibility_bits)})]},P.collection_uid)),t.length===0&&!r&&o.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),O?o.jsxs("div",{className:"coll-detail",children:[o.jsxs("div",{className:"coll-detail-header",children:[Ue?o.jsx("input",{ref:I,className:"coll-rename-input",value:k,onChange:P=>R(P.target.value),onBlur:re,onKeyDown:P=>{P.key==="Enter"&&re(),P.key==="Escape"&&E(!1)}}):o.jsxs("h3",{className:`coll-detail-name${pe?"":" coll-detail-name--editable"}`,title:pe?void 0:"Click to rename",onClick:()=>{pe||(R(O.name),E(!0))},children:[(d==null?void 0:d.name)??O.name,!pe&&o.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!pe&&o.jsx("button",{className:"coll-delete-btn",onClick:dt,title:"Delete collection",children:"Delete"})]}),o.jsxs("div",{className:"coll-detail-vis",children:[o.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),o.jsx("select",{className:"coll-vis-select",value:(d==null?void 0:d.default_visibility_bits)??O.default_visibility_bits,onChange:P=>Xt(Number(P.target.value)),disabled:pe,children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),o.jsxs("div",{className:"coll-entries-section",children:[o.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&o.jsx("div",{className:"muted",children:"Loading…"}),w&&o.jsx("div",{className:"collections-error",children:w}),!m&&d&&(d.entries.length===0?o.jsx("div",{className:"muted",children:"No entries in this collection."}):o.jsx("ul",{className:"coll-entries-list",children:d.entries.map(P=>o.jsxs("li",{className:"coll-entry-row",children:[o.jsxs("div",{className:"coll-entry-info",children:[o.jsx("span",{className:"coll-entry-title",children:P.title||P.entry_uid}),o.jsx("span",{className:"coll-entry-kind muted",children:P.source_kind})]}),o.jsxs("div",{className:"coll-entry-actions",children:[o.jsx("select",{className:"coll-entry-vis-select",value:P.collection_visibility_bits,onChange:U=>Cc(P.entry_uid,Number(U.target.value)),children:$n.map(U=>o.jsx("option",{value:U.value,children:U.label},U.value))}),!pe&&o.jsx("button",{className:"coll-entry-remove",onClick:()=>jc(P.entry_uid),title:"Remove from collection",children:"×"})]})]},P.entry_uid))}))]}),!pe&&o.jsxs("form",{className:"coll-add-entry-form",onSubmit:Nc,children:[o.jsx("div",{className:"coll-section-heading",children:"Add entry"}),o.jsxs("div",{className:"coll-add-entry-row",children:[o.jsx("input",{className:"coll-add-entry-input",type:"text",value:A,onChange:P=>F(P.target.value),placeholder:"entry_uid",required:!0}),o.jsx("select",{className:"coll-vis-select",value:Z,onChange:P=>we(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))}),o.jsx("button",{className:"coll-add-btn",type:"submit",disabled:fe,children:fe?"…":"Add"})]}),Re&&o.jsx("div",{className:"collections-error",style:{marginTop:4},children:Re})]})]}):o.jsx("div",{className:"coll-detail coll-detail--empty",children:o.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),o.jsxs("details",{className:"coll-create-details",children:[o.jsx("summary",{children:"+ Create collection"}),o.jsxs("form",{className:"coll-create-form",onSubmit:D,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),o.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:S,onChange:P=>{C(P.target.value),p||c(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),o.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:P=>c(P.target.value),placeholder:"my-collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),o.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:f,onChange:P=>g(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),T&&o.jsx("div",{className:"collections-error",children:T}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create collection"})]})]})]}):o.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Yp=4;function Xp({tab:e,onTabChange:t}){const{currentUser:n,setCurrentUser:r}=y.useContext(Ll)??{},l=n&&(n.role_bits&Yp)!==0,i=["profile","tokens",...l?["instance"]:[]],s={profile:"Profile",tokens:"API Tokens",instance:"Instance"};return o.jsxs("section",{className:"admin-view",children:[o.jsx("h1",{children:"Settings"}),o.jsx("div",{className:"view-tabs",children:i.map(u=>o.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:s[u]},u))}),e==="profile"&&o.jsx(Gp,{currentUser:n,setCurrentUser:r}),e==="tokens"&&o.jsx(Jp,{}),e==="instance"&&l&&o.jsx(Zp,{})]})}function Gp({currentUser:e,setCurrentUser:t}){const[n,r]=y.useState((e==null?void 0:e.display_name)??""),[l,i]=y.useState(!1),[s,u]=y.useState(null),[a,d]=y.useState(""),[v,m]=y.useState(""),[h,w]=y.useState(""),[x,S]=y.useState(!1),[C,p]=y.useState(null);async function c(g){g.preventDefault(),i(!0),u(null);try{await fp(n),t(j=>({...j,display_name:n||null})),u({ok:!0,text:"Saved."})}catch(j){u({ok:!1,text:j.message})}finally{i(!1)}}async function f(g){if(g.preventDefault(),v!==h){p({ok:!1,text:"Passwords do not match."});return}S(!0),p(null);try{await pp(a,v),d(""),m(""),w(""),p({ok:!0,text:"Password changed."})}catch(j){p({ok:!1,text:j.message})}finally{S(!1)}}return o.jsxs("div",{style:{maxWidth:440},children:[o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Display Name"}),o.jsxs("form",{onSubmit:c,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),o.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:g=>r(g.target.value)})]}),s&&o.jsx("div",{className:`form-msg form-msg--${s.ok?"ok":"err"}`,children:s.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Change Password"}),o.jsxs("form",{onSubmit:f,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),o.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:a,onChange:g=>d(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),o.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:v,onChange:g=>m(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),o.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:h,onChange:g=>w(g.target.value),required:!0})]}),C&&o.jsx("div",{className:`form-msg form-msg--${C.ok?"ok":"err"}`,children:C.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function Jp(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(""),[a,d]=y.useState(!1),[v,m]=y.useState(null),h=y.useCallback(async()=>{r(!0),i(null);try{t(await hp())}catch(S){i(S.message)}finally{r(!1)}},[]);y.useEffect(()=>{h()},[h]);async function w(S){if(S.preventDefault(),!!s.trim()){d(!0);try{const C=await mp(s.trim());m(C),u(""),h()}catch(C){i(C.message)}finally{d(!1)}}}async function x(S){try{await vp(S),t(C=>C.filter(p=>p.token_uid!==S))}catch(C){i(C.message)}}return o.jsx("div",{style:{maxWidth:600},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"API Tokens"}),v&&o.jsxs("div",{className:"token-banner",children:[o.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",o.jsx("code",{children:v.raw_token}),o.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),o.jsxs("form",{className:"token-create-row",onSubmit:w,children:[o.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:s,onChange:S=>u(S.target.value),required:!0}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Creating…":"Create token"})]}),l&&o.jsx("div",{className:"form-msg form-msg--err",children:l}),n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):o.jsxs("div",{children:[e.length===0&&o.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(S=>o.jsxs("div",{className:"token-row",children:[o.jsxs("div",{className:"token-row-info",children:[o.jsx("strong",{children:S.name}),o.jsxs("div",{className:"muted",children:["Created ",S.created_at.slice(0,10),S.last_used_at&&` · Last used ${S.last_used_at.slice(0,10)}`]})]}),o.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(S.token_uid),children:"Revoke"})]},S.token_uid))]})]})})}function Zp(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(!1),[a,d]=y.useState(null);y.useEffect(()=>{(async()=>{try{t(await gp())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function v(m){m.preventDefault(),u(!0),d(null);try{await yp(e),d({ok:!0,text:"Saved."})}catch(h){d({ok:!1,text:h.message})}finally{u(!1)}}return n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):l?o.jsx("div",{className:"form-msg form-msg--err",children:l}):e?o.jsx("div",{style:{maxWidth:440},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Instance Settings"}),o.jsxs("form",{onSubmit:v,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,h])=>o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:!!e[m],onChange:w=>t(x=>({...x,[m]:w.target.checked}))}),h]},m)),o.jsxs("div",{className:"form-field",style:{marginTop:4},children:[o.jsx("label",{className:"form-label",children:"Default entry visibility"}),o.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(h=>({...h,default_entry_visibility:Number(m.target.value)})),children:[o.jsx("option",{value:0,children:"Private"}),o.jsx("option",{value:2,children:"Unlisted"}),o.jsx("option",{value:3,children:"Public"})]})]}),a&&o.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:s,children:s?"Saving…":"Save Settings"})]})]})}):null}const iu={0:"Private",1:"Public",2:"Users only",3:"Public"},qp=()=>o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function bp({archiveId:e,selectedEntry:t,onTagFilterSet:n,tagNodes:r,onTagsRefresh:l}){const[i,s]=y.useState(null),[u,a]=y.useState([]),[d,v]=y.useState(""),[m,h]=y.useState([]),[w,x]=y.useState(""),S=y.useRef(0);y.useEffect(()=>{if(!t||!e){s(null),a([]),h([]);return}const f=++S.current;s(null),a([]),Promise.all([np(e,t.entry_uid),ri(e,t.entry_uid),Lp(e,t.entry_uid)]).then(([g,j,_])=>{f===S.current&&(s(g),a(j),h(_))}).catch(()=>{})},[t,e]);async function C(){const f=d.trim();if(!(!f||!t))try{await rp(e,t.entry_uid,f),v(""),x("");const g=await ri(e,t.entry_uid);a(g),l()}catch(g){x(g.message)}}async function p(f){try{await lp(e,t.entry_uid,f);const g=await ri(e,t.entry_uid);a(g),l()}catch{}}const c=i?[["Added",xc(i.summary.archived_at)],["Source",i.summary.source_kind],["Type",i.summary.entity_kind],["Visibility",iu[i.summary.visibility]??i.summary.visibility],["Root",i.structured_root_relpath]]:[];return o.jsxs("aside",{className:"context-rail",children:[o.jsx("div",{className:"rail-eyebrow",children:"Context"}),t?i?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"rail-title",children:It(i.summary.title)||It(i.summary.entry_uid)}),i.summary.original_url&&o.jsxs("a",{className:"url-tile",href:i.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Sc(i.summary.source_kind)}}),o.jsx("span",{className:"u-text",children:i.summary.original_url}),o.jsx("span",{className:"ext",children:o.jsx(qp,{})})]}),o.jsx("div",{className:"meta-list",children:c.filter(([,f])=>f!=null&&f!=="").map(([f,g])=>o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-k",children:f}),o.jsx("span",{className:`meta-v${f==="Root"?" mono":""}`,children:It(g)})]},f))}),i.artifacts.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",o.jsx("span",{className:"num",children:i.artifacts.length})]}),o.jsx("ul",{className:"artifact-list",children:i.artifacts.map((f,g)=>o.jsx("li",{children:o.jsxs("a",{href:`/api/archives/${e}/entries/${i.summary.entry_uid}/artifacts/${g}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[o.jsx("span",{className:"artifact-name",children:f.artifact_role.replace(/_/g," ")}),o.jsx("span",{className:"artifact-size",children:f.byte_size!=null?wc(f.byte_size):"—"})]})},g))})]})]}):o.jsx("p",{className:"tags-empty",children:"Loading…"}):o.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Tags"}),u.length===0?o.jsx("p",{className:"tags-empty",children:"No tags yet."}):o.jsx("div",{className:"tags-wrap",children:u.map(f=>o.jsxs("span",{className:"tag-pill",title:f.full_path,children:[f.name,o.jsx("button",{className:"remove",title:`Remove tag ${f.full_path}`,onClick:()=>p(f.tag_uid),children:"×"})]},f.tag_uid))}),w&&o.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:w}),o.jsxs("div",{className:"tag-input-wrap",children:[o.jsx("span",{className:"hash",children:"/"}),o.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:d,onChange:f=>v(f.target.value),onKeyDown:f=>{f.key==="Enter"&&C()}}),o.jsx("button",{className:"tag-add-btn",onClick:C,children:"Add"})]})]}),m.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Collections"}),m.map(f=>o.jsxs("div",{className:"coll-row",children:[o.jsx("span",{className:"coll-name",children:f.collection_uid}),o.jsx("span",{className:"vis-badge",children:iu[f.visibility_bits]??`bits:${f.visibility_bits}`})]},f.collection_uid))]})]})]})}const Ll=y.createContext(null),eh=["archive","runs","admin","tags","collections","settings"],th=["profile","tokens","instance"];function ii(){const e=window.location.pathname.split("/").filter(Boolean),t=eh.includes(e[0])?e[0]:"archive",n=t==="settings"&&th.includes(e[1])?e[1]:"profile";return{view:t,settingsTab:n}}function nh(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function rh(){const[e,t]=y.useState("loading"),[n,r]=y.useState(null);y.useEffect(()=>{(async()=>{if(await op()){t("setup");return}const re=await dp();if(!re){t("login");return}r(re),t("authenticated")})()},[]),y.useEffect(()=>{const D=()=>{r(null),t("login")};return window.addEventListener("auth:expired",D),()=>window.removeEventListener("auth:expired",D)},[]),y.useEffect(()=>{const D=()=>{const{view:re,settingsTab:Xt}=ii();p(re),f(Xt)};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]);const[l,i]=y.useState([]),[s,u]=y.useState(null),[a,d]=y.useState([]),[v,m]=y.useState(null),[h,w]=y.useState(null),[x,S]=y.useState(null),[C,p]=y.useState(()=>ii().view),[c,f]=y.useState(()=>ii().settingsTab),[g,j]=y.useState(""),[_,T]=y.useState(""),[z,A]=y.useState(!1),[F,Z]=y.useState([]),[we,fe]=y.useState([]),[Xe,Re]=y.useState(!1),xe=y.useCallback(async(D,re,Xt)=>{if(D){A(!0);try{let dt;re||Xt?dt=await tp(D,re,Xt):dt=await ep(D),d(dt),T(dt.length===0?"No results":`${dt.length} result${dt.length===1?"":"s"}`)}catch{d([]),T("Search failed. Try again.")}finally{A(!1)}}},[]);y.useEffect(()=>{e==="authenticated"&&bf().then(D=>{if(i(D),D.length>0){const re=D[0].id;u(re)}})},[e]),y.useEffect(()=>{s&&(S(null),w(null),m(null),Promise.all([xe(s,"",null),nu(s).then(Z),li(s).then(fe)]))},[s]),y.useEffect(()=>{if(s===null)return;const D=setTimeout(()=>{xe(s,g,x)},300);return()=>clearTimeout(D)},[g,s]),y.useEffect(()=>{s!==null&&(x!==null&&p("archive"),xe(s,g,x))},[x,s]);const Ue=y.useCallback(D=>{u(D)},[]),E=y.useCallback(D=>{p(D),D==="tags"&&s&&li(s).then(fe)},[s]);y.useEffect(()=>{const D=nh(C,c);window.location.pathname!==D&&history.pushState(null,"",D)},[C,c]);const k=y.useCallback(D=>{m(D?D.entry_uid:null),w(D)},[]),R=y.useCallback(D=>{S(D)},[]),I=y.useCallback(()=>{S(null)},[]),O=y.useCallback(()=>{s&&li(s).then(fe)},[s]),pe=y.useCallback(()=>{Re(!0)},[]),oe=y.useCallback(()=>{Re(!1)},[]),Ge=y.useCallback(()=>{s&&Promise.all([xe(s,g,x),nu(s).then(Z)])},[s,g,x,xe]);return e==="loading"?o.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?o.jsx(Dp,{onComplete:()=>t("login")}):e==="login"?o.jsx(Op,{onLogin:D=>{r(D),t("authenticated")}}):o.jsx(Ll.Provider,{value:{currentUser:n,setCurrentUser:r},children:o.jsxs(o.Fragment,{children:[o.jsx(Fp,{archives:l,archiveId:s,onArchiveChange:Ue,view:C,onViewChange:E,onCaptureClick:pe}),o.jsxs("main",{className:"app-shell",children:[o.jsxs("div",{className:"workspace",children:[C==="archive"&&o.jsxs("div",{className:"toolbar",children:[o.jsxs("div",{className:"search-field",children:[o.jsx("span",{className:"ico","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"7"}),o.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),o.jsx("input",{className:"search-input",type:"search","aria-label":"Search archive","aria-busy":z,placeholder:"Search titles, URLs, types, tags…",value:g,onChange:D=>j(D.target.value)}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsxs("span",{className:"result-count",children:[_&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:_.split(" ")[0]})," ",_.split(" ").slice(1).join(" ")]}),x&&o.jsxs("button",{className:"tag-filter-badge",onClick:I,children:["× ",x]})]})]}),C==="archive"&&o.jsx(Ip,{entries:a,selectedEntryUid:v,onSelectEntry:k,archiveId:s,tagFilter:x,onClearTagFilter:I,searchQuery:g,onSearchChange:j,resultCount:_,searchBusy:z}),C==="runs"&&o.jsx(Vp,{runs:F}),C==="admin"&&o.jsx(Hp,{archives:l}),C==="tags"&&o.jsx(Wp,{tagNodes:we,tagFilter:x,onTagFilterSet:R,onViewChange:E}),C==="collections"&&o.jsx(Kp,{archiveId:s}),C==="settings"&&o.jsx(Xp,{tab:c,onTabChange:f})]}),o.jsx(bp,{archiveId:s,selectedEntry:h,onTagFilterSet:R,tagNodes:we,onTagsRefresh:O})]}),o.jsx(Mp,{open:Xe,archiveId:s,onClose:oe,onCaptured:Ge})]})})}yc(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(rh,{})})); diff --git a/crates/archivr-server/static/assets/index-CbWD4KAy.js b/crates/archivr-server/static/assets/index-CbWD4KAy.js deleted file mode 100644 index 04d8937..0000000 --- a/crates/archivr-server/static/assets/index-CbWD4KAy.js +++ /dev/null @@ -1,40 +0,0 @@ -(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 s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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 ru={exports:{}},fl={},lu={exports:{}},M={};/** - * @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"),Cc=Symbol.for("react.portal"),Ec=Symbol.for("react.fragment"),_c=Symbol.for("react.strict_mode"),Pc=Symbol.for("react.profiler"),Tc=Symbol.for("react.provider"),Lc=Symbol.for("react.context"),zc=Symbol.for("react.forward_ref"),Rc=Symbol.for("react.suspense"),Oc=Symbol.for("react.memo"),Dc=Symbol.for("react.lazy"),Hs=Symbol.iterator;function Fc(e){return e===null||typeof e!="object"?null:(e=Hs&&e[Hs]||e["@@iterator"],typeof e=="function"?e:null)}var iu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},su=Object.assign,ou={};function xn(e,t,n){this.props=e,this.context=t,this.refs=ou,this.updater=n||iu}xn.prototype.isReactComponent={};xn.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")};xn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function uu(){}uu.prototype=xn.prototype;function Gi(e,t,n){this.props=e,this.context=t,this.refs=ou,this.updater=n||iu}var Ji=Gi.prototype=new uu;Ji.constructor=Gi;su(Ji,xn.prototype);Ji.isPureReactComponent=!0;var Ws=Array.isArray,au=Object.prototype.hasOwnProperty,Zi={current:null},cu={key:!0,ref:!0,__self:!0,__source:!0};function du(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)au.call(t,r)&&!cu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,O=E[A];if(0>>1;Al(se,R))Rel(we,se)?(E[A]=we,E[Re]=R,A=Re):(E[A]=se,E[F]=R,A=F);else if(Rel(we,R))E[A]=we,E[Re]=R,A=Re;else break e}}return k}function l(E,k){var R=E.sortIndex-k.sortIndex;return R!==0?R:E.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],d=[],v=1,m=null,h=3,w=!1,x=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(E){for(var k=n(d);k!==null;){if(k.callback===null)r(d);else if(k.startTime<=E)r(d),k.sortIndex=k.expirationTime,t(a,k);else break;k=n(d)}}function g(E){if(S=!1,f(E),!x)if(n(a)!==null)x=!0,Ae(j);else{var k=n(d);k!==null&&Ve(g,k.startTime-E)}}function j(E,k){x=!1,S&&(S=!1,p(z),z=-1),w=!0;var R=h;try{for(f(k),m=n(a);m!==null&&(!(m.expirationTime>k)||E&&!J());){var A=m.callback;if(typeof A=="function"){m.callback=null,h=m.priorityLevel;var O=A(m.expirationTime<=k);k=e.unstable_now(),typeof O=="function"?m.callback=O:m===n(a)&&r(a),f(k)}else r(a);m=n(a)}if(m!==null)var de=!0;else{var F=n(d);F!==null&&Ve(g,F.startTime-k),de=!1}return de}finally{m=null,h=R,w=!1}}var P=!1,T=null,z=-1,U=5,D=-1;function J(){return!(e.unstable_now()-DE||125A?(E.sortIndex=R,t(d,E),n(a)===null&&E===n(d)&&(S?(p(z),z=-1):S=!0,Ve(g,R-A))):(E.sortIndex=O,t(a,E),x||w||(x=!0,Ae(j))),E},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(E){var k=h;return function(){var R=h;h=k;try{return E.apply(this,arguments)}finally{h=R}}}})(vu);mu.exports=vu;var Kc=mu.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 Yc=y,Te=Kc;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ri=Object.prototype.hasOwnProperty,Xc=/^[: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]*$/,Ks={},Ys={};function Gc(e){return ri.call(Ys,e)?!0:ri.call(Ks,e)?!1:Xc.test(e)?Ys[e]=!0:(Ks[e]=!0,!1)}function Jc(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 Zc(e,t,n,r){if(t===null||typeof t>"u"||Jc(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function me(e,t,n,r,l,i,s){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=s}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new me(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new me(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new me(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new me(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new me(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new me(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new me(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new me(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new me(e,5,!1,e.toLowerCase(),null,!1,!1)});var bi=/[\-:]([a-z])/g;function es(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(bi,es);ie[t]=new me(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(bi,es);ie[t]=new me(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(bi,es);ie[t]=new me(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new me(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new me("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new me(e,1,!1,e.toLowerCase(),null,!0,!0)});function ts(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2u||l[s]!==i[u]){var a=` -`+l[s].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{zl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zn(e):""}function qc(e){switch(e.tag){case 5:return zn(e.type);case 16:return zn("Lazy");case 13:return zn("Suspense");case 19:return zn("SuspenseList");case 0:case 2:case 15:return e=Rl(e.type,!1),e;case 11:return e=Rl(e.type.render,!1),e;case 1:return e=Rl(e.type,!0),e;default:return""}}function oi(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 Gt:return"Fragment";case Xt:return"Portal";case li:return"Profiler";case ns:return"StrictMode";case ii:return"Suspense";case si:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case wu:return(e.displayName||"Context")+".Consumer";case yu:return(e._context.displayName||"Context")+".Provider";case rs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ls:return t=e.displayName||null,t!==null?t:oi(e.type)||"Memo";case ft:t=e._payload,e=e._init;try{return oi(e(t))}catch{}}return null}function bc(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 oi(t);case 8:return t===ns?"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 Et(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Su(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ed(e){var t=Su(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(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function mr(e){e._valueTracker||(e._valueTracker=ed(e))}function ku(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Su(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Br(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 ui(e,t){var n=t.checked;return X({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Gs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Et(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 Nu(e,t){t=t.checked,t!=null&&ts(e,"checked",t,!1)}function ai(e,t){Nu(e,t);var n=Et(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,Et(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Js(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"||Br(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=vr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mn={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},td=["Webkit","ms","Moz","O"];Object.keys(Mn).forEach(function(e){td.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mn[t]=Mn[e]})});function _u(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mn.hasOwnProperty(e)&&Mn[e]?(""+t).trim():t+"px"}function Pu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=_u(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var nd=X({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(nd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(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 is(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vi=null,un=null,an=null;function bs(e){if(e=dr(e)){if(typeof vi!="function")throw Error(N(280));var t=e.stateNode;t&&(t=gl(t),vi(e.stateNode,e.type,t))}}function Tu(e){un?an?an.push(e):an=[e]:un=e}function Lu(){if(un){var e=un,t=an;if(an=un=null,bs(e),t)for(e=0;e>>=0,e===0?32:31-(pd(e)/hd|0)|0}var gr=64,yr=4194304;function On(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 Kr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var u=s&~l;u!==0?r=On(u):(i&=s,i!==0&&(r=On(i)))}else s=n&~l,s!==0?r=On(s):i!==0&&(r=On(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;0n;n++)t.push(e);return t}function ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ye(t),e[t]=n}function yd(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=In),uo=" ",ao=!1;function Ju(e,t){switch(e){case"keyup":return Kd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jt=!1;function Xd(e,t){switch(e){case"compositionend":return Zu(t);case"keypress":return t.which!==32?null:(ao=!0,uo);case"textInput":return e=t.data,e===uo&&ao?null:e;default:return null}}function Gd(e,t){if(Jt)return e==="compositionend"||!ps&&Ju(e,t)?(e=Xu(),Or=cs=vt=null,Jt=!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)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=ho(n)}}function ta(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ta(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function na(){for(var e=window,t=Br();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Br(e.document)}return t}function hs(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 lf(e){var t=na(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ta(n.ownerDocument.documentElement,n)){if(r!==null&&hs(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=mo(n,i);var s=mo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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=document.documentMode,Zt=null,ki=null,An=null,Ni=!1;function vo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ni||Zt==null||Zt!==Br(r)||(r=Zt,"selectionStart"in r&&hs(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}),An&&qn(An,r)||(An=r,r=Gr(ki,"onSelect"),0en||(e.current=Ti[en],Ti[en]=null,en--)}function B(e,t){en++,Ti[en]=e.current,e.current=t}var _t={},ce=Tt(_t),ke=Tt(!1),At=_t;function hn(e,t){var n=e.type.contextTypes;if(!n)return _t;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 Ne(e){return e=e.childContextTypes,e!=null}function Zr(){W(ke),W(ce)}function No(e,t,n){if(ce.current!==_t)throw Error(N(168));B(ce,t),B(ke,n)}function da(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(N(108,bc(e)||"Unknown",l));return X({},n,r)}function qr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,At=ce.current,B(ce,e),B(ke,ke.current),!0}function jo(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=da(e,t,At),r.__reactInternalMemoizedMergedChildContext=e,W(ke),W(ce),B(ce,e)):W(ke),B(ke,n)}var nt=null,yl=!1,Kl=!1;function fa(e){nt===null?nt=[e]:nt.push(e)}function gf(e){yl=!0,fa(e)}function Lt(){if(!Kl&&nt!==null){Kl=!0;var e=0,t=V;try{var n=nt;for(V=1;e>=s,l-=s,rt=1<<32-Ye(t)+l|n<z?(U=T,T=null):U=T.sibling;var D=h(p,T,f[z],g);if(D===null){T===null&&(T=U);break}e&&T&&D.alternate===null&&t(p,T),c=i(D,c,z),P===null?j=D:P.sibling=D,P=D,T=U}if(z===f.length)return n(p,T),Q&&Rt(p,z),j;if(T===null){for(;zz?(U=T,T=null):U=T.sibling;var J=h(p,T,D.value,g);if(J===null){T===null&&(T=U);break}e&&T&&J.alternate===null&&t(p,T),c=i(J,c,z),P===null?j=J:P.sibling=J,P=J,T=U}if(D.done)return n(p,T),Q&&Rt(p,z),j;if(T===null){for(;!D.done;z++,D=f.next())D=m(p,D.value,g),D!==null&&(c=i(D,c,z),P===null?j=D:P.sibling=D,P=D);return Q&&Rt(p,z),j}for(T=r(p,T);!D.done;z++,D=f.next())D=w(T,p,z,D.value,g),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?z:D.key),c=i(D,c,z),P===null?j=D:P.sibling=D,P=D);return e&&T.forEach(function(Ce){return t(p,Ce)}),Q&&Rt(p,z),j}function C(p,c,f,g){if(typeof f=="object"&&f!==null&&f.type===Gt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case hr:e:{for(var j=f.key,P=c;P!==null;){if(P.key===j){if(j=f.type,j===Gt){if(P.tag===7){n(p,P.sibling),c=l(P,f.props.children),c.return=p,p=c;break e}}else if(P.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ft&&_o(j)===P.type){n(p,P.sibling),c=l(P,f.props),c.ref=Pn(p,P,f),c.return=p,p=c;break e}n(p,P);break}else t(p,P);P=P.sibling}f.type===Gt?(c=Ut(f.props.children,p.mode,g,f.key),c.return=p,p=c):(g=Vr(f.type,f.key,f.props,null,p.mode,g),g.ref=Pn(p,c,f),g.return=p,p=g)}return s(p);case Xt:e:{for(P=f.key;c!==null;){if(c.key===P)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(p,c.sibling),c=l(c,f.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=ei(f,p.mode,g),c.return=p,p=c}return s(p);case ft:return P=f._init,C(p,c,P(f._payload),g)}if(Rn(f))return x(p,c,f,g);if(Nn(f))return S(p,c,f,g);Cr(p,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(p,c.sibling),c=l(c,f),c.return=p,p=c):(n(p,c),c=bl(f,p.mode,g),c.return=p,p=c),s(p)):n(p,c)}return C}var vn=va(!0),ga=va(!1),tl=Tt(null),nl=null,rn=null,ys=null;function ws(){ys=rn=nl=null}function xs(e){var t=tl.current;W(tl),e._currentValue=t}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function dn(e,t){nl=e,ys=rn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Se=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(ys!==e)if(e={context:e,memoizedValue:t,next:null},rn===null){if(nl===null)throw Error(N(308));rn=e,nl.dependencies={lanes:0,firstContext:e}}else rn=rn.next=e;return t}var Ft=null;function Ss(e){Ft===null?Ft=[e]:Ft.push(e)}function ya(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ss(t)):(n.next=l.next,l.next=n),t.interleaved=n,ut(e,r)}function ut(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var pt=!1;function ks(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function wa(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 it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function kt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ut(e,n)}return l=r.interleaved,l===null?(t.next=t,Ss(r)):(t.next=l.next,l.next=t),r.interleaved=t,ut(e,n)}function Fr(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,os(e,n)}}function Po(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,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 rl(e,t,n,r){var l=e.updateQueue;pt=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,d=a.next;a.next=null,s===null?i=d:s.next=d,s=a;var v=e.alternate;v!==null&&(v=v.updateQueue,u=v.lastBaseUpdate,u!==s&&(u===null?v.firstBaseUpdate=d:u.next=d,v.lastBaseUpdate=a))}if(i!==null){var m=l.baseState;s=0,v=d=a=null,u=i;do{var h=u.lane,w=u.eventTime;if((r&h)===h){v!==null&&(v=v.next={eventTime:w,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var x=e,S=u;switch(h=t,w=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){m=x.call(w,m,h);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,m,h):x,h==null)break e;m=X({},m,h);break e;case 2:pt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else w={eventTime:w,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},v===null?(d=v=w,a=m):v=v.next=w,s|=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(v===null&&(a=m),l.baseState=a,l.firstBaseUpdate=d,l.lastBaseUpdate=v,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ht|=s,e.lanes=s,e.memoizedState=m}}function To(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Xl.transition;Xl.transition={};try{e(!1),t()}finally{V=n,Xl.transition=r}}function Ma(){return Ie().memoizedState}function Sf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},$a(e))Ia(t,n);else if(n=ya(e,t,n,r),n!==null){var l=pe();Xe(n,e,r,l),Ua(n,t,r)}}function kf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if($a(e))Ia(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,u=i(s,n);if(l.hasEagerState=!0,l.eagerState=u,Ge(u,s)){var a=t.interleaved;a===null?(l.next=l,Ss(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=ya(e,t,l,r),n!==null&&(l=pe(),Xe(n,e,r,l),Ua(n,t,r))}}function $a(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function Ia(e,t){Vn=il=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ua(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,os(e,n)}}var sl={readContext:$e,useCallback:oe,useContext:oe,useEffect:oe,useImperativeHandle:oe,useInsertionEffect:oe,useLayoutEffect:oe,useMemo:oe,useReducer:oe,useRef:oe,useState:oe,useDebugValue:oe,useDeferredValue:oe,useTransition:oe,useMutableSource:oe,useSyncExternalStore:oe,useId:oe,unstable_isNewReconciler:!1},Nf={readContext:$e,useCallback:function(e,t){return Ze().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:zo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$r(4194308,4,za.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $r(4194308,4,e,t)},useInsertionEffect:function(e,t){return $r(4,2,e,t)},useMemo:function(e,t){var n=Ze();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ze();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=Sf.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=Ze();return e={current:e},t.memoizedState=e},useState:Lo,useDebugValue:Ls,useDeferredValue:function(e){return Ze().memoizedState=e},useTransition:function(){var e=Lo(!1),t=e[0];return e=xf.bind(null,e[1]),Ze().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Y,l=Ze();if(Q){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||Na(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,zo(Ca.bind(null,r,i,e),[e]),r.flags|=2048,sr(9,ja.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ze(),t=ne.identifierPrefix;if(Q){var n=lt,r=rt;n=(r&~(1<<32-Ye(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=lr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[qe]=t,e[tr]=r,Ga(e,t,!1,!1),t.stateNode=e;e:{switch(s=hi(n,r),n){case"dialog":H("cancel",e),H("close",e),l=r;break;case"iframe":case"object":case"embed":H("load",e),l=r;break;case"video":case"audio":for(l=0;lwn&&(t.flags|=128,r=!0,Tn(i,!1),t.lanes=4194304)}else{if(!r)if(e=ll(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Tn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Q)return ue(t),null}else 2*Z()-i.renderingStartTime>wn&&n!==1073741824&&(t.flags|=128,r=!0,Tn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Z(),t.sibling=null,n=K.current,B(K,r?n&1|2:n&1),t):(ue(t),null);case 22:case 23:return Ms(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ee&1073741824&&(ue(t),t.subtreeFlags&6&&(t.flags|=8192)):ue(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function zf(e,t){switch(vs(t),t.tag){case 1:return Ne(t.type)&&Zr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gn(),W(ke),W(ce),Cs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return js(t),null;case 13:if(W(K),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(K),null;case 4:return gn(),null;case 10:return xs(t.type._context),null;case 22:case 23:return Ms(),null;case 24:return null;default:return null}}var _r=!1,ae=!1,Rf=typeof WeakSet=="function"?WeakSet:Set,L=null;function ln(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){G(e,t,r)}}var Bo=!1;function Of(e,t){if(ji=Yr,e=na(),hs(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 s=0,u=-1,a=-1,d=0,v=0,m=e,h=null;t:for(;;){for(var w;m!==n||l!==0&&m.nodeType!==3||(u=s+l),m!==i||r!==0&&m.nodeType!==3||(a=s+r),m.nodeType===3&&(s+=m.nodeValue.length),(w=m.firstChild)!==null;)h=m,m=w;for(;;){if(m===e)break t;if(h===n&&++d===l&&(u=s),h===i&&++v===r&&(a=s),(w=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=w}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ci={focusedElem:e,selectionRange:n},Yr=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,C=x.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:We(t.type,S),C);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(g){G(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return x=Bo,Bo=!1,x}function Bn(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&&Vi(t,n,i)}l=l.next}while(l!==r)}}function Sl(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 Bi(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 qa(e){var t=e.alternate;t!==null&&(e.alternate=null,qa(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qe],delete t[tr],delete t[Pi],delete t[mf],delete t[vf])),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 ba(e){return e.tag===5||e.tag===3||e.tag===4}function Ho(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ba(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 Hi(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=Jr));else if(r!==4&&(e=e.child,e!==null))for(Hi(e,t,n),e=e.sibling;e!==null;)Hi(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 re=null,Qe=!1;function dt(e,t,n){for(n=n.child;n!==null;)ec(e,t,n),n=n.sibling}function ec(e,t,n){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(pl,n)}catch{}switch(n.tag){case 5:ae||ln(n,t);case 6:var r=re,l=Qe;re=null,dt(e,t,n),re=r,Qe=l,re!==null&&(Qe?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Qe?(e=re,n=n.stateNode,e.nodeType===8?Ql(e.parentNode,n):e.nodeType===1&&Ql(e,n),Jn(e)):Ql(re,n.stateNode));break;case 4:r=re,l=Qe,re=n.stateNode.containerInfo,Qe=!0,dt(e,t,n),re=r,Qe=l;break;case 0:case 11:case 14:case 15:if(!ae&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Vi(n,t,s),l=l.next}while(l!==r)}dt(e,t,n);break;case 1:if(!ae&&(ln(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){G(n,t,u)}dt(e,t,n);break;case 21:dt(e,t,n);break;case 22:n.mode&1?(ae=(r=ae)||n.memoizedState!==null,dt(e,t,n),ae=r):dt(e,t,n);break;default:dt(e,t,n)}}function Wo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function He(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ff(r/1960))-r,10e?16:e,gt===null)var r=!1;else{if(e=gt,gt=null,al=0,$&6)throw Error(N(331));var l=$;for($|=4,L=e.current;L!==null;){var i=L,s=i.child;if(L.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aZ()-Ds?It(e,0):Os|=n),je(e,t)}function uc(e,t){t===0&&(e.mode&1?(t=yr,yr<<=1,!(yr&130023424)&&(yr=4194304)):t=1);var n=pe();e=ut(e,t),e!==null&&(ar(e,t,n),je(e,n))}function Vf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uc(e,n)}function Bf(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(N(314))}r!==null&&r.delete(t),uc(e,n)}var ac;ac=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ke.current)Se=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Se=!1,Tf(e,t,n);Se=!!(e.flags&131072)}else Se=!1,Q&&t.flags&1048576&&pa(t,el,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ir(e,t),e=t.pendingProps;var l=hn(t,ce.current);dn(t,n),l=_s(null,t,r,e,l,n);var i=Ps();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,Ne(r)?(i=!0,qr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ks(t),l.updater=xl,t.stateNode=l,l._reactInternals=t,Di(t,r,e,n),t=$i(null,t,r,!0,i,n)):(t.tag=0,Q&&i&&ms(t),fe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ir(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Wf(r),e=We(r,e),l){case 0:t=Mi(null,t,r,e,n);break e;case 1:t=Uo(null,t,r,e,n);break e;case 11:t=$o(null,t,r,e,n);break e;case 14:t=Io(null,t,r,We(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:We(r,l),Mi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:We(r,l),Uo(e,t,r,l,n);case 3:e:{if(Ka(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,wa(e,t),rl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(N(423)),t),t=Ao(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(N(424)),t),t=Ao(e,t,r,n,l);break e}else for(_e=St(t.stateNode.containerInfo.firstChild),Pe=t,Q=!0,Ke=null,n=ga(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mn(),r===l){t=at(e,t,n);break e}fe(e,t,r,n)}t=t.child}return t;case 5:return xa(t),e===null&&zi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ei(r,l)?s=null:i!==null&&Ei(r,i)&&(t.flags|=32),Qa(e,t),fe(e,t,s,n),t.child;case 6:return e===null&&zi(t),null;case 13:return Ya(e,t,n);case 4:return Ns(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vn(t,null,r,n):fe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:We(r,l),$o(e,t,r,l,n);case 7:return fe(e,t,t.pendingProps,n),t.child;case 8:return fe(e,t,t.pendingProps.children,n),t.child;case 12:return fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,B(tl,r._currentValue),r._currentValue=s,i!==null)if(Ge(i.value,s)){if(i.children===l.children&&!ke.current){t=at(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=it(-1,n&-n),a.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var v=d.pending;v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ri(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ri(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}fe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,dn(t,n),l=$e(l),r=r(l),t.flags|=1,fe(e,t,r,n),t.child;case 14:return r=t.type,l=We(r,t.pendingProps),l=We(r.type,l),Io(e,t,r,l,n);case 15:return Ha(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:We(r,l),Ir(e,t),t.tag=1,Ne(r)?(e=!0,qr(t)):e=!1,dn(t,n),Aa(t,r,l),Di(t,r,l,n),$i(null,t,r,!0,e,n);case 19:return Xa(e,t,n);case 22:return Wa(e,t,n)}throw Error(N(156,t.tag))};function cc(e,t){return $u(e,t)}function Hf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fe(e,t,n,r){return new Hf(e,t,n,r)}function Is(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Wf(e){if(typeof e=="function")return Is(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rs)return 11;if(e===ls)return 14}return 2}function Ct(e,t){var n=e.alternate;return n===null?(n=Fe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Vr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Is(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Gt:return Ut(n.children,l,i,t);case ns:s=8,l|=8;break;case li:return e=Fe(12,n,t,l|2),e.elementType=li,e.lanes=i,e;case ii:return e=Fe(13,n,t,l),e.elementType=ii,e.lanes=i,e;case si:return e=Fe(19,n,t,l),e.elementType=si,e.lanes=i,e;case xu:return Nl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yu:s=10;break e;case wu:s=9;break e;case rs:s=11;break e;case ls:s=14;break e;case ft:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Fe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ut(e,t,n,r){return e=Fe(7,e,r,t),e.lanes=n,e}function Nl(e,t,n,r){return e=Fe(22,e,r,t),e.elementType=xu,e.lanes=n,e.stateNode={isHidden:!1},e}function bl(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function ei(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qf(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=Dl(0),this.expirationTimes=Dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Us(e,t,n,r,l,i,s,u,a){return e=new Qf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Fe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ks(i),e}function Kf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hc)}catch(e){console.error(e)}}hc(),hu.exports=Le;var Zf=hu.exports,mc,qo=Zf;mc=qo.createRoot,qo.hydrateRoot;async function ve(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function qf(){return ve("/api/archives")}async function bf(e){return ve(`/api/archives/${e}/entries`)}async function ep(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),ve(`/api/archives/${e}/entries/search?${r}`)}async function tp(e,t){return ve(`/api/archives/${e}/entries/${t}`)}async function ti(e,t){return ve(`/api/archives/${e}/entries/${t}/tags`)}async function np(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 rp(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 bo(e){return ve(`/api/archives/${e}/runs`)}async function ni(e){return ve(`/api/archives/${e}/tags`)}async function lp(e,t){const n=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function ip(e,t){return ve(`/api/archives/${e}/capture_jobs/${t}`)}async function sp(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function op(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 up(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 ap(){await fetch("/api/auth/logout",{method:"POST"})}async function cp(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function dp(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 fp(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 pp(){return ve("/api/auth/tokens")}async function hp(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 mp(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function vp(){return ve("/api/admin/instance-settings")}async function gp(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 yp(){return ve("/api/admin/users")}async function wp(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 xp(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 Sp(){return ve("/api/admin/roles")}async function kp(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 Np(e){return ve(`/api/archives/${e}/collections`)}async function jp(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 Cp(e,t){return ve(`/api/archives/${e}/collections/${t}`)}async function Ep(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 _p(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 Pp(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 Tp(e,t){return ve(`/api/archives/${e}/entries/${t}/collections`)}async function eu(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 Lp(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)}}const zp=window.fetch;window.fetch=async(...e)=>{var n;const t=await zp(...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 Rp({onLogin:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(null),[u,a]=y.useState(!1);async function d(v){v.preventDefault(),s(null),a(!0);try{const m=await up(t,r);e(m)}catch(m){s(m.message)}finally{a(!1)}}return o.jsx("div",{className:"login-page",children:o.jsxs("div",{className:"login-card",children:[o.jsx("h1",{className:"login-brand",children:"Archivr"}),o.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),o.jsxs("form",{onSubmit:d,children:[o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),o.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:v=>n(v.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),o.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:v=>l(v.target.value),required:!0,autoComplete:"current-password"})]}),i&&o.jsx("p",{className:"login-error",children:i}),o.jsx("button",{className:"login-submit",type:"submit",disabled:u,children:u?"Signing in…":"Sign in"})]})]})})}function Op({onComplete:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1);async function m(h){if(h.preventDefault(),r!==i){a("Passwords do not match");return}if(r.length<8){a("Password must be at least 8 characters");return}a(null),v(!0);try{await op(t,r),e()}catch(w){a(w.message)}finally{v(!1)}}return o.jsx("div",{className:"setup-page",children:o.jsxs("div",{className:"setup-card",children:[o.jsx("h1",{className:"setup-brand",children:"Archivr"}),o.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),o.jsxs("form",{onSubmit:m,children:[o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),o.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:h=>n(h.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),o.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:h=>l(h.target.value),required:!0,autoComplete:"new-password"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),o.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:h=>s(h.target.value),required:!0,autoComplete:"new-password"})]}),u&&o.jsx("p",{className:"setup-error",children:u}),o.jsx("button",{className:"setup-submit",type:"submit",disabled:d,children:d?"Creating account…":"Create account"})]})]})})}function Dp({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:s,setCurrentUser:u}=y.useContext(Pl)??{},[a,d]=y.useState(!1);async function v(){d(!0),await ap(),u(null),window.location.reload()}return o.jsxs("header",{className:"topbar",children:[o.jsx("div",{className:"brand",children:"Archivr"}),o.jsx("div",{className:"switcher",children:o.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>o.jsx("option",{value:m.id,children:m.label},m.id))})}),o.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","runs","admin","tags","collections","settings"].map(m=>o.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),o.jsx("button",{className:"capture-button",onClick:i,children:"+ Capture"}),s&&o.jsxs("div",{className:"user-menu",children:[o.jsx("span",{className:"user-name",children:s.display_name||s.username}),o.jsx("button",{className:"logout-btn",onClick:v,disabled:a,children:a?"Logging out…":"Log out"})]})]})}function Fp({open:e,archiveId:t,onClose:n,onCaptured:r}){const l=y.useRef(null),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1),[m,h]=y.useState(null),w=y.useRef(null);y.useEffect(()=>{const C=l.current;if(!C)return;const p=()=>{clearInterval(w.current),n()};return C.addEventListener("close",p),()=>C.removeEventListener("close",p)},[n]),y.useEffect(()=>{const C=l.current;C&&(e?(s(""),a(null),h(null),v(!1),clearInterval(w.current),C.open||C.showModal()):C.open&&C.close())},[e]);async function x(){if(!i.trim()){a("Enter a locator.");return}v(!0),a(null),h(null);try{const C=await lp(t,i.trim());h("running"),w.current=setInterval(async()=>{var p;try{const c=await ip(t,C.job_uid);c.status==="completed"?(clearInterval(w.current),w.current=null,v(!1),h("completed"),(p=l.current)==null||p.close(),r()):c.status==="failed"&&(clearInterval(w.current),w.current=null,v(!1),h("failed"),a(c.error_text||"Capture failed."))}catch(c){clearInterval(w.current),w.current=null,v(!1),a(c.message)}},500)}catch(C){a(C.message),v(!1)}}function S(){return d?m==="running"?"Running…":"Capturing…":"Capture"}return o.jsx("dialog",{ref:l,className:"capture-dialog",children:o.jsxs("div",{className:"capture-dialog-inner",children:[o.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),o.jsx("label",{htmlFor:"capture-locator",className:"capture-label",children:"Locator"}),o.jsx("input",{id:"capture-locator",className:"capture-input",type:"text",placeholder:"tweet:1234567890 or https://...",value:i,onChange:C=>s(C.target.value),onKeyDown:C=>{C.key==="Enter"&&x()},autoComplete:"off"}),u&&o.jsx("div",{className:"capture-error",children:u}),o.jsxs("div",{className:"capture-actions",children:[o.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var C;return(C=l.current)==null?void 0:C.close()},children:"Cancel"}),o.jsx("button",{type:"button",className:"capture-submit",onClick:x,disabled:d,children:S()})]})]})})}function vc(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&rString(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const tu={youtube:'',x:'',instagram:'',facebook:'',tiktok:'',reddit:'',snapchat:'',local:'',web:'',other:'?'};function yc(e){return tu[e]??tu.other}function Mp({entry:e,archiveId:t,isSelected:n,onSelect:r}){const[l,i]=y.useState(!1),u=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!l?o.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>i(!0),style:{objectFit:"contain"}}):o.jsx("span",{dangerouslySetInnerHTML:{__html:yc(e.source_kind)}});return o.jsxs("div",{className:n?"is-selected":void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onClick:r,onKeyDown:a=>{a.key==="Enter"&&r()},children:[o.jsx("div",{className:"col-added",children:gc(e.archived_at)}),o.jsxs("div",{className:"col-title",children:[o.jsx("span",{className:"source-icon",children:u}),o.jsx("span",{className:"entry-title",children:$t(e.title)||$t(e.entry_uid)})]}),o.jsx("div",{className:"col-type",children:o.jsx("span",{className:"type-pill",children:$t(e.entity_kind)})}),o.jsx("div",{className:"col-size",children:vc(e.total_artifact_bytes)}),o.jsx("div",{className:"url-cell col-url",children:$t(e.original_url)})]})}function $p({entries:e,selectedEntryUid:t,onSelectEntry:n,archiveId:r}){return o.jsx("section",{id:"archive-view",className:"view is-active",children:o.jsxs("div",{className:"entry-table",children:[o.jsxs("div",{className:"entry-header-row",children:[o.jsx("div",{className:"col-added",children:"Added"}),o.jsx("div",{className:"col-title",children:"Title"}),o.jsx("div",{className:"col-type",children:"Type"}),o.jsx("div",{className:"col-size",children:"Size"}),o.jsx("div",{className:"col-url",children:"Original URL"})]}),o.jsx("div",{id:"entries-body",children:e.map(l=>o.jsx(Mp,{entry:l,archiveId:r,isSelected:l.entry_uid===t,onSelect:()=>n(l)},l.entry_uid))})]})})}function Ip(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 Up({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="running"?"run-status--running":"";return o.jsx("span",{className:`run-status ${t}`,children:e||"—"})}function Ap({runs:e}){return o.jsx("section",{id:"runs-view",className:"view is-active",children:o.jsxs("table",{className:"entry-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Started"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Requested"}),o.jsx("th",{children:"Completed"}),o.jsx("th",{children:"Failed"})]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map((t,n)=>o.jsxs("tr",{children:[o.jsx("td",{children:Ip(t.started_at)}),o.jsx("td",{children:o.jsx(Up,{status:t.status})}),o.jsx("td",{children:t.requested_count??"—"}),o.jsx("td",{children:t.completed_count??"—"}),o.jsx("td",{children:t.failed_count??"—"})]},n))})]})})}const Vp=4;function Bp({archives:e}){const{currentUser:t}=y.useContext(Pl)??{},n=t&&(t.role_bits&Vp)!==0,[r,l]=y.useState("users"),[i,s]=y.useState([]),[u,a]=y.useState([]),[d,v]=y.useState(!1),[m,h]=y.useState(null),[w,x]=y.useState(""),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(null),[j,P]=y.useState(!1),[T,z]=y.useState(""),[U,D]=y.useState(""),[J,Ce]=y.useState(null),[ge,ye]=y.useState(!1),Ue=y.useCallback(async()=>{if(n){v(!0),h(null);try{const[k,R]=await Promise.all([yp(),Sp()]);s(k),a(R)}catch(k){h(k.message)}finally{v(!1)}}},[n]);y.useEffect(()=>{Ue()},[Ue]);async function Ae(k){const R=k.status==="active"?"disabled":"active";try{await xp(k.user_uid,R),s(A=>A.map(O=>O.user_uid===k.user_uid?{...O,status:R}:O))}catch(A){h(A.message)}}async function Ve(k){if(k.preventDefault(),!w.trim()||!S){g("Username and password required");return}P(!0),g(null);try{await wp(w.trim(),S,p.trim()||void 0),x(""),C(""),c(""),await Ue()}catch(R){g(R.message)}finally{P(!1)}}async function E(k){if(k.preventDefault(),!T.trim()||!U.trim()){Ce("Slug and name required");return}ye(!0),Ce(null);try{await kp(T.trim(),U.trim()),z(""),D(""),await Ue()}catch(R){Ce(R.message)}finally{ye(!1)}}return n?o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsxs("div",{className:"view-tabs",children:[o.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),o.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),o.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&o.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Users"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Username"}),o.jsx("th",{children:"Email"}),o.jsx("th",{children:"Roles"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Actions"})]})}),o.jsx("tbody",{children:i.map(k=>o.jsxs("tr",{className:k.status==="disabled"?"admin-row-disabled":"",children:[o.jsx("td",{children:k.username}),o.jsx("td",{className:"muted",children:k.email||"—"}),o.jsx("td",{children:k.role_slugs.join(", ")||"—"}),o.jsx("td",{children:o.jsx("span",{className:`status-badge status-${k.status}`,children:k.status})}),o.jsx("td",{children:o.jsx("button",{className:"admin-action-btn",onClick:()=>Ae(k),children:k.status==="active"?"Ban":"Unban"})})]},k.user_uid))})]}),o.jsx("h3",{children:"Create User"}),o.jsxs("form",{className:"admin-form",onSubmit:Ve,children:[o.jsx("input",{className:"admin-input",placeholder:"Username",value:w,onChange:k=>x(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:S,onChange:k=>C(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:k=>c(k.target.value)}),f&&o.jsx("div",{className:"form-msg form-msg--err",children:f}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create User"})]})]}),r==="roles"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Roles"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Slug"}),o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Level"}),o.jsx("th",{children:"Bit"}),o.jsx("th",{children:"Built-in"})]})}),o.jsx("tbody",{children:u.map(k=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("code",{children:k.slug})}),o.jsx("td",{children:k.name}),o.jsx("td",{children:k.level}),o.jsx("td",{children:k.bit_position}),o.jsx("td",{children:k.is_builtin?"✓":""})]},k.role_uid))})]}),o.jsx("h3",{children:"Create Custom Role"}),o.jsxs("form",{className:"admin-form",onSubmit:E,children:[o.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:T,onChange:k=>z(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:U,onChange:k=>D(k.target.value),required:!0}),J&&o.jsx("div",{className:"form-msg form-msg--err",children:J}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:ge,children:ge?"Creating…":"Create Role"})]})]}),r==="archives"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})]}):o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})}function wc({node:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){var s;const l=t===e.tag.full_path;function i(){const u=l?null:e.tag.full_path;n(u),r("archive")}return o.jsxs("li",{children:[o.jsx("button",{className:`tag-node-btn${l?" is-active":""}`,title:e.tag.full_path,onClick:i,children:e.tag.name}),((s=e.children)==null?void 0:s.length)>0&&o.jsx("div",{className:"tag-children",children:o.jsx("ul",{className:"tag-tree-list",children:e.children.map(u=>o.jsx(wc,{node:u,tagFilter:t,onTagFilterSet:n,onViewChange:r},u.tag.tag_uid))})})]})}function Hp({tagNodes:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){return o.jsx("section",{id:"tags-view",className:"view is-active",children:o.jsxs("div",{className:"tag-tree",children:[o.jsxs("div",{className:"tag-tree-header",children:[o.jsx("span",{className:"tag-tree-title",children:"Tags"}),t&&o.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",t]})]}),e.length===0?o.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):o.jsx("ul",{className:"tag-tree-list",children:e.map(l=>o.jsx(wc,{node:l,tagFilter:t,onTagFilterSet:n,onViewChange:r},l.tag.tag_uid))})]})})}const Fn=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],Wp=e=>{var t;return((t=Fn.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Qp({archiveId:e}){const[t,n]=y.useState([]),[r,l]=y.useState(!1),[i,s]=y.useState(null),[u,a]=y.useState(null),[d,v]=y.useState(null),[m,h]=y.useState(!1),[w,x]=y.useState(null),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(2),[j,P]=y.useState(!1),[T,z]=y.useState(null),[U,D]=y.useState(""),[J,Ce]=y.useState(2),[ge,ye]=y.useState(!1),[Ue,Ae]=y.useState(null),[Ve,E]=y.useState(!1),[k,R]=y.useState(""),A=y.useRef(null),O=t.find(_=>_.collection_uid===u)??null,de=(O==null?void 0:O.slug)==="_default_",F=y.useCallback(async()=>{if(e){l(!0),s(null);try{const _=await Np(e);n(_)}catch(_){s(_.message)}finally{l(!1)}}},[e]),se=y.useCallback(async _=>{if(!_){v(null);return}h(!0),x(null);try{const I=await Cp(e,_);v(I)}catch(I){x(I.message)}finally{h(!1)}},[e]);y.useEffect(()=>{F()},[F]),y.useEffect(()=>{se(u)},[u,se]),y.useEffect(()=>{Ve&&A.current&&A.current.focus()},[Ve]);async function Re(_){_.preventDefault();const I=S.trim(),Be=p.trim();if(!(!I||!Be)){P(!0),z(null);try{const zt=await jp(e,I,Be,f);C(""),c(""),g(2),await F(),a(zt.collection_uid)}catch(zt){z(zt.message)}finally{P(!1)}}}async function we(){const _=k.trim();if(!_||!O){E(!1);return}try{await eu(e,O.collection_uid,{name:_}),await F(),v(I=>I&&{...I,name:_})}catch(I){s(I.message)}finally{E(!1)}}async function xc(_){if(O)try{await eu(e,O.collection_uid,{default_visibility_bits:_}),await F(),v(I=>I&&{...I,default_visibility_bits:_})}catch(I){s(I.message)}}async function Sc(){if(O&&window.confirm(`Delete collection "${O.name}"? Entries will not be deleted.`))try{await Lp(e,O.collection_uid),a(null),v(null),await F()}catch(_){s(_.message)}}async function kc(_){_.preventDefault();const I=U.trim();if(!(!I||!O)){ye(!0),Ae(null);try{await Ep(e,O.collection_uid,I,J),D(""),await se(O.collection_uid)}catch(Be){Ae(Be.message)}finally{ye(!1)}}}async function Nc(_){if(O)try{await _p(e,O.collection_uid,_),await se(O.collection_uid)}catch(I){x(I.message)}}async function jc(_,I){if(O)try{await Pp(e,O.collection_uid,_,I),v(Be=>Be&&{...Be,entries:Be.entries.map(zt=>zt.entry_uid===_?{...zt,collection_visibility_bits:I}:zt)})}catch(Be){x(Be.message)}}return e?o.jsxs("div",{className:"collections-view",children:[o.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&o.jsx("div",{className:"muted",children:"Loading…"}),i&&o.jsxs("div",{className:"collections-error",children:[i," ",o.jsx("button",{onClick:()=>s(null),className:"coll-dismiss",children:"×"})]}),o.jsxs("div",{className:"collections-layout",children:[o.jsxs("div",{className:"collections-sidebar",children:[t.map(_=>o.jsxs("button",{className:`coll-sidebar-row${u===_.collection_uid?" is-active":""}`,onClick:()=>a(_.collection_uid),children:[o.jsx("span",{className:"coll-row-name",children:_.name}),o.jsx("span",{className:"coll-row-meta",children:Wp(_.default_visibility_bits)})]},_.collection_uid)),t.length===0&&!r&&o.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),O?o.jsxs("div",{className:"coll-detail",children:[o.jsxs("div",{className:"coll-detail-header",children:[Ve?o.jsx("input",{ref:A,className:"coll-rename-input",value:k,onChange:_=>R(_.target.value),onBlur:we,onKeyDown:_=>{_.key==="Enter"&&we(),_.key==="Escape"&&E(!1)}}):o.jsxs("h3",{className:`coll-detail-name${de?"":" coll-detail-name--editable"}`,title:de?void 0:"Click to rename",onClick:()=>{de||(R(O.name),E(!0))},children:[(d==null?void 0:d.name)??O.name,!de&&o.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!de&&o.jsx("button",{className:"coll-delete-btn",onClick:Sc,title:"Delete collection",children:"Delete"})]}),o.jsxs("div",{className:"coll-detail-vis",children:[o.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),o.jsx("select",{className:"coll-vis-select",value:(d==null?void 0:d.default_visibility_bits)??O.default_visibility_bits,onChange:_=>xc(Number(_.target.value)),disabled:de,children:Fn.map(_=>o.jsx("option",{value:_.value,children:_.label},_.value))})]}),o.jsxs("div",{className:"coll-entries-section",children:[o.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&o.jsx("div",{className:"muted",children:"Loading…"}),w&&o.jsx("div",{className:"collections-error",children:w}),!m&&d&&(d.entries.length===0?o.jsx("div",{className:"muted",children:"No entries in this collection."}):o.jsx("ul",{className:"coll-entries-list",children:d.entries.map(_=>o.jsxs("li",{className:"coll-entry-row",children:[o.jsxs("div",{className:"coll-entry-info",children:[o.jsx("span",{className:"coll-entry-title",children:_.title||_.entry_uid}),o.jsx("span",{className:"coll-entry-kind muted",children:_.source_kind})]}),o.jsxs("div",{className:"coll-entry-actions",children:[o.jsx("select",{className:"coll-entry-vis-select",value:_.collection_visibility_bits,onChange:I=>jc(_.entry_uid,Number(I.target.value)),children:Fn.map(I=>o.jsx("option",{value:I.value,children:I.label},I.value))}),!de&&o.jsx("button",{className:"coll-entry-remove",onClick:()=>Nc(_.entry_uid),title:"Remove from collection",children:"×"})]})]},_.entry_uid))}))]}),!de&&o.jsxs("form",{className:"coll-add-entry-form",onSubmit:kc,children:[o.jsx("div",{className:"coll-section-heading",children:"Add entry"}),o.jsxs("div",{className:"coll-add-entry-row",children:[o.jsx("input",{className:"coll-add-entry-input",type:"text",value:U,onChange:_=>D(_.target.value),placeholder:"entry_uid",required:!0}),o.jsx("select",{className:"coll-vis-select",value:J,onChange:_=>Ce(Number(_.target.value)),children:Fn.map(_=>o.jsx("option",{value:_.value,children:_.label},_.value))}),o.jsx("button",{className:"coll-add-btn",type:"submit",disabled:ge,children:ge?"…":"Add"})]}),Ue&&o.jsx("div",{className:"collections-error",style:{marginTop:4},children:Ue})]})]}):o.jsx("div",{className:"coll-detail coll-detail--empty",children:o.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),o.jsxs("details",{className:"coll-create-details",children:[o.jsx("summary",{children:"+ Create collection"}),o.jsxs("form",{className:"coll-create-form",onSubmit:Re,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),o.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:S,onChange:_=>{C(_.target.value),p||c(_.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),o.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:_=>c(_.target.value),placeholder:"my-collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),o.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:f,onChange:_=>g(Number(_.target.value)),children:Fn.map(_=>o.jsx("option",{value:_.value,children:_.label},_.value))})]}),T&&o.jsx("div",{className:"collections-error",children:T}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create collection"})]})]})]}):o.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Kp=4;function Yp(){const{currentUser:e,setCurrentUser:t}=y.useContext(Pl)??{},n=e&&(e.role_bits&Kp)!==0,[r,l]=y.useState("profile"),i=["profile","tokens",...n?["instance"]:[]],s={profile:"Profile",tokens:"API Tokens",instance:"Instance"};return o.jsxs("section",{className:"admin-view",children:[o.jsx("h1",{children:"Settings"}),o.jsx("div",{className:"view-tabs",children:i.map(u=>o.jsx("button",{className:`view-tab${r===u?" is-active":""}`,onClick:()=>l(u),children:s[u]},u))}),r==="profile"&&o.jsx(Xp,{currentUser:e,setCurrentUser:t}),r==="tokens"&&o.jsx(Gp,{}),r==="instance"&&n&&o.jsx(Jp,{})]})}function Xp({currentUser:e,setCurrentUser:t}){const[n,r]=y.useState((e==null?void 0:e.display_name)??""),[l,i]=y.useState(!1),[s,u]=y.useState(null),[a,d]=y.useState(""),[v,m]=y.useState(""),[h,w]=y.useState(""),[x,S]=y.useState(!1),[C,p]=y.useState(null);async function c(g){g.preventDefault(),i(!0),u(null);try{await dp(n),t(j=>({...j,display_name:n||null})),u({ok:!0,text:"Saved."})}catch(j){u({ok:!1,text:j.message})}finally{i(!1)}}async function f(g){if(g.preventDefault(),v!==h){p({ok:!1,text:"Passwords do not match."});return}S(!0),p(null);try{await fp(a,v),d(""),m(""),w(""),p({ok:!0,text:"Password changed."})}catch(j){p({ok:!1,text:j.message})}finally{S(!1)}}return o.jsxs("div",{style:{maxWidth:440},children:[o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Display Name"}),o.jsxs("form",{onSubmit:c,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),o.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:g=>r(g.target.value)})]}),s&&o.jsx("div",{className:`form-msg form-msg--${s.ok?"ok":"err"}`,children:s.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Change Password"}),o.jsxs("form",{onSubmit:f,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),o.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:a,onChange:g=>d(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),o.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:v,onChange:g=>m(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),o.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:h,onChange:g=>w(g.target.value),required:!0})]}),C&&o.jsx("div",{className:`form-msg form-msg--${C.ok?"ok":"err"}`,children:C.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function Gp(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(""),[a,d]=y.useState(!1),[v,m]=y.useState(null),h=y.useCallback(async()=>{r(!0),i(null);try{t(await pp())}catch(S){i(S.message)}finally{r(!1)}},[]);y.useEffect(()=>{h()},[h]);async function w(S){if(S.preventDefault(),!!s.trim()){d(!0);try{const C=await hp(s.trim());m(C),u(""),h()}catch(C){i(C.message)}finally{d(!1)}}}async function x(S){try{await mp(S),t(C=>C.filter(p=>p.token_uid!==S))}catch(C){i(C.message)}}return o.jsx("div",{style:{maxWidth:600},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"API Tokens"}),v&&o.jsxs("div",{className:"token-banner",children:[o.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",o.jsx("code",{children:v.raw_token}),o.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),o.jsxs("form",{className:"token-create-row",onSubmit:w,children:[o.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:s,onChange:S=>u(S.target.value),required:!0}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Creating…":"Create token"})]}),l&&o.jsx("div",{className:"form-msg form-msg--err",children:l}),n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):o.jsxs("div",{children:[e.length===0&&o.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(S=>o.jsxs("div",{className:"token-row",children:[o.jsxs("div",{className:"token-row-info",children:[o.jsx("strong",{children:S.name}),o.jsxs("div",{className:"muted",children:["Created ",S.created_at.slice(0,10),S.last_used_at&&` · Last used ${S.last_used_at.slice(0,10)}`]})]}),o.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(S.token_uid),children:"Revoke"})]},S.token_uid))]})]})})}function Jp(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(!1),[a,d]=y.useState(null);y.useEffect(()=>{(async()=>{try{t(await vp())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function v(m){m.preventDefault(),u(!0),d(null);try{await gp(e),d({ok:!0,text:"Saved."})}catch(h){d({ok:!1,text:h.message})}finally{u(!1)}}return n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):l?o.jsx("div",{className:"form-msg form-msg--err",children:l}):e?o.jsx("div",{style:{maxWidth:440},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Instance Settings"}),o.jsxs("form",{onSubmit:v,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,h])=>o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:!!e[m],onChange:w=>t(x=>({...x,[m]:w.target.checked}))}),h]},m)),o.jsxs("div",{className:"form-field",style:{marginTop:4},children:[o.jsx("label",{className:"form-label",children:"Default entry visibility"}),o.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(h=>({...h,default_entry_visibility:Number(m.target.value)})),children:[o.jsx("option",{value:0,children:"Private"}),o.jsx("option",{value:2,children:"Unlisted"}),o.jsx("option",{value:3,children:"Public"})]})]}),a&&o.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:s,children:s?"Saving…":"Save Settings"})]})]})}):null}const nu={0:"Private",1:"Public",2:"Users only",3:"Public"},Zp=()=>o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function qp({archiveId:e,selectedEntry:t,onTagFilterSet:n,tagNodes:r,onTagsRefresh:l}){const[i,s]=y.useState(null),[u,a]=y.useState([]),[d,v]=y.useState(""),[m,h]=y.useState([]),[w,x]=y.useState(""),S=y.useRef(0);y.useEffect(()=>{if(!t||!e){s(null),a([]),h([]);return}const f=++S.current;s(null),a([]),Promise.all([tp(e,t.entry_uid),ti(e,t.entry_uid),Tp(e,t.entry_uid)]).then(([g,j,P])=>{f===S.current&&(s(g),a(j),h(P))}).catch(()=>{})},[t,e]);async function C(){const f=d.trim();if(!(!f||!t))try{await np(e,t.entry_uid,f),v(""),x("");const g=await ti(e,t.entry_uid);a(g),l()}catch(g){x(g.message)}}async function p(f){try{await rp(e,t.entry_uid,f);const g=await ti(e,t.entry_uid);a(g),l()}catch{}}const c=i?[["Added",gc(i.summary.archived_at)],["Source",i.summary.source_kind],["Type",i.summary.entity_kind],["Visibility",nu[i.summary.visibility]??i.summary.visibility],["Root",i.structured_root_relpath]]:[];return o.jsxs("aside",{className:"context-rail",children:[o.jsx("div",{className:"rail-eyebrow",children:"Context"}),t?i?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"rail-title",children:$t(i.summary.title)||$t(i.summary.entry_uid)}),i.summary.original_url&&o.jsxs("a",{className:"url-tile",href:i.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:yc(i.summary.source_kind)}}),o.jsx("span",{className:"u-text",children:i.summary.original_url}),o.jsx("span",{className:"ext",children:o.jsx(Zp,{})})]}),o.jsx("div",{className:"meta-list",children:c.filter(([,f])=>f!=null&&f!=="").map(([f,g])=>o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-k",children:f}),o.jsx("span",{className:`meta-v${f==="Root"?" mono":""}`,children:$t(g)})]},f))}),i.artifacts.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",o.jsx("span",{className:"num",children:i.artifacts.length})]}),o.jsx("ul",{className:"artifact-list",children:i.artifacts.map((f,g)=>o.jsx("li",{children:o.jsxs("a",{href:`/api/archives/${e}/entries/${i.summary.entry_uid}/artifacts/${g}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[o.jsx("span",{className:"artifact-name",children:f.artifact_role.replace(/_/g," ")}),o.jsx("span",{className:"artifact-size",children:f.byte_size!=null?vc(f.byte_size):"—"})]})},g))})]})]}):o.jsx("p",{className:"tags-empty",children:"Loading…"}):o.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Tags"}),u.length===0?o.jsx("p",{className:"tags-empty",children:"No tags yet."}):o.jsx("div",{className:"tags-wrap",children:u.map(f=>o.jsxs("span",{className:"tag-pill",title:f.full_path,children:[f.name,o.jsx("button",{className:"remove",title:`Remove tag ${f.full_path}`,onClick:()=>p(f.tag_uid),children:"×"})]},f.tag_uid))}),w&&o.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:w}),o.jsxs("div",{className:"tag-input-wrap",children:[o.jsx("span",{className:"hash",children:"/"}),o.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:d,onChange:f=>v(f.target.value),onKeyDown:f=>{f.key==="Enter"&&C()}}),o.jsx("button",{className:"tag-add-btn",onClick:C,children:"Add"})]})]}),m.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Collections"}),m.map(f=>o.jsxs("div",{className:"coll-row",children:[o.jsx("span",{className:"coll-name",children:f.collection_uid}),o.jsx("span",{className:"vis-badge",children:nu[f.visibility_bits]??`bits:${f.visibility_bits}`})]},f.collection_uid))]})]})]})}const Pl=y.createContext(null);function bp(){const[e,t]=y.useState("loading"),[n,r]=y.useState(null);y.useEffect(()=>{(async()=>{if(await sp()){t("setup");return}const se=await cp();if(!se){t("login");return}r(se),t("authenticated")})()},[]),y.useEffect(()=>{const F=()=>{r(null),t("login")};return window.addEventListener("auth:expired",F),()=>window.removeEventListener("auth:expired",F)},[]);const[l,i]=y.useState([]),[s,u]=y.useState(null),[a,d]=y.useState([]),[v,m]=y.useState(null),[h,w]=y.useState(null),[x,S]=y.useState(null),[C,p]=y.useState("archive"),[c,f]=y.useState(""),[g,j]=y.useState(""),[P,T]=y.useState(!1),[z,U]=y.useState([]),[D,J]=y.useState([]),[Ce,ge]=y.useState(!1),ye=y.useCallback(async(F,se,Re)=>{if(F){T(!0);try{let we;se||Re?we=await ep(F,se,Re):we=await bf(F),d(we),j(we.length===0?"No results":`${we.length} result${we.length===1?"":"s"}`)}catch{d([]),j("Search failed. Try again.")}finally{T(!1)}}},[]);y.useEffect(()=>{e==="authenticated"&&qf().then(F=>{if(i(F),F.length>0){const se=F[0].id;u(se)}})},[e]),y.useEffect(()=>{s&&(S(null),w(null),m(null),Promise.all([ye(s,"",null),bo(s).then(U),ni(s).then(J)]))},[s]),y.useEffect(()=>{if(s===null)return;const F=setTimeout(()=>{ye(s,c,x)},300);return()=>clearTimeout(F)},[c,s]),y.useEffect(()=>{s!==null&&(p("archive"),ye(s,c,x))},[x,s]);const Ue=y.useCallback(F=>{u(F)},[]),Ae=y.useCallback(F=>{p(F),F==="tags"&&s&&ni(s).then(J)},[s]),Ve=y.useCallback(F=>{m(F?F.entry_uid:null),w(F)},[]),E=y.useCallback(F=>{S(F)},[]),k=y.useCallback(()=>{S(null)},[]),R=y.useCallback(()=>{s&&ni(s).then(J)},[s]),A=y.useCallback(()=>{ge(!0)},[]),O=y.useCallback(()=>{ge(!1)},[]),de=y.useCallback(()=>{s&&Promise.all([ye(s,c,x),bo(s).then(U)])},[s,c,x,ye]);return e==="loading"?o.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?o.jsx(Op,{onComplete:()=>t("login")}):e==="login"?o.jsx(Rp,{onLogin:F=>{r(F),t("authenticated")}}):o.jsx(Pl.Provider,{value:{currentUser:n,setCurrentUser:r},children:o.jsxs(o.Fragment,{children:[o.jsx(Dp,{archives:l,archiveId:s,onArchiveChange:Ue,view:C,onViewChange:Ae,onCaptureClick:A}),o.jsxs("main",{className:"app-shell",children:[o.jsxs("div",{className:"workspace",children:[C==="archive"&&o.jsxs("div",{className:"toolbar",children:[o.jsxs("div",{className:"search-field",children:[o.jsx("span",{className:"ico","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"7"}),o.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),o.jsx("input",{className:"search-input",type:"search","aria-label":"Search archive","aria-busy":P,placeholder:"Search titles, URLs, types, tags…",value:c,onChange:F=>f(F.target.value)}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsxs("span",{className:"result-count",children:[g&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:g.split(" ")[0]})," ",g.split(" ").slice(1).join(" ")]}),x&&o.jsxs("button",{className:"tag-filter-badge",onClick:k,children:["× ",x]})]})]}),C==="archive"&&o.jsx($p,{entries:a,selectedEntryUid:v,onSelectEntry:Ve,archiveId:s,tagFilter:x,onClearTagFilter:k,searchQuery:c,onSearchChange:f,resultCount:g,searchBusy:P}),C==="runs"&&o.jsx(Ap,{runs:z}),C==="admin"&&o.jsx(Bp,{archives:l}),C==="tags"&&o.jsx(Hp,{tagNodes:D,tagFilter:x,onTagFilterSet:E,onViewChange:Ae}),C==="collections"&&o.jsx(Qp,{archiveId:s}),C==="settings"&&o.jsx(Yp,{})]}),o.jsx(qp,{archiveId:s,selectedEntry:h,onTagFilterSet:E,tagNodes:D,onTagsRefresh:R})]}),o.jsx(Fp,{open:Ce,archiveId:s,onClose:O,onCaptured:de})]})})}mc(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(bp,{})})); diff --git a/crates/archivr-server/static/index.html b/crates/archivr-server/static/index.html index d036919..1965bff 100644 --- a/crates/archivr-server/static/index.html +++ b/crates/archivr-server/static/index.html @@ -4,7 +4,7 @@ Archivr - + diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 1a3b758..5e21ede 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -15,6 +15,22 @@ import ContextRail from './components/ContextRail' export const AuthContext = createContext(null); +const VIEWS = ['archive','runs','admin','tags','collections','settings'] +const SETTINGS_TABS = ['profile','tokens','instance'] + +function parseLocation() { + const parts = window.location.pathname.split('/').filter(Boolean) + const view = VIEWS.includes(parts[0]) ? parts[0] : 'archive' + const settingsTab = (view === 'settings' && SETTINGS_TABS.includes(parts[1])) ? parts[1] : 'profile' + return { view, settingsTab } +} + +function locationPath(view, settingsTab) { + if (view === 'archive') return '/' + if (view === 'settings') return `/settings/${settingsTab}` + return `/${view}` +} + export default function App() { const [authState, setAuthState] = useState('loading'); const [currentUser, setCurrentUser] = useState(null); @@ -36,13 +52,25 @@ export default function App() { return () => window.removeEventListener('auth:expired', handler); }, []); + // Sync URL → state on back/forward + useEffect(() => { + const handler = () => { + const { view, settingsTab } = parseLocation() + setView(view) + setSettingsTab(settingsTab) + } + window.addEventListener('popstate', handler) + return () => window.removeEventListener('popstate', handler) + }, []) + const [archives, setArchives] = useState([]) const [archiveId, setArchiveId] = useState(null) const [entries, setEntries] = useState([]) const [selectedEntryUid, setSelectedEntryUid] = useState(null) const [selectedEntry, setSelectedEntry] = useState(null) const [tagFilter, setTagFilter] = useState(null) - const [view, setView] = useState('archive') + const [view, setView] = useState(() => parseLocation().view) + const [settingsTab, setSettingsTab] = useState(() => parseLocation().settingsTab) const [searchQuery, setSearchQuery] = useState('') const [resultCount, setResultCount] = useState('') const [searchBusy, setSearchBusy] = useState(false) @@ -105,10 +133,12 @@ export default function App() { return () => clearTimeout(timer) }, [searchQuery, archiveId]) // tagFilter handled separately below - // Tag filter change: switch to archive view, reload + // Tag filter applied: switch to archive view and reload. + // Only reset view when tagFilter is non-null; archive change alone (tagFilter=null) + // must not stomp the URL-initialised view on first load. useEffect(() => { if (archiveId === null) return - setView('archive') + if (tagFilter !== null) setView('archive') loadEntries(archiveId, searchQuery, tagFilter) }, [tagFilter, archiveId]) // intentional: searchQuery excluded to avoid double-fire @@ -123,6 +153,14 @@ export default function App() { } }, [archiveId]) + // Sync view + settingsTab → URL + useEffect(() => { + const path = locationPath(view, settingsTab) + if (window.location.pathname !== path) { + history.pushState(null, '', path) + } + }, [view, settingsTab]) + const selectEntry = useCallback((entry) => { setSelectedEntryUid(entry ? entry.entry_uid : null) setSelectedEntry(entry) @@ -230,7 +268,7 @@ export default function App() { )} {view === 'settings' && ( - + )} ( ))}